summaryrefslogtreecommitdiffstats
path: root/chromium/printing/printed_page_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/printing/printed_page_unittest.cc')
-rw-r--r--chromium/printing/printed_page_unittest.cc44
1 files changed, 20 insertions, 24 deletions
diff --git a/chromium/printing/printed_page_unittest.cc b/chromium/printing/printed_page_unittest.cc
index 9cce52a1cb8..d37d93a60cf 100644
--- a/chromium/printing/printed_page_unittest.cc
+++ b/chromium/printing/printed_page_unittest.cc
@@ -12,56 +12,52 @@ TEST(PrintedPageTest, GetCenteredPageContentRect) {
gfx::Rect page_content;
// No centering.
- page = new PrintedPage(1,
- NULL,
- gfx::Size(1200, 1200),
- gfx::Rect(0, 0, 400, 1100),
- 0.2f);
+ page = new PrintedPage(
+ 1, NULL, gfx::Size(1200, 1200), gfx::Rect(0, 0, 400, 1100));
page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
EXPECT_EQ(0, page_content.x());
EXPECT_EQ(0, page_content.y());
EXPECT_EQ(400, page_content.width());
EXPECT_EQ(1100, page_content.height());
- EXPECT_EQ(0.2f, page->shrink_factor());
// X centered.
- page = new PrintedPage(1,
- NULL,
- gfx::Size(500, 1200),
- gfx::Rect(0, 0, 400, 1100),
- 0.8f);
+ page = new PrintedPage(
+ 1, NULL, gfx::Size(500, 1200), gfx::Rect(0, 0, 400, 1100));
page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
EXPECT_EQ(250, page_content.x());
EXPECT_EQ(0, page_content.y());
EXPECT_EQ(400, page_content.width());
EXPECT_EQ(1100, page_content.height());
- EXPECT_EQ(0.8f, page->shrink_factor());
// Y centered.
- page = new PrintedPage(1,
- NULL,
- gfx::Size(1200, 500),
- gfx::Rect(0, 0, 400, 1100),
- 1.0f);
+ page = new PrintedPage(
+ 1, NULL, gfx::Size(1200, 500), gfx::Rect(0, 0, 400, 1100));
page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
EXPECT_EQ(0, page_content.x());
EXPECT_EQ(250, page_content.y());
EXPECT_EQ(400, page_content.width());
EXPECT_EQ(1100, page_content.height());
- EXPECT_EQ(1.0f, page->shrink_factor());
// Both X and Y centered.
- page = new PrintedPage(1,
- NULL,
- gfx::Size(500, 500),
- gfx::Rect(0, 0, 400, 1100),
- 0.3f);
+ page =
+ new PrintedPage(1, NULL, gfx::Size(500, 500), gfx::Rect(0, 0, 400, 1100));
page->GetCenteredPageContentRect(gfx::Size(1000, 1000), &page_content);
EXPECT_EQ(250, page_content.x());
EXPECT_EQ(250, page_content.y());
EXPECT_EQ(400, page_content.width());
EXPECT_EQ(1100, page_content.height());
- EXPECT_EQ(0.3f, page->shrink_factor());
}
+#if defined(OS_WIN)
+TEST(PrintedPageTest, Shrink) {
+ scoped_refptr<PrintedPage> page = new PrintedPage(
+ 1, NULL, gfx::Size(1200, 1200), gfx::Rect(0, 0, 400, 1100));
+ EXPECT_EQ(0.0f, page->shrink_factor());
+ page->set_shrink_factor(0.2f);
+ EXPECT_EQ(0.2f, page->shrink_factor());
+ page->set_shrink_factor(0.7f);
+ EXPECT_EQ(0.7f, page->shrink_factor());
+}
+#endif // OS_WIN
+
} // namespace printing