Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / css / script-tests / svg-paint-order.js
blobd0f70ed70c64c3dda2f6d880eeeae09582abc408
1 description("Test paint-order.")
3 if (window.testRunner)
4 testRunner.dumpAsText();
5 createSVGTestCase();
7 var text = createSVGElement("text");
8 text.setAttribute("id", "text");
9 text.setAttribute("x", "100px");
10 text.setAttribute("y", "100px");
11 rootSVGElement.appendChild(text);
13 function test(valueString, expectedValue) {
14 // Reset paint-order.
15 text.removeAttribute("style");
17 // Run test
18 text.setAttribute("style", "paint-order: " + valueString);
19 shouldBeEqualToString("getComputedStyle(text).paintOrder", expectedValue);
22 function test_attr(valueString, expectedValue) {
23 // Reset paint-order.
24 text.removeAttribute("paint-order");
26 // Run test
27 text.setAttribute("paint-order", valueString);
28 shouldBeEqualToString("getComputedStyle(text).paintOrder", expectedValue);
31 debug("");
32 debug("Test pre-normalized correct variants of 'paint-order'");
33 test("fill stroke markers", "fill stroke markers");
34 test("fill markers stroke", "fill markers stroke");
35 test("stroke fill markers", "stroke fill markers");
36 test("stroke markers fill", "stroke markers fill");
37 test("markers stroke fill", "markers stroke fill");
38 test("markers fill stroke", "markers fill stroke");
40 debug("");
41 debug("Test correct single keyword value of 'paint-order'");
42 test("normal", "fill stroke markers");
43 test("fill", "fill stroke markers");
44 test("stroke", "stroke fill markers");
45 test("markers", "markers fill stroke");
47 debug("");
48 debug("Test correct dual keyword values of 'paint-order'");
49 test("fill stroke", "fill stroke markers");
50 test("fill markers", "fill markers stroke");
51 test("stroke fill", "stroke fill markers");
52 test("stroke markers", "stroke markers fill");
53 test("markers fill", "markers fill stroke");
54 test("markers stroke", "markers stroke fill");
56 debug("");
57 debug("Test invalid values of 'paint-order'");
58 test("foo", "fill stroke markers");
59 test("fill foo", "fill stroke markers");
60 test("stroke foo", "fill stroke markers");
61 test("markers foo", "fill stroke markers");
62 test("normal foo", "fill stroke markers");
63 test("fill markers stroke foo", "fill stroke markers");
65 debug("");
66 debug("Test pre-normalized correct variants of 'paint-order' (presentation attribute)");
67 test_attr("fill stroke markers", "fill stroke markers");
68 test_attr("fill markers stroke", "fill markers stroke");
69 test_attr("stroke fill markers", "stroke fill markers");
70 test_attr("stroke markers fill", "stroke markers fill");
71 test_attr("markers stroke fill", "markers stroke fill");
72 test_attr("markers fill stroke", "markers fill stroke");
74 debug("");
75 debug("Test correct single keyword value of 'paint-order' (presentation attribute)");
76 test_attr("normal", "fill stroke markers");
77 test_attr("fill", "fill stroke markers");
78 test_attr("stroke", "stroke fill markers");
79 test_attr("markers", "markers fill stroke");
81 debug("");
82 debug("Test correct dual keyword values of 'paint-order' (presentation attribute)");
83 test_attr("fill stroke", "fill stroke markers");
84 test_attr("fill markers", "fill markers stroke");
85 test_attr("stroke fill", "stroke fill markers");
86 test_attr("stroke markers", "stroke markers fill");
87 test_attr("markers fill", "markers fill stroke");
88 test_attr("markers stroke", "markers stroke fill");
90 debug("");
91 debug("Test invalid values of 'paint-order' (presentation attribute)");
92 test_attr("foo", "fill stroke markers");
93 test_attr("fill foo", "fill stroke markers");
94 test_attr("stroke foo", "fill stroke markers");
95 test_attr("markers foo", "fill stroke markers");
96 test_attr("normal foo", "fill stroke markers");
97 test_attr("fill markers stroke foo", "fill stroke markers");
99 var successfullyParsed = true;
101 completeTest();