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

Unified Diff: LayoutTests/svg/css/script-tests/svg-paint-order.js

Issue 22482004: Add support for the object-fit CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase for landing Created 7 years, 4 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 | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/css/svg-paint-order.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/css/script-tests/svg-paint-order.js
diff --git a/LayoutTests/svg/css/script-tests/svg-paint-order.js b/LayoutTests/svg/css/script-tests/svg-paint-order.js
new file mode 100644
index 0000000000000000000000000000000000000000..6328806f1dbef9467064724a6c0cf2c72a3ffd74
--- /dev/null
+++ b/LayoutTests/svg/css/script-tests/svg-paint-order.js
@@ -0,0 +1,106 @@
+description("Test paint-order.")
+if (internals.runtimeFlags.svgPaintOrderEnabled) {
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+createSVGTestCase();
+
+var text = createSVGElement("text");
+text.setAttribute("id", "text");
+text.setAttribute("x", "100px");
+text.setAttribute("y", "100px");
+rootSVGElement.appendChild(text);
+
+function test(valueString, expectedValue) {
+ // Reset paint-order.
+ text.removeAttribute("style");
+
+ // Run test
+ text.setAttribute("style", "paint-order: " + valueString);
+ shouldBeEqualToString("getComputedStyle(text).paintOrder", expectedValue);
+}
+
+function test_attr(valueString, expectedValue) {
+ // Reset paint-order.
+ text.removeAttribute("paint-order");
+
+ // Run test
+ text.setAttribute("paint-order", valueString);
+ shouldBeEqualToString("getComputedStyle(text).paintOrder", expectedValue);
+}
+
+debug("");
+debug("Test pre-normalized correct variants of 'paint-order'");
+test("fill stroke markers", "fill stroke markers");
+test("fill markers stroke", "fill markers stroke");
+test("stroke fill markers", "stroke fill markers");
+test("stroke markers fill", "stroke markers fill");
+test("markers stroke fill", "markers stroke fill");
+test("markers fill stroke", "markers fill stroke");
+
+debug("");
+debug("Test correct single keyword value of 'paint-order'");
+test("normal", "fill stroke markers");
+test("fill", "fill stroke markers");
+test("stroke", "stroke fill markers");
+test("markers", "markers fill stroke");
+
+debug("");
+debug("Test correct dual keyword values of 'paint-order'");
+test("fill stroke", "fill stroke markers");
+test("fill markers", "fill markers stroke");
+test("stroke fill", "stroke fill markers");
+test("stroke markers", "stroke markers fill");
+test("markers fill", "markers fill stroke");
+test("markers stroke", "markers stroke fill");
+
+debug("");
+debug("Test invalid values of 'paint-order'");
+test("foo", "fill stroke markers");
+test("fill foo", "fill stroke markers");
+test("stroke foo", "fill stroke markers");
+test("markers foo", "fill stroke markers");
+test("normal foo", "fill stroke markers");
+test("fill markers stroke foo", "fill stroke markers");
+
+debug("");
+debug("Test pre-normalized correct variants of 'paint-order' (presentation attribute)");
+test_attr("fill stroke markers", "fill stroke markers");
+test_attr("fill markers stroke", "fill markers stroke");
+test_attr("stroke fill markers", "stroke fill markers");
+test_attr("stroke markers fill", "stroke markers fill");
+test_attr("markers stroke fill", "markers stroke fill");
+test_attr("markers fill stroke", "markers fill stroke");
+
+debug("");
+debug("Test correct single keyword value of 'paint-order' (presentation attribute)");
+test_attr("normal", "fill stroke markers");
+test_attr("fill", "fill stroke markers");
+test_attr("stroke", "stroke fill markers");
+test_attr("markers", "markers fill stroke");
+
+debug("");
+debug("Test correct dual keyword values of 'paint-order' (presentation attribute)");
+test_attr("fill stroke", "fill stroke markers");
+test_attr("fill markers", "fill markers stroke");
+test_attr("stroke fill", "stroke fill markers");
+test_attr("stroke markers", "stroke markers fill");
+test_attr("markers fill", "markers fill stroke");
+test_attr("markers stroke", "markers stroke fill");
+
+debug("");
+debug("Test invalid values of 'paint-order' (presentation attribute)");
+test_attr("foo", "fill stroke markers");
+test_attr("fill foo", "fill stroke markers");
+test_attr("stroke foo", "fill stroke markers");
+test_attr("markers foo", "fill stroke markers");
+test_attr("normal foo", "fill stroke markers");
+test_attr("fill markers stroke foo", "fill stroke markers");
+
+} else {
+debug("paint-order is disabled, skipping test.");
+}
+
+var successfullyParsed = true;
+
+completeTest();
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/svg/css/svg-paint-order.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698