OLD | NEW |
1 <html xmlns="http://www.w3.org/1999/xhtml"> | 1 <html xmlns="http://www.w3.org/1999/xhtml"> |
2 <head> | 2 <head> |
3 <script>window.enablePixelTesting = true;</script> | 3 <script>window.enablePixelTesting = true;</script> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 <script src="resources/SVGTransformList-helper.js"></script> |
5 </head> | 6 </head> |
6 <body> | 7 <body> |
7 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> | 8 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="200" height="200"> |
8 <circle id="circle1" cx="40" cy="40" r="40" fill="green" transform="scale(2,
2) translate(10 10)"/> | 9 <circle id="circle1" cx="40" cy="40" r="40" fill="green" transform="scale(2,
2) translate(10 10)"/> |
9 </svg> | 10 </svg> |
10 | 11 |
11 <p id="description"></p> | 12 <p id="description"></p> |
12 <div id="console"></div> | 13 <div id="console"></div> |
13 <script type="text/javascript"> | 14 <script type="text/javascript"> |
14 <![CDATA[ | 15 <![CDATA[ |
15 description("This is a test of the simple SVGTransformList API parts."); | 16 description("This is a test of the simple SVGTransformList API parts."); |
16 | 17 |
17 if (window.testRunner) | 18 if (window.testRunner) |
18 testRunner.dumpAsText(); | 19 testRunner.dumpAsText(); |
19 | 20 |
20 function dumpMatrix(matrix) { | |
21 return "[" + matrix.a.toFixed(1) | |
22 + " " + matrix.b.toFixed(1) | |
23 + " " + matrix.c.toFixed(1) | |
24 + " " + matrix.d.toFixed(1) | |
25 + " " + matrix.e.toFixed(1) | |
26 + " " + matrix.f.toFixed(1) | |
27 + "]"; | |
28 } | |
29 | |
30 function dumpTransform(transform) { | |
31 var transformTypes = { | |
32 "0": "SVG_TRANSFORM_UNKNOWN", | |
33 "1": "SVG_TRANSFORM_MATRIX", | |
34 "2": "SVG_TRANSFORM_TRANSLATE", | |
35 "3": "SVG_TRANSFORM_SCALE", | |
36 "4": "SVG_TRANSFORM_ROTATE", | |
37 "5": "SVG_TRANSFORM_SKEWX", | |
38 "6": "SVG_TRANSFORM_SKEWY" | |
39 }; | |
40 | |
41 return "type=" + transformTypes[transform.type] + " matrix=" + dumpMatri
x(transform.matrix); | |
42 } | |
43 | |
44 var svg = document.getElementById("svg"); | 21 var svg = document.getElementById("svg"); |
45 var circle1 = document.getElementById("circle1"); | 22 var circle1 = document.getElementById("circle1"); |
46 | 23 var transformList = circle1.transform.baseVal; |
| 24 |
47 // Spec: The object referenced by animVal will always be distinct from the o
ne referenced by baseVal, even when the attribute is not animated. | 25 // Spec: The object referenced by animVal will always be distinct from the o
ne referenced by baseVal, even when the attribute is not animated. |
48 shouldBeTrue("circle1.transform.baseVal != circle1.transform.animVal"); | 26 shouldBeTrue("circle1.transform.baseVal != circle1.transform.animVal"); |
49 | 27 |
50 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); | 28 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); |
51 shouldBe("circle1.transform.animVal.numberOfItems", "2"); | 29 shouldBe("circle1.transform.animVal.numberOfItems", "2"); |
52 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 30 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
53 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 31 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
54 | 32 |
55 debug(""); | 33 debug(""); |
56 debug("Test uncommon arguments for initialize()"); | 34 debug("Test uncommon arguments for initialize()"); |
57 shouldThrow("circle1.transform.baseVal.initialize(30)"); | 35 shouldThrow("transformList.initialize(30)"); |
58 shouldThrow("circle1.transform.baseVal.initialize('aString')"); | 36 shouldThrow("transformList.initialize('aString')"); |
59 shouldThrow("circle1.transform.baseVal.initialize(circle1)"); | 37 shouldThrow("transformList.initialize(circle1)"); |
60 shouldThrow("circle1.transform.baseVal.initialize(null)"); | 38 shouldThrow("transformList.initialize(null)"); |
61 | 39 |
62 debug(""); | 40 debug(""); |
63 debug("Test uncommon arguments for getItem()"); | 41 debug("Test uncommon arguments for getItem()"); |
64 shouldThrow("circle1.transform.baseVal.getItem(30)"); | 42 shouldThrow("transformList.getItem(30)"); |
65 shouldBe("circle1.transform.baseVal.getItem('aString')", "circle1.transform.
baseVal.getItem(0)"); | 43 shouldBeEqualToString("transformList.getItem('aString').toString()", "type=S
VG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
66 shouldBe("circle1.transform.baseVal.getItem(circle1)", "circle1.transform.ba
seVal.getItem(0)"); | 44 shouldBeEqualToString("transformList.getItem(circle1).toString()", "type=SVG
_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
67 shouldBe("circle1.transform.baseVal.getItem(null)", "circle1.transform.baseV
al.getItem(0)"); | 45 shouldBeEqualToString("transformList.getItem(null).toString()", "type=SVG_TR
ANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
68 | 46 |
69 debug(""); | 47 debug(""); |
70 debug("Test uncommon arguments for insertItemBefore()"); | 48 debug("Test uncommon arguments for insertItemBefore()"); |
71 shouldThrow("circle1.transform.baseVal.insertItemBefore(30)"); | 49 shouldThrow("transformList.insertItemBefore(30)"); |
72 shouldThrow("circle1.transform.baseVal.insertItemBefore('aString')"); | 50 shouldThrow("transformList.insertItemBefore('aString')"); |
73 shouldThrow("circle1.transform.baseVal.insertItemBefore(circle1)"); | 51 shouldThrow("transformList.insertItemBefore(circle1)"); |
74 shouldThrow("circle1.transform.baseVal.insertItemBefore(null)"); | 52 shouldThrow("transformList.insertItemBefore(null)"); |
75 | 53 |
76 shouldBe("circle1.transform.baseVal.insertItemBefore(circle1.transform.baseV
al.getItem(1), 'aString')", "circle1.transform.baseVal.getItem(0)"); | 54 shouldBeEqualToString("transformList.insertItemBefore(transformList.getItem(
1), 'aString').toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.
0 10.0 10.0]"); |
77 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); | 55 shouldBe("transformList.numberOfItems", "3"); |
78 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 56 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
79 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 57 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
80 shouldBeEqualToString("circle1.getAttribute('transform')", "translate(10 10)
scale(2 2)"); | 58 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
| 59 shouldBeEqualToString("circle1.getAttribute('transform')", "translate(10 10)
scale(2 2) translate(10 10)"); |
81 | 60 |
82 shouldBe("circle1.transform.baseVal.insertItemBefore(circle1.transform.baseV
al.getItem(1), circle1)", "circle1.transform.baseVal.getItem(0)"); | 61 shouldBeEqualToString("transformList.insertItemBefore(transformList.getItem(
1), circle1).toString()", "type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0
0.0]"); |
83 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); | 62 shouldBe("transformList.numberOfItems", "4"); |
84 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 63 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
85 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 64 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
86 shouldBeEqualToString("circle1.getAttribute('transform')", "scale(2 2) trans
late(10 10)"); | 65 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
| 66 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
| 67 shouldBeEqualToString("circle1.getAttribute('transform')", "scale(2 2) trans
late(10 10) scale(2 2) translate(10 10)"); |
87 | 68 |
88 shouldBe("circle1.transform.baseVal.insertItemBefore(circle1.transform.baseV
al.getItem(1), null)", "circle1.transform.baseVal.getItem(0)"); | 69 shouldBeEqualToString("transformList.insertItemBefore(transformList.getItem(
1), null).toString()", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.
0 10.0]"); |
89 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); | 70 shouldBe("transformList.numberOfItems", "5"); |
90 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 71 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
91 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 72 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
92 shouldBeEqualToString("circle1.getAttribute('transform')", "translate(10 10)
scale(2 2)"); | 73 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
| 74 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
| 75 shouldBeEqualToString("transformList.getItem(4).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
| 76 shouldBeEqualToString("circle1.getAttribute('transform')", "translate(10 10)
scale(2 2) translate(10 10) scale(2 2) translate(10 10)"); |
93 | 77 |
94 shouldBe("circle1.transform.baseVal.insertItemBefore(circle1.transform.baseV
al.getItem(1), 0)", "circle1.transform.baseVal.getItem(0)"); | 78 shouldBeEqualToString("transformList.insertItemBefore(transformList.getItem(
1), 0).toString()", "type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]")
; |
95 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); | 79 shouldBe("transformList.numberOfItems", "6"); |
96 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 80 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
97 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 81 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
98 shouldBeEqualToString("circle1.getAttribute('transform')", "scale(2 2) trans
late(10 10)"); | 82 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
| 83 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
| 84 shouldBeEqualToString("transformList.getItem(4).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
| 85 shouldBeEqualToString("transformList.getItem(5).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
| 86 shouldBeEqualToString("circle1.getAttribute('transform')", "scale(2 2) trans
late(10 10) scale(2 2) translate(10 10) scale(2 2) translate(10 10)"); |
99 | 87 |
100 shouldThrow("circle1.transform.baseVal.insertItemBefore(30, 0)"); | 88 shouldThrow("transformList.insertItemBefore(30, 0)"); |
101 shouldThrow("circle1.transform.baseVal.insertItemBefore('aString', 0)"); | 89 shouldThrow("transformList.insertItemBefore('aString', 0)"); |
102 shouldThrow("circle1.transform.baseVal.insertItemBefore(circle1, 0)"); | 90 shouldThrow("transformList.insertItemBefore(circle1, 0)"); |
103 shouldThrow("circle1.transform.baseVal.insertItemBefore(null, 0)"); | 91 shouldThrow("transformList.insertItemBefore(null, 0)"); |
104 | 92 |
105 debug(""); | 93 debug(""); |
106 debug("Set transform='rotate(90) scale(2 2) translate(10 10) skewX(45)' for
circle1"); | 94 debug("Set transform='rotate(90) scale(2 2) translate(10 10) skewX(45)' for
circle1"); |
107 shouldBeUndefined("circle1.setAttribute('transform', 'rotate(90) scale(2 2)
translate(10 10) skewX(45)')"); | 95 shouldBeUndefined("circle1.setAttribute('transform', 'rotate(90) scale(2 2)
translate(10 10) skewX(45)')"); |
108 shouldBe("circle1.transform.baseVal.numberOfItems", "4"); | 96 shouldBe("transformList.numberOfItems", "4"); |
109 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); | 97 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); |
110 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 98 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
111 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(2))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 99 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
112 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(3))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 100 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
113 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); | 101 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); |
114 | 102 |
115 debug(""); | 103 debug(""); |
116 debug("Test uncommon arguments for replaceItem()"); | 104 debug("Test uncommon arguments for replaceItem()"); |
117 shouldThrow("circle1.transform.baseVal.replaceItem(30)"); | 105 shouldThrow("transformList.replaceItem(30)"); |
118 shouldThrow("circle1.transform.baseVal.replaceItem('aString')"); | 106 shouldThrow("transformList.replaceItem('aString')"); |
119 shouldThrow("circle1.transform.baseVal.replaceItem(circle1)"); | 107 shouldThrow("transformList.replaceItem(circle1)"); |
120 shouldThrow("circle1.transform.baseVal.replaceItem(null)"); | 108 shouldThrow("transformList.replaceItem(null)"); |
121 shouldThrow("circle1.transform.baseVal.replaceItem(30, 0)"); | 109 shouldThrow("transformList.replaceItem(30, 0)"); |
122 shouldThrow("circle1.transform.baseVal.replaceItem('aString', 0)"); | 110 shouldThrow("transformList.replaceItem('aString', 0)"); |
123 shouldThrow("circle1.transform.baseVal.replaceItem(circle1, 0)"); | 111 shouldThrow("transformList.replaceItem(circle1, 0)"); |
124 shouldThrow("circle1.transform.baseVal.replaceItem(null, 0)"); | 112 shouldThrow("transformList.replaceItem(null, 0)"); |
125 | 113 |
126 debug(""); | 114 debug(""); |
127 debug("Test uncommon values for indexed setter"); | 115 debug("Test uncommon values for indexed setter"); |
128 shouldThrow("circle1.transform.baseVal[0] = 30"); | 116 shouldThrow("transformList[0] = 30"); |
129 shouldThrow("circle1.transform.baseVal[0] = 'aString'"); | 117 shouldThrow("transformList[0] = 'aString'"); |
130 shouldThrow("circle1.transform.baseVal[0] = circle1"); | 118 shouldThrow("transformList[0] = circle1"); |
131 shouldThrow("circle1.transform.baseVal[0] = null"); | 119 shouldThrow("transformList[0] = null"); |
132 | 120 |
133 shouldBe("circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.ge
tItem(0), 0)", "circle1.transform.baseVal.getItem(0)"); | 121 shouldBeEqualToString("transformList.replaceItem(transformList.getItem(0), 0
).toString()", "type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); |
134 shouldBe("circle1.transform.baseVal.numberOfItems", "4"); | 122 shouldBe("transformList.numberOfItems", "4"); |
135 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); | 123 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); |
136 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 124 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
137 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(2))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 125 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
138 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(3))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 126 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
139 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); | 127 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); |
140 | 128 |
141 shouldBe("circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.ge
tItem(0), 'aString')", "circle1.transform.baseVal.getItem(0)"); | 129 shouldBeEqualToString("transformList.replaceItem(transformList.getItem(0), '
aString').toString()", "type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0
.0]"); |
142 shouldBe("circle1.transform.baseVal.numberOfItems", "4"); | 130 shouldBe("transformList.numberOfItems", "4"); |
143 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); | 131 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); |
144 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 132 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
145 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(2))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 133 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
146 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(3))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 134 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
147 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); | 135 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); |
148 | 136 |
149 shouldBe("circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.ge
tItem(0), circle1)", "circle1.transform.baseVal.getItem(0)"); | 137 shouldBeEqualToString("transformList.replaceItem(transformList.getItem(0), c
ircle1).toString()", "type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0
]"); |
150 shouldBe("circle1.transform.baseVal.numberOfItems", "4"); | 138 shouldBe("transformList.numberOfItems", "4"); |
151 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); | 139 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); |
152 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 140 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
153 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(2))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 141 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
154 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(3))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 142 shouldBeEqualToString("transformList.getItem(3).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
155 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); | 143 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); |
156 | 144 |
157 shouldBe("circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.ge
tItem(0), null)", "circle1.transform.baseVal.getItem(0)"); | 145 shouldBeEqualToString("transformList.replaceItem(transformList.getItem(0), n
ull).toString()", "type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]")
; |
158 shouldBe("circle1.transform.baseVal.numberOfItems", "4"); | 146 shouldBe("transformList.numberOfItems", "4"); |
159 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); | 147 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(90) scale
(2 2) translate(10 10) skewX(45)"); |
160 | 148 |
161 debug(""); | 149 debug(""); |
162 debug("Set transform='rotate(90) scale(2 2) translate(10 10) skewX(45)' for
circle1"); | 150 debug("Set transform='rotate(90) scale(2 2) translate(10 10) skewX(45)' for
circle1"); |
163 shouldBeUndefined("circle1.setAttribute('transform', 'rotate(90) scale(2 2)
translate(10 10) skewX(45)')"); | 151 shouldBeUndefined("circle1.setAttribute('transform', 'rotate(90) scale(2 2)
translate(10 10) skewX(45)')"); |
164 | 152 |
165 debug(""); | 153 debug(""); |
166 debug("Test uncommon arguments for removeItem()"); | 154 debug("Test uncommon arguments for removeItem()"); |
167 shouldThrow("circle1.transform.baseVal.removeItem(30)"); | 155 shouldThrow("transformList.removeItem(30)"); |
168 | 156 |
169 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.removeItem(0)
)", "type=SVG_TRANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); | 157 shouldBeEqualToString("transformList.removeItem(0).toString()", "type=SVG_TR
ANSFORM_ROTATE matrix=[0.0 1.0 -1.0 0.0 0.0 0.0]"); |
170 shouldBe("circle1.transform.baseVal.numberOfItems", "3"); | 158 shouldBe("transformList.numberOfItems", "3"); |
171 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 159 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
172 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 160 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
173 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(2))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 161 shouldBeEqualToString("transformList.getItem(2).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
174 shouldBeEqualToString("circle1.getAttribute('transform')", "scale(2 2) trans
late(10 10) skewX(45)"); | 162 shouldBeEqualToString("circle1.getAttribute('transform')", "scale(2 2) trans
late(10 10) skewX(45)"); |
175 | 163 |
176 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.removeItem('a
String'))", "type=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); | 164 shouldBeEqualToString("transformList.removeItem('aString').toString()", "typ
e=SVG_TRANSFORM_SCALE matrix=[2.0 0.0 0.0 2.0 0.0 0.0]"); |
177 shouldBe("circle1.transform.baseVal.numberOfItems", "2"); | 165 shouldBe("transformList.numberOfItems", "2"); |
178 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 166 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
179 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(1))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 167 shouldBeEqualToString("transformList.getItem(1).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
180 shouldBeEqualToString("circle1.getAttribute('transform')", "translate(10 10)
skewX(45)"); | 168 shouldBeEqualToString("circle1.getAttribute('transform')", "translate(10 10)
skewX(45)"); |
181 | 169 |
182 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.removeItem(ci
rcle1))", "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); | 170 shouldBeEqualToString("transformList.removeItem(circle1).toString()", "type=
SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"); |
183 shouldBe("circle1.transform.baseVal.numberOfItems", "1"); | 171 shouldBe("transformList.numberOfItems", "1"); |
184 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); | 172 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_SKEWX matrix=[1.0 0.0 1.0 1.0 0.0 0.0]"); |
185 shouldBeEqualToString("circle1.getAttribute('transform')", "skewX(45)"); | 173 shouldBeEqualToString("circle1.getAttribute('transform')", "skewX(45)"); |
186 | 174 |
187 debug(""); | 175 debug(""); |
188 debug("Test uncommon arguments for appendItem()"); | 176 debug("Test uncommon arguments for appendItem()"); |
189 shouldThrow("circle1.transform.baseVal.appendItem(30)"); | 177 shouldThrow("transformList.appendItem(30)"); |
190 shouldThrow("circle1.transform.baseVal.appendItem('aString')"); | 178 shouldThrow("transformList.appendItem('aString')"); |
191 shouldThrow("circle1.transform.baseVal.appendItem(circle1)"); | 179 shouldThrow("transformList.appendItem(circle1)"); |
192 shouldThrow("circle1.transform.baseVal.appendItem(null)"); | 180 shouldThrow("transformList.appendItem(null)"); |
193 | 181 |
194 debug(""); | 182 debug(""); |
195 debug("Testing animVal clear throws"); | 183 debug("Testing animVal clear throws"); |
196 shouldThrow("circle1.transform.animVal.clear()"); | 184 shouldThrow("circle1.transform.animVal.clear()"); |
197 shouldBeUndefined("circle1.transform.baseVal.clear()"); | 185 shouldBeUndefined("transformList.clear()"); |
198 | 186 |
199 debug(""); | 187 debug(""); |
200 debug("Creating new SVGTransform, with 45 deg rotation about x=50, y=100 and
append it to the transform list"); | 188 debug("Creating new SVGTransform, with 45 deg rotation about x=50, y=100 and
append it to the transform list"); |
201 var transform; | 189 var transform; |
202 shouldBeEqualToString("dumpTransform(transform = svg.createSVGTransform())",
"type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 0.0 0.0]"); | 190 shouldBeEqualToString("(transform = svg.createSVGTransform()).toString()", "
type=SVG_TRANSFORM_MATRIX matrix=[1.0 0.0 0.0 1.0 0.0 0.0]"); |
203 shouldBeUndefined("transform.setRotate(45, 50, 100)"); | 191 shouldBeUndefined("transform.setRotate(45, 50, 100)"); |
204 | 192 |
205 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.appendItem(tr
ansform))", "type=SVG_TRANSFORM_ROTATE matrix=[0.7 0.7 -0.7 0.7 85.4 -6.1]"); | 193 shouldBeEqualToString("transformList.appendItem(transform).toString()", "typ
e=SVG_TRANSFORM_ROTATE matrix=[0.7 0.7 -0.7 0.7 85.4 -6.1]"); |
206 shouldBe("circle1.transform.baseVal.numberOfItems", "1"); | 194 shouldBe("transformList.numberOfItems", "1"); |
207 shouldBeEqualToString("dumpTransform(circle1.transform.baseVal.getItem(0))",
"type=SVG_TRANSFORM_ROTATE matrix=[0.7 0.7 -0.7 0.7 85.4 -6.1]"); | 195 shouldBeEqualToString("transformList.getItem(0).toString()", "type=SVG_TRANS
FORM_ROTATE matrix=[0.7 0.7 -0.7 0.7 85.4 -6.1]"); |
208 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(45 50 100
)"); | 196 shouldBeEqualToString("circle1.getAttribute('transform')", "rotate(45 50 100
)"); |
209 | 197 |
210 ]]> | 198 ]]> |
211 </script> | 199 </script> |
212 </body> | 200 </body> |
213 </html> | 201 </html> |
OLD | NEW |