From: reed@google.com Date: Fri, 9 Nov 2012 21:25:06 +0000 (+0000) Subject: add quick-n-dirty test for concat on matrix44 X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~14340 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80b577eba6bd8ad2065e3bd9113b9bb86c4a5288;p=platform%2Fupstream%2FlibSkiaSharp.git add quick-n-dirty test for concat on matrix44 Review URL: https://codereview.appspot.com/6827069 git-svn-id: http://skia.googlecode.com/svn/trunk@6371 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index 7037877..6e70c5f 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -76,6 +76,44 @@ static void test_common_angles(skiatest::Reporter* reporter) { } } +static void test_concat(skiatest::Reporter* reporter) { + int i; + SkMatrix44 a, b, c, d; + + a.setTranslate(10, 10, 10); + b.setScale(2, 2, 2); + + SkScalar src[8] = { + 0, 0, 0, 1, + 1, 1, 1, 1 + }; + SkScalar dst[8]; + + c.setConcat(a, b); + + d = a; + d.preConcat(b); + REPORTER_ASSERT(reporter, d == c); + + c.map(src, dst); c.map(src + 4, dst + 4); + for (i = 0; i < 3; ++i) { + REPORTER_ASSERT(reporter, 10 == dst[i]); + REPORTER_ASSERT(reporter, 12 == dst[i + 4]); + } + + c.setConcat(b, a); + + d = a; + d.postConcat(b); + REPORTER_ASSERT(reporter, d == c); + + c.map(src, dst); c.map(src + 4, dst + 4); + for (i = 0; i < 3; ++i) { + REPORTER_ASSERT(reporter, 20 == dst[i]); + REPORTER_ASSERT(reporter, 22 == dst[i + 4]); + } +} + static void TestMatrix44(skiatest::Reporter* reporter) { #ifdef SK_SCALAR_IS_FLOAT SkMatrix44 mat, inverse, iden1, iden2, rot; @@ -139,6 +177,8 @@ static void TestMatrix44(skiatest::Reporter* reporter) { 0, 0, 0, 1); } + test_concat(reporter); + if (false) { // avoid bit rot, suppress warning (working on making this pass) test_common_angles(reporter); }