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

Unified Diff: tests/html/svg_2_test.dart

Issue 12095088: "Reverting 17940" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « tests/html/svg_1_test.dart ('k') | tests/html/svg_3_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/svg_2_test.dart
diff --git a/tests/html/svg_2_test.dart b/tests/html/svg_2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b2c4547ad4dae536af53ac46d2f157a4c2139a2f
--- /dev/null
+++ b/tests/html/svg_2_test.dart
@@ -0,0 +1,65 @@
+library SVG2Test;
+import '../../pkg/unittest/lib/unittest.dart';
+import '../../pkg/unittest/lib/html_config.dart';
+import 'dart:html';
+import 'dart:svg' as svg;
+
+// Test that SVG elements explicitly implement the IDL interfaces (is-checks
+// only, see SVGTest3 for behavioural tests).
+
+main() {
+
+ insertTestDiv() {
+ var element = new Element.tag('div');
+ element.innerHtml = r'''
+<svg id='svg1' width='200' height='100'>
+<rect id='rect1' x='10' y='20' width='130' height='40' rx='5'fill='blue'></rect>
+</svg>
+''';
+ document.body.nodes.add(element);
+ return element;
+ }
+
+ useHtmlConfiguration();
+
+ var isElement = predicate((x) => x is Element, 'is an Element');
+ var isSvgElement = predicate((x) => x is svg.SvgElement, 'is a SvgElement');
+ var isSvgSvgElement =
+ predicate((x) => x is svg.SvgSvgElement, 'is a SvgSvgElement');
+ var isNode = predicate((x) => x is Node, 'is a Node');
+ var isSvgTests = predicate((x) => x is svg.Tests, 'is a svg.Tests');
+ var isSvgLangSpace = predicate((x) => x is svg.LangSpace, 'is a svg.LangSpace');
+ var isSvgExternalResourcesRequired =
+ predicate((x) => x is svg.ExternalResourcesRequired,
+ 'is a svg.ExternalResourcesRequired');
+ var isSvgTransformable =
+ predicate((x) => x is svg.Transformable, 'is a svg.Transformable');
+ var isSvgLocatable =
+ predicate((x) => x is svg.Locatable, 'is a svg.Locatable');
+ var isSvgNumber = predicate((x) => x is svg.Number, 'is a svg.Number');
+ var isSvgRect = predicate((x) => x is svg.Rect, 'is a svg.Rect');
+
+ test('rect_isChecks', () {
+ var div = insertTestDiv();
+ var r = document.query('#rect1');
+
+ // Direct inheritance chain
+ expect(r, isSvgElement);
+ expect(r, isElement);
+ expect(r, isNode);
+
+ // Other implemented interfaces.
+ expect(r, isSvgTests);
+ expect(r, isSvgLangSpace);
+ expect(r, isSvgExternalResourcesRequired);
+ expect(r, isSvgTransformable);
+ expect(r, isSvgLocatable);
+
+ // Interfaces not implemented.
+ expect(r, isNot(isSvgNumber));
+ expect(r, isNot(isSvgRect));
+ expect(r, isNot(isSvgSvgElement));
+
+ div.remove();
+ });
+}
« no previous file with comments | « tests/html/svg_1_test.dart ('k') | tests/html/svg_3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698