Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: printing/printed_page_unittest.cc

Issue 335473002: Guarded shrink setting with ifdefs to make clear where it is used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Thu 06/12/2014 0:59:45.49 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/printed_page.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/printed_page_unittest.cc
diff --git a/printing/printed_page_unittest.cc b/printing/printed_page_unittest.cc
index 9cce52a1cb831640511f485b25b1b82f3c76a060..d37d93a60cfac0c559bef6e0e192d35cfc59dd6e 100644
--- a/printing/printed_page_unittest.cc
+++ b/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
« no previous file with comments | « printing/printed_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698