Title: [133591] trunk/LayoutTests
Revision
133591
Author
ale...@webkit.org
Date
2012-11-06 05:55:01 -0800 (Tue, 06 Nov 2012)

Log Message

Add an extra test for background-position parsing.
https://bugs.webkit.org/show_bug.cgi?id=101245

Reviewed by Eric Seidel.

This test may overlap some existing tests but they are usually
old tests where the parsing is tested but mixed with the rendering
verification, therefore it is not ideal to add new parsing tests.
This will be useful for the upcoming support of background-position with 4
values as this test will be extended to verify the parsing and later another
test/patch will be added to check/support the rendering.

* fast/backgrounds/background-position-parsing-2-expected.txt: Added.
* fast/backgrounds/background-position-parsing-2.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (133590 => 133591)


--- trunk/LayoutTests/ChangeLog	2012-11-06 13:24:32 UTC (rev 133590)
+++ trunk/LayoutTests/ChangeLog	2012-11-06 13:55:01 UTC (rev 133591)
@@ -1,3 +1,20 @@
+2012-11-06  Alexis Menard  <ale...@webkit.org>
+
+        Add an extra test for background-position parsing.
+        https://bugs.webkit.org/show_bug.cgi?id=101245
+
+        Reviewed by Eric Seidel.
+
+        This test may overlap some existing tests but they are usually
+        old tests where the parsing is tested but mixed with the rendering
+        verification, therefore it is not ideal to add new parsing tests.
+        This will be useful for the upcoming support of background-position with 4
+        values as this test will be extended to verify the parsing and later another
+        test/patch will be added to check/support the rendering.
+
+        * fast/backgrounds/background-position-parsing-2-expected.txt: Added.
+        * fast/backgrounds/background-position-parsing-2.html: Added.
+
 2012-11-06  Keishi Hattori  <kei...@webkit.org>
 
         The "Rect" class in WebCore/Resources/pagepopups/pickerCommon.js should be renamed

Added: trunk/LayoutTests/fast/backgrounds/background-position-parsing-2-expected.txt (0 => 133591)


--- trunk/LayoutTests/fast/backgrounds/background-position-parsing-2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/background-position-parsing-2-expected.txt	2012-11-06 13:55:01 UTC (rev 133591)
@@ -0,0 +1,97 @@
+Test to make sure background-position is parsed correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS style.backgroundPosition is '70% 50%'
+PASS computedStyle.backgroundPosition is '70% 50%'
+PASS style.backgroundPosition is '84px 50%'
+PASS computedStyle.backgroundPosition is '84px 50%'
+PASS style.backgroundPosition is '0% 50%'
+PASS computedStyle.backgroundPosition is '0% 50%'
+PASS style.backgroundPosition is '100% 50%'
+PASS computedStyle.backgroundPosition is '100% 50%'
+PASS style.backgroundPosition is '50% 100%'
+PASS computedStyle.backgroundPosition is '50% 100%'
+PASS style.backgroundPosition is '50% 0%'
+PASS computedStyle.backgroundPosition is '50% 0%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '0% 100%'
+PASS computedStyle.backgroundPosition is '0% 100%'
+PASS style.backgroundPosition is '0% 100%'
+PASS computedStyle.backgroundPosition is '0% 100%'
+PASS style.backgroundPosition is '100% 100%'
+PASS computedStyle.backgroundPosition is '100% 100%'
+PASS style.backgroundPosition is '100% 0%'
+PASS computedStyle.backgroundPosition is '100% 0%'
+PASS style.backgroundPosition is '54px 100%'
+PASS computedStyle.backgroundPosition is '54px 100%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '5% 100%'
+PASS computedStyle.backgroundPosition is '5% 100%'
+PASS style.backgroundPosition is '30pt -20px'
+PASS computedStyle.backgroundPosition is '40px -20px'
+PASS style.backgroundPosition is '100% 50%'
+PASS computedStyle.backgroundPosition is '100% 50%'
+PASS style.backgroundPosition is '100% 0px'
+PASS computedStyle.backgroundPosition is '100% 0px'
+PASS style.backgroundPosition is '100% 50%'
+PASS computedStyle.backgroundPosition is '100% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '0% 50%'
+PASS computedStyle.backgroundPosition is '0% 50%'
+PASS style.backgroundPosition is '-20% 50%'
+PASS computedStyle.backgroundPosition is '-20% 50%'
+PASS style.backgroundPosition is '100% 0%'
+PASS computedStyle.backgroundPosition is '100% 0%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%'
+PASS style.backgroundPosition is '50% 50%, 100% 50%'
+PASS computedStyle.backgroundPosition is '50% 50%, 100% 50%'
+PASS style.backgroundPosition is '50% 0%, 50% 100%'
+PASS computedStyle.backgroundPosition is '50% 0%, 50% 100%'
+PASS style.backgroundPosition is '100% 50%, 5px 100%'
+PASS computedStyle.backgroundPosition is '100% 50%, 5px 100%'
+PASS style.backgroundPosition is '0% 0%, 100% 100%'
+PASS computedStyle.backgroundPosition is '0% 0%, 100% 100%'
+PASS style.backgroundPosition is '0% 0%, 100% 100%'
+PASS computedStyle.backgroundPosition is '0% 0%, 100% 100%'
+PASS style.backgroundPosition is '0% 0%, 100% 100%'
+PASS computedStyle.backgroundPosition is '0% 0%, 100% 100%'
+PASS style.backgroundPosition is '0% 0%, 100% 100%'
+PASS computedStyle.backgroundPosition is '0% 0%, 100% 100%'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/backgrounds/background-position-parsing-2.html (0 => 133591)


