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

Side by Side Diff: tests/RoundRectTest.cpp

Issue 921163003: fix more tricky-float cases in SkRRect validate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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
« src/core/SkRRect.cpp ('K') | « src/core/SkRRect.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 2012 Google Inc. 2 * Copyright 2012 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 "SkMatrix.h" 8 #include "SkMatrix.h"
9 #include "SkRRect.h" 9 #include "SkRRect.h"
10 #include "Test.h" 10 #include "Test.h"
11 11
12 static void test_tricky_radii_crbug_458522(skiatest::Reporter* reporter) {
13 SkRRect rr;
14 const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
15 const SkScalar rad = 12814;
16 const SkVector vec[] = { { rad, rad }, { 0, rad }, { rad, rad }, { 0, rad } };
17 rr.setRectRadii(bounds, vec);
18 }
19
20 static void test_empty_crbug_458524(skiatest::Reporter* reporter) {
21 SkRRect rr;
22 const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
23 const SkScalar rad = 40;
24 rr.setRectXY(bounds, rad, rad);
25
26 SkRRect other;
27 SkMatrix matrix;
28 matrix.setScale(0, 1);
29 rr.transform(matrix, &other);
30 REPORTER_ASSERT(reporter, SkRRect::kEmpty_Type == other.getType());
31 }
32
12 static const SkScalar kWidth = 100.0f; 33 static const SkScalar kWidth = 100.0f;
13 static const SkScalar kHeight = 100.0f; 34 static const SkScalar kHeight = 100.0f;
14 35
15 static void test_inset(skiatest::Reporter* reporter) { 36 static void test_inset(skiatest::Reporter* reporter) {
16 SkRRect rr, rr2; 37 SkRRect rr, rr2;
17 SkRect r = { 0, 0, 100, 100 }; 38 SkRect r = { 0, 0, 100, 100 };
18 39
19 rr.setRect(r); 40 rr.setRect(r);
20 rr.inset(-20, -20, &rr2); 41 rr.inset(-20, -20, &rr2);
21 REPORTER_ASSERT(reporter, rr2.isRect()); 42 REPORTER_ASSERT(reporter, rr2.isRect());
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 DEF_TEST(RoundRect, reporter) { 635 DEF_TEST(RoundRect, reporter) {
615 test_round_rect_basic(reporter); 636 test_round_rect_basic(reporter);
616 test_round_rect_rects(reporter); 637 test_round_rect_rects(reporter);
617 test_round_rect_ovals(reporter); 638 test_round_rect_ovals(reporter);
618 test_round_rect_general(reporter); 639 test_round_rect_general(reporter);
619 test_round_rect_iffy_parameters(reporter); 640 test_round_rect_iffy_parameters(reporter);
620 test_inset(reporter); 641 test_inset(reporter);
621 test_round_rect_contains_rect(reporter); 642 test_round_rect_contains_rect(reporter);
622 test_round_rect_transform(reporter); 643 test_round_rect_transform(reporter);
623 test_issue_2696(reporter); 644 test_issue_2696(reporter);
645 test_tricky_radii_crbug_458522(reporter);
646 test_empty_crbug_458524(reporter);
624 } 647 }
OLDNEW
« src/core/SkRRect.cpp ('K') | « src/core/SkRRect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698