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

Unified Diff: tests/SkNxTest.cpp

Issue 1312053004: Require Sk4f::toBytes() clamps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test Created 5 years, 4 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/SkNx_sse.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkNxTest.cpp
diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp
index 4005d2518f5684a4b782a097cd01579afb58751b..0e76014d09c37137283d9f089694253b1e412809 100644
--- a/tests/SkNxTest.cpp
+++ b/tests/SkNxTest.cpp
@@ -208,3 +208,12 @@ DEF_TEST(Sk4px_widening, r) {
wideLoHiAlt = wideLo + wideHi;
REPORTER_ASSERT(r, 0 == memcmp(&wideLoHi, &wideLoHiAlt, sizeof(wideLoHi)));
}
+
+DEF_TEST(Sk4f_clamps, r) {
+ uint8_t bytes[4];
+ Sk4f(-2.0f, -0.7f, 255.9f, 256.0f).toBytes(bytes);
+ REPORTER_ASSERT(r, bytes[0] == 0);
+ REPORTER_ASSERT(r, bytes[1] == 0);
+ REPORTER_ASSERT(r, bytes[2] == 255);
+ REPORTER_ASSERT(r, bytes[3] == 255);
Noel Gordon 2015/09/01 12:58:31 Thanks for the clamp test. Perhaps add a +0.7f te
mtklein_C 2015/09/01 13:01:15 Done.
+}
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698