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

Side by Side Diff: tests/PathTest.cpp

Issue 27513003: add disabled tests, in pref for experimental isRect behavior (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
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 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 path.moveTo(0, 0); 1305 path.moveTo(0, 0);
1306 path.lineTo(SkIntToScalar(100), 0); 1306 path.lineTo(SkIntToScalar(100), 0);
1307 path.lineTo(0, SkIntToScalar(100)); 1307 path.lineTo(0, SkIntToScalar(100));
1308 1308
1309 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(S kIntToScalar(50), 0, 1309 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(S kIntToScalar(50), 0,
1310 S kIntToScalar(10), 1310 S kIntToScalar(10),
1311 S kIntToScalar(10)))); 1311 S kIntToScalar(10))));
1312 1312
1313 } 1313 }
1314 1314
1315 static void test_isRect_open_close(skiatest::Reporter* reporter) {
1316 SkPath path;
1317 bool isClosed;
1318
1319 path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1);
1320
1321 if (false) {
1322 // I think these should pass, but isRect() doesn't behave
1323 // this way... yet
1324 REPORTER_ASSERT(reporter, path.isRect(NULL, NULL));
1325 REPORTER_ASSERT(reporter, path.isRect(&isClosed, NULL));
1326 REPORTER_ASSERT(reporter, !isClosed);
1327 }
1328
1329 path.close();
1330 REPORTER_ASSERT(reporter, path.isRect(NULL, NULL));
1331 REPORTER_ASSERT(reporter, path.isRect(&isClosed, NULL));
1332 REPORTER_ASSERT(reporter, isClosed);
1333 }
1334
1315 // Simple isRect test is inline TestPath, below. 1335 // Simple isRect test is inline TestPath, below.
1316 // test_isRect provides more extensive testing. 1336 // test_isRect provides more extensive testing.
1317 static void test_isRect(skiatest::Reporter* reporter) { 1337 static void test_isRect(skiatest::Reporter* reporter) {
1338 test_isRect_open_close(reporter);
1339
1318 // passing tests (all moveTo / lineTo... 1340 // passing tests (all moveTo / lineTo...
1319 SkPoint r1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}}; 1341 SkPoint r1[] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
1320 SkPoint r2[] = {{1, 0}, {1, 1}, {0, 1}, {0, 0}}; 1342 SkPoint r2[] = {{1, 0}, {1, 1}, {0, 1}, {0, 0}};
1321 SkPoint r3[] = {{1, 1}, {0, 1}, {0, 0}, {1, 0}}; 1343 SkPoint r3[] = {{1, 1}, {0, 1}, {0, 0}, {1, 0}};
1322 SkPoint r4[] = {{0, 1}, {0, 0}, {1, 0}, {1, 1}}; 1344 SkPoint r4[] = {{0, 1}, {0, 0}, {1, 0}, {1, 1}};
1323 SkPoint r5[] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}}; 1345 SkPoint r5[] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
1324 SkPoint r6[] = {{0, 1}, {1, 1}, {1, 0}, {0, 0}}; 1346 SkPoint r6[] = {{0, 1}, {1, 1}, {1, 0}, {0, 0}};
1325 SkPoint r7[] = {{1, 1}, {1, 0}, {0, 0}, {0, 1}}; 1347 SkPoint r7[] = {{1, 1}, {1, 0}, {0, 0}, {0, 1}};
1326 SkPoint r8[] = {{1, 0}, {0, 0}, {0, 1}, {1, 1}}; 1348 SkPoint r8[] = {{1, 0}, {0, 0}, {0, 1}, {1, 1}};
1327 SkPoint r9[] = {{0, 1}, {1, 1}, {1, 0}, {0, 0}}; 1349 SkPoint r9[] = {{0, 1}, {1, 1}, {1, 0}, {0, 0}};
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 test_crbug_170666(); 2619 test_crbug_170666();
2598 test_bad_cubic_crbug229478(); 2620 test_bad_cubic_crbug229478();
2599 test_bad_cubic_crbug234190(); 2621 test_bad_cubic_crbug234190();
2600 test_android_specific_behavior(reporter); 2622 test_android_specific_behavior(reporter);
2601 test_path_close_issue1474(reporter); 2623 test_path_close_issue1474(reporter);
2602 test_path_to_region(reporter); 2624 test_path_to_region(reporter);
2603 } 2625 }
2604 2626
2605 #include "TestClassDef.h" 2627 #include "TestClassDef.h"
2606 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) 2628 DEFINE_TESTCLASS("Path", PathTestClass, TestPath)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698