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

Side by Side Diff: printing/page_setup_unittest.cc

Issue 8038024: ui/gfx: Add ToString() function to Size 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 | « chrome/browser/printing/printing_layout_uitest.cc ('k') | ui/gfx/rect.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 effective_margins.header); 60 effective_margins.header);
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 << " " << page_size << 70 EXPECT_EQ(page_size, setup.physical_size()) << seed << " " <<
71 " " << printable_area << " " << kTextHeight; 71 page_size.ToString() << " " << printable_area << " " << kTextHeight;
72 EXPECT_EQ(overlay_area, setup.overlay_area()) << seed << " " << page_size << 72 EXPECT_EQ(overlay_area, setup.overlay_area()) << seed << " " <<
73 " " << printable_area << " " << kTextHeight; 73 page_size.ToString() << " " << printable_area << " " << kTextHeight;
74 EXPECT_EQ(content_area, setup.content_area()) << seed << " " << page_size << 74 EXPECT_EQ(content_area, setup.content_area()) << seed << " " <<
75 " " << printable_area << " " << kTextHeight; 75 page_size.ToString() << " " << printable_area << " " << kTextHeight;
76 76
77 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) << 77 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) <<
78 seed << " " << page_size << " " << printable_area << " " << kTextHeight; 78 seed << " " << page_size.ToString() << " " << printable_area <<
79 " " << kTextHeight;
79 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) << 80 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) <<
80 seed << " " << page_size << " " << printable_area << " " << kTextHeight; 81 seed << " " << page_size.ToString() << " " << printable_area <<
82 " " << kTextHeight;
81 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) << seed << 83 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) << seed <<
82 " " << page_size << " " << printable_area << " " << kTextHeight; 84 " " << page_size.ToString() << " " << printable_area <<
85 " " << kTextHeight;
83 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) << seed << 86 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) << seed <<
84 " " << page_size << " " << printable_area << " " << kTextHeight; 87 " " << page_size.ToString() << " " << printable_area <<
88 " " << kTextHeight;
85 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) << seed << 89 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) << seed <<
86 " " << page_size << " " << printable_area << " " << kTextHeight; 90 " " << page_size.ToString() << " " << printable_area <<
91 " " << kTextHeight;
87 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) << 92 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) <<
88 seed << " " << page_size << " " << printable_area << " " << kTextHeight; 93 seed << " " << page_size.ToString() << " " << printable_area <<
94 " " << kTextHeight;
89 } 95 }
90 96
91 TEST(PageSetupTest, HardCoded) { 97 TEST(PageSetupTest, HardCoded) {
92 // Margins. 98 // Margins.
93 printing::PageMargins margins; 99 printing::PageMargins margins;
94 margins.header = 2; 100 margins.header = 2;
95 margins.footer = 2; 101 margins.footer = 2;
96 margins.left = 4; 102 margins.left = 4;
97 margins.top = 4; 103 margins.top = 4;
98 margins.right = 4; 104 margins.right = 4;
(...skipping 18 matching lines...) Expand all
117 effective_margins.right = 4; 123 effective_margins.right = 4;
118 effective_margins.bottom = 6; 124 effective_margins.bottom = 6;
119 125
120 // Calculate the overlay area. 126 // Calculate the overlay area.
121 gfx::Rect overlay_area(4, 3, 92, 94); 127 gfx::Rect overlay_area(4, 3, 92, 94);
122 128
123 // Calculate the content area. 129 // Calculate the content area.
124 gfx::Rect content_area(4, 6, 92, 88); 130 gfx::Rect content_area(4, 6, 92, 88);
125 131
126 // Test values. 132 // Test values.
127 EXPECT_EQ(page_size, setup.physical_size()) << " " << page_size << 133 EXPECT_EQ(page_size, setup.physical_size()) << " " << page_size.ToString() <<
128 " " << printable_area << " " << kTextHeight; 134 " " << printable_area << " " << kTextHeight;
129 EXPECT_EQ(overlay_area, setup.overlay_area()) << " " << page_size << 135 EXPECT_EQ(overlay_area, setup.overlay_area()) << " " <<
130 " " << printable_area << " " << kTextHeight; 136 page_size.ToString() << " " << printable_area << " " << kTextHeight;
131 EXPECT_EQ(content_area, setup.content_area()) << " " << page_size << 137 EXPECT_EQ(content_area, setup.content_area()) << " " <<
132 " " << printable_area << " " << kTextHeight; 138 page_size.ToString() << " " << printable_area << " " << kTextHeight;
133 139
134 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) << 140 EXPECT_EQ(effective_margins.header, setup.effective_margins().header) <<
135 " " << page_size << " " << printable_area << " " << kTextHeight; 141 " " << page_size.ToString() << " " <<
142 printable_area << " " << kTextHeight;
136 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) << 143 EXPECT_EQ(effective_margins.footer, setup.effective_margins().footer) <<
137 " " << page_size << " " << printable_area << " " << kTextHeight; 144 " " << page_size.ToString() << " " << printable_area <<
145 " " << kTextHeight;
138 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) << 146 EXPECT_EQ(effective_margins.left, setup.effective_margins().left) <<
139 " " << page_size << " " << printable_area << " " << kTextHeight; 147 " " << page_size.ToString() << " " << printable_area <<
148 " " << kTextHeight;
140 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) << 149 EXPECT_EQ(effective_margins.top, setup.effective_margins().top) <<
141 " " << page_size << " " << printable_area << " " << kTextHeight; 150 " " << page_size.ToString() << " " << printable_area <<
151 " " << kTextHeight;
142 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) << 152 EXPECT_EQ(effective_margins.right, setup.effective_margins().right) <<
143 " " << page_size << " " << printable_area << " " << kTextHeight; 153 " " << page_size.ToString() << " " << printable_area <<
154 " " << kTextHeight;
144 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) << 155 EXPECT_EQ(effective_margins.bottom, setup.effective_margins().bottom) <<
145 " " << page_size << " " << printable_area << " " << kTextHeight; 156 " " << page_size.ToString() << " " << printable_area <<
157 " " << kTextHeight;
146 } 158 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/printing_layout_uitest.cc ('k') | ui/gfx/rect.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698