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

Unified Diff: third_party/WebKit/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html

Issue 2362653002: Convert LayoutTests/svg/dom/SVGTransform*.html js-tests.js to testharness.js based tests (Closed)
Patch Set: Align with review comments Created 4 years, 3 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: third_party/WebKit/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html
diff --git a/third_party/WebKit/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html b/third_party/WebKit/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html
index ad93a00cd2247f5722f8c66ea8358ffc369b183c..aaf7439861633cc9a5590f97a423d8f9e5b55661 100644
--- a/third_party/WebKit/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html
+++ b/third_party/WebKit/LayoutTests/svg/dom/SVGTransformList-with-existing-item.html
@@ -1,70 +1,66 @@
<!DOCTYPE HTML>
-<script src="../../resources/js-test.js"></script>
+<title>SVGTransformList, with existing item</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<script src="resources/SVGTransformList-helper.js"></script>
-<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200">
+<svg width="200" height="200">
<circle id="circle1" cx="40" cy="40" r="40" fill="green" transform="scale(2,2)"/>
<circle id="circle2" cx="40" cy="40" r="40" fill="green" transform="scale(2,2)"/>
</svg>
-<script type="text/javascript">
- description("This is a test of more SVGTransformList API parts.");
+<script>
+test(function() {
+ // This is of mutations of a SVGTransformList with an SVGTransform that already exist in a list.
- if (window.testRunner)
- testRunner.dumpAsText();
+ var svg = document.querySelector("svg");
+ var circle1 = document.getElementById("circle1");
+ var circle2 = document.getElementById("circle2");
- var svg = document.getElementById("svg");
- var circle1 = document.getElementById("circle1");
- var circle2 = document.getElementById("circle2");
-
- var translate = svg.createSVGTransform();
- translate.setTranslate(100, 100);
-
- var scale = svg.createSVGTransform();
- scale.setScale(3, 3);
-
- var transformList1 = circle1.transform.baseVal;
- var transformList2 = circle2.transform.baseVal;
-
- debug("Test appendItem with SVGTransform that already exist in a list");
- transformList1.appendItem(translate);
- transformList2.appendItem(translate);
- shouldBe("transformList1.numberOfItems", "2");
- shouldBe("transformList2.numberOfItems", "2");
- shouldBeEqualToString("transformList1.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]");
- shouldBeEqualToString("transformList2.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]");
-
- debug("");
- debug("Test changing SVGTransform value");
- translate.setTranslate(200, 200);
- shouldBeEqualToString("transformList1.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]");
- shouldBeEqualToString("transformList2.getItem(1).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]");
-
- debug("");
- debug("Test insertItemBefore with SVGTransform that already exist in a list");
- transformList1.insertItemBefore(translate,0);
- transformList2.insertItemBefore(translate,0);
- shouldBeEqualToString("transformList1.getItem(0).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]");
- shouldBeEqualToString("transformList2.getItem(0).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]");
- shouldBe("transformList1.numberOfItems", "3");
- shouldBe("transformList2.numberOfItems", "3");
-
- debug("");
- debug("Test replaceItem with SVGTransform that already exist in a list");
- transformList1.replaceItem(scale,2);
- transformList2.replaceItem(scale,2);
- shouldBeEqualToString("transformList1.getItem(2).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
- shouldBeEqualToString("transformList2.getItem(2).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
- shouldBe("transformList1.numberOfItems", "3");
- shouldBe("transformList2.numberOfItems", "3");
-
- debug("");
- debug("Test initialize with SVGTransform that already exist in a list");
- transformList1.initialize(scale);
- transformList2.initialize(scale);
- shouldBeEqualToString("transformList1.getItem(0).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
- shouldBeEqualToString("transformList2.getItem(0).toString()", "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
- shouldBe("transformList1.numberOfItems", "1");
- shouldBe("transformList2.numberOfItems", "1");
+ var translate = svg.createSVGTransform();
+ translate.setTranslate(100, 100);
-</script>
+ var scale = svg.createSVGTransform();
+ scale.setScale(3, 3);
+
+ var transformList1 = circle1.transform.baseVal;
+ var transformList2 = circle2.transform.baseVal;
+
+ // Test appendItem with SVGTransform that already exist in a list.
+ transformList1.appendItem(translate);
+ transformList2.appendItem(translate);
+ assert_equals(transformList1.numberOfItems, 2);
+ assert_equals(transformList2.numberOfItems, 2);
+ assert_equals(transformList1.getItem(1).toString(), "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]");
+ assert_equals(transformList2.getItem(1).toString(), "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]");
+
+ // Test changing SVGTransform value.
+ translate.setTranslate(200, 200);
+ assert_equals(transformList1.getItem(1).toString(), "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]");
+ assert_equals(transformList2.getItem(1).toString(), "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 100.0 100.0]");
+
+ // Test insertItemBefore with SVGTransform that already exist in a list.
+ transformList1.insertItemBefore(translate,0);
+ transformList2.insertItemBefore(translate,0);
+ assert_equals(transformList1.getItem(0).toString(), "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]");
+ assert_equals(transformList2.getItem(0).toString(), "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 200.0 200.0]");
+ assert_equals(transformList1.numberOfItems, 3);
+ assert_equals(transformList2.numberOfItems, 3);
+
+ // Test replaceItem with SVGTransform that already exist in a list.
+ transformList1.replaceItem(scale,2);
+ transformList2.replaceItem(scale,2);
+ assert_equals(transformList1.getItem(2).toString(), "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
+ assert_equals(transformList2.getItem(2).toString(), "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
+ assert_equals(transformList1.numberOfItems, 3);
+ assert_equals(transformList2.numberOfItems, 3);
+
+ // Test initialize with SVGTransform that already exist in a list.
+ transformList1.initialize(scale);
+ transformList2.initialize(scale);
+ assert_equals(transformList1.getItem(0).toString(), "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
+ assert_equals(transformList2.getItem(0).toString(), "type=SVG_TRANSFORM_SCALE matrix=[3.0 0.0 0.0 3.0 0.0 0.0]");
+ assert_equals(transformList1.numberOfItems, 1);
+ assert_equals(transformList2.numberOfItems, 1);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698