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

Unified Diff: tests/RoundRectTest.cpp

Issue 202163004: Revert of Add nine patch type to SkRRect. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/debugger/SkObjectParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RoundRectTest.cpp
diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp
index 0a528a65357f8f83fb4e18036b63841f49bf4a93..9b2eecd19c4a56e75ec15ba2a50cb2693f5fb523 100644
--- a/tests/RoundRectTest.cpp
+++ b/tests/RoundRectTest.cpp
@@ -60,13 +60,6 @@
for (int i = 0; i < 4; ++i) {
REPORTER_ASSERT(reporter, zeroPt == rr1.radii((SkRRect::Corner) i));
}
- SkRRect rr1_2; // construct the same RR using the most general set function
- SkVector rr1_2_radii[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
- rr1_2.setRectRadii(rect, rr1_2_radii);
- REPORTER_ASSERT(reporter, rr1_2 == rr1 && rr1_2.getType() == rr1.getType());
- SkRRect rr1_3; // construct the same RR using the nine patch set function
- rr1_3.setNinePatch(rect, 0, 0, 0, 0);
- REPORTER_ASSERT(reporter, rr1_3 == rr1 && rr1_3.getType() == rr1.getType());
//----
SkPoint halfPoint = { SkScalarHalf(kWidth), SkScalarHalf(kHeight) };
@@ -80,14 +73,6 @@
REPORTER_ASSERT(reporter,
rr2.radii((SkRRect::Corner) i).equalsWithinTolerance(halfPoint));
}
- SkRRect rr2_2; // construct the same RR using the most general set function
- SkVector rr2_2_radii[4] = { { halfPoint.fX, halfPoint.fY }, { halfPoint.fX, halfPoint.fY },
- { halfPoint.fX, halfPoint.fY }, { halfPoint.fX, halfPoint.fY } };
- rr2_2.setRectRadii(rect, rr2_2_radii);
- REPORTER_ASSERT(reporter, rr2_2 == rr2 && rr2_2.getType() == rr2.getType());
- SkRRect rr2_3; // construct the same RR using the nine patch set function
- rr2_3.setNinePatch(rect, halfPoint.fX, halfPoint.fY, halfPoint.fX, halfPoint.fY);
- REPORTER_ASSERT(reporter, rr2_3 == rr2 && rr2_3.getType() == rr2.getType());
//----
SkPoint p = { 5, 5 };
@@ -100,33 +85,19 @@
for (int i = 0; i < 4; ++i) {
REPORTER_ASSERT(reporter, p == rr3.radii((SkRRect::Corner) i));
}
- SkRRect rr3_2; // construct the same RR using the most general set function
- SkVector rr3_2_radii[4] = { { 5, 5 }, { 5, 5 }, { 5, 5 }, { 5, 5 } };
- rr3_2.setRectRadii(rect, rr3_2_radii);
- REPORTER_ASSERT(reporter, rr3_2 == rr3 && rr3_2.getType() == rr3.getType());
- SkRRect rr3_3; // construct the same RR using the nine patch set function
- rr3_3.setNinePatch(rect, 5, 5, 5, 5);
- REPORTER_ASSERT(reporter, rr3_3 == rr3 && rr3_3.getType() == rr3.getType());
-
- //----
- SkRect ninePatchRadii = { 10, 9, 8, 7 };
+
+ //----
+ SkPoint radii[4] = { { 5, 5 }, { 5, 5 }, { 5, 5 }, { 5, 5 } };
SkRRect rr4;
- rr4.setNinePatch(rect, ninePatchRadii.fLeft, ninePatchRadii.fTop, ninePatchRadii.fRight,
- ninePatchRadii.fBottom);
-
- REPORTER_ASSERT(reporter, SkRRect::kNinePatch_Type == rr4.type());
+ rr4.setRectRadii(rect, radii);
+
+ REPORTER_ASSERT(reporter, SkRRect::kSimple_Type == rr4.type());
REPORTER_ASSERT(reporter, rr4.rect() == rect);
- SkPoint rquad[4];
- ninePatchRadii.toQuad(rquad);
- for (int i = 0; i < 4; ++i) {
- REPORTER_ASSERT(reporter, rquad[i] == rr4.radii((SkRRect::Corner) i));
- }
- SkRRect rr4_2; // construct the same RR using the most general set function
- SkVector rr4_2_radii[4] = { { 10, 9 }, { 8, 9 }, {8, 7 }, { 10, 7 } };
- rr4_2.setRectRadii(rect, rr4_2_radii);
- REPORTER_ASSERT(reporter, rr4_2 == rr4 && rr4_2.getType() == rr4.getType());
+ for (int i = 0; i < 4; ++i) {
+ REPORTER_ASSERT(reporter, radii[i] == rr4.radii((SkRRect::Corner) i));
+ }
//----
SkPoint radii2[4] = { { 0, 0 }, { 0, 0 }, { 50, 50 }, { 20, 50 } };
@@ -143,7 +114,7 @@
// Test out == & !=
REPORTER_ASSERT(reporter, empty != rr3);
- REPORTER_ASSERT(reporter, rr3 != rr4);
+ REPORTER_ASSERT(reporter, rr3 == rr4);
REPORTER_ASSERT(reporter, rr4 != rr5);
}
« no previous file with comments | « src/utils/debugger/SkObjectParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698