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

Side by Side Diff: tests/PathTest.cpp

Issue 1601103006: Add SkPath::isLastContourClosed() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: isClosed -> isLastContourClosed; add braces Created 4 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 "SkGeometry.h" 9 #include "SkGeometry.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 path.reset(); 811 path.reset();
812 path.moveTo(nan, 0); 812 path.moveTo(nan, 0);
813 REPORTER_ASSERT(reporter, !path.isFinite()); 813 REPORTER_ASSERT(reporter, !path.isFinite());
814 } 814 }
815 815
816 static void test_isfinite(skiatest::Reporter* reporter) { 816 static void test_isfinite(skiatest::Reporter* reporter) {
817 test_rect_isfinite(reporter); 817 test_rect_isfinite(reporter);
818 test_path_isfinite(reporter); 818 test_path_isfinite(reporter);
819 } 819 }
820 820
821 static void test_islastcontourclosed(skiatest::Reporter* reporter) {
822 SkPath path;
823 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
824 path.moveTo(0, 0);
825 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
826 path.close();
827 REPORTER_ASSERT(reporter, path.isLastContourClosed());
828 path.lineTo(100, 100);
829 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
830 path.moveTo(200, 200);
831 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
832 path.close();
833 REPORTER_ASSERT(reporter, path.isLastContourClosed());
834 path.moveTo(0, 0);
835 REPORTER_ASSERT(reporter, !path.isLastContourClosed());
836 }
837
821 // assert that we always 838 // assert that we always
822 // start with a moveTo 839 // start with a moveTo
823 // only have 1 moveTo 840 // only have 1 moveTo
824 // only have Lines after that 841 // only have Lines after that
825 // end with a single close 842 // end with a single close
826 // only have (at most) 1 close 843 // only have (at most) 1 close
827 // 844 //
828 static void test_poly(skiatest::Reporter* reporter, const SkPath& path, 845 static void test_poly(skiatest::Reporter* reporter, const SkPath& path,
829 const SkPoint srcPts[], bool expectClose) { 846 const SkPoint srcPts[], bool expectClose) {
830 SkPath::RawIter iter(path); 847 SkPath::RawIter iter(path);
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3998 test_transform(reporter); 4015 test_transform(reporter);
3999 test_bounds(reporter); 4016 test_bounds(reporter);
4000 test_iter(reporter); 4017 test_iter(reporter);
4001 test_raw_iter(reporter); 4018 test_raw_iter(reporter);
4002 test_circle(reporter); 4019 test_circle(reporter);
4003 test_oval(reporter); 4020 test_oval(reporter);
4004 test_strokerec(reporter); 4021 test_strokerec(reporter);
4005 test_addPoly(reporter); 4022 test_addPoly(reporter);
4006 test_isfinite(reporter); 4023 test_isfinite(reporter);
4007 test_isfinite_after_transform(reporter); 4024 test_isfinite_after_transform(reporter);
4025 test_islastcontourclosed(reporter);
4008 test_arb_round_rect_is_convex(reporter); 4026 test_arb_round_rect_is_convex(reporter);
4009 test_arb_zero_rad_round_rect_is_rect(reporter); 4027 test_arb_zero_rad_round_rect_is_rect(reporter);
4010 test_addrect(reporter); 4028 test_addrect(reporter);
4011 test_addrect_isfinite(reporter); 4029 test_addrect_isfinite(reporter);
4012 test_tricky_cubic(); 4030 test_tricky_cubic();
4013 test_clipped_cubic(); 4031 test_clipped_cubic();
4014 test_crbug_170666(); 4032 test_crbug_170666();
4015 test_crbug_493450(reporter); 4033 test_crbug_493450(reporter);
4016 test_crbug_495894(reporter); 4034 test_crbug_495894(reporter);
4017 test_bad_cubic_crbug229478(); 4035 test_bad_cubic_crbug229478();
(...skipping 18 matching lines...) Expand all
4036 PathTest_Private::TestPathTo(reporter); 4054 PathTest_Private::TestPathTo(reporter);
4037 PathRefTest_Private::TestPathRef(reporter); 4055 PathRefTest_Private::TestPathRef(reporter);
4038 PathTest_Private::TestPathrefListeners(reporter); 4056 PathTest_Private::TestPathrefListeners(reporter);
4039 test_dump(reporter); 4057 test_dump(reporter);
4040 test_path_crbug389050(reporter); 4058 test_path_crbug389050(reporter);
4041 test_path_crbugskia2820(reporter); 4059 test_path_crbugskia2820(reporter);
4042 test_skbug_3469(reporter); 4060 test_skbug_3469(reporter);
4043 test_skbug_3239(reporter); 4061 test_skbug_3239(reporter);
4044 test_bounds_crbug_513799(reporter); 4062 test_bounds_crbug_513799(reporter);
4045 } 4063 }
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