--- trunk/LayoutTests/fast/backgrounds/background-position-parsing-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/background-position-parsing-2.html	2012-11-06 13:55:01 UTC (rev 133591)
@@ -0,0 +1,211 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Test to make sure background-position is parsed correctly.")
+
+var testContainer = document.createElement("div");
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<div style="width:500px;height:500px"><div id="test">hello</div></div>';
+
+e = document.getElementById('test');
+style = e.style;
+computedStyle = window.getComputedStyle(e, null);
+
+style.backgroundImage = "url(resources/diamond.png)";
+style.backgroundRepeat = "no-repeat";
+
+// One value.
+style.backgroundPosition = "70%";
+// Second value is assuming to be 'center'
+shouldBe("style.backgroundPosition", "'70% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'70% 50%'");
+
+style.backgroundPosition = "84px";
+shouldBe("style.backgroundPosition", "'84px 50%'");
+shouldBe("computedStyle.backgroundPosition", "'84px 50%'");
+
+style.backgroundPosition = "left";
+shouldBe("style.backgroundPosition", "'0% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 50%'");
+
+style.backgroundPosition = "right";
+shouldBe("style.backgroundPosition", "'100% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 50%'");
+
+style.backgroundPosition = "bottom";
+shouldBe("style.backgroundPosition", "'50% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 100%'");
+
+style.backgroundPosition = "top";
+shouldBe("style.backgroundPosition", "'50% 0%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 0%'");
+
+style.backgroundPosition = "center";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+// Two values.
+style.backgroundPosition = "left bottom";
+shouldBe("style.backgroundPosition", "'0% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 100%'");
+
+style.backgroundPosition = "bottom left";
+shouldBe("style.backgroundPosition", "'0% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 100%'");
+
+style.backgroundPosition = "100% bottom";
+shouldBe("style.backgroundPosition", "'100% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 100%'");
+
+style.backgroundPosition = "100% top";
+shouldBe("style.backgroundPosition", "'100% 0%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 0%'");
+
+style.backgroundPosition = "54px bottom";
+shouldBe("style.backgroundPosition", "'54px 100%'");
+shouldBe("computedStyle.backgroundPosition", "'54px 100%'");
+
+style.backgroundPosition = "center center";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "5% bottom";
+shouldBe("style.backgroundPosition", "'5% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'5% 100%'");
+
+style.backgroundPosition = "30pt -20px";
+shouldBe("style.backgroundPosition", "'30pt -20px'");
+shouldBe("computedStyle.backgroundPosition", "'40px -20px'");
+
+style.backgroundPosition = "right center";
+shouldBe("style.backgroundPosition", "'100% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 50%'");
+
+style.backgroundPosition = "100% 0";
+shouldBe("style.backgroundPosition", "'100% 0px'");
+shouldBe("computedStyle.backgroundPosition", "'100% 0px'");
+
+style.backgroundPosition = "center right";
+shouldBe("style.backgroundPosition", "'100% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 50%'");
+
+style.backgroundPosition = "center 50%";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "center left";
+shouldBe("style.backgroundPosition", "'0% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 50%'");
+
+style.backgroundPosition = "-20% center";
+shouldBe("style.backgroundPosition", "'-20% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'-20% 50%'");
+
+style.backgroundPosition = "top right";
+shouldBe("style.backgroundPosition", "'100% 0%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 0%'");
+
+style.backgroundPosition = "50% center";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+// A bunch of invalid values, no changes expected on the style.
+style.backgroundPosition = "5 right";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "0 right";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "0px right";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "top 108px";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "top 100%";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "60 50%";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "hidden";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "hidden solid";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "bottombottom";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "left left";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "left right";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "top top";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "50% left";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+style.backgroundPosition = "50";
+shouldBe("style.backgroundPosition", "'50% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%'");
+
+// CSS3, new comma separator.
+style.backgroundImage = "url(resources/diamond.png), url(resources/ring.png)";
+style.backgroundRepeat = "no-repeat";
+
+style.backgroundPosition = "50%, 100%";
+shouldBe("style.backgroundPosition", "'50% 50%, 100% 50%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 50%, 100% 50%'");
+
+style.backgroundPosition = "top, bottom";
+shouldBe("style.backgroundPosition", "'50% 0%, 50% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'50% 0%, 50% 100%'");
+
+style.backgroundPosition = "right center, 5px bottom";
+shouldBe("style.backgroundPosition", "'100% 50%, 5px 100%'");
+shouldBe("computedStyle.backgroundPosition", "'100% 50%, 5px 100%'");
+
+style.backgroundPosition = "top left, bottom right";
+shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
+
+// A bunch of invalid CSS3 values, no changes expected on the style.
+style.backgroundPosition = "0 center, right right";
+shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
+
+style.backgroundPosition = "center right, right right";
+shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
+
+style.backgroundPosition = "center 20px, solid 20px";
+shouldBe("style.backgroundPosition", "'0% 0%, 100% 100%'");
+shouldBe("computedStyle.backgroundPosition", "'0% 0%, 100% 100%'");
+
+document.body.removeChild(testContainer);
+</script>
+<script src=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to