| 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 "ui/gfx/point.h" | 7 #include "ui/gfx/point.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 TEST(TransformUtilTest, GetScaleTransform) { | 10 TEST(TransformUtilTest, GetScaleTransform) { |
| 11 const gfx::Point kAnchor(20, 40); | 11 const gfx::Point kAnchor(20, 40); |
| 12 const float kScale = 0.5f; | 12 const float kScale = 0.5f; |
| 13 | 13 |
| 14 ui::Transform scale = ui::GetScaleTransform(kAnchor, kScale); | 14 gfx::Transform scale = gfx::GetScaleTransform(kAnchor, kScale); |
| 15 | 15 |
| 16 const int kOffset = 10; | 16 const int kOffset = 10; |
| 17 for (int sign_x = -1; sign_x <= 1; ++sign_x) { | 17 for (int sign_x = -1; sign_x <= 1; ++sign_x) { |
| 18 for (int sign_y = -1; sign_y <= 1; ++sign_y) { | 18 for (int sign_y = -1; sign_y <= 1; ++sign_y) { |
| 19 gfx::Point test(kAnchor.x() + sign_x * kOffset, | 19 gfx::Point test(kAnchor.x() + sign_x * kOffset, |
| 20 kAnchor.y() + sign_y * kOffset); | 20 kAnchor.y() + sign_y * kOffset); |
| 21 scale.TransformPoint(test); | 21 scale.TransformPoint(test); |
| 22 | 22 |
| 23 EXPECT_EQ(gfx::Point(kAnchor.x() + sign_x * kOffset * kScale, | 23 EXPECT_EQ(gfx::Point(kAnchor.x() + sign_x * kOffset * kScale, |
| 24 kAnchor.y() + sign_y * kOffset * kScale), | 24 kAnchor.y() + sign_y * kOffset * kScale), |
| 25 test); | 25 test); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 } | 28 } |
| OLD | NEW |