Title: [104428] trunk/LayoutTests
Revision
104428
Author
[email protected]
Date
2012-01-08 18:57:57 -0800 (Sun, 08 Jan 2012)

Log Message

border tests for CSS3 calc
https://bugs.webkit.org/show_bug.cgi?id=75815

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.

Reviewed by Adam Barth.

* css3/calc/border-expected.txt: Added.
* css3/calc/border-radius-expected-mismatch.html: Added.
* css3/calc/border-radius.html: Added.
* css3/calc/border.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104427 => 104428)


--- trunk/LayoutTests/ChangeLog	2012-01-09 02:50:32 UTC (rev 104427)
+++ trunk/LayoutTests/ChangeLog	2012-01-09 02:57:57 UTC (rev 104428)
@@ -1,3 +1,20 @@
+2012-01-08  Mike Lawther  <[email protected]>
+
+        border tests for CSS3 calc
+        https://bugs.webkit.org/show_bug.cgi?id=75815
+
+        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.
+
+        Reviewed by Adam Barth.
+
+        * css3/calc/border-expected.txt: Added.
+        * css3/calc/border-radius-expected-mismatch.html: Added.
+        * css3/calc/border-radius.html: Added.
+        * css3/calc/border.html: Added.
+
 2012-01-08  Ryosuke Niwa  <[email protected]>
 
         Add intermittent timeout expectations to media/track/track-cues-cuechange.html and

Added: trunk/LayoutTests/css3/calc/border-expected.txt (0 => 104428)


--- trunk/LayoutTests/css3/calc/border-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/border-expected.txt	2012-01-09 02:57:57 UTC (rev 104428)
@@ -0,0 +1,9 @@
+This element should have an overall border of 25 pixels. => FAIL: wrong width, wrong height
+
+This element should have a left border of 25 pixels. => FAIL: wrong width
+
+This element should have a right border of 25 pixels. => FAIL: wrong width
+
+This element should have a top border of 25 pixels. => FAIL: wrong height
+
+This element should have a bottom border of 25 pixels. => FAIL: wrong height

Added: trunk/LayoutTests/css3/calc/border-radius-expected-mismatch.html (0 => 104428)


--- trunk/LayoutTests/css3/calc/border-radius-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/border-radius-expected-mismatch.html	2012-01-09 02:57:57 UTC (rev 104428)
@@ -0,0 +1,26 @@
+<style>
+div {
+    width:100px;
+    height:100px;
+    border: 2px solid black;
+}
+.control {
+    border-radius:50px;
+}
+.pixels {
+    border-radius:50px;
+}
+.percent {
+    border-radius:50%;
+}
+.both {
+    border-radius:50%;
+}
+</style>
+
+This test should have four circles.
+
+<div class="control"></div>
+<div class="pixels"></div>
+<div class="percent"></div>
+<div class="both"></div>

Added: trunk/LayoutTests/css3/calc/border-radius.html (0 => 104428)


--- trunk/LayoutTests/css3/calc/border-radius.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/border-radius.html	2012-01-09 02:57:57 UTC (rev 104428)
@@ -0,0 +1,26 @@
+<style>
+div {
+    width:100px;
+    height:100px;
+    border: 2px solid black;
+}
+.control {
+    border-radius:50px;    
+}
+.pixels {
+    border-radius:-webkit-calc(50px);
+}
+.percent {
+    border-radius:-webkit-calc(50%);
+}
+.both {
+    border-radius:-webkit-calc(25% + 25px);
+}
+</style>
+
+This test should have four circles.
+
+<div class="control"></div>
+<div class="pixels"></div>
+<div class="percent"></div>
+<div class="both"></div>

Added: trunk/LayoutTests/css3/calc/border.html (0 => 104428)


--- trunk/LayoutTests/css3/calc/border.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/border.html	2012-01-09 02:57:57 UTC (rev 104428)
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML>
+<style>
+p {
+    width:200px; height:120px;
+}
+.simple-all {
+    border: -webkit-calc(13px + 12px) solid;
+}
+
+.simple-left {
+    border-left: -webkit-calc(13px + 12px) solid;
+}
+.simple-right {
+    border-right: -webkit-calc(13px + 12px) solid;
+}
+.simple-top {
+    border-top: -webkit-calc(13px + 12px) solid;
+}
+.simple-bottom {
+    border-bottom: -webkit-calc(13px + 12px) solid;
+}
+</style>
+
+<p class="simple-all">This element should have an overall border of 25 pixels.</p>
+<p class="simple-left">This element should have a left border of 25 pixels.</p>
+<p class="simple-right">This element should have a right border of 25 pixels.</p>
+<p class="simple-top">This element should have a top border of 25 pixels.</p>
+<p class="simple-bottom">This element should have a bottom border of 25 pixels.</p>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var innerWidth = 200;
+var innerHeight = 120;
+var border = 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 * border;
+        expectedHeight += 2 * border;
+        break;
+    case "top":
+    case "bottom":
+        expectedHeight += border;
+        break;
+    case "left":
+    case "right":
+        expectedWidth += border;
+        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

Reply via email to