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

Side by Side Diff: tests/PathTest.cpp

Issue 954453003: Reset conicWeights in SkPath::consumeDegenerateSegments when rewinding to last Move op (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added unit test Created 5 years, 9 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 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 2468
2469 p.moveTo(1, 1); // add a trailing moveto 2469 p.moveTo(1, 1); // add a trailing moveto
2470 iter.setPath(p, false); 2470 iter.setPath(p, false);
2471 iter.next(pts, false); 2471 iter.next(pts, false);
2472 REPORTER_ASSERT(reporter, SkPath::kCubic_Verb == iter.next(pts, false)); 2472 REPORTER_ASSERT(reporter, SkPath::kCubic_Verb == iter.next(pts, false));
2473 iter.setPath(p, false); 2473 iter.setPath(p, false);
2474 iter.next(pts, false); 2474 iter.next(pts, false);
2475 REPORTER_ASSERT(reporter, SkPath::kDone_Verb == iter.next(pts, true)); 2475 REPORTER_ASSERT(reporter, SkPath::kDone_Verb == iter.next(pts, true));
2476 2476
2477 // The GM degeneratesegments.cpp test is more extensive 2477 // The GM degeneratesegments.cpp test is more extensive
2478
2479 // Test out mixed degenerate and non-degenerate geometry with Conics
2480 const SkVector radii[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 100, 100 } };
2481 SkRect r = SkRect::MakeWH(100, 100);
2482 SkRRect rr;
2483 rr.setRectRadii(r, radii);
2484 p.reset();
2485 p.addRRect(rr);
2486 iter.setPath(p, false);
2487 REPORTER_ASSERT(reporter, SkPath::kMove_Verb == iter.next(pts));
2488 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == iter.next(pts));
2489 REPORTER_ASSERT(reporter, SkPath::kLine_Verb == iter.next(pts));
2490 REPORTER_ASSERT(reporter, SkPath::kConic_Verb == iter.next(pts));
robertphillips 2015/02/23 18:53:47 This next line will trigger a valgrind complaint w
2491 REPORTER_ASSERT(reporter, SK_ScalarRoot2Over2 == iter.conicWeight());
2478 } 2492 }
2479 2493
2480 static void test_raw_iter(skiatest::Reporter* reporter) { 2494 static void test_raw_iter(skiatest::Reporter* reporter) {
2481 SkPath p; 2495 SkPath p;
2482 SkPoint pts[4]; 2496 SkPoint pts[4];
2483 2497
2484 // Test an iterator with no path 2498 // Test an iterator with no path
2485 SkPath::RawIter noPathIter; 2499 SkPath::RawIter noPathIter;
2486 REPORTER_ASSERT(reporter, noPathIter.next(pts) == SkPath::kDone_Verb); 2500 REPORTER_ASSERT(reporter, noPathIter.next(pts) == SkPath::kDone_Verb);
2487 // Test that setting an empty path works 2501 // Test that setting an empty path works
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3713 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); 3727 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode);
3714 test_conicTo_special_case(reporter); 3728 test_conicTo_special_case(reporter);
3715 test_get_point(reporter); 3729 test_get_point(reporter);
3716 test_contains(reporter); 3730 test_contains(reporter);
3717 PathTest_Private::TestPathTo(reporter); 3731 PathTest_Private::TestPathTo(reporter);
3718 PathRefTest_Private::TestPathRef(reporter); 3732 PathRefTest_Private::TestPathRef(reporter);
3719 test_dump(reporter); 3733 test_dump(reporter);
3720 test_path_crbugskia2820(reporter); 3734 test_path_crbugskia2820(reporter);
3721 test_skbug_3239(reporter); 3735 test_skbug_3239(reporter);
3722 } 3736 }
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