aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/MatrixTest.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-06-19 05:14:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-19 05:14:26 -0700
commit20eee3f047f56b7715b311313b2998daaaf08a96 (patch)
tree5c7592f8266290804816c43f808db060ed3adec9 /tests/MatrixTest.cpp
parent13a007d9df7769d3c63998dfeadda5ca17f1d15a (diff)
Added check for ill-conditioned invert
sk_inv_determinant has a guard that the determinant can't get too big so this CL only checks if the determinant gets too small. BUG=492263 Review URL: https://codereview.chromium.org/1188433011
Diffstat (limited to 'tests/MatrixTest.cpp')
-rw-r--r--tests/MatrixTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index 72e0dcc021..2296b8f2b5 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -838,6 +838,13 @@ DEF_TEST(Matrix, reporter) {
REPORTER_ASSERT(reporter, !mat.invert(NULL));
REPORTER_ASSERT(reporter, !mat.invert(&inverse));
+ // Inverting this matrix results in a non-finite matrix
+ mat.setAll(0.0f, 1.0f, 2.0f,
+ 0.0f, 1.0f, -3.40277175e+38f,
+ 1.00003040f, 1.0f, 0.0f);
+ REPORTER_ASSERT(reporter, !mat.invert(NULL));
+ REPORTER_ASSERT(reporter, !mat.invert(&inverse));
+
// rectStaysRect test
{
static const struct {