| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #define _USE_MATH_DEFINES | 5 #define _USE_MATH_DEFINES |
| 6 #include <math.h> | 6 #include <math.h> |
| 7 | 7 |
| 8 #include "cc/test/geometry_test_utils.h" | 8 #include "cc/test/geometry_test_utils.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa
trix.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #define EXPECT_ROW3_EQ(a, b, c, d, matrix) \ | 24 #define EXPECT_ROW3_EQ(a, b, c, d, matrix) \ |
| 25 EXPECT_FLOAT_EQ((a), (matrix).m13()); \ | 25 EXPECT_FLOAT_EQ((a), (matrix).m13()); \ |
| 26 EXPECT_FLOAT_EQ((b), (matrix).m23()); \ | 26 EXPECT_FLOAT_EQ((b), (matrix).m23()); \ |
| 27 EXPECT_FLOAT_EQ((c), (matrix).m33()); \ | 27 EXPECT_FLOAT_EQ((c), (matrix).m33()); \ |
| 28 EXPECT_FLOAT_EQ((d), (matrix).m43()); | 28 EXPECT_FLOAT_EQ((d), (matrix).m43()); |
| 29 | 29 |
| 30 #define EXPECT_ROW4_EQ(a, b, c, d, matrix) \ | 30 #define EXPECT_ROW4_EQ(a, b, c, d, matrix) \ |
| 31 EXPECT_FLOAT_EQ((a), (matrix).m14()); \ | 31 EXPECT_FLOAT_EQ((a), (matrix).m14()); \ |
| 32 EXPECT_FLOAT_EQ((b), (matrix).m24()); \ | 32 EXPECT_FLOAT_EQ((b), (matrix).m24()); \ |
| 33 EXPECT_FLOAT_EQ((c), (matrix).m34()); \ | 33 EXPECT_FLOAT_EQ((c), (matrix).m34()); \ |
| 34 EXPECT_FLOAT_EQ((d), (matrix).m44()); \ | 34 EXPECT_FLOAT_EQ((d), (matrix).m44()); |
| 35 | 35 |
| 36 // Checking float values for equality close to zero is not robust using EXPECT_F
LOAT_EQ | 36 // Checking float values for equality close to zero is not robust using EXPECT_F
LOAT_EQ |
| 37 // (see gtest documentation). So, to verify rotation matrices, we must use a loo
ser | 37 // (see gtest documentation). So, to verify rotation matrices, we must use a loo
ser |
| 38 // absolute error threshold in some places. | 38 // absolute error threshold in some places. |
| 39 #define EXPECT_ROW1_NEAR(a, b, c, d, matrix, errorThreshold) \ | 39 #define EXPECT_ROW1_NEAR(a, b, c, d, matrix, errorThreshold) \ |
| 40 EXPECT_NEAR((a), (matrix).m11(), (errorThreshold)); \ | 40 EXPECT_NEAR((a), (matrix).m11(), (errorThreshold)); \ |
| 41 EXPECT_NEAR((b), (matrix).m21(), (errorThreshold)); \ | 41 EXPECT_NEAR((b), (matrix).m21(), (errorThreshold)); \ |
| 42 EXPECT_NEAR((c), (matrix).m31(), (errorThreshold)); \ | 42 EXPECT_NEAR((c), (matrix).m31(), (errorThreshold)); \ |
| 43 EXPECT_NEAR((d), (matrix).m41(), (errorThreshold)); | 43 EXPECT_NEAR((d), (matrix).m41(), (errorThreshold)); |
| 44 | 44 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 0.3333333333333334258519187, | 625 0.3333333333333334258519187, |
| 626 -0.2440169358562924717404030, | 626 -0.2440169358562924717404030, |
| 627 0, A, ERROR_THRESHOLD); | 627 0, A, ERROR_THRESHOLD); |
| 628 EXPECT_ROW3_NEAR(-0.2440169358562924717404030, | 628 EXPECT_ROW3_NEAR(-0.2440169358562924717404030, |
| 629 0.9106836025229592124219380, | 629 0.9106836025229592124219380, |
| 630 0.3333333333333334258519187, | 630 0.3333333333333334258519187, |
| 631 0, A, ERROR_THRESHOLD); | 631 0, A, ERROR_THRESHOLD); |
| 632 EXPECT_ROW4_EQ(0, 0, 0, 1, A); | 632 EXPECT_ROW4_EQ(0, 0, 0, 1, A); |
| 633 } | 633 } |
| 634 | 634 |
| 635 // Test failing as of webkit 132872:132896. http://crbug.com/158553 | |
| 636 TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForDegenerateAxis) | 635 TEST(WebTransformationMatrixTest, verifyRotateAxisAngle3dForDegenerateAxis) |
| 637 { | 636 { |
| 638 // Check rotation about a degenerate zero vector. | 637 // Check rotation about a degenerate zero vector. |
| 639 // It is expected to skip applying the rotation. | 638 // It is expected to skip applying the rotation. |
| 640 WebTransformationMatrix A; | 639 WebTransformationMatrix A; |
| 641 | 640 |
| 642 A.rotate3d(0, 0, 0, 45); | 641 A.rotate3d(0, 0, 0, 45); |
| 643 // Verify that A remains unchanged. | 642 // Verify that A remains unchanged. |
| 644 EXPECT_TRUE(A.isIdentity()); | 643 EXPECT_TRUE(A.isIdentity()); |
| 645 | 644 |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 normalizationMatrix.setM11(1 / expectedEndOfAnimation.m44()); | 1303 normalizationMatrix.setM11(1 / expectedEndOfAnimation.m44()); |
| 1305 normalizationMatrix.setM22(1 / expectedEndOfAnimation.m44()); | 1304 normalizationMatrix.setM22(1 / expectedEndOfAnimation.m44()); |
| 1306 normalizationMatrix.setM33(1 / expectedEndOfAnimation.m44()); | 1305 normalizationMatrix.setM33(1 / expectedEndOfAnimation.m44()); |
| 1307 normalizationMatrix.setM44(1 / expectedEndOfAnimation.m44()); | 1306 normalizationMatrix.setM44(1 / expectedEndOfAnimation.m44()); |
| 1308 normalizedExpectedEndOfAnimation.multiply(normalizationMatrix); | 1307 normalizedExpectedEndOfAnimation.multiply(normalizationMatrix); |
| 1309 | 1308 |
| 1310 EXPECT_TRANSFORMATION_MATRIX_EQ(normalizedExpectedEndOfAnimation, to); | 1309 EXPECT_TRANSFORMATION_MATRIX_EQ(normalizedExpectedEndOfAnimation, to); |
| 1311 } | 1310 } |
| 1312 | 1311 |
| 1313 } // namespace | 1312 } // namespace |
| OLD | NEW |