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

Unified Diff: tests/Matrix44Test.cpp

Issue 1209763002: Fix infinite matrix during an invert. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 years, 6 months 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
« no previous file with comments | « src/utils/SkMatrix44.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/Matrix44Test.cpp
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp
index cd11a7da2d0ea5b9460eb44072153993d04d82e7..9208ed13ad640a69cbe42f933643f4bfd5fd3211 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -426,6 +426,31 @@ static void test_invert(skiatest::Reporter* reporter) {
0, 0, -1, 1};
expected.setRowMajord(expectedInverseAffineAndPerspective);
REPORTER_ASSERT(reporter, nearly_equal(expected, inverse));
+
+ SkMatrix44 tinyScale(SkMatrix44::kIdentity_Constructor);
+ tinyScale.setDouble(0, 0, 1e-39);
+ REPORTER_ASSERT(reporter, tinyScale.getType() == SkMatrix44::kScale_Mask);
+ REPORTER_ASSERT(reporter, !tinyScale.invert(NULL));
+ REPORTER_ASSERT(reporter, !tinyScale.invert(&inverse));
+
+ SkMatrix44 tinyScaleTranslate(SkMatrix44::kIdentity_Constructor);
+ tinyScaleTranslate.setDouble(0, 0, 1e-38);
+ REPORTER_ASSERT(reporter, tinyScaleTranslate.invert(NULL));
+ tinyScaleTranslate.setDouble(0, 3, 10);
+ REPORTER_ASSERT(
+ reporter, tinyScaleTranslate.getType() ==
+ (SkMatrix44::kScale_Mask | SkMatrix44::kTranslate_Mask));
+ REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(NULL));
+ REPORTER_ASSERT(reporter, !tinyScaleTranslate.invert(&inverse));
+
+ SkMatrix44 tinyScalePerspective(SkMatrix44::kIdentity_Constructor);
+ tinyScalePerspective.setDouble(0, 0, 1e-39);
+ tinyScalePerspective.setDouble(3, 2, -1);
+ REPORTER_ASSERT(reporter, (tinyScalePerspective.getType() &
+ SkMatrix44::kPerspective_Mask) ==
+ SkMatrix44::kPerspective_Mask);
+ REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(NULL));
+ REPORTER_ASSERT(reporter, !tinyScalePerspective.invert(&inverse));
}
static void test_transpose(skiatest::Reporter* reporter) {
« no previous file with comments | « src/utils/SkMatrix44.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698