| 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 <sstream> |
| 6 |
| 5 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "ui/gfx/range/range.h" | 8 #include "ui/gfx/range/range.h" |
| 7 #include "ui/gfx/range/range_f.h" | 9 #include "ui/gfx/range/range_f.h" |
| 8 | 10 |
| 9 namespace { | 11 namespace { |
| 10 | 12 |
| 11 template <typename T> | 13 template <typename T> |
| 12 class RangeTest : public testing::Test { | 14 class RangeTest : public testing::Test { |
| 13 }; | 15 }; |
| 14 | 16 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 EXPECT_EQ(0U, range.end()); | 247 EXPECT_EQ(0U, range.end()); |
| 246 | 248 |
| 247 range = range_f.Ceil(); | 249 range = range_f.Ceil(); |
| 248 EXPECT_EQ(0U, range.start()); | 250 EXPECT_EQ(0U, range.start()); |
| 249 EXPECT_EQ(0U, range.end()); | 251 EXPECT_EQ(0U, range.end()); |
| 250 | 252 |
| 251 range = range_f.Round(); | 253 range = range_f.Round(); |
| 252 EXPECT_EQ(0U, range.start()); | 254 EXPECT_EQ(0U, range.start()); |
| 253 EXPECT_EQ(0U, range.end()); | 255 EXPECT_EQ(0U, range.end()); |
| 254 } | 256 } |
| 257 |
| 258 TEST(RangeTest, ToString) { |
| 259 gfx::Range range(4, 7); |
| 260 EXPECT_EQ("{4,7}", range.ToString()); |
| 261 |
| 262 range = gfx::Range::InvalidRange(); |
| 263 std::ostringstream expected; |
| 264 expected << "{" << range.start() << "," << range.end() << "}"; |
| 265 EXPECT_EQ(expected.str(), range.ToString()); |
| 266 } |
| OLD | NEW |