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

Unified Diff: tests/PMFloatTest.cpp

Issue 974643002: Test and fix SkPMFloat rounding. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: f Created 5 years, 10 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
« no previous file with comments | « src/opts/SkPMFloat_none.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PMFloatTest.cpp
diff --git a/tests/PMFloatTest.cpp b/tests/PMFloatTest.cpp
index fceeb47fa127538cbcff0f4521b4ed5f65713974..fbd8626cc813bff944449373d12d31d76fee1e24 100644
--- a/tests/PMFloatTest.cpp
+++ b/tests/PMFloatTest.cpp
@@ -11,7 +11,13 @@ DEF_TEST(SkPMFloat, r) {
REPORTER_ASSERT(r, SkScalarNearlyEqual(204.0f, pmf.r()));
REPORTER_ASSERT(r, SkScalarNearlyEqual(153.0f, pmf.g()));
REPORTER_ASSERT(r, SkScalarNearlyEqual( 51.0f, pmf.b()));
+ REPORTER_ASSERT(r, c == pmf.get());
+ // Test rounding. (Don't bother testing .5... we don't care which way it goes.)
+ pmf.setA(254.6f);
+ pmf.setR(204.3f);
+ pmf.setG(153.1f);
+ pmf.setB( 50.8f);
REPORTER_ASSERT(r, c == pmf.get());
// Test clamping.
« no previous file with comments | « src/opts/SkPMFloat_none.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698