| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "ui/gfx/rect.h" | 7 #include "ui/gfx/rect.h" |
| 8 #include "ui/gfx/rect_conversions.h" | 8 #include "ui/gfx/rect_conversions.h" |
| 9 #include "ui/gfx/skia_util.h" | 9 #include "ui/gfx/skia_util.h" |
| 10 | 10 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 std::numeric_limits<float>::quiet_NaN(), | 426 std::numeric_limits<float>::quiet_NaN(), |
| 427 std::numeric_limits<float>::quiet_NaN(), | 427 std::numeric_limits<float>::quiet_NaN(), |
| 428 std::numeric_limits<float>::quiet_NaN(), | 428 std::numeric_limits<float>::quiet_NaN(), |
| 429 std::numeric_limits<float>::quiet_NaN(), | 429 std::numeric_limits<float>::quiet_NaN(), |
| 430 std::numeric_limits<float>::quiet_NaN() }, | 430 std::numeric_limits<float>::quiet_NaN() }, |
| 431 { 3, 3, 3, 3, | 431 { 3, 3, 3, 3, |
| 432 std::numeric_limits<float>::max(), | 432 std::numeric_limits<float>::max(), |
| 433 std::numeric_limits<float>::max(), | 433 std::numeric_limits<float>::max(), |
| 434 std::numeric_limits<float>::max(), | 434 std::numeric_limits<float>::max(), |
| 435 std::numeric_limits<float>::max(), | 435 std::numeric_limits<float>::max(), |
| 436 std::numeric_limits<float>::max() } | 436 std::numeric_limits<float>::max() }, |
| 437 { 3, 3, 3, 3, |
| 438 -1.0f, |
| 439 -3.0f, -3.0f, 0.0f, 0.0f } |
| 437 }; | 440 }; |
| 438 | 441 |
| 439 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 442 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 440 Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1); | 443 Rect r1(tests[i].x1, tests[i].y1, tests[i].w1, tests[i].h1); |
| 441 RectF r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2); | 444 RectF r2(tests[i].x2, tests[i].y2, tests[i].w2, tests[i].h2); |
| 442 | 445 |
| 443 RectF scaled = ScaleRect(r1, tests[i].scale); | 446 RectF scaled = ScaleRect(r1, tests[i].scale); |
| 444 EXPECT_FLOAT_AND_NAN_EQ(r2.x(), scaled.x()); | 447 EXPECT_FLOAT_AND_NAN_EQ(r2.x(), scaled.x()); |
| 445 EXPECT_FLOAT_AND_NAN_EQ(r2.y(), scaled.y()); | 448 EXPECT_FLOAT_AND_NAN_EQ(r2.y(), scaled.y()); |
| 446 EXPECT_FLOAT_AND_NAN_EQ(r2.width(), scaled.width()); | 449 EXPECT_FLOAT_AND_NAN_EQ(r2.width(), scaled.width()); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 (Vector2dF(1.1f, -1.1f) + f).ToString()); | 718 (Vector2dF(1.1f, -1.1f) + f).ToString()); |
| 716 f += Vector2dF(1.1f, -1.1f); | 719 f += Vector2dF(1.1f, -1.1f); |
| 717 EXPECT_EQ(RectF(2.2f, 1.1f, 3.3f, 4.4f).ToString(), f.ToString()); | 720 EXPECT_EQ(RectF(2.2f, 1.1f, 3.3f, 4.4f).ToString(), f.ToString()); |
| 718 EXPECT_EQ(RectF(1.1f, 2.2f, 3.3f, 4.4f).ToString(), | 721 EXPECT_EQ(RectF(1.1f, 2.2f, 3.3f, 4.4f).ToString(), |
| 719 (f - Vector2dF(1.1f, -1.1f)).ToString()); | 722 (f - Vector2dF(1.1f, -1.1f)).ToString()); |
| 720 f -= Vector2dF(1.1f, -1.1f); | 723 f -= Vector2dF(1.1f, -1.1f); |
| 721 EXPECT_EQ(RectF(1.1f, 2.2f, 3.3f, 4.4f).ToString(), f.ToString()); | 724 EXPECT_EQ(RectF(1.1f, 2.2f, 3.3f, 4.4f).ToString(), f.ToString()); |
| 722 } | 725 } |
| 723 | 726 |
| 724 } // namespace gfx | 727 } // namespace gfx |
| OLD | NEW |