Skip to content

Commit

Permalink
PrintPreview: [LINUX] While flipping the orientation, do not rotate t…
Browse files Browse the repository at this point in the history
…he 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
  • Loading branch information
kmadhusu@chromium.org committed Nov 9, 2011
1 parent 25d55e8 commit 8d29383
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
9 changes: 0 additions & 9 deletions printing/page_setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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_);
}
}
Expand Down
3 changes: 0 additions & 3 deletions printing/page_setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ class PRINTING_EXPORT PageMargins {
public:
PageMargins();

// Rotates the margin values in anti-clockwise direction.
void Rotate();

void Clear();

// Equality operator.
Expand Down
26 changes: 12 additions & 14 deletions printing/page_setup_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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());
Expand All @@ -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);
}

0 comments on commit 8d29383

Please sign in to comment.