Chromium Code Reviews| Index: printing/page_setup_unittest.cc |
| diff --git a/printing/page_setup_unittest.cc b/printing/page_setup_unittest.cc |
| index 54e436c27d28a3e7e04f1c1878fcc823be7a2fe1..f9c5cb77cf9abf3d7b2ceff212833ee36f385fcf 100644 |
| --- a/printing/page_setup_unittest.cc |
| +++ b/printing/page_setup_unittest.cc |
| @@ -190,3 +190,50 @@ TEST(PageSetupTest, OutOfRangeMargins) { |
| EXPECT_EQ(setup.effective_margins().right, 0); |
| EXPECT_EQ(setup.effective_margins().bottom, 0); |
| } |
| + |
| +TEST(PageSetupTest, FlipOrientation) { |
| + // Margins. |
| + printing::PageMargins margins; |
| + margins.header = 2; |
| + margins.footer = 2; |
| + margins.left = 4; |
| + margins.top = 14; |
| + margins.right = 5; |
| + margins.bottom = 7; |
| + int kTextHeight = 3; |
| + |
| + // Page description. |
| + gfx::Size page_size(100, 70); |
| + gfx::Rect printable_area(3, 3, 92, 50); |
| + |
| + // Make the calculations. |
| + printing::PageSetup setup; |
| + setup.Init(page_size, printable_area, kTextHeight); |
| + setup.SetRequestedMargins(margins); |
| + |
| + EXPECT_EQ(setup.effective_margins().left, 4); |
| + EXPECT_EQ(setup.effective_margins().top, 14); |
| + EXPECT_EQ(setup.effective_margins().right, 5); |
| + EXPECT_EQ(setup.effective_margins().bottom, 20); |
| + |
| + setup.FlipOrientation(); |
|
vandebo (ex-Chrome)
2011/11/02 20:26:03
Let's check all the values (physical_size_, printa
kmadhusu
2011/11/02 23:15:03
Done.
|
| + EXPECT_EQ(setup.effective_margins().left, 14); |
| + EXPECT_EQ(setup.effective_margins().top, 8); |
| + EXPECT_EQ(setup.effective_margins().right, 17); |
| + EXPECT_EQ(setup.effective_margins().bottom, 6); |
| + |
| + // Force requested margins and flip the orientation. |
| + setup.Init(page_size, printable_area, kTextHeight); |
| + setup.ForceRequestedMargins(margins); |
| + EXPECT_EQ(setup.effective_margins().left, 4); |
| + EXPECT_EQ(setup.effective_margins().top, 14); |
| + EXPECT_EQ(setup.effective_margins().right, 5); |
| + EXPECT_EQ(setup.effective_margins().bottom, 7); |
| + |
| + setup.FlipOrientation(); |
| + // Margins values are changed respectively. |
| + EXPECT_EQ(setup.effective_margins().left,14); |
| + EXPECT_EQ(setup.effective_margins().top, 5); |
| + EXPECT_EQ(setup.effective_margins().right, 7); |
| + EXPECT_EQ(setup.effective_margins().bottom, 4); |
| +} |