summaryrefslogtreecommitdiffstats
path: root/printing/units_unittest.cc
diff options
context:
space:
mode:
authorhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-28 09:46:00 +0000
committerhamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-28 09:46:00 +0000
commit4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4 (patch)
tree8709d2a1c9b6afcff614c4d58b774cb2ba89ff31 /printing/units_unittest.cc
parentfae8f2508f0927d4099fa78be85f089bae55575c (diff)
downloadchromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.zip
chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.tar.gz
chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.tar.bz2
Create constant variables kPointsPerInch and kPixelsPerInch and conversion functions.
BUG=47277 TEST=units_unittest.cc Review URL: http://codereview.chromium.org/2877001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/units_unittest.cc')
-rw-r--r--printing/units_unittest.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/printing/units_unittest.cc b/printing/units_unittest.cc
index b2db567..82f9acb 100644
--- a/printing/units_unittest.cc
+++ b/printing/units_unittest.cc
@@ -50,4 +50,12 @@ TEST(UnitsTest, Convertions) {
EXPECT_EQ(-1000,
ConvertHundredThousanthMeterToMilliInch(-kHundrethsMMPerInch));
EXPECT_EQ(0, ConvertHundredThousanthMeterToMilliInch(0));
+
+ EXPECT_EQ(8.25, ConvertPixelsToPointDouble(11.0));
+ // Round down.
+ EXPECT_EQ(8, ConvertPixelsToPoint(11));
+ EXPECT_EQ(7.5, ConvertPixelsToPointDouble(10.0));
+ // Round up.
+ EXPECT_EQ(8, ConvertPixelsToPoint(10));
+ EXPECT_EQ(0, ConvertPixelsToPoint(0));
}