| Index: ui/gfx/transform_unittest.cc
|
| diff --git a/ui/gfx/transform_unittest.cc b/ui/gfx/transform_unittest.cc
|
| index ef801ac15e39cf7f5045568f2bf7c440b7744e55..aee6d8c6ebf7200acb85d9f8aff2297aadff8ef9 100644
|
| --- a/ui/gfx/transform_unittest.cc
|
| +++ b/ui/gfx/transform_unittest.cc
|
| @@ -2420,6 +2420,29 @@ TEST(XFormTest, verifyFlattenTo2d) {
|
| EXPECT_ROW4_EQ(13.0f, 17.0f, 0.0f, 25.0f, A);
|
| }
|
|
|
| +TEST(XFormTest, IsFlat) {
|
| + Transform transform;
|
| + InitializeTestMatrix(&transform);
|
| +
|
| + // A transform with all entries non-zero isn't flat.
|
| + EXPECT_FALSE(transform.IsFlat());
|
| +
|
| + transform.matrix().set(0, 2, 0.f);
|
| + transform.matrix().set(1, 2, 0.f);
|
| + transform.matrix().set(2, 2, 1.f);
|
| + transform.matrix().set(3, 2, 0.f);
|
| +
|
| + EXPECT_FALSE(transform.IsFlat());
|
| +
|
| + transform.matrix().set(2, 0, 0.f);
|
| + transform.matrix().set(2, 1, 0.f);
|
| + transform.matrix().set(2, 3, 0.f);
|
| +
|
| + // Since the third column and row are both (0, 0, 1, 0), the transform is
|
| + // flat.
|
| + EXPECT_TRUE(transform.IsFlat());
|
| +}
|
| +
|
| // Another implementation of Preserves2dAxisAlignment that isn't as fast,
|
| // good for testing the faster implementation.
|
| static bool EmpiricallyPreserves2dAxisAlignment(const Transform& transform) {
|
|
|