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

Unified Diff: printing/units_unittest.cc

Issue 2116283002: Don't let rounding prematurely influence document size when printing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@620456-2
Patch Set: bug 467579 Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/units.cc ('k') | third_party/WebKit/LayoutTests/printing/iso-page-in-inches.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/units_unittest.cc
diff --git a/printing/units_unittest.cc b/printing/units_unittest.cc
index fe160b3f405096496b51a1ec3a0420cfdc88d56e..da3b3ce9af9ecc1ede532f2414cddda5756b9881 100644
--- a/printing/units_unittest.cc
+++ b/printing/units_unittest.cc
@@ -31,10 +31,19 @@ TEST(UnitsTest, Convertions) {
EXPECT_EQ(-10, ConvertUnit(-1049, 1000, 10));
EXPECT_EQ(-11, ConvertUnit(-1050, 1000, 10));
+ EXPECT_EQ(99920, ConvertUnit(999.2, 10, 1000));
+ EXPECT_EQ(-94920, ConvertUnit(-949.2, 10, 1000));
+ EXPECT_EQ(99970, ConvertUnit(999.7, 10, 1000));
+ EXPECT_EQ(-94970, ConvertUnit(-949.7, 10, 1000));
+
+ EXPECT_EQ(3996, ConvertUnit(999.1, 75, 300));
+ EXPECT_EQ(3997, ConvertUnit(999.3, 75, 300));
+ EXPECT_EQ(3998, ConvertUnit(999.5, 75, 300));
+ EXPECT_EQ(3999, ConvertUnit(999.7, 75, 300));
+ EXPECT_EQ(4000, ConvertUnit(999.9, 75, 300));
+
EXPECT_EQ(0, ConvertUnit(2, 1000000000, 1));
EXPECT_EQ(2000000000, ConvertUnit(2, 1, 1000000000));
- EXPECT_EQ(4000000000U,
- static_cast<unsigned int>(ConvertUnit(2, 1, 2000000000)));
EXPECT_EQ(100, ConvertUnitDouble(100, 100, 100));
EXPECT_EQ(-100, ConvertUnitDouble(-100, 100, 100));
« no previous file with comments | « printing/units.cc ('k') | third_party/WebKit/LayoutTests/printing/iso-page-in-inches.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698