OLD | NEW |
(Empty) | |
| 1 description("Test paint-order.") |
| 2 if (internals.runtimeFlags.svgPaintOrderEnabled) { |
| 3 |
| 4 if (window.testRunner) |
| 5 testRunner.dumpAsText(); |
| 6 createSVGTestCase(); |
| 7 |
| 8 var text = createSVGElement("text"); |
| 9 text.setAttribute("id", "text"); |
| 10 text.setAttribute("x", "100px"); |
| 11 text.setAttribute("y", "100px"); |
| 12 rootSVGElement.appendChild(text); |
| 13 |
| 14 function test(valueString, expectedValue) { |
| 15 // Reset paint-order. |
| 16 text.removeAttribute("style"); |
| 17 |
| 18 // Run test |
| 19 text.setAttribute("style", "paint-order: " + valueString); |
| 20 shouldBeEqualToString("getComputedStyle(text).paintOrder", expectedValue); |
| 21 } |
| 22 |
| 23 function test_attr(valueString, expectedValue) { |
| 24 // Reset paint-order. |
| 25 text.removeAttribute("paint-order"); |
| 26 |
| 27 // Run test |
| 28 text.setAttribute("paint-order", valueString); |
| 29 shouldBeEqualToString("getComputedStyle(text).paintOrder", expectedValue); |
| 30 } |
| 31 |
| 32 debug(""); |
| 33 debug("Test pre-normalized correct variants of 'paint-order'"); |
| 34 test("fill stroke markers", "fill stroke markers"); |
| 35 test("fill markers stroke", "fill markers stroke"); |
| 36 test("stroke fill markers", "stroke fill markers"); |
| 37 test("stroke markers fill", "stroke markers fill"); |
| 38 test("markers stroke fill", "markers stroke fill"); |
| 39 test("markers fill stroke", "markers fill stroke"); |
| 40 |
| 41 debug(""); |
| 42 debug("Test correct single keyword value of 'paint-order'"); |
| 43 test("normal", "fill stroke markers"); |
| 44 test("fill", "fill stroke markers"); |
| 45 test("stroke", "stroke fill markers"); |
| 46 test("markers", "markers fill stroke"); |
| 47 |
| 48 debug(""); |
| 49 debug("Test correct dual keyword values of 'paint-order'"); |
| 50 test("fill stroke", "fill stroke markers"); |
| 51 test("fill markers", "fill markers stroke"); |
| 52 test("stroke fill", "stroke fill markers"); |
| 53 test("stroke markers", "stroke markers fill"); |
| 54 test("markers fill", "markers fill stroke"); |
| 55 test("markers stroke", "markers stroke fill"); |
| 56 |
| 57 debug(""); |
| 58 debug("Test invalid values of 'paint-order'"); |
| 59 test("foo", "fill stroke markers"); |
| 60 test("fill foo", "fill stroke markers"); |
| 61 test("stroke foo", "fill stroke markers"); |
| 62 test("markers foo", "fill stroke markers"); |
| 63 test("normal foo", "fill stroke markers"); |
| 64 test("fill markers stroke foo", "fill stroke markers"); |
| 65 |
| 66 debug(""); |
| 67 debug("Test pre-normalized correct variants of 'paint-order' (presentation attri
bute)"); |
| 68 test_attr("fill stroke markers", "fill stroke markers"); |
| 69 test_attr("fill markers stroke", "fill markers stroke"); |
| 70 test_attr("stroke fill markers", "stroke fill markers"); |
| 71 test_attr("stroke markers fill", "stroke markers fill"); |
| 72 test_attr("markers stroke fill", "markers stroke fill"); |
| 73 test_attr("markers fill stroke", "markers fill stroke"); |
| 74 |
| 75 debug(""); |
| 76 debug("Test correct single keyword value of 'paint-order' (presentation attribut
e)"); |
| 77 test_attr("normal", "fill stroke markers"); |
| 78 test_attr("fill", "fill stroke markers"); |
| 79 test_attr("stroke", "stroke fill markers"); |
| 80 test_attr("markers", "markers fill stroke"); |
| 81 |
| 82 debug(""); |
| 83 debug("Test correct dual keyword values of 'paint-order' (presentation attribute
)"); |
| 84 test_attr("fill stroke", "fill stroke markers"); |
| 85 test_attr("fill markers", "fill markers stroke"); |
| 86 test_attr("stroke fill", "stroke fill markers"); |
| 87 test_attr("stroke markers", "stroke markers fill"); |
| 88 test_attr("markers fill", "markers fill stroke"); |
| 89 test_attr("markers stroke", "markers stroke fill"); |
| 90 |
| 91 debug(""); |
| 92 debug("Test invalid values of 'paint-order' (presentation attribute)"); |
| 93 test_attr("foo", "fill stroke markers"); |
| 94 test_attr("fill foo", "fill stroke markers"); |
| 95 test_attr("stroke foo", "fill stroke markers"); |
| 96 test_attr("markers foo", "fill stroke markers"); |
| 97 test_attr("normal foo", "fill stroke markers"); |
| 98 test_attr("fill markers stroke foo", "fill stroke markers"); |
| 99 |
| 100 } else { |
| 101 debug("paint-order is disabled, skipping test."); |
| 102 } |
| 103 |
| 104 var successfullyParsed = true; |
| 105 |
| 106 completeTest(); |
OLD | NEW |