| Index: ui/gfx/transform_util_unittest.cc
|
| diff --git a/ui/gfx/transform_util_unittest.cc b/ui/gfx/transform_util_unittest.cc
|
| index 94195c29bb92f90641e8eecdfb87ae3bcb966b27..274f0526ae5c725de0f87613a0504bc50e120a62 100644
|
| --- a/ui/gfx/transform_util_unittest.cc
|
| +++ b/ui/gfx/transform_util_unittest.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/gfx/point.h"
|
| +#include "ui/gfx/point3_f.h"
|
| +#include "ui/gfx/rect.h"
|
|
|
| namespace gfx {
|
| namespace {
|
| @@ -30,5 +32,42 @@ TEST(TransformUtilTest, GetScaleTransform) {
|
| }
|
| }
|
|
|
| +TEST(TransformUtilTest, SnapRotation) {
|
| + gfx::Transform result(gfx::Transform::kSkipInitialization);
|
| + gfx::Transform transform;
|
| + transform.RotateAboutZAxis(89.99);
|
| +
|
| + Rect viewport(1920, 1200);
|
| + bool snapped = SnapRotation(&result, transform, viewport);
|
| +
|
| + EXPECT_TRUE(snapped) << "Viewport should snap for this rotation.";
|
| +}
|
| +
|
| +TEST(TransformUtilTest, SnapDistantRotation) {
|
| + const int kOffset = 5000;
|
| + gfx::Transform result(gfx::Transform::kSkipInitialization);
|
| + gfx::Transform transform;
|
| +
|
| + transform.RotateAboutZAxis(89.99);
|
| +
|
| + Rect viewport(1920 + kOffset, 1200 + kOffset);
|
| + bool snapped = SnapRotation(&result, transform, viewport);
|
| +
|
| + EXPECT_FALSE(snapped) << "Distant viewport shouldn't snap by more than 1px.";
|
| +}
|
| +
|
| +TEST(TransformUtilTest, NoSnapRotation) {
|
| + gfx::Transform result(gfx::Transform::kSkipInitialization);
|
| + gfx::Transform transform;
|
| + const int kOffset = 5000;
|
| +
|
| + transform.RotateAboutZAxis(89.9);
|
| +
|
| + Rect viewport(1920 + kOffset, 1200 + kOffset);
|
| + bool snapped = SnapRotation(&result, transform, viewport);
|
| +
|
| + EXPECT_FALSE(snapped) << "Viewport should not snap for this rotation.";
|
| +}
|
| +
|
| } // namespace
|
| } // namespace gfx
|
|
|