Title: [109874] trunk/LayoutTests
- Revision
- 109874
- Author
- [email protected]
- Date
- 2012-03-06 01:06:35 -0800 (Tue, 06 Mar 2012)
Log Message
CSS3 calc: rewrite margin test to use getComputedStyle
https://bugs.webkit.org/show_bug.cgi?id=80379
Note that parts of this test still fail, due to yet-to-be-landed CSS3 calc()
functionality (see http://wkb.ug/16662)
Reviewed by Kent Tamura.
* css3/calc/margin-expected.txt:
* css3/calc/margin.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (109873 => 109874)
--- trunk/LayoutTests/ChangeLog 2012-03-06 08:48:20 UTC (rev 109873)
+++ trunk/LayoutTests/ChangeLog 2012-03-06 09:06:35 UTC (rev 109874)
@@ -1,3 +1,16 @@
+2012-03-06 Mike Lawther <[email protected]>
+
+ CSS3 calc: rewrite margin test to use getComputedStyle
+ https://bugs.webkit.org/show_bug.cgi?id=80379
+
+ Note that parts of this test still fail, due to yet-to-be-landed CSS3 calc()
+ functionality (see http://wkb.ug/16662)
+
+ Reviewed by Kent Tamura.
+
+ * css3/calc/margin-expected.txt:
+ * css3/calc/margin.html:
+
2012-03-06 Philippe Normand <[email protected]>
REGRESSION (r109461): broke fast/js/function-dot-arguments-and-caller.html on GTK
Modified: trunk/LayoutTests/css3/calc/margin-expected.txt (109873 => 109874)
--- trunk/LayoutTests/css3/calc/margin-expected.txt 2012-03-06 08:48:20 UTC (rev 109873)
+++ trunk/LayoutTests/css3/calc/margin-expected.txt 2012-03-06 09:06:35 UTC (rev 109874)
@@ -1,23 +1,43 @@
-PASS document.getElementById("simple-all").parentNode.offsetWidth is 250
-PASS document.getElementById("simple-all").parentNode.offsetHeight is 170
-PASS document.getElementById("simple-left").parentNode.offsetWidth is 225
-PASS document.getElementById("simple-left").parentNode.offsetHeight is 120
-PASS document.getElementById("simple-right").parentNode.offsetWidth is 225
-PASS document.getElementById("simple-right").parentNode.offsetHeight is 120
-PASS document.getElementById("simple-top").parentNode.offsetWidth is 200
-PASS document.getElementById("simple-top").parentNode.offsetHeight is 145
-PASS document.getElementById("simple-bottom").parentNode.offsetWidth is 200
-PASS document.getElementById("simple-bottom").parentNode.offsetHeight is 145
-FAIL document.getElementById("percent-all").parentNode.offsetWidth should be 250. Was 200.
-FAIL document.getElementById("percent-all").parentNode.offsetHeight should be 170. Was 120.
-FAIL document.getElementById("percent-left").parentNode.offsetWidth should be 225. Was 200.
-PASS document.getElementById("percent-left").parentNode.offsetHeight is 120
-FAIL document.getElementById("percent-right").parentNode.offsetWidth should be 225. Was 200.
-PASS document.getElementById("percent-right").parentNode.offsetHeight is 120
-PASS document.getElementById("percent-top").parentNode.offsetWidth is 200
-FAIL document.getElementById("percent-top").parentNode.offsetHeight should be 145. Was 120.
-PASS document.getElementById("percent-bottom").parentNode.offsetWidth is 200
-FAIL document.getElementById("percent-bottom").parentNode.offsetHeight should be 145. Was 120.
+PASS computedMarginLeft("simple-all") is "25px"
+PASS computedMarginTop("simple-all") is "25px"
+PASS computedMarginRight("simple-all") is "25px"
+PASS computedMarginBottom("simple-all") is "25px"
+PASS computedMarginLeft("simple-left") is "25px"
+PASS computedMarginTop("simple-left") is "0px"
+PASS computedMarginRight("simple-left") is "0px"
+PASS computedMarginBottom("simple-left") is "0px"
+PASS computedMarginLeft("simple-right") is "0px"
+PASS computedMarginTop("simple-right") is "0px"
+PASS computedMarginRight("simple-right") is "25px"
+PASS computedMarginBottom("simple-right") is "0px"
+PASS computedMarginLeft("simple-top") is "0px"
+PASS computedMarginTop("simple-top") is "25px"
+PASS computedMarginRight("simple-top") is "0px"
+PASS computedMarginBottom("simple-top") is "0px"
+PASS computedMarginLeft("simple-bottom") is "0px"
+PASS computedMarginTop("simple-bottom") is "0px"
+PASS computedMarginRight("simple-bottom") is "0px"
+PASS computedMarginBottom("simple-bottom") is "25px"
+FAIL computedMarginLeft("percent-all") should be 25px. Was 0px.
+FAIL computedMarginTop("percent-all") should be 25px. Was 0px.
+FAIL computedMarginRight("percent-all") should be 25px. Was 0px.
+FAIL computedMarginBottom("percent-all") should be 25px. Was 0px.
+FAIL computedMarginLeft("percent-left") should be 25px. Was 0px.
+PASS computedMarginTop("percent-left") is "0px"
+PASS computedMarginRight("percent-left") is "0px"
+PASS computedMarginBottom("percent-left") is "0px"
+PASS computedMarginLeft("percent-right") is "0px"
+PASS computedMarginTop("percent-right") is "0px"
+FAIL computedMarginRight("percent-right") should be 25px. Was 0px.
+PASS computedMarginBottom("percent-right") is "0px"
+PASS computedMarginLeft("percent-top") is "0px"
+FAIL computedMarginTop("percent-top") should be 25px. Was 0px.
+PASS computedMarginRight("percent-top") is "0px"
+PASS computedMarginBottom("percent-top") is "0px"
+PASS computedMarginLeft("percent-bottom") is "0px"
+PASS computedMarginTop("percent-bottom") is "0px"
+PASS computedMarginRight("percent-bottom") is "0px"
+FAIL computedMarginBottom("percent-bottom") should be 25px. Was 0px.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/css3/calc/margin.html (109873 => 109874)
--- trunk/LayoutTests/css3/calc/margin.html 2012-03-06 08:48:20 UTC (rev 109873)
+++ trunk/LayoutTests/css3/calc/margin.html 2012-03-06 09:06:35 UTC (rev 109874)
@@ -16,65 +16,75 @@
</style>
<div id="test-container">
- <div><p id="simple-all">This element should have an overall margin of 25 pixels.</p></div><br/>
- <div><p id="simple-left">This element should have a left margin of 25 pixels.</p></div><br/>
- <div><p id="simple-right">This element should have a right margin of 25 pixels.</p></div><br/>
- <div><p id="simple-top">This element should have a top margin of 25 pixels.</p></div><br/>
- <div><p id="simple-bottom">This element should have a bottom margin of 25 pixels.</p></div><br/>
+ <p id="simple-all">This element should have an overall margin of 25 pixels.</p><br/>
+ <p id="simple-left">This element should have a left margin of 25 pixels.</p><br/>
+ <p id="simple-right">This element should have a right margin of 25 pixels.</p><br/>
+ <p id="simple-top">This element should have a top margin of 25 pixels.</p><br/>
+ <p id="simple-bottom">This element should have a bottom margin of 25 pixels.</p><br/>
<div id="wrapper" style="width: 300px; background-color: cornsilk; display: block;">
- <div><p id="percent-all">This element should have an overall margin of 25 pixels (10% of parent width of 300px minus 5px).</p></div><br/>
- <div><p id="percent-left">This element should have a left margin of 25 pixels (10% of parent width of 300px minus 5px).</p></div><br/>
- <div><p id="percent-right">This element should have a right margin of 25 pixels (10% of parent width of 300px minus 5px).</p></div><br/>
- <div><p id="percent-top">This element should have a top margin of 25 pixels (10% of parent width of 300px minus 5px).</p></div><br/>
- <div><p id="percent-bottom">This element should have a bottom margin of 25 pixels (10% of parent width of 300px minus 5px).</p></div><br/>
+ <p id="percent-all">This element should have an overall margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/>
+ <p id="percent-left">This element should have a left margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/>
+ <p id="percent-right">This element should have a right margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/>
+ <p id="percent-top">This element should have a top margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/>
+ <p id="percent-bottom">This element should have a bottom margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/>
</div>
</div>
<script>
+
+ function computedMarginLeft(id)
+ {
+ return getComputedStyle(document.getElementById(id), null).marginLeft;
+ }
+ function computedMarginRight(id)
+ {
+ return getComputedStyle(document.getElementById(id), null).marginRight;
+ }
+ function computedMarginTop(id)
+ {
+ return getComputedStyle(document.getElementById(id), null).marginTop;
+ }
+ function computedMarginBottom(id)
+ {
+ return getComputedStyle(document.getElementById(id), null).marginBottom;
+ }
+
var innerWidth = 200;
var innerHeight = 120;
- var margin = 25;
+ var margin = "25px";
+ var noMargin = "0px";
var tests = document.getElementsByTagName("p");
for (var i = 0; i < tests.length; ++i) {
- var outerElement = tests[i].parentNode;
- var innerElement = tests[i];
- var width = outerElement.offsetWidth;
- var height = outerElement.offsetHeight;
-
- var expectedWidth = innerWidth;
- var expectedHeight = innerHeight;
-
+ var innerElement = tests[i]
+ var expectedLeft = noMargin;
+ var expectedTop = noMargin;
+ var expectedRight = noMargin;
+ var expectedBottom = noMargin;
switch (innerElement.id.split("-")[1]) {
case "all":
- expectedWidth += 2 * margin;
- expectedHeight += 2 * margin;
+ expectedLeft = margin;
+ expectedTop = margin;
+ expectedRight = margin;
+ expectedBottom = margin;
break;
case "top":
+ expectedTop = margin;
+ break;
case "bottom":
- expectedHeight += margin;
+ expectedBottom = margin;
break;
case "left":
+ expectedLeft = margin;
+ break;
case "right":
- expectedWidth += margin;
+ expectedRight = margin;
break;
}
- shouldEvaluateTo('document.getElementById("' + innerElement.id + '").parentNode.offsetWidth', expectedWidth);
- shouldEvaluateTo('document.getElementById("' + innerElement.id + '").parentNode.offsetHeight', expectedHeight);
-
- var error = [];
- if (width != expectedWidth)
- error.push("expected width " + expectedWidth + ", was " + width);
- if (height != expectedHeight)
- error.push("expected height " + expectedHeight + ", was " + height);
-
- if (error == "") {
- innerElement.style.backgroundColor = "green";
- innerElement.innerHTML += " => PASS";
- } else {
- innerElement.style.backgroundColor = "red";
- innerElement.innerHTML += " => FAIL: " + error.join(", ");
- }
+ shouldBeEqualToString('computedMarginLeft("' + innerElement.id + '")', expectedLeft);
+ shouldBeEqualToString('computedMarginTop("' + innerElement.id + '")', expectedTop);
+ shouldBeEqualToString('computedMarginRight("' + innerElement.id + '")', expectedRight);
+ shouldBeEqualToString('computedMarginBottom("' + innerElement.id + '")', expectedBottom);
}
if (window.layoutTestController) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes