Chromium Code Reviews| Index: cc/animation/transform_operations_unittest.cc |
| diff --git a/cc/animation/transform_operations_unittest.cc b/cc/animation/transform_operations_unittest.cc |
| index b82d91103778c0e248ebaf63d3f6991524daad44..1d3a79efbf9f87345f3c0e8d8fb7dcd5f14c6a17 100644 |
| --- a/cc/animation/transform_operations_unittest.cc |
| +++ b/cc/animation/transform_operations_unittest.cc |
| @@ -147,9 +147,9 @@ TEST(TransformOperationTest, IdentityAlwaysMatches) { |
| } |
| TEST(TransformOperationTest, ApplyTranslate) { |
| - double x = 1; |
| - double y = 2; |
| - double z = 3; |
| + SkMScalar x = 1; |
| + SkMScalar y = 2; |
| + SkMScalar z = 3; |
| TransformOperations operations; |
| operations.AppendTranslate(x, y, z); |
| gfx::Transform expected; |
| @@ -158,10 +158,10 @@ TEST(TransformOperationTest, ApplyTranslate) { |
| } |
| TEST(TransformOperationTest, ApplyRotate) { |
| - double x = 1; |
| - double y = 2; |
| - double z = 3; |
| - double degrees = 80; |
| + SkMScalar x = 1; |
| + SkMScalar y = 2; |
| + SkMScalar z = 3; |
| + SkMScalar degrees = 80; |
| TransformOperations operations; |
| operations.AppendRotate(x, y, z, degrees); |
| gfx::Transform expected; |
| @@ -170,9 +170,9 @@ TEST(TransformOperationTest, ApplyRotate) { |
| } |
| TEST(TransformOperationTest, ApplyScale) { |
| - double x = 1; |
| - double y = 2; |
| - double z = 3; |
| + SkMScalar x = 1; |
| + SkMScalar y = 2; |
| + SkMScalar z = 3; |
| TransformOperations operations; |
| operations.AppendScale(x, y, z); |
| gfx::Transform expected; |
| @@ -181,8 +181,8 @@ TEST(TransformOperationTest, ApplyScale) { |
| } |
| TEST(TransformOperationTest, ApplySkew) { |
| - double x = 1; |
| - double y = 2; |
| + SkMScalar x = 1; |
| + SkMScalar y = 2; |
| TransformOperations operations; |
| operations.AppendSkew(x, y); |
| gfx::Transform expected; |
| @@ -192,7 +192,7 @@ TEST(TransformOperationTest, ApplySkew) { |
| } |
| TEST(TransformOperationTest, ApplyPerspective) { |
| - double depth = 800; |
| + SkMScalar depth = 800; |
| TransformOperations operations; |
| operations.AppendPerspective(depth); |
| gfx::Transform expected; |
| @@ -201,9 +201,9 @@ TEST(TransformOperationTest, ApplyPerspective) { |
| } |
| TEST(TransformOperationTest, ApplyMatrix) { |
| - double dx = 1; |
| - double dy = 2; |
| - double dz = 3; |
| + SkMScalar dx = 1; |
| + SkMScalar dy = 2; |
| + SkMScalar dz = 3; |
| gfx::Transform expected_matrix; |
| expected_matrix.Translate3d(dx, dy, dz); |
| TransformOperations matrix_transform; |
| @@ -212,13 +212,13 @@ TEST(TransformOperationTest, ApplyMatrix) { |
| } |
| TEST(TransformOperationTest, ApplyOrder) { |
| - double sx = 2; |
| - double sy = 4; |
| - double sz = 8; |
| + SkMScalar sx = 2; |
| + SkMScalar sy = 4; |
| + SkMScalar sz = 8; |
| - double dx = 1; |
| - double dy = 2; |
| - double dz = 3; |
| + SkMScalar dx = 1; |
| + SkMScalar dy = 2; |
| + SkMScalar dz = 3; |
| TransformOperations operations; |
| operations.AppendScale(sx, sy, sz); |
| @@ -237,21 +237,21 @@ TEST(TransformOperationTest, ApplyOrder) { |
| } |
| TEST(TransformOperationTest, BlendOrder) { |
| - double sx1 = 2; |
| - double sy1 = 4; |
| - double sz1 = 8; |
| + SkMScalar sx1 = 2; |
| + SkMScalar sy1 = 4; |
| + SkMScalar sz1 = 8; |
| - double dx1 = 1; |
| - double dy1 = 2; |
| - double dz1 = 3; |
| + SkMScalar dx1 = 1; |
| + SkMScalar dy1 = 2; |
| + SkMScalar dz1 = 3; |
| - double sx2 = 4; |
| - double sy2 = 8; |
| - double sz2 = 16; |
| + SkMScalar sx2 = 4; |
| + SkMScalar sy2 = 8; |
| + SkMScalar sz2 = 16; |
| - double dx2 = 10; |
| - double dy2 = 20; |
| - double dz2 = 30; |
| + SkMScalar dx2 = 10; |
| + SkMScalar dy2 = 20; |
| + SkMScalar dz2 = 30; |
| TransformOperations operations_from; |
| operations_from.AppendScale(sx1, sy1, sz1); |
| @@ -271,7 +271,7 @@ TEST(TransformOperationTest, BlendOrder) { |
| gfx::Transform translate_to; |
| translate_to.Translate3d(dx2, dy2, dz2); |
| - double progress = 0.25; |
| + SkMScalar progress = 0.25; |
|
danakj
2013/09/09 17:57:45
double?
|
| gfx::Transform blended_scale = scale_to; |
| blended_scale.Blend(scale_from, progress); |
| @@ -286,11 +286,11 @@ TEST(TransformOperationTest, BlendOrder) { |
| expected, operations_to.Blend(operations_from, progress)); |
| } |
| -static void CheckProgress(double progress, |
| - const gfx::Transform& from_matrix, |
| - const gfx::Transform& to_matrix, |
| - const TransformOperations& from_transform, |
| - const TransformOperations& to_transform) { |
| +static void CheckProgress(SkMScalar progress, |
|
danakj
2013/09/09 17:57:45
double?
|
| + const gfx::Transform& from_matrix, |
| + const gfx::Transform& to_matrix, |
| + const TransformOperations& from_transform, |
| + const TransformOperations& to_transform) { |
| gfx::Transform expected_matrix = to_matrix; |
| expected_matrix.Blend(from_matrix, progress); |
| EXPECT_TRANSFORMATION_MATRIX_EQ( |
| @@ -298,9 +298,9 @@ static void CheckProgress(double progress, |
| } |
| TEST(TransformOperationTest, BlendProgress) { |
| - double sx = 2; |
| - double sy = 4; |
| - double sz = 8; |
| + SkMScalar sx = 2; |
| + SkMScalar sy = 4; |
| + SkMScalar sz = 8; |
| TransformOperations operations_from; |
| operations_from.AppendScale(sx, sy, sz); |
| @@ -325,21 +325,21 @@ TEST(TransformOperationTest, BlendProgress) { |
| } |
| TEST(TransformOperationTest, BlendWhenTypesDoNotMatch) { |
| - double sx1 = 2; |
| - double sy1 = 4; |
| - double sz1 = 8; |
| + SkMScalar sx1 = 2; |
| + SkMScalar sy1 = 4; |
| + SkMScalar sz1 = 8; |
| - double dx1 = 1; |
| - double dy1 = 2; |
| - double dz1 = 3; |
| + SkMScalar dx1 = 1; |
| + SkMScalar dy1 = 2; |
| + SkMScalar dz1 = 3; |
| - double sx2 = 4; |
| - double sy2 = 8; |
| - double sz2 = 16; |
| + SkMScalar sx2 = 4; |
| + SkMScalar sy2 = 8; |
| + SkMScalar sz2 = 16; |
| - double dx2 = 10; |
| - double dy2 = 20; |
| - double dz2 = 30; |
| + SkMScalar dx2 = 10; |
| + SkMScalar dy2 = 20; |
| + SkMScalar dz2 = 30; |
| TransformOperations operations_from; |
| operations_from.AppendScale(sx1, sy1, sz1); |
| @@ -357,7 +357,7 @@ TEST(TransformOperationTest, BlendWhenTypesDoNotMatch) { |
| to.Translate3d(dx2, dy2, dz2); |
| to.Scale3d(sx2, sy2, sz2); |
| - double progress = 0.25; |
| + SkMScalar progress = 0.25; |
|
danakj
2013/09/09 17:57:45
double for all these?
|
| gfx::Transform expected = to; |
| expected.Blend(from, progress); |
| @@ -373,7 +373,7 @@ TEST(TransformOperationTest, LargeRotationsWithSameAxis) { |
| TransformOperations operations_to; |
| operations_to.AppendRotate(0, 0, 2, 360); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 180); |
| @@ -389,7 +389,7 @@ TEST(TransformOperationTest, LargeRotationsWithSameAxisInDifferentDirection) { |
| TransformOperations operations_to; |
| operations_to.AppendRotate(0, 0, -1, 180); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| @@ -404,7 +404,7 @@ TEST(TransformOperationTest, LargeRotationsWithDifferentAxes) { |
| TransformOperations operations_to; |
| operations_to.AppendRotate(0, 1, 0, 175); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform matrix_from; |
| matrix_from.RotateAbout(gfx::Vector3dF(0, 0, 1), 175); |
| @@ -426,7 +426,7 @@ TEST(TransformOperationTest, BlendRotationFromIdentity) { |
| TransformOperations operations; |
| operations.AppendRotate(0, 0, 1, 360); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 180); |
| @@ -460,7 +460,7 @@ TEST(TransformOperationTest, BlendTranslationFromIdentity) { |
| TransformOperations operations; |
| operations.AppendTranslate(2, 2, 2); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.Translate3d(1, 1, 1); |
| @@ -494,7 +494,7 @@ TEST(TransformOperationTest, BlendScaleFromIdentity) { |
| TransformOperations operations; |
| operations.AppendScale(3, 3, 3); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.Scale3d(2, 2, 2); |
| @@ -528,7 +528,7 @@ TEST(TransformOperationTest, BlendSkewFromIdentity) { |
| TransformOperations operations; |
| operations.AppendSkew(2, 2); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.SkewX(1); |
| @@ -565,11 +565,11 @@ TEST(TransformOperationTest, BlendPerspectiveFromIdentity) { |
| TransformOperations operations; |
| operations.AppendPerspective(1000); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| - expected.ApplyPerspectiveDepth( |
| - 500 + 0.5 * std::numeric_limits<double>::max()); |
| + expected.ApplyPerspectiveDepth(500 + |
| + 0.5 * std::numeric_limits<SkMScalar>::max()); |
| EXPECT_TRANSFORMATION_MATRIX_EQ( |
| expected, operations.Blend(*identity_operations[i], progress)); |
| @@ -584,7 +584,7 @@ TEST(TransformOperationTest, BlendRotationToIdentity) { |
| TransformOperations operations; |
| operations.AppendRotate(0, 0, 1, 360); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.RotateAbout(gfx::Vector3dF(0, 0, 1), 180); |
| @@ -602,7 +602,7 @@ TEST(TransformOperationTest, BlendTranslationToIdentity) { |
| TransformOperations operations; |
| operations.AppendTranslate(2, 2, 2); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
|
danakj
2013/09/09 17:57:45
It's a bit off that these are 0.5 and not 0.5f or
enne (OOO)
2013/09/10 22:32:32
Changed all progress to float literals to avoid na
|
| gfx::Transform expected; |
| expected.Translate3d(1, 1, 1); |
| @@ -620,7 +620,7 @@ TEST(TransformOperationTest, BlendScaleToIdentity) { |
| TransformOperations operations; |
| operations.AppendScale(3, 3, 3); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.Scale3d(2, 2, 2); |
| @@ -638,7 +638,7 @@ TEST(TransformOperationTest, BlendSkewToIdentity) { |
| TransformOperations operations; |
| operations.AppendSkew(2, 2); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| expected.SkewX(1); |
| @@ -657,11 +657,11 @@ TEST(TransformOperationTest, BlendPerspectiveToIdentity) { |
| TransformOperations operations; |
| operations.AppendPerspective(1000); |
| - double progress = 0.5; |
| + SkMScalar progress = 0.5; |
| gfx::Transform expected; |
| - expected.ApplyPerspectiveDepth( |
| - 500 + 0.5 * std::numeric_limits<double>::max()); |
| + expected.ApplyPerspectiveDepth(500 + |
| + 0.5 * std::numeric_limits<SkMScalar>::max()); |
| EXPECT_TRANSFORMATION_MATRIX_EQ( |
| expected, identity_operations[i]->Blend(operations, progress)); |
| @@ -720,8 +720,8 @@ TEST(TransformOperationTest, BlendedBoundsWhenTypesDoNotMatch) { |
| gfx::BoxF box(1.f, 1.f, 1.f); |
| gfx::BoxF bounds; |
| - double min_progress = 0.0; |
| - double max_progress = 1.0; |
| + SkMScalar min_progress = 0.0; |
|
danakj
2013/09/09 17:57:45
more doubles?
|
| + SkMScalar max_progress = 1.0; |
| EXPECT_FALSE(operations_to.BlendedBoundsForBox( |
| box, operations_from, min_progress, max_progress, &bounds)); |
| @@ -736,8 +736,8 @@ TEST(TransformOperationTest, BlendedBoundsForIdentity) { |
| gfx::BoxF box(1.f, 2.f, 3.f); |
| gfx::BoxF bounds; |
| - double min_progress = 0.0; |
| - double max_progress = 1.0; |
| + SkMScalar min_progress = 0.0; |
| + SkMScalar max_progress = 1.0; |
| EXPECT_TRUE(operations_to.BlendedBoundsForBox( |
| box, operations_from, min_progress, max_progress, &bounds)); |
| @@ -753,8 +753,8 @@ TEST(TransformOperationTest, BlendedBoundsForTranslate) { |
| gfx::BoxF box(1.f, 2.f, 3.f, 4.f, 4.f, 4.f); |
| gfx::BoxF bounds; |
| - double min_progress = -0.5; |
| - double max_progress = 1.5; |
| + SkMScalar min_progress = -0.5; |
| + SkMScalar max_progress = 1.5; |
| EXPECT_TRUE(operations_to.BlendedBoundsForBox( |
| box, operations_from, min_progress, max_progress, &bounds)); |
| EXPECT_EQ(gfx::BoxF(2.f, -6.f, -1.f, 12.f, 20.f, 12.f).ToString(), |
| @@ -788,8 +788,8 @@ TEST(TransformOperationTest, BlendedBoundsForScale) { |
| gfx::BoxF box(1.f, 2.f, 3.f, 4.f, 4.f, 4.f); |
| gfx::BoxF bounds; |
| - double min_progress = -0.5; |
| - double max_progress = 1.5; |
| + SkMScalar min_progress = -0.5; |
| + SkMScalar max_progress = 1.5; |
| EXPECT_TRUE(operations_to.BlendedBoundsForBox( |
| box, operations_from, min_progress, max_progress, &bounds)); |
| EXPECT_EQ(gfx::BoxF(1.f, -7.5f, -28.f, 44.f, 42.f, 56.f).ToString(), |
| @@ -823,8 +823,8 @@ TEST(TransformOperationTest, BlendedBoundsWithZeroScale) { |
| gfx::BoxF box(1.f, 2.f, 3.f, 4.f, 4.f, 4.f); |
| gfx::BoxF bounds; |
| - double min_progress = 0.0; |
| - double max_progress = 1.0; |
| + SkMScalar min_progress = 0.0; |
| + SkMScalar max_progress = 1.0; |
| EXPECT_TRUE(zero_scale.BlendedBoundsForBox( |
| box, non_zero_scale, min_progress, max_progress, &bounds)); |
| EXPECT_EQ(gfx::BoxF(0.f, -24.f, 0.f, 10.f, 24.f, 35.f).ToString(), |
| @@ -853,8 +853,8 @@ TEST(TransformOperationTest, BlendedBoundsForSequence) { |
| gfx::BoxF box(1.f, 2.f, 3.f, 4.f, 4.f, 4.f); |
| gfx::BoxF bounds; |
| - double min_progress = -0.5; |
| - double max_progress = 1.5; |
| + SkMScalar min_progress = -0.5; |
| + SkMScalar max_progress = 1.5; |
| EXPECT_TRUE(operations_to.BlendedBoundsForBox( |
| box, operations_from, min_progress, max_progress, &bounds)); |
| EXPECT_EQ(gfx::BoxF(-57.f, -59.f, -1.f, 76.f, 112.f, 80.f).ToString(), |