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

Side by Side Diff: tests/PathTest.cpp

Issue 834483002: Fix bound returned by SkPath::isRect when the path contains a trailing moveTo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 3694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3705 REPORTER_ASSERT(reporter, p.isRect(NULL)); 3705 REPORTER_ASSERT(reporter, p.isRect(NULL));
3706 bounds2.setEmpty(); 3706 bounds2.setEmpty();
3707 REPORTER_ASSERT(reporter, p.isRect(&bounds2)); 3707 REPORTER_ASSERT(reporter, p.isRect(&bounds2));
3708 REPORTER_ASSERT(reporter, bounds == bounds2); 3708 REPORTER_ASSERT(reporter, bounds == bounds2);
3709 3709
3710 // now force p to not be a rect 3710 // now force p to not be a rect
3711 bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2); 3711 bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2);
3712 p.addRect(bounds); 3712 p.addRect(bounds);
3713 REPORTER_ASSERT(reporter, !p.isRect(NULL)); 3713 REPORTER_ASSERT(reporter, !p.isRect(NULL));
3714 3714
3715 // Test an edge case w.r.t. the bound returned by isRect (i.e., the
3716 // path has a trailing moveTo. Please see crbug.com\445368)
3717 {
3718 SkRect r;
3719 p.reset();
3720 p.addRect(bounds);
3721 REPORTER_ASSERT(reporter, p.isRect(&r));
3722 REPORTER_ASSERT(reporter, r == bounds);
3723 // add a moveTo outside of our bounds
3724 p.moveTo(bounds.fLeft + 10, bounds.fBottom + 10);
3725 REPORTER_ASSERT(reporter, p.isRect(&r));
3726 REPORTER_ASSERT(reporter, r == bounds);
3727 }
3728
3715 test_operatorEqual(reporter); 3729 test_operatorEqual(reporter);
3716 test_isLine(reporter); 3730 test_isLine(reporter);
3717 test_isRect(reporter); 3731 test_isRect(reporter);
3718 test_isNestedRects(reporter); 3732 test_isNestedRects(reporter);
3719 test_zero_length_paths(reporter); 3733 test_zero_length_paths(reporter);
3720 test_direction(reporter); 3734 test_direction(reporter);
3721 test_convexity(reporter); 3735 test_convexity(reporter);
3722 test_convexity2(reporter); 3736 test_convexity2(reporter);
3723 test_conservativelyContains(reporter); 3737 test_conservativelyContains(reporter);
3724 test_close(reporter); 3738 test_close(reporter);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3760 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); 3774 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode);
3761 test_conicTo_special_case(reporter); 3775 test_conicTo_special_case(reporter);
3762 test_get_point(reporter); 3776 test_get_point(reporter);
3763 test_contains(reporter); 3777 test_contains(reporter);
3764 PathTest_Private::TestPathTo(reporter); 3778 PathTest_Private::TestPathTo(reporter);
3765 PathRefTest_Private::TestPathRef(reporter); 3779 PathRefTest_Private::TestPathRef(reporter);
3766 test_dump(reporter); 3780 test_dump(reporter);
3767 test_path_crbugskia2820(reporter); 3781 test_path_crbugskia2820(reporter);
3768 test_skbug_3239(reporter); 3782 test_skbug_3239(reporter);
3769 } 3783 }
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