Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: cc/math_util_unittest.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed feedback Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/math_util_unittest.cc
diff --git a/cc/math_util_unittest.cc b/cc/math_util_unittest.cc
index 93a980ffa92f589ca36ff8b615a05fb5583e3b61..73812bbf95cd37a01d16ce31b6de879ce7871d0a 100644
--- a/cc/math_util_unittest.cc
+++ b/cc/math_util_unittest.cc
@@ -11,37 +11,37 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_f.h"
-#include <public/WebTransformationMatrix.h>
+#include "ui/gfx/transform.h"
-using WebKit::WebTransformationMatrix;
+using gfx::Transform;
namespace cc {
namespace {
TEST(MathUtilTest, verifyBackfaceVisibilityBasicCases)
{
- WebTransformationMatrix transform;
+ Transform transform;
- transform.makeIdentity();
- EXPECT_FALSE(transform.isBackFaceVisible());
+ transform.matrix().setIdentity();
+ EXPECT_FALSE(MathUtil::isBackFaceVisible(transform));
- transform.makeIdentity();
- transform.rotate3d(0, 80, 0);
- EXPECT_FALSE(transform.isBackFaceVisible());
+ transform.matrix().setIdentity();
+ MathUtil::rotateEulerAngles(&transform, 0, 80, 0);
+ EXPECT_FALSE(MathUtil::isBackFaceVisible(transform));
- transform.makeIdentity();
- transform.rotate3d(0, 100, 0);
- EXPECT_TRUE(transform.isBackFaceVisible());
+ transform.matrix().setIdentity();
+ MathUtil::rotateEulerAngles(&transform, 0, 100, 0);
+ EXPECT_TRUE(MathUtil::isBackFaceVisible(transform));
// Edge case, 90 degree rotation should return false.
- transform.makeIdentity();
- transform.rotate3d(0, 90, 0);
- EXPECT_FALSE(transform.isBackFaceVisible());
+ transform.matrix().setIdentity();
+ MathUtil::rotateEulerAngles(&transform, 0, 90, 0);
+ EXPECT_FALSE(MathUtil::isBackFaceVisible(transform));
}
TEST(MathUtilTest, verifyBackfaceVisibilityForPerspective)
{
- WebTransformationMatrix layerSpaceToProjectionPlane;
+ Transform layerSpaceToProjectionPlane;
// This tests if isBackFaceVisible works properly under perspective transforms.
// Specifically, layers that may have their back face visible in orthographic
@@ -50,11 +50,11 @@ TEST(MathUtilTest, verifyBackfaceVisibilityForPerspective)
// Case 1: Layer is rotated by slightly more than 90 degrees, at the center of the
// prespective projection. In this case, the layer's back-side is visible to
// the camera.
- layerSpaceToProjectionPlane.makeIdentity();
- layerSpaceToProjectionPlane.applyPerspective(1);
- layerSpaceToProjectionPlane.translate3d(0, 0, 0);
- layerSpaceToProjectionPlane.rotate3d(0, 100, 0);
- EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible());
+ layerSpaceToProjectionPlane.matrix().setIdentity();
+ layerSpaceToProjectionPlane.PreconcatPerspectiveDepth(1);
+ layerSpaceToProjectionPlane.PreconcatTranslate3d(0, 0, 0);
+ MathUtil::rotateEulerAngles(&layerSpaceToProjectionPlane, 0, 100, 0);
+ EXPECT_TRUE(MathUtil::isBackFaceVisible(layerSpaceToProjectionPlane));
// Case 2: Layer is rotated by slightly more than 90 degrees, but shifted off to the
// side of the camera. Because of the wide field-of-view, the layer's front
@@ -70,16 +70,16 @@ TEST(MathUtilTest, verifyBackfaceVisibilityForPerspective)
// back side of layer -->| \ /
// \./ <-- camera origin
//
- layerSpaceToProjectionPlane.makeIdentity();
- layerSpaceToProjectionPlane.applyPerspective(1);
- layerSpaceToProjectionPlane.translate3d(-10, 0, 0);
- layerSpaceToProjectionPlane.rotate3d(0, 100, 0);
- EXPECT_FALSE(layerSpaceToProjectionPlane.isBackFaceVisible());
+ layerSpaceToProjectionPlane.matrix().setIdentity();
+ layerSpaceToProjectionPlane.PreconcatPerspectiveDepth(1);
+ layerSpaceToProjectionPlane.PreconcatTranslate3d(-10, 0, 0);
+ MathUtil::rotateEulerAngles(&layerSpaceToProjectionPlane, 0, 100, 0);
+ EXPECT_FALSE(MathUtil::isBackFaceVisible(layerSpaceToProjectionPlane));
// Case 3: Additionally rotating the layer by 180 degrees should of course show the
// opposite result of case 2.
- layerSpaceToProjectionPlane.rotate3d(0, 180, 0);
- EXPECT_TRUE(layerSpaceToProjectionPlane.isBackFaceVisible());
+ MathUtil::rotateEulerAngles(&layerSpaceToProjectionPlane, 0, 180, 0);
+ EXPECT_TRUE(MathUtil::isBackFaceVisible(layerSpaceToProjectionPlane));
}
TEST(MathUtilTest, verifyProjectionOfPerpendicularPlane)
@@ -87,9 +87,9 @@ TEST(MathUtilTest, verifyProjectionOfPerpendicularPlane)
// In this case, the m33() element of the transform becomes zero, which could cause a
// divide-by-zero when projecting points/quads.
- WebTransformationMatrix transform;
- transform.makeIdentity();
- transform.setM33(0);
+ Transform transform;
+ transform.matrix().setIdentity();
+ transform.matrix().setDouble(2, 2, 0);
gfx::RectF rect = gfx::RectF(0, 0, 1, 1);
gfx::RectF projectedRect = MathUtil::projectClippedRect(transform, rect);
@@ -293,7 +293,7 @@ TEST(MathUtilGfxTransformTest, verifyDefaultConstructorCreatesIdentityMatrix)
EXPECT_ROW2_EQ(0, 1, 0, 0, A);
EXPECT_ROW3_EQ(0, 0, 1, 0, A);
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
- EXPECT_TRUE(MathUtil::isIdentity(A));
+ EXPECT_TRUE(A.IsIdentity());
}
TEST(MathUtilGfxTransformTest, verifyCreateGfxTransformFor2dElements)
@@ -332,7 +332,7 @@ TEST(MathUtilGfxTransformTest, verifyMatrixInversion)
// Invert a translation
gfx::Transform translation;
translation.PreconcatTranslate3d(2, 3, 4);
- EXPECT_TRUE(MathUtil::isInvertible(translation));
+ EXPECT_TRUE(translation.IsInvertible());
gfx::Transform inverseTranslation = MathUtil::inverse(translation);
EXPECT_ROW1_EQ(1, 0, 0, -2, inverseTranslation);
@@ -349,7 +349,7 @@ TEST(MathUtilGfxTransformTest, verifyMatrixInversion)
// Invert a non-uniform scale
gfx::Transform scale;
scale.PreconcatScale3d(4, 10, 100);
- EXPECT_TRUE(MathUtil::isInvertible(scale));
+ EXPECT_TRUE(scale.IsInvertible());
gfx::Transform inverseScale = MathUtil::inverse(scale);
EXPECT_ROW1_EQ(0.25, 0, 0, 0, inverseScale);
@@ -364,12 +364,12 @@ TEST(MathUtilGfxTransformTest, verifyMatrixInversion)
notInvertible.matrix().setDouble(1, 1, 0);
notInvertible.matrix().setDouble(2, 2, 0);
notInvertible.matrix().setDouble(3, 3, 0);
- EXPECT_FALSE(MathUtil::isInvertible(notInvertible));
+ 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(MathUtil::isIdentity(inverseOfNotInvertible));
+ EXPECT_TRUE(inverseOfNotInvertible.IsIdentity());
}
TEST(MathUtilGfxTransformTest, verifyTo2DTransform)
@@ -531,12 +531,12 @@ TEST(MathUtilGfxTransformTest, verifyMakeIdentiy)
{
gfx::Transform A;
initializeTestMatrix(&A);
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
EXPECT_ROW1_EQ(1, 0, 0, 0, A);
EXPECT_ROW2_EQ(0, 1, 0, 0, A);
EXPECT_ROW3_EQ(0, 0, 1, 0, A);
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
- EXPECT_TRUE(MathUtil::isIdentity(A));
+ EXPECT_TRUE(A.IsIdentity());
}
TEST(MathUtilGfxTransformTest, verifyTranslate)
@@ -549,7 +549,7 @@ TEST(MathUtilGfxTransformTest, verifyTranslate)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that PreconcatTranslate() post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale(5, 5);
A.PreconcatTranslate(2, 3);
EXPECT_ROW1_EQ(5, 0, 0, 10, A);
@@ -568,7 +568,7 @@ TEST(MathUtilGfxTransformTest, verifyTranslate3d)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that PreconcatTranslate3d() post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
A.PreconcatTranslate3d(2, 3, 4);
EXPECT_ROW1_EQ(6, 0, 0, 12, A);
@@ -587,7 +587,7 @@ TEST(MathUtilGfxTransformTest, verifyScale)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that PreconcatScale() post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatTranslate3d(2, 3, 4);
A.PreconcatScale(6, 7);
EXPECT_ROW1_EQ(6, 0, 0, 2, A);
@@ -606,7 +606,7 @@ TEST(MathUtilGfxTransformTest, verifyScale3d)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that scale3d() post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatTranslate3d(2, 3, 4);
A.PreconcatScale3d(6, 7, 8);
EXPECT_ROW1_EQ(6, 0, 0, 2, A);
@@ -625,7 +625,7 @@ TEST(MathUtilGfxTransformTest, verifyRotate)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that PreconcatRotate() post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
A.PreconcatRotate(90);
EXPECT_ROW1_NEAR(0, -6, 0, 0, A, ERROR_THRESHOLD);
@@ -639,7 +639,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateEulerAngles)
gfx::Transform A;
// Check rotation about z-axis
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateEulerAngles(&A, 0, 0, 90);
EXPECT_ROW1_NEAR(0, -1, 0, 0, A, ERROR_THRESHOLD);
EXPECT_ROW2_NEAR(1, 0, 0, 0, A, ERROR_THRESHOLD);
@@ -647,7 +647,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateEulerAngles)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Check rotation about x-axis
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateEulerAngles(&A, 90, 0, 0);
EXPECT_ROW1_EQ(1, 0, 0, 0, A);
EXPECT_ROW2_NEAR(0, 0, -1, 0, A, ERROR_THRESHOLD);
@@ -656,7 +656,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateEulerAngles)
// Check rotation about y-axis.
// Note carefully, the expected pattern is inverted compared to rotating about x axis or z axis.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateEulerAngles(&A, 0, 90, 0);
EXPECT_ROW1_NEAR(0, 0, 1, 0, A, ERROR_THRESHOLD);
EXPECT_ROW2_EQ(0, 1, 0, 0, A);
@@ -664,7 +664,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateEulerAngles)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that rotate3d(rx, ry, rz) post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
MathUtil::rotateEulerAngles(&A, 0, 0, 90);
EXPECT_ROW1_NEAR(0, -6, 0, 0, A, ERROR_THRESHOLD);
@@ -689,7 +689,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateEulerAnglesOrderOfCompositeRotations)
// from the other orderings. That way, this test verifies the exact ordering.
gfx::Transform A;
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateEulerAngles(&A, 10, 20, 30);
EXPECT_ROW1_NEAR(0.8137976813493738026394908,
@@ -712,7 +712,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateAxisAngleForAlignedAxes)
gfx::Transform A;
// Check rotation about z-axis
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateAxisAngle(&A, 0, 0, 1, 90);
EXPECT_ROW1_NEAR(0, -1, 0, 0, A, ERROR_THRESHOLD);
EXPECT_ROW2_NEAR(1, 0, 0, 0, A, ERROR_THRESHOLD);
@@ -720,7 +720,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateAxisAngleForAlignedAxes)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Check rotation about x-axis
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateAxisAngle(&A, 1, 0, 0, 90);
EXPECT_ROW1_EQ(1, 0, 0, 0, A);
EXPECT_ROW2_NEAR(0, 0, -1, 0, A, ERROR_THRESHOLD);
@@ -729,7 +729,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateAxisAngleForAlignedAxes)
// Check rotation about y-axis.
// Note carefully, the expected pattern is inverted compared to rotating about x axis or z axis.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateAxisAngle(&A, 0, 1, 0, 90);
EXPECT_ROW1_NEAR(0, 0, 1, 0, A, ERROR_THRESHOLD);
EXPECT_ROW2_EQ(0, 1, 0, 0, A);
@@ -737,7 +737,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateAxisAngleForAlignedAxes)
EXPECT_ROW4_EQ(0, 0, 0, 1, A);
// Verify that rotate3d(axis, angle) post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
MathUtil::rotateAxisAngle(&A, 0, 0, 1, 90);
EXPECT_ROW1_NEAR(0, -6, 0, 0, A, ERROR_THRESHOLD);
@@ -774,7 +774,7 @@ TEST(MathUtilGfxTransformTest, verifyRotateAxisAngleForDegenerateAxis)
MathUtil::rotateAxisAngle(&A, 0, 0, 0, 45);
// Verify that A remains unchanged.
- EXPECT_TRUE(MathUtil::isIdentity(A));
+ EXPECT_TRUE(A.IsIdentity());
initializeTestMatrix(&A);
MathUtil::rotateAxisAngle(&A, 0, 0, 0, 35);
@@ -797,7 +797,7 @@ TEST(MathUtilGfxTransformTest, verifySkewX)
// Verify that skewX() post-multiplies the existing matrix.
// Row 1, column 2, would incorrectly have value "7" if the matrix is pre-multiplied instead of post-multiplied.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
A.PreconcatSkewX(45);
EXPECT_ROW1_EQ(6, 6, 0, 0, A);
@@ -817,7 +817,7 @@ TEST(MathUtilGfxTransformTest, verifySkewY)
// Verify that skewY() post-multiplies the existing matrix.
// Row 2, column 1, would incorrectly have value "6" if the matrix is pre-multiplied instead of post-multiplied.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
A.PreconcatSkewY(45);
EXPECT_ROW1_EQ(6, 0, 0, 0, A);
@@ -836,7 +836,7 @@ TEST(MathUtilGfxTransformTest, verifyPerspectiveDepth)
EXPECT_ROW4_EQ(0, 0, -1, 1, A);
// Verify that PreconcatPerspectiveDepth() post-multiplies the existing matrix.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatTranslate3d(2, 3, 4);
A.PreconcatPerspectiveDepth(1);
EXPECT_ROW1_EQ(1, 0, -2, 2, A);
@@ -851,27 +851,27 @@ TEST(MathUtilGfxTransformTest, verifyHasPerspective)
A.PreconcatPerspectiveDepth(1);
EXPECT_TRUE(MathUtil::hasPerspective(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatPerspectiveDepth(0);
EXPECT_FALSE(MathUtil::hasPerspective(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 0, -1);
EXPECT_TRUE(MathUtil::hasPerspective(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 1, -1);
EXPECT_TRUE(MathUtil::hasPerspective(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 2, -0.3);
EXPECT_TRUE(MathUtil::hasPerspective(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 3, 0.5);
EXPECT_TRUE(MathUtil::hasPerspective(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 3, 0);
EXPECT_TRUE(MathUtil::hasPerspective(A));
}
@@ -881,55 +881,55 @@ TEST(MathUtilGfxTransformTest, verifyIsInvertible)
gfx::Transform A;
// Translations, rotations, scales, skews and arbitrary combinations of them are invertible.
- MathUtil::makeIdentity(&A);
- EXPECT_TRUE(MathUtil::isInvertible(A));
+ A.matrix().setIdentity();
+ EXPECT_TRUE(A.IsInvertible());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatTranslate3d(2, 3, 4);
- EXPECT_TRUE(MathUtil::isInvertible(A));
+ EXPECT_TRUE(A.IsInvertible());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatScale3d(6, 7, 8);
- EXPECT_TRUE(MathUtil::isInvertible(A));
+ EXPECT_TRUE(A.IsInvertible());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
MathUtil::rotateEulerAngles(&A, 10, 20, 30);
- EXPECT_TRUE(MathUtil::isInvertible(A));
+ EXPECT_TRUE(A.IsInvertible());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatSkewX(45);
- EXPECT_TRUE(MathUtil::isInvertible(A));
+ EXPECT_TRUE(A.IsInvertible());
// A perspective matrix (projection plane at z=0) is invertible. The intuitive
// explanation is that perspective is eqivalent to a skew of the w-axis; skews are
// invertible.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatPerspectiveDepth(1);
- EXPECT_TRUE(MathUtil::isInvertible(A));
+ EXPECT_TRUE(A.IsInvertible());
// A "pure" perspective matrix derived by similar triangles, with m44() set to zero
// (i.e. camera positioned at the origin), is not invertible.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatPerspectiveDepth(1);
A.matrix().setDouble(3, 3, 0);
- EXPECT_FALSE(MathUtil::isInvertible(A));
+ EXPECT_FALSE(A.IsInvertible());
// Adding more to a non-invertible matrix will not make it invertible in the general case.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.PreconcatPerspectiveDepth(1);
A.matrix().setDouble(3, 3, 0);
A.PreconcatScale3d(6, 7, 8);
MathUtil::rotateEulerAngles(&A, 10, 20, 30);
A.PreconcatTranslate3d(6, 7, 8);
- EXPECT_FALSE(MathUtil::isInvertible(A));
+ EXPECT_FALSE(A.IsInvertible());
// A degenerate matrix of all zeros is not invertible.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 0, 0);
A.matrix().setDouble(1, 1, 0);
A.matrix().setDouble(2, 2, 0);
A.matrix().setDouble(3, 3, 0);
- EXPECT_FALSE(MathUtil::isInvertible(A));
+ EXPECT_FALSE(A.IsInvertible());
}
TEST(MathUtilGfxTransformTest, verifyIsIdentity)
@@ -937,75 +937,75 @@ TEST(MathUtilGfxTransformTest, verifyIsIdentity)
gfx::Transform A;
initializeTestMatrix(&A);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
- EXPECT_TRUE(MathUtil::isIdentity(A));
+ A.matrix().setIdentity();
+ EXPECT_TRUE(A.IsIdentity());
// Modifying any one individual element should cause the matrix to no longer be identity.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 0, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 0, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 0, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 0, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 1, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 1, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 1, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 1, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 2, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 2, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 2, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 2, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 3, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 3, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 3, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 3, 2);
- EXPECT_FALSE(MathUtil::isIdentity(A));
+ EXPECT_FALSE(A.IsIdentity());
}
TEST(MathUtilGfxTransformTest, verifyIsIdentityOrTranslation)
@@ -1015,76 +1015,76 @@ TEST(MathUtilGfxTransformTest, verifyIsIdentityOrTranslation)
initializeTestMatrix(&A);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
EXPECT_TRUE(MathUtil::isIdentityOrTranslation(A));
// Modifying any non-translation components should cause isIdentityOrTranslation() to
// return false. NOTE: (0, 3), (1, 3), and (2, 3) are the translation components, so
// modifying them should still return true for isIdentityOrTranslation().
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 0, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 0, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 0, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 0, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 0, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 1, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 1, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 1, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 2, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 2, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 2, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 2, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
// Note carefully - expecting true here.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(0, 3, 2);
EXPECT_TRUE(MathUtil::isIdentityOrTranslation(A));
// Note carefully - expecting true here.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(1, 3, 2);
EXPECT_TRUE(MathUtil::isIdentityOrTranslation(A));
// Note carefully - expecting true here.
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(2, 3, 2);
EXPECT_TRUE(MathUtil::isIdentityOrTranslation(A));
- MathUtil::makeIdentity(&A);
+ A.matrix().setIdentity();
A.matrix().setDouble(3, 3, 2);
EXPECT_FALSE(MathUtil::isIdentityOrTranslation(A));
}

Powered by Google App Engine
This is Rietveld 408576698