aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/FillPathTest.cpp3
-rw-r--r--tests/MathTest.cpp12
-rw-r--r--tests/PointTest.cpp4
3 files changed, 12 insertions, 7 deletions
diff --git a/tests/FillPathTest.cpp b/tests/FillPathTest.cpp
index 827185167e..b14f5bca1e 100644
--- a/tests/FillPathTest.cpp
+++ b/tests/FillPathTest.cpp
@@ -39,7 +39,8 @@ static void TestFillPathInverse(skiatest::Reporter* reporter) {
int expected_lines = 5;
clip.set(0, height - expected_lines, width, height);
path.moveTo(0.0, 0.0);
- path.quadTo(width/2, height, width, 0.0);
+ path.quadTo(SkIntToScalar(width/2), SkIntToScalar(height),
+ SkIntToScalar(width), 0.0);
path.close();
path.setFillType(SkPath::kInverseWinding_FillType);
SkScan::FillPath(path, clip, &blitter);
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index fef93cdacb..fe162b114f 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -245,8 +245,8 @@ static float make_zero() {
static void unittest_isfinite(skiatest::Reporter* reporter) {
#ifdef SK_SCALAR_IS_FLOAT
float nan = sk_float_asin(2);
- float inf = 1.0 / make_zero();
- float big = 3.40282e+038;
+ float inf = 1.0f / make_zero();
+ float big = 3.40282e+038f;
REPORTER_ASSERT(reporter, !SkScalarIsNaN(inf));
REPORTER_ASSERT(reporter, !SkScalarIsNaN(-inf));
@@ -416,9 +416,13 @@ static void TestMath(skiatest::Reporter* reporter) {
for (i = 0; i < 10000; i++) {
SkPoint p;
- p.setLength(rand.nextS(), rand.nextS(), SK_Scalar1);
+ // These random values are being treated as 32-bit-patterns, not as
+ // ints; calling SkIntToScalar() here produces crashes.
+ p.setLength(rand.nextS(),
+ rand.nextS(), SK_Scalar1);
check_length(reporter, p, SK_Scalar1);
- p.setLength(rand.nextS() >> 13, rand.nextS() >> 13, SK_Scalar1);
+ p.setLength(rand.nextS() >> 13,
+ rand.nextS() >> 13, SK_Scalar1);
check_length(reporter, p, SK_Scalar1);
}
diff --git a/tests/PointTest.cpp b/tests/PointTest.cpp
index 876a2726b4..db9c803445 100644
--- a/tests/PointTest.cpp
+++ b/tests/PointTest.cpp
@@ -36,10 +36,10 @@ static void test_Normalize(skiatest::Reporter* reporter,
void PointTest(skiatest::Reporter* reporter) {
test_length(reporter, SkIntToScalar(3), SkIntToScalar(4), SkIntToScalar(5));
- test_length(reporter, SkFloatToScalar(0.6), SkFloatToScalar(0.8),
+ test_length(reporter, SkFloatToScalar(0.6f), SkFloatToScalar(0.8f),
SK_Scalar1);
test_Normalize(reporter, SkIntToScalar(3), SkIntToScalar(4));
- test_Normalize(reporter, SkFloatToScalar(0.6), SkFloatToScalar(0.8));
+ test_Normalize(reporter, SkFloatToScalar(0.6f), SkFloatToScalar(0.8f));
}
#include "TestClassDef.h"