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

Side by Side Diff: printing/page_setup_unittest.cc

Issue 8066006: ui/gfx: Add ToString() function to Rect class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/rect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/page_setup.h" 5 #include "printing/page_setup.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <time.h> 8 #include <time.h>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Calculate the content area. 62 // Calculate the content area.
63 gfx::Rect content_area(overlay_area.x(), 63 gfx::Rect content_area(overlay_area.x(),
64 effective_margins.top, 64 effective_margins.top,
65 overlay_area.width(), 65 overlay_area.width(),
66 page_size.height() - effective_margins.bottom - 66 page_size.height() - effective_margins.bottom -
67 effective_margins.top); 67 effective_margins.top);
68 68
69 // Test values. 69 // Test values.
70 EXPECT_EQ(page_size, setup.physical_size()) << seed << " " << 70 EXPECT_EQ(page_size, setup.physical_size()) << seed << " " <<
71 page_size.ToString() << " " << printable_area << " " << kTextHeight; 71 page_size.ToString() << " " << printable_area.ToString() <<
72 " " << kTextHeight;
72 EXPECT_EQ(overlay_area, setup.overlay_area()) << seed << " " << 73 EXPECT_EQ(overlay_area, setup.overlay_area()) << seed << " " <<
73 page_size.ToString() << " " << printable_area << " " << kTextHeight; 74 page_size.ToString() << " " << printable_area.ToString() <<
75 " " << kTextHeight;
74 EXPECT_EQ(content_area, setup.content_area()) << seed << " " << 76 EXPECT_EQ(content_area, setup.content_area()) << seed << " " <<
75 page_size.ToString() << " " << printable_area << " " << kTextHeight; 77 page_size.ToString() << " " << printable_area.ToString() <<
78 " " << kTextHeight;
76 79
77 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) << 80 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) <<
78 seed << " " << page_size.ToString() << " " << printable_area << 81 seed << " " << page_size.ToString() << " " << printable_area.ToString() <<
79 " " << kTextHeight; 82 " " << kTextHeight;
80 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) << 83 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) <<
81 seed << " " << page_size.ToString() << " " << printable_area << 84 seed << " " << page_size.ToString() << " " << printable_area.ToString() <<
82 " " << kTextHeight; 85 " " << kTextHeight;
83 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) << seed << 86 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) << seed <<
84 " " << page_size.ToString() << " " << printable_area << 87 " " << page_size.ToString() << " " << printable_area.ToString() <<
85 " " << kTextHeight; 88 " " << kTextHeight;
86 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) << seed << 89 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) << seed <<
87 " " << page_size.ToString() << " " << printable_area << 90 " " << page_size.ToString() << " " << printable_area.ToString() <<
88 " " << kTextHeight; 91 " " << kTextHeight;
89 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) << seed << 92 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) << seed <<
90 " " << page_size.ToString() << " " << printable_area << 93 " " << page_size.ToString() << " " << printable_area.ToString() <<
91 " " << kTextHeight; 94 " " << kTextHeight;
92 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) << 95 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) <<
93 seed << " " << page_size.ToString() << " " << printable_area << 96 seed << " " << page_size.ToString() << " " << printable_area.ToString() <<
94 " " << kTextHeight; 97 " " << kTextHeight;
95 } 98 }
96 99
97 TEST(PageSetupTest, HardCoded) { 100 TEST(PageSetupTest, HardCoded) {
98 // Margins. 101 // Margins.
99 printing::PageMargins margins; 102 printing::PageMargins margins;
100 margins.header = 2; 103 margins.header = 2;
101 margins.footer = 2; 104 margins.footer = 2;
102 margins.left = 4; 105 margins.left = 4;
103 margins.top = 4; 106 margins.top = 4;
(...skipping 20 matching lines...) Expand all
124 effective_margins.bottom = 6; 127 effective_margins.bottom = 6;
125 128
126 // Calculate the overlay area. 129 // Calculate the overlay area.
127 gfx::Rect overlay_area(4, 3, 92, 94); 130 gfx::Rect overlay_area(4, 3, 92, 94);
128 131
129 // Calculate the content area. 132 // Calculate the content area.
130 gfx::Rect content_area(4, 6, 92, 88); 133 gfx::Rect content_area(4, 6, 92, 88);
131 134
132 // Test values. 135 // Test values.
133 EXPECT_EQ(page_size, setup.physical_size()) << " " << page_size.ToString() << 136 EXPECT_EQ(page_size, setup.physical_size()) << " " << page_size.ToString() <<
134 " " << printable_area << " " << kTextHeight; 137 " " << printable_area.ToString() << " " << kTextHeight;
135 EXPECT_EQ(overlay_area, setup.overlay_area()) << " " << 138 EXPECT_EQ(overlay_area, setup.overlay_area()) << " " <<
136 page_size.ToString() << " " << printable_area << " " << kTextHeight; 139 page_size.ToString() << " " << printable_area.ToString() <<
140 " " << kTextHeight;
137 EXPECT_EQ(content_area, setup.content_area()) << " " << 141 EXPECT_EQ(content_area, setup.content_area()) << " " <<
138 page_size.ToString() << " " << printable_area << " " << kTextHeight; 142 page_size.ToString() << " " << printable_area.ToString() <<
143 " " << kTextHeight;
139 144
140 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) << 145 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) <<
141 " " << page_size.ToString() << " " << 146 " " << page_size.ToString() << " " <<
142 printable_area << " " << kTextHeight; 147 printable_area.ToString() << " " << kTextHeight;
143 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) << 148 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) <<
144 " " << page_size.ToString() << " " << printable_area << 149 " " << page_size.ToString() << " " << printable_area.ToString() <<
145 " " << kTextHeight; 150 " " << kTextHeight;
146 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) << 151 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) <<
147 " " << page_size.ToString() << " " << printable_area << 152 " " << page_size.ToString() << " " << printable_area.ToString() <<
148 " " << kTextHeight; 153 " " << kTextHeight;
149 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) << 154 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) <<
150 " " << page_size.ToString() << " " << printable_area << 155 " " << page_size.ToString() << " " << printable_area.ToString() <<
151 " " << kTextHeight; 156 " " << kTextHeight;
152 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) << 157 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) <<
153 " " << page_size.ToString() << " " << printable_area << 158 " " << page_size.ToString() << " " << printable_area.ToString() <<
154 " " << kTextHeight; 159 " " << kTextHeight;
155 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) << 160 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) <<
156 " " << page_size.ToString() << " " << printable_area << 161 " " << page_size.ToString() << " " << printable_area.ToString() <<
157 " " << kTextHeight; 162 " " << kTextHeight;
158 } 163 }
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/rect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698