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

Unified Diff: tests/lib/math/rectangle_test.dart

Issue 145973005: Change Rectangle.operator== to compare right/bottom instead of width/height. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/math/rectangle.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/math/rectangle_test.dart
diff --git a/tests/lib/math/rectangle_test.dart b/tests/lib/math/rectangle_test.dart
index 9e1c47957ef650d9c0ae76b2c2aa09286872d95a..96a0ba1068698abacc5c45601e4aded7e565db49 100644
--- a/tests/lib/math/rectangle_test.dart
+++ b/tests/lib/math/rectangle_test.dart
@@ -128,4 +128,36 @@ main() {
var c = new Rectangle(1, 0, 2, 3);
expect(a.hashCode == c.hashCode, isFalse);
});
+
+ { // Edge cases for boundingBox/intersection
+ edgeTest(a, l) {
+ test('edge case $a/$l', () {
+ var r = new Rectangle(a, a, l, l);
+ expect(r.boundingBox(r), r);
+ expect(r.intersection(r), r);
+ });
+ }
+
+ var bignum1 = 0x20000000000000 + 0.0;
+ var bignum2 = 0x20000000000002 + 0.0;
+ var bignum3 = 0x20000000000004 + 0.0;
+ edgeTest(1.0, bignum1);
+ edgeTest(1.0, bignum2);
+ edgeTest(1.0, bignum3);
+ edgeTest(bignum1, 1.0);
+ edgeTest(bignum2, 1.0);
+ edgeTest(bignum3, 1.0);
+ }
+
+ test("equality with different widths", () {
+ var bignum = 0x80000000000008 + 0.0;
+ var r1 = new Rectangle(bignum, bignum, 1.0, 1.0);
+ var r2 = new Rectangle(bignum, bignum, 2.0, 2.0);
+ expect(r1, r2);
+ expect(r1.hashCode, r2.hashCode);
+ expect(r1.right, r2.right);
+ expect(r1.bottom, r2.bottom);
+ expect(r1.width, 1.0);
+ expect(r2.width, 2.0);
+ });
}
« no previous file with comments | « sdk/lib/math/rectangle.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698