diff options
author | shawnsingh@google.com <shawnsingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-07 18:46:17 +0000 |
---|---|---|
committer | shawnsingh@google.com <shawnsingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-07 18:46:17 +0000 |
commit | bda419621f3a609ac9381f03344574b297d2a3fc (patch) | |
tree | ec426b89d2fd0db9841add54580ff4bfcc50802c /cc/math_util_unittest.cc | |
parent | 38eb497c29f6ba7ddf8b067f7b892bd7ed9e1423 (diff) | |
download | chromium_src-bda419621f3a609ac9381f03344574b297d2a3fc.zip chromium_src-bda419621f3a609ac9381f03344574b297d2a3fc.tar.gz chromium_src-bda419621f3a609ac9381f03344574b297d2a3fc.tar.bz2 |
Migrate from MathUtil::inverse() to gfx::Transform::GetInverse()
BUG=159972, 163769
Review URL: https://codereview.chromium.org/11644008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175363 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/math_util_unittest.cc')
-rw-r--r-- | cc/math_util_unittest.cc | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/cc/math_util_unittest.cc b/cc/math_util_unittest.cc index 0aa0523..6dc2ced 100644 --- a/cc/math_util_unittest.cc +++ b/cc/math_util_unittest.cc @@ -325,51 +325,6 @@ TEST(MathUtilGfxTransformTest, verifyCopyConstructor) EXPECT_ROW4_EQ(13, 17, 21, 25, B); } -TEST(MathUtilGfxTransformTest, verifyMatrixInversion) -{ - // Invert a translation - gfx::Transform translation; - translation.Translate3d(2, 3, 4); - EXPECT_TRUE(translation.IsInvertible()); - - gfx::Transform inverseTranslation = MathUtil::inverse(translation); - EXPECT_ROW1_EQ(1, 0, 0, -2, inverseTranslation); - EXPECT_ROW2_EQ(0, 1, 0, -3, inverseTranslation); - EXPECT_ROW3_EQ(0, 0, 1, -4, inverseTranslation); - EXPECT_ROW4_EQ(0, 0, 0, 1, inverseTranslation); - - // Note that inversion should not have changed the original matrix. - EXPECT_ROW1_EQ(1, 0, 0, 2, translation); - EXPECT_ROW2_EQ(0, 1, 0, 3, translation); - EXPECT_ROW3_EQ(0, 0, 1, 4, translation); - EXPECT_ROW4_EQ(0, 0, 0, 1, translation); - - // Invert a non-uniform scale - gfx::Transform scale; - scale.Scale3d(4, 10, 100); - EXPECT_TRUE(scale.IsInvertible()); - - gfx::Transform inverseScale = MathUtil::inverse(scale); - EXPECT_ROW1_EQ(0.25, 0, 0, 0, inverseScale); - EXPECT_ROW2_EQ(0, .1f, 0, 0, inverseScale); - EXPECT_ROW3_EQ(0, 0, .01f, 0, inverseScale); - EXPECT_ROW4_EQ(0, 0, 0, 1, inverseScale); - - // Try to invert a matrix that is not invertible. - // The inverse() function should simply return an identity matrix. - gfx::Transform notInvertible; - notInvertible.matrix().setDouble(0, 0, 0); - notInvertible.matrix().setDouble(1, 1, 0); - notInvertible.matrix().setDouble(2, 2, 0); - notInvertible.matrix().setDouble(3, 3, 0); - EXPECT_FALSE(notInvertible.IsInvertible()); - - gfx::Transform inverseOfNotInvertible; - initializeTestMatrix(&inverseOfNotInvertible); // initialize this to something non-identity, to make sure that assignment below actually took place. - inverseOfNotInvertible = MathUtil::inverse(notInvertible); - EXPECT_TRUE(inverseOfNotInvertible.IsIdentity()); -} - TEST(MathUtilGfxTransformTest, verifyTo2DTransform) { gfx::Transform A; |