diff options
author | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 19:43:54 +0000 |
---|---|---|
committer | kmadhusu@chromium.org <kmadhusu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 19:43:54 +0000 |
commit | 8d29383cf9634bf34732c8dec23b6f2436204585 (patch) | |
tree | 9883c8d341fe178b8eb67a8c052bfd6029b035a0 /printing | |
parent | 25d55e8906d3322a899232604c02dbe232b1b3e1 (diff) | |
download | chromium_src-8d29383cf9634bf34732c8dec23b6f2436204585.zip chromium_src-8d29383cf9634bf34732c8dec23b6f2436204585.tar.gz chromium_src-8d29383cf9634bf34732c8dec23b6f2436204585.tar.bz2 |
PrintPreview: [LINUX] While flipping the orientation, do not rotate the margins values.
BUG=103465
TEST=Please refer to bug report.
Review URL: http://codereview.chromium.org/8505024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109286 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/page_setup.cc | 9 | ||||
-rw-r--r-- | printing/page_setup.h | 3 | ||||
-rw-r--r-- | printing/page_setup_unittest.cc | 26 |
3 files changed, 12 insertions, 26 deletions
diff --git a/printing/page_setup.cc b/printing/page_setup.cc index ad0156e..f0ea223 100644 --- a/printing/page_setup.cc +++ b/printing/page_setup.cc @@ -19,14 +19,6 @@ PageMargins::PageMargins() bottom(0) { } -void PageMargins::Rotate() { - int temp_right = right; - right = bottom; - bottom = left; - left = top; - top = temp_right; -} - void PageMargins::Clear() { header = 0; footer = 0; @@ -107,7 +99,6 @@ void PageSetup::FlipOrientation() { new_y, printable_area_.height(), printable_area_.width()); - requested_margins_.Rotate(); Init(new_size, new_printable_area, text_height_); } } diff --git a/printing/page_setup.h b/printing/page_setup.h index 8ed342a..585d48a 100644 --- a/printing/page_setup.h +++ b/printing/page_setup.h @@ -15,9 +15,6 @@ class PRINTING_EXPORT PageMargins { public: PageMargins(); - // Rotates the margin values in anti-clockwise direction. - void Rotate(); - void Clear(); // Equality operator. diff --git a/printing/page_setup_unittest.cc b/printing/page_setup_unittest.cc index 00c8f2a..4915a6c 100644 --- a/printing/page_setup_unittest.cc +++ b/printing/page_setup_unittest.cc @@ -229,20 +229,18 @@ TEST(PageSetupTest, FlipOrientation) { // Expected values. gfx::Size flipped_page_size(70, 100); gfx::Rect flipped_printable_area(9, 0, 50, 92); - gfx::Rect flipped_overlay_area(14, 2, 45, 90); - gfx::Rect flipped_content_area(14, 7, 45, 80); + gfx::Rect flipped_overlay_area(9, 2, 50, 90); + gfx::Rect flipped_content_area(9, 14, 50, 73); // Test values. EXPECT_EQ(flipped_page_size, setup.physical_size()); - EXPECT_EQ(flipped_overlay_area, setup.overlay_area()) << " " << - flipped_page_size.ToString() << " " << flipped_printable_area.ToString(); - EXPECT_EQ(flipped_content_area, setup.content_area()) << " " << - flipped_page_size.ToString() << " " << flipped_printable_area.ToString(); + EXPECT_EQ(flipped_overlay_area, setup.overlay_area()); + EXPECT_EQ(flipped_content_area, setup.content_area()); EXPECT_EQ(flipped_printable_area, setup.printable_area()); // Margin values are updated as per the flipped values. - EXPECT_EQ(setup.effective_margins().left, 14); - EXPECT_EQ(setup.effective_margins().top, 7); + EXPECT_EQ(setup.effective_margins().left, 9); + EXPECT_EQ(setup.effective_margins().top, 14); EXPECT_EQ(setup.effective_margins().right, 11); EXPECT_EQ(setup.effective_margins().bottom, 13); @@ -259,8 +257,8 @@ TEST(PageSetupTest, FlipOrientation) { // Expected values. gfx::Rect new_printable_area(9, 0, 50, 92); - gfx::Rect new_overlay_area(14, 2, 49, 95); - gfx::Rect new_content_area(14, 6, 49, 90); + gfx::Rect new_overlay_area(4, 2, 60, 95); + gfx::Rect new_content_area(4, 14, 60, 79); // Test values. EXPECT_EQ(flipped_page_size, setup.physical_size()); @@ -269,8 +267,8 @@ TEST(PageSetupTest, FlipOrientation) { EXPECT_EQ(new_printable_area, setup.printable_area()); // Margins values are changed respectively. - EXPECT_EQ(setup.effective_margins().left,14); - EXPECT_EQ(setup.effective_margins().top, 6); - EXPECT_EQ(setup.effective_margins().right, 7); - EXPECT_EQ(setup.effective_margins().bottom, 4); + EXPECT_EQ(setup.effective_margins().left, 4); + EXPECT_EQ(setup.effective_margins().top, 14); + EXPECT_EQ(setup.effective_margins().right, 6); + EXPECT_EQ(setup.effective_margins().bottom, 7); } |