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

Unified Diff: tests/html/rect_test.dart

Issue 12493003: Exposing Point & Rect types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: tests/html/rect_test.dart
diff --git a/tests/html/rect_test.dart b/tests/html/rect_test.dart
index 369b44719497781f7f47638f97cb8c34205a5bcc..4606e989b556237caa3df4d56f3d69e7d28899c1 100644
--- a/tests/html/rect_test.dart
+++ b/tests/html/rect_test.dart
@@ -15,6 +15,17 @@ main() {
return a != null ? new Rect(a[0], a[1], a[2] - a[0], a[3] - a[1]) : null;
}
+ Rect createClientRect(List<num> a) {
+ var element = new DivElement();
+ element.style.left = '${a[0]}px';
+ element.style.top = '${a[1]}px';
+ element.style.width = '${a[2] - a[0]}px';
+ element.style.height = '${a[3] - a[1]}px';
+ element.style.position = 'absolute';
+ document.body.append(element);
+ return element.getBoundingClientRect();
+ }
+
test('construction', () {
var r0 = new Rect(10, 20, 30, 40);
expect(r0.toString(), '(10, 20, 30, 40)');
@@ -42,6 +53,12 @@ main() {
expect(r0.intersection(r1), expected);
expect(r1.intersection(r0), expected);
+
+ var r2 = createClientRect(test[0]);
+ var r3 = createClientRect(test[1]);
+
+ expect(r2.intersection(r3), expected);
+ expect(r3.intersection(r2), expected);
}
});
@@ -71,6 +88,12 @@ main() {
expect(r0.union(r1), expected);
expect(r1.union(r0), expected);
+
+ var r2 = createClientRect(test[0]);
+ var r3 = createClientRect(test[1]);
+
+ expect(r2.union(r3), expected);
+ expect(r3.union(r2), expected);
}
});

Powered by Google App Engine
This is Rietveld 408576698