Chromium Code Reviews| Index: ui/gfx/transform_util_unittest.cc |
| diff --git a/ui/gfx/transform_util_unittest.cc b/ui/gfx/transform_util_unittest.cc |
| index 41bfc40783a805caa8ce78fc0cd36b29c034b7b1..06a3fcb2b59a5e5c0dc865b8651bfbb9d68e15fe 100644 |
| --- a/ui/gfx/transform_util_unittest.cc |
| +++ b/ui/gfx/transform_util_unittest.cc |
| @@ -4,6 +4,7 @@ |
| #include "ui/gfx/transform_util.h" |
| +#include "base/logging.h" |
|
Matt Giuca
2014/11/04 01:05:18
Don't think you need this.
calamity
2014/11/04 01:40:30
Done.
|
| #include "testing/gtest/include/gtest/gtest.h" |
| #include "ui/gfx/point.h" |
| #include "ui/gfx/point3_f.h" |
| @@ -32,6 +33,24 @@ TEST(TransformUtilTest, GetScaleTransform) { |
| } |
| } |
| +TEST(TransformUtilTest, GetRectTransform) { |
|
Matt Giuca
2014/11/04 01:05:18
Good test.
|
| + gfx::Rect from(20, 40, 40, 40); |
| + gfx::Rect to(-10, 20, 80, 20); |
| + |
| + Transform transform = GetRectTransform(from, to); |
| + |
| + std::vector<std::pair<gfx::Point, gfx::Point> > test_data; |
| + test_data.push_back(std::make_pair(from.origin(), to.origin())); |
| + test_data.push_back(std::make_pair(from.bottom_right(), to.bottom_right())); |
| + test_data.push_back(std::make_pair(from.CenterPoint(), to.CenterPoint())); |
| + |
| + for (const auto& data : test_data) { |
| + Point test = data.first; |
| + transform.TransformPoint(&test); |
| + EXPECT_EQ(data.second, test); |
| + } |
| +} |
| + |
| TEST(TransformUtilTest, SnapRotation) { |
| Transform result(Transform::kSkipInitialization); |
| Transform transform; |