OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(
SkIntToScalar(-10), | 1154 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(
SkIntToScalar(-10), |
1155
SkIntToScalar(5), | 1155
SkIntToScalar(5), |
1156
SkIntToScalar(5), | 1156
SkIntToScalar(5), |
1157
SkIntToScalar(5)))); | 1157
SkIntToScalar(5)))); |
1158 | 1158 |
1159 // outside the diagonal edge | 1159 // outside the diagonal edge |
1160 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(
SkIntToScalar(10), | 1160 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(
SkIntToScalar(10), |
1161
SkIntToScalar(200), | 1161
SkIntToScalar(200), |
1162
SkIntToScalar(20), | 1162
SkIntToScalar(20), |
1163
SkIntToScalar(5)))); | 1163
SkIntToScalar(5)))); |
| 1164 |
| 1165 // same as above path and first test but with an extra moveTo. |
| 1166 path.reset(); |
| 1167 path.moveTo(100, 100); |
| 1168 path.moveTo(0, 0); |
| 1169 path.lineTo(SkIntToScalar(100), 0); |
| 1170 path.lineTo(0, SkIntToScalar(100)); |
| 1171 |
| 1172 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(S
kIntToScalar(50), 0, |
| 1173 S
kIntToScalar(10), |
| 1174 S
kIntToScalar(10)))); |
| 1175 |
1164 } | 1176 } |
1165 | 1177 |
1166 // Simple isRect test is inline TestPath, below. | 1178 // Simple isRect test is inline TestPath, below. |
1167 // test_isRect provides more extensive testing. | 1179 // test_isRect provides more extensive testing. |
1168 static void test_isRect(skiatest::Reporter* reporter) { | 1180 static void test_isRect(skiatest::Reporter* reporter) { |
1169 // passing tests (all moveTo / lineTo... | 1181 // passing tests (all moveTo / lineTo... |
1170 SkPoint r1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; | 1182 SkPoint r1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; |
1171 SkPoint r2[] = {{1, 0}, {1, 1}, {0, 1}, {0, 0}}; | 1183 SkPoint r2[] = {{1, 0}, {1, 1}, {0, 1}, {0, 0}}; |
1172 SkPoint r3[] = {{1, 1}, {0, 1}, {0, 0}, {1, 0}}; | 1184 SkPoint r3[] = {{1, 1}, {0, 1}, {0, 0}, {1, 0}}; |
1173 SkPoint r4[] = {{0, 1}, {0, 0}, {1, 0}, {1, 1}}; | 1185 SkPoint r4[] = {{0, 1}, {0, 0}, {1, 0}, {1, 1}}; |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 test_addrect_isfinite(reporter); | 2447 test_addrect_isfinite(reporter); |
2436 test_tricky_cubic(); | 2448 test_tricky_cubic(); |
2437 test_clipped_cubic(); | 2449 test_clipped_cubic(); |
2438 test_crbug_170666(); | 2450 test_crbug_170666(); |
2439 test_bad_cubic_crbug229478(); | 2451 test_bad_cubic_crbug229478(); |
2440 test_bad_cubic_crbug234190(); | 2452 test_bad_cubic_crbug234190(); |
2441 } | 2453 } |
2442 | 2454 |
2443 #include "TestClassDef.h" | 2455 #include "TestClassDef.h" |
2444 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) | 2456 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) |
OLD | NEW |