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

Unified Diff: tests/utils/txt_layout_test.dart

Issue 10683009: Adds support for layout tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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/utils/txt_layout_test.dart
diff --git a/tests/utils/txt_layout_test.dart b/tests/utils/txt_layout_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..993232d3895bd267cd3df0c58ef55687b7d84c4a
--- /dev/null
+++ b/tests/utils/txt_layout_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// WebTest=true
+// WebTestOutput=txt_layout_out.txt
+
+/**
+ * Tests the layout test functionality of test.dart: using the WebTestOutput
+ * option above we simply compare the final state of this application against a
+ * text file (with a text representation of the DOM tree).
+ */
+#library("layouttest");
+
+#import('dart:html');
+
+main() {
+ var div1Style = _style('blue', 20, 10, 40, 10);
+ var div2Style = _style('red', 25, 30, 40, 10);
+ var div1 = new Element.html('<div style="$div1Style"></div>');
+ var div2 = new Element.html('<div style="$div2Style"></div>');
+ document.body.elements.add(div1);
+ document.body.elements.add(div2);
+}
+
+_style(String color, int top, int left, int width, int height) {
+ return ('background-color:$color; position:absolute; '
+ 'top:${top}px; left:${left}px; '
+ 'width:${width}px; height:${height}px;');
+}

Powered by Google App Engine
This is Rietveld 408576698