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