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

Unified Diff: tests/Matrix44Test.cpp

Issue 645793006: add round/ceil/etc. for SkMScalar (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« include/core/SkFloatingPoint.h ('K') | « include/utils/SkMatrix44.h ('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 75dd5181d4c6df0767fdc0e38ac2cd7c66d84175..c22af31304b2bb2e1cd0a5cae1143e1624314a19 100644
--- a/tests/Matrix44Test.cpp
+++ b/tests/Matrix44Test.cpp
@@ -761,6 +761,20 @@ static void test_preserves_2d_axis_alignment(skiatest::Reporter* reporter) {
test(true, reporter, transform);
}
+// just want to exercise the various converters for MScalar
Peter Kasting 2014/10/21 18:56:09 Nit: Capitalization, period
reed1 2014/10/21 19:10:40 Acknowledged.
+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));
Peter Kasting 2014/10/21 18:56:09 Nit: This formatting is not really standard...
reed1 2014/10/21 19:10:41 ack. shooting for readability that we covered the
+ REPORTER_ASSERT(reporter, sum >= 0);
+ REPORTER_ASSERT(reporter, isum >= 0);
+}
DEF_TEST(Matrix44, reporter) {
SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
@@ -869,4 +883,5 @@ DEF_TEST(Matrix44, reporter) {
test_3x3_conversion(reporter);
test_has_perspective(reporter);
test_preserves_2d_axis_alignment(reporter);
+ test_toint(reporter);
}
« include/core/SkFloatingPoint.h ('K') | « include/utils/SkMatrix44.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698