Chromium Code Reviews| Index: cc/trees/property_tree_unittest.cc |
| diff --git a/cc/trees/property_tree_unittest.cc b/cc/trees/property_tree_unittest.cc |
| index 8eba77382654ea7f6b310e42d1582293ae3df863..e216ed4c241d02f78eb0e190b6c2ff0456826fe8 100644 |
| --- a/cc/trees/property_tree_unittest.cc |
| +++ b/cc/trees/property_tree_unittest.cc |
| @@ -316,4 +316,42 @@ TEST(PropertyTreeTest, ComputeTransformWithSublayerScale) { |
| transform); |
| } |
| +TEST (PropertyTreeTest, FlattenOperationPropertyTest) { |
|
ajuma
2015/04/16 17:34:37
Maybe call this something like FlatteningWhenDesti
|
| + // This test verifies the property : |
| + // If A is a 2d transform, then |
| + // flatten(B*A) = flatten(B)*A |
|
ajuma
2015/04/16 17:34:37
Nit: This is the property the implementation relie
jaydasika
2015/04/16 17:44:22
The property is used by the test. But, I agree, th
|
| + TransformTree tree; |
| + |
| + int parent = tree.Insert(TransformNode(), 0); |
| + tree.Node(parent)->data.content_target_id = parent; |
| + tree.Node(parent)->data.target_id = parent; |
| + tree.Node(parent)->data.local.Translate(2, 2); |
| + |
| + gfx::Transform rotation_about_x; |
| + rotation_about_x.RotateAboutXAxis(15); |
| + |
| + int child = tree.Insert(TransformNode(), parent); |
| + tree.Node(child)->data.content_target_id = child; |
| + tree.Node(child)->data.target_id = child; |
| + tree.Node(child)->data.local = rotation_about_x; |
| + |
| + |
| + int grand_child = tree.Insert(TransformNode(), child); |
| + tree.Node(grand_child)->data.content_target_id = grand_child; |
| + tree.Node(grand_child)->data.target_id = grand_child; |
| + tree.Node(grand_child)->data.flattens_inherited_transform = true; |
| + |
| + ComputeTransforms(&tree); |
| + |
| + gfx::Transform flattened_rotation_about_x = rotation_about_x; |
| + flattened_rotation_about_x.FlattenTo2d(); |
| + |
| + gfx::Transform grand_child_to_parent; |
| + bool success = |
| + tree.ComputeTransform(grand_child, parent, &grand_child_to_parent); |
| + EXPECT_TRUE(success); |
| + EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x, |
| + grand_child_to_parent); |
| +} |
| + |
| } // namespace cc |