Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/units.h" | 5 #include "printing/units.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "testing/gtest/include/gtest/gtest-spi.h" | 7 #include "testing/gtest/include/gtest/gtest-spi.h" |
| 8 | 8 |
| 9 using namespace printing; | 9 namespace printing { |
| 10 namespace { | |
|
Lei Zhang
2011/05/10 01:17:03
I don't think you need the anonymous namespace her
tfarina
2011/05/10 01:18:47
I think it's better to protect against http://en.w
tfarina
2011/05/10 01:25:48
Removed.
| |
| 10 | 11 |
| 11 TEST(UnitsTest, Convertions) { | 12 TEST(UnitsTest, Convertions) { |
| 12 EXPECT_EQ(100, ConvertUnit(100, 100, 100)); | 13 EXPECT_EQ(100, ConvertUnit(100, 100, 100)); |
| 13 EXPECT_EQ(-100, ConvertUnit(-100, 100, 100)); | 14 EXPECT_EQ(-100, ConvertUnit(-100, 100, 100)); |
| 14 EXPECT_EQ(0, ConvertUnit(0, 100, 100)); | 15 EXPECT_EQ(0, ConvertUnit(0, 100, 100)); |
| 15 EXPECT_EQ(99, ConvertUnit(99, 100, 100)); | 16 EXPECT_EQ(99, ConvertUnit(99, 100, 100)); |
| 16 EXPECT_EQ(101, ConvertUnit(101, 100, 100)); | 17 EXPECT_EQ(101, ConvertUnit(101, 100, 100)); |
| 17 EXPECT_EQ(99900, ConvertUnit(999, 10, 1000)); | 18 EXPECT_EQ(99900, ConvertUnit(999, 10, 1000)); |
| 18 EXPECT_EQ(100100, ConvertUnit(1001, 10, 1000)); | 19 EXPECT_EQ(100100, ConvertUnit(1001, 10, 1000)); |
| 19 | 20 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 EXPECT_EQ(0, ConvertHundredThousanthMeterToMilliInch(0)); | 53 EXPECT_EQ(0, ConvertHundredThousanthMeterToMilliInch(0)); |
| 53 | 54 |
| 54 EXPECT_EQ(8.25, ConvertPixelsToPointDouble(11.0)); | 55 EXPECT_EQ(8.25, ConvertPixelsToPointDouble(11.0)); |
| 55 // Round down. | 56 // Round down. |
| 56 EXPECT_EQ(8, ConvertPixelsToPoint(11)); | 57 EXPECT_EQ(8, ConvertPixelsToPoint(11)); |
| 57 EXPECT_EQ(7.5, ConvertPixelsToPointDouble(10.0)); | 58 EXPECT_EQ(7.5, ConvertPixelsToPointDouble(10.0)); |
| 58 // Round up. | 59 // Round up. |
| 59 EXPECT_EQ(8, ConvertPixelsToPoint(10)); | 60 EXPECT_EQ(8, ConvertPixelsToPoint(10)); |
| 60 EXPECT_EQ(0, ConvertPixelsToPoint(0)); | 61 EXPECT_EQ(0, ConvertPixelsToPoint(0)); |
| 61 } | 62 } |
| 63 | |
| 64 } // namespace | |
| 65 } // namespace printing | |
| OLD | NEW |