| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/gfx/transform_util.h" | 5 #include "ui/gfx/transform_util.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "ui/gfx/point.h" | 8 #include "ui/gfx/point.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 TEST(TransformUtilTest, GetScaleTransform) { | 13 TEST(TransformUtilTest, GetScaleTransform) { |
| 14 const Point kAnchor(20, 40); | 14 const Point kAnchor(20, 40); |
| 15 const float kScale = 0.5f; | 15 const float kScale = 0.5f; |
| 16 | 16 |
| 17 Transform scale = GetScaleTransform(kAnchor, kScale); | 17 Transform scale = GetScaleTransform(kAnchor, kScale); |
| 18 | 18 |
| 19 const int kOffset = 10; | 19 const int kOffset = 10; |
| 20 for (int sign_x = -1; sign_x <= 1; ++sign_x) { | 20 for (int sign_x = -1; sign_x <= 1; ++sign_x) { |
| 21 for (int sign_y = -1; sign_y <= 1; ++sign_y) { | 21 for (int sign_y = -1; sign_y <= 1; ++sign_y) { |
| 22 Point test(kAnchor.x() + sign_x * kOffset, | 22 Point test(kAnchor.x() + sign_x * kOffset, |
| 23 kAnchor.y() + sign_y * kOffset); | 23 kAnchor.y() + sign_y * kOffset); |
| 24 scale.TransformPoint(test); | 24 scale.TransformPoint(test); |
| 25 | 25 |
| 26 EXPECT_EQ(Point(kAnchor.x() + sign_x * kOffset * kScale, | 26 EXPECT_EQ(Point(kAnchor.x() + sign_x * kOffset * kScale, |
| 27 kAnchor.y() + sign_y * kOffset * kScale), | 27 kAnchor.y() + sign_y * kOffset * kScale), |
| 28 test); | 28 test); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 } // namespace gfx | 34 } // namespace gfx |
| OLD | NEW |