diff options
Diffstat (limited to 'tests/Matrix44Test.cpp')
-rw-r--r-- | tests/Matrix44Test.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index af10e00d71..782b51e0bf 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -147,6 +147,35 @@ static void test_determinant(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, nearly_equal_double(0, e.determinant())); } +static void test_transpose(skiatest::Reporter* reporter) { + SkMatrix44 a; + SkMatrix44 b; + + int i = 0; + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + a.setDouble(row, col, i); + b.setDouble(col, row, i++); + } + } + + a.transpose(); + REPORTER_ASSERT(reporter, nearly_equal(a, b)); +} + +static void test_get_set_double(skiatest::Reporter* reporter) { + SkMatrix44 a; + for (int row = 0; row < 4; ++row) { + for (int col = 0; col < 4; ++col) { + a.setDouble(row, col, 3.141592653589793); + REPORTER_ASSERT(reporter, nearly_equal_double(3.141592653589793, + a.getDouble(row, col))); + a.setDouble(row, col, 0); + REPORTER_ASSERT(reporter, nearly_equal_double(0, a.getDouble(row, col))); + } + } +} + static void TestMatrix44(skiatest::Reporter* reporter) { #ifdef SK_SCALAR_IS_FLOAT SkMatrix44 mat, inverse, iden1, iden2, rot; @@ -217,6 +246,8 @@ static void TestMatrix44(skiatest::Reporter* reporter) { } test_determinant(reporter); + test_transpose(reporter); + test_get_set_double(reporter); #endif } |