diff options
author | reed <reed@google.com> | 2014-10-21 12:33:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-21 12:33:21 -0700 |
commit | 39393e3ac309d4bedbc18bae98d3ebcb762501dd (patch) | |
tree | e8c984efb79c6e08474c0f52e8260597664a59b4 /tests/Matrix44Test.cpp | |
parent | c7f7f467df07be73b22dbee38a59762997eb19bc (diff) |
add round/ceil/etc. for SkMScalar
BUG=skia:
TBR=
Review URL: https://codereview.chromium.org/645793006
Diffstat (limited to 'tests/Matrix44Test.cpp')
-rw-r--r-- | tests/Matrix44Test.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index 75dd5181d4..13ead192b3 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -761,6 +761,21 @@ static void test_preserves_2d_axis_alignment(skiatest::Reporter* reporter) { test(true, reporter, transform); } +// just want to exercise the various converters for MScalar +static void test_toint(skiatest::Reporter* reporter) { + SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); + mat.setScale(3, 3, 3); + + SkMScalar sum = SkMScalarFloor(mat.get(0, 0)) + + SkMScalarRound(mat.get(1, 0)) + + SkMScalarCeil(mat.get(2, 0)); + int isum = SkMScalarFloorToInt(mat.get(0, 1)) + + SkMScalarRoundToInt(mat.get(1, 2)) + + SkMScalarCeilToInt(mat.get(2, 3)); + REPORTER_ASSERT(reporter, sum >= 0); + REPORTER_ASSERT(reporter, isum >= 0); + REPORTER_ASSERT(reporter, static_cast<SkMScalar>(isum) == SkIntToMScalar(isum)); +} DEF_TEST(Matrix44, reporter) { SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor); @@ -869,4 +884,5 @@ DEF_TEST(Matrix44, reporter) { test_3x3_conversion(reporter); test_has_perspective(reporter); test_preserves_2d_axis_alignment(reporter); + test_toint(reporter); } |