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

Side by Side Diff: tests/PathTest.cpp

Issue 517023003: Add dirty_after_edit to SkPath::moveTo. Add commented out test case that triggers assert. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 6 years, 3 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
« no previous file with comments | « src/core/SkPath.cpp ('k') | 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkParse.h" 10 #include "SkParse.h"
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 SkIntToScalar(5), 1497 SkIntToScalar(5),
1498 SkIntToScalar(5), 1498 SkIntToScalar(5),
1499 SkIntToScalar(5)))); 1499 SkIntToScalar(5))));
1500 1500
1501 // outside the diagonal edge 1501 // outside the diagonal edge
1502 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH( SkIntToScalar(10), 1502 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH( SkIntToScalar(10),
1503 SkIntToScalar(200), 1503 SkIntToScalar(200),
1504 SkIntToScalar(20), 1504 SkIntToScalar(20),
1505 SkIntToScalar(5)))); 1505 SkIntToScalar(5))));
1506 1506
1507 // same as above path and first test but with an extra moveTo. 1507
1508 // Test that multiple move commands do not cause asserts.
1509
1510 // At the time of writing, this would not modify cached convexity. This caus ed an assert while
1511 // checking conservative containment again. http://skbug.com/1460
1512 path.moveTo(SkIntToScalar(100), SkIntToScalar(100));
1513 #if 0
1514 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(S kIntToScalar(50), 0,
1515 S kIntToScalar(10),
1516 S kIntToScalar(10))));
1517 #endif
1518
1519 // Same as above path and first test but with an extra moveTo.
1508 path.reset(); 1520 path.reset();
1509 path.moveTo(100, 100); 1521 path.moveTo(100, 100);
1510 path.moveTo(0, 0); 1522 path.moveTo(0, 0);
1511 path.lineTo(SkIntToScalar(100), 0); 1523 path.lineTo(SkIntToScalar(100), 0);
1512 path.lineTo(0, SkIntToScalar(100)); 1524 path.lineTo(0, SkIntToScalar(100));
1513 1525
1514 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(S kIntToScalar(50), 0, 1526 REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(S kIntToScalar(50), 0,
1515 S kIntToScalar(10), 1527 S kIntToScalar(10),
1516 S kIntToScalar(10)))); 1528 S kIntToScalar(10))));
1517 1529
1530 // Test that multiple move commands do not cause asserts and that the functi on
1531 // is not confused by the multiple moves.
1532 path.reset();
1533 path.moveTo(0, 0);
1534 path.lineTo(SkIntToScalar(100), 0);
1535 path.lineTo(0, SkIntToScalar(100));
1536 path.moveTo(0, SkIntToScalar(200));
1537 path.lineTo(SkIntToScalar(100), SkIntToScalar(200));
1538 path.lineTo(0, SkIntToScalar(300));
1539
1540 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
1541 SkRect::MakeXYWH(SkI ntToScalar(50), 0,
1542 SkI ntToScalar(10),
1543 SkI ntToScalar(10))));
1544
1518 path.reset(); 1545 path.reset();
1519 path.lineTo(100, 100); 1546 path.lineTo(100, 100);
1520 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH( 0, 0, 1, 1))); 1547 REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH( 0, 0, 1, 1)));
1521 } 1548 }
1522 1549
1523 static void test_isRect_open_close(skiatest::Reporter* reporter) { 1550 static void test_isRect_open_close(skiatest::Reporter* reporter) {
1524 SkPath path; 1551 SkPath path;
1525 bool isClosed; 1552 bool isClosed;
1526 1553
1527 path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1); 1554 path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1);
(...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after
3574 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); 3601 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode);
3575 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); 3602 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode);
3576 test_conicTo_special_case(reporter); 3603 test_conicTo_special_case(reporter);
3577 test_get_point(reporter); 3604 test_get_point(reporter);
3578 test_contains(reporter); 3605 test_contains(reporter);
3579 PathTest_Private::TestPathTo(reporter); 3606 PathTest_Private::TestPathTo(reporter);
3580 PathRefTest_Private::TestPathRef(reporter); 3607 PathRefTest_Private::TestPathRef(reporter);
3581 test_dump(reporter); 3608 test_dump(reporter);
3582 test_path_crbugskia2820(reporter); 3609 test_path_crbugskia2820(reporter);
3583 } 3610 }
OLDNEW
« no previous file with comments | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698