aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SkNxTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/SkNxTest.cpp')
-rw-r--r--tests/SkNxTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp
index e329e17bfa..57e659ea5b 100644
--- a/tests/SkNxTest.cpp
+++ b/tests/SkNxTest.cpp
@@ -237,6 +237,22 @@ DEF_TEST(SkNx_shuffle, r) {
REPORTER_ASSERT(r, f4[3] == 20);
}
+DEF_TEST(SkNx_int_float, r) {
+ Sk4f f(-2.3f, 1.0f, 0.45f, 0.6f);
+
+ Sk4i i = SkNx_cast<int>(f);
+ REPORTER_ASSERT(r, i[0] == -2);
+ REPORTER_ASSERT(r, i[1] == 1);
+ REPORTER_ASSERT(r, i[2] == 0);
+ REPORTER_ASSERT(r, i[3] == 0);
+
+ f = SkNx_cast<float>(i);
+ REPORTER_ASSERT(r, f[0] == -2.0f);
+ REPORTER_ASSERT(r, f[1] == 1.0f);
+ REPORTER_ASSERT(r, f[2] == 0.0f);
+ REPORTER_ASSERT(r, f[3] == 0.0f);
+}
+
#include "SkRandom.h"
DEF_TEST(SkNx_u16_float, r) {