Title: [104653] trunk/LayoutTests
- Revision
- 104653
- Author
- [email protected]
- Date
- 2012-01-10 17:10:08 -0800 (Tue, 10 Jan 2012)
Log Message
padding test for CSS3 calc
https://bugs.webkit.org/show_bug.cgi?id=76005
Reviewed by Darin Adler.
Tests for future implementation of CSS3 calc() (see http://webkit.org/b/16662)
These tests are expected to 'fail', and will pass once calc() functionality is landed.
For now, they serve to demonstrate that the current code doesn't crash on these tests.
* css3/calc/padding-expected.txt: Added.
* css3/calc/padding.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (104652 => 104653)
--- trunk/LayoutTests/ChangeLog 2012-01-11 01:07:14 UTC (rev 104652)
+++ trunk/LayoutTests/ChangeLog 2012-01-11 01:10:08 UTC (rev 104653)
@@ -1,3 +1,18 @@
+2012-01-10 Mike Lawther <[email protected]>
+
+ padding test for CSS3 calc
+ https://bugs.webkit.org/show_bug.cgi?id=76005
+
+ Reviewed by Darin Adler.
+
+ Tests for future implementation of CSS3 calc() (see http://webkit.org/b/16662)
+
+ These tests are expected to 'fail', and will pass once calc() functionality is landed.
+ For now, they serve to demonstrate that the current code doesn't crash on these tests.
+
+ * css3/calc/padding-expected.txt: Added.
+ * css3/calc/padding.html: Added.
+
2012-01-10 Chris Marrin <[email protected]>
CIFilter version of Sepia Tone filter doesn't match software
Added: trunk/LayoutTests/css3/calc/padding-expected.txt (0 => 104653)
--- trunk/LayoutTests/css3/calc/padding-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/calc/padding-expected.txt 2012-01-11 01:10:08 UTC (rev 104653)
@@ -0,0 +1,19 @@
+This element should have an overall padding of 25 pixels. => FAIL: wrong width, wrong height
+
+This element should have a left padding of 25 pixels. => FAIL: wrong width
+
+This element should have a right padding of 25 pixels. => FAIL: wrong width
+
+This element should have a top padding of 25 pixels. => FAIL: wrong height
+
+This element should have a bottom padding of 25 pixels. => FAIL: wrong height
+
+This element should have an overall padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong width, wrong height
+
+This element should have a left padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong width
+
+This element should have a right padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong width
+
+This element should have a top padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong height
+
+This element should have a bottom padding of 25 pixels (10% of parent width of 300px minus 5px). => FAIL: wrong height
Added: trunk/LayoutTests/css3/calc/padding.html (0 => 104653)
--- trunk/LayoutTests/css3/calc/padding.html (rev 0)
+++ trunk/LayoutTests/css3/calc/padding.html 2012-01-11 01:10:08 UTC (rev 104653)
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<style>
+ p { width:200px; height:120px; }
+ .simple-all { padding: -webkit-calc(13px + 12px); }
+ .simple-left { padding-left: -webkit-calc(13px + 12px); }
+ .simple-right { padding-right: -webkit-calc(13px + 12px); }
+ .simple-top { padding-top: -webkit-calc(13px + 12px); }
+ .simple-bottom { padding-bottom: -webkit-calc(13px + 12px); }
+ .percent-all { padding: -webkit-calc(10% - 5px); }
+ .percent-left { padding-left: -webkit-calc(10% - 5px); }
+ .percent-right { padding-right: -webkit-calc(10% - 5px); }
+ .percent-top { padding-top: -webkit-calc(10% - 5px); }
+ .percent-bottom { padding-bottom: -webkit-calc(10% - 5px); }
+</style>
+
+<p class="simple-all">This element should have an overall padding of 25 pixels.</p>
+<p class="simple-left">This element should have a left padding of 25 pixels.</p>
+<p class="simple-right">This element should have a right padding of 25 pixels.</p>
+<p class="simple-top">This element should have a top padding of 25 pixels.</p>
+<p class="simple-bottom">This element should have a bottom padding of 25 pixels.</p>
+
+<div style="width: 300px; background-color: cornsilk;">
+ <p class="percent-all">This element should have an overall padding of 25 pixels (10% of parent width of 300px minus 5px).</p>
+ <p class="percent-left">This element should have a left padding of 25 pixels (10% of parent width of 300px minus 5px).</p>
+ <p class="percent-right">This element should have a right padding of 25 pixels (10% of parent width of 300px minus 5px).</p>
+ <p class="percent-top">This element should have a top padding of 25 pixels (10% of parent width of 300px minus 5px).</p>
+ <p class="percent-bottom">This element should have a bottom padding of 25 pixels (10% of parent width of 300px minus 5px).</p>
+</div>
+
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var innerWidth = 200;
+ var innerHeight = 120;
+ var padding = 25;
+
+ var tests = document.getElementsByTagName("p");
+ for (var i = 0; i < tests.length; ++i) {
+ var element = tests[i];
+ var width = element.offsetWidth;
+ var height = element.offsetHeight;
+
+ var expectedWidth = innerWidth;
+ var expectedHeight = innerHeight;
+
+ switch (element.className.split("-")[1]) {
+ case "all":
+ expectedWidth += 2 * padding;
+ expectedHeight += 2 * padding;
+ break;
+ case "top":
+ case "bottom":
+ expectedHeight += padding;
+ break;
+ case "left":
+ case "right":
+ expectedWidth += padding;
+ break;
+ }
+
+ var error = [];
+ if (width != expectedWidth)
+ error.push("wrong width");
+ if (height != expectedHeight)
+ error.push("wrong height");
+
+ results = document.getElementById("results");
+ if (error == "") {
+ element.style.backgroundColor = "green";
+ element.innerHTML += " => PASS";
+ } else {
+ element.style.backgroundColor = "red";
+ element.innerHTML += " => FAIL: " + error.join(", ");
+ }
+ }
+</script>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes