Changeset 109874 in webkit
- Timestamp:
- Mar 6, 2012 1:06:35 AM (12 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109873 r109874 1 2012-03-06 Mike Lawther <mikelawther@chromium.org> 2 3 CSS3 calc: rewrite margin test to use getComputedStyle 4 https://bugs.webkit.org/show_bug.cgi?id=80379 5 6 Note that parts of this test still fail, due to yet-to-be-landed CSS3 calc() 7 functionality (see http://wkb.ug/16662) 8 9 Reviewed by Kent Tamura. 10 11 * css3/calc/margin-expected.txt: 12 * css3/calc/margin.html: 13 1 14 2012-03-06 Philippe Normand <pnormand@igalia.com> 2 15 -
trunk/LayoutTests/css3/calc/margin-expected.txt
r107688 r109874 1 PASS document.getElementById("simple-all").parentNode.offsetWidth is 250 2 PASS document.getElementById("simple-all").parentNode.offsetHeight is 170 3 PASS document.getElementById("simple-left").parentNode.offsetWidth is 225 4 PASS document.getElementById("simple-left").parentNode.offsetHeight is 120 5 PASS document.getElementById("simple-right").parentNode.offsetWidth is 225 6 PASS document.getElementById("simple-right").parentNode.offsetHeight is 120 7 PASS document.getElementById("simple-top").parentNode.offsetWidth is 200 8 PASS document.getElementById("simple-top").parentNode.offsetHeight is 145 9 PASS document.getElementById("simple-bottom").parentNode.offsetWidth is 200 10 PASS document.getElementById("simple-bottom").parentNode.offsetHeight is 145 11 FAIL document.getElementById("percent-all").parentNode.offsetWidth should be 250. Was 200. 12 FAIL document.getElementById("percent-all").parentNode.offsetHeight should be 170. Was 120. 13 FAIL document.getElementById("percent-left").parentNode.offsetWidth should be 225. Was 200. 14 PASS document.getElementById("percent-left").parentNode.offsetHeight is 120 15 FAIL document.getElementById("percent-right").parentNode.offsetWidth should be 225. Was 200. 16 PASS document.getElementById("percent-right").parentNode.offsetHeight is 120 17 PASS document.getElementById("percent-top").parentNode.offsetWidth is 200 18 FAIL document.getElementById("percent-top").parentNode.offsetHeight should be 145. Was 120. 19 PASS document.getElementById("percent-bottom").parentNode.offsetWidth is 200 20 FAIL document.getElementById("percent-bottom").parentNode.offsetHeight should be 145. Was 120. 1 PASS computedMarginLeft("simple-all") is "25px" 2 PASS computedMarginTop("simple-all") is "25px" 3 PASS computedMarginRight("simple-all") is "25px" 4 PASS computedMarginBottom("simple-all") is "25px" 5 PASS computedMarginLeft("simple-left") is "25px" 6 PASS computedMarginTop("simple-left") is "0px" 7 PASS computedMarginRight("simple-left") is "0px" 8 PASS computedMarginBottom("simple-left") is "0px" 9 PASS computedMarginLeft("simple-right") is "0px" 10 PASS computedMarginTop("simple-right") is "0px" 11 PASS computedMarginRight("simple-right") is "25px" 12 PASS computedMarginBottom("simple-right") is "0px" 13 PASS computedMarginLeft("simple-top") is "0px" 14 PASS computedMarginTop("simple-top") is "25px" 15 PASS computedMarginRight("simple-top") is "0px" 16 PASS computedMarginBottom("simple-top") is "0px" 17 PASS computedMarginLeft("simple-bottom") is "0px" 18 PASS computedMarginTop("simple-bottom") is "0px" 19 PASS computedMarginRight("simple-bottom") is "0px" 20 PASS computedMarginBottom("simple-bottom") is "25px" 21 FAIL computedMarginLeft("percent-all") should be 25px. Was 0px. 22 FAIL computedMarginTop("percent-all") should be 25px. Was 0px. 23 FAIL computedMarginRight("percent-all") should be 25px. Was 0px. 24 FAIL computedMarginBottom("percent-all") should be 25px. Was 0px. 25 FAIL computedMarginLeft("percent-left") should be 25px. Was 0px. 26 PASS computedMarginTop("percent-left") is "0px" 27 PASS computedMarginRight("percent-left") is "0px" 28 PASS computedMarginBottom("percent-left") is "0px" 29 PASS computedMarginLeft("percent-right") is "0px" 30 PASS computedMarginTop("percent-right") is "0px" 31 FAIL computedMarginRight("percent-right") should be 25px. Was 0px. 32 PASS computedMarginBottom("percent-right") is "0px" 33 PASS computedMarginLeft("percent-top") is "0px" 34 FAIL computedMarginTop("percent-top") should be 25px. Was 0px. 35 PASS computedMarginRight("percent-top") is "0px" 36 PASS computedMarginBottom("percent-top") is "0px" 37 PASS computedMarginLeft("percent-bottom") is "0px" 38 PASS computedMarginTop("percent-bottom") is "0px" 39 PASS computedMarginRight("percent-bottom") is "0px" 40 FAIL computedMarginBottom("percent-bottom") should be 25px. Was 0px. 21 41 PASS successfullyParsed is true 22 42 -
trunk/LayoutTests/css3/calc/margin.html
r104783 r109874 17 17 18 18 <div id="test-container"> 19 < div><p id="simple-all">This element should have an overall margin of 25 pixels.</p></div><br/>20 < div><p id="simple-left">This element should have a left margin of 25 pixels.</p></div><br/>21 < div><p id="simple-right">This element should have a right margin of 25 pixels.</p></div><br/>22 < div><p id="simple-top">This element should have a top margin of 25 pixels.</p></div><br/>23 < div><p id="simple-bottom">This element should have a bottom margin of 25 pixels.</p></div><br/>19 <p id="simple-all">This element should have an overall margin of 25 pixels.</p><br/> 20 <p id="simple-left">This element should have a left margin of 25 pixels.</p><br/> 21 <p id="simple-right">This element should have a right margin of 25 pixels.</p><br/> 22 <p id="simple-top">This element should have a top margin of 25 pixels.</p><br/> 23 <p id="simple-bottom">This element should have a bottom margin of 25 pixels.</p><br/> 24 24 <div id="wrapper" style="width: 300px; background-color: cornsilk; display: block;"> 25 < 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/>26 < 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/>27 < 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/>28 < 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/>29 < 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/>25 <p id="percent-all">This element should have an overall margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/> 26 <p id="percent-left">This element should have a left margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/> 27 <p id="percent-right">This element should have a right margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/> 28 <p id="percent-top">This element should have a top margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/> 29 <p id="percent-bottom">This element should have a bottom margin of 25 pixels (10% of parent width of 300px minus 5px).</p><br/> 30 30 </div> 31 31 </div> 32 32 <script> 33 34 function computedMarginLeft(id) 35 { 36 return getComputedStyle(document.getElementById(id), null).marginLeft; 37 } 38 function computedMarginRight(id) 39 { 40 return getComputedStyle(document.getElementById(id), null).marginRight; 41 } 42 function computedMarginTop(id) 43 { 44 return getComputedStyle(document.getElementById(id), null).marginTop; 45 } 46 function computedMarginBottom(id) 47 { 48 return getComputedStyle(document.getElementById(id), null).marginBottom; 49 } 50 33 51 var innerWidth = 200; 34 52 var innerHeight = 120; 35 var margin = 25; 53 var margin = "25px"; 54 var noMargin = "0px"; 36 55 37 56 var tests = document.getElementsByTagName("p"); 38 57 for (var i = 0; i < tests.length; ++i) { 39 var outerElement = tests[i].parentNode; 40 var innerElement = tests[i]; 41 var width = outerElement.offsetWidth; 42 var height = outerElement.offsetHeight; 43 44 var expectedWidth = innerWidth; 45 var expectedHeight = innerHeight; 46 58 var innerElement = tests[i] 59 var expectedLeft = noMargin; 60 var expectedTop = noMargin; 61 var expectedRight = noMargin; 62 var expectedBottom = noMargin; 47 63 switch (innerElement.id.split("-")[1]) { 48 64 case "all": 49 expectedWidth += 2 * margin; 50 expectedHeight += 2 * margin; 65 expectedLeft = margin; 66 expectedTop = margin; 67 expectedRight = margin; 68 expectedBottom = margin; 51 69 break; 52 70 case "top": 71 expectedTop = margin; 72 break; 53 73 case "bottom": 54 expected Height += margin;74 expectedBottom = margin; 55 75 break; 56 76 case "left": 77 expectedLeft = margin; 78 break; 57 79 case "right": 58 expected Width += margin;80 expectedRight = margin; 59 81 break; 60 82 } 61 83 62 shouldEvaluateTo('document.getElementById("' + innerElement.id + '").parentNode.offsetWidth', expectedWidth); 63 shouldEvaluateTo('document.getElementById("' + innerElement.id + '").parentNode.offsetHeight', expectedHeight); 64 65 var error = []; 66 if (width != expectedWidth) 67 error.push("expected width " + expectedWidth + ", was " + width); 68 if (height != expectedHeight) 69 error.push("expected height " + expectedHeight + ", was " + height); 70 71 if (error == "") { 72 innerElement.style.backgroundColor = "green"; 73 innerElement.innerHTML += " => PASS"; 74 } else { 75 innerElement.style.backgroundColor = "red"; 76 innerElement.innerHTML += " => FAIL: " + error.join(", "); 77 } 84 shouldBeEqualToString('computedMarginLeft("' + innerElement.id + '")', expectedLeft); 85 shouldBeEqualToString('computedMarginTop("' + innerElement.id + '")', expectedTop); 86 shouldBeEqualToString('computedMarginRight("' + innerElement.id + '")', expectedRight); 87 shouldBeEqualToString('computedMarginBottom("' + innerElement.id + '")', expectedBottom); 78 88 } 79 89
Note: See TracChangeset
for help on using the changeset viewer.