- Revision
- 104432
- Author
- [email protected]
- Date
- 2012-01-08 22:56:18 -0800 (Sun, 08 Jan 2012)
Log Message
color tests for CSS3 calc
https://bugs.webkit.org/show_bug.cgi?id=75819
Reviewed by Eric Seidel.
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/color-hsl-expected.txt: Added.
* css3/calc/color-hsl.html: Added.
* css3/calc/color-rgb-expected.txt: Added.
* css3/calc/color-rgb.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (104431 => 104432)
--- trunk/LayoutTests/ChangeLog 2012-01-09 06:14:33 UTC (rev 104431)
+++ trunk/LayoutTests/ChangeLog 2012-01-09 06:56:18 UTC (rev 104432)
@@ -1,5 +1,22 @@
2012-01-08 Mike Lawther <[email protected]>
+ color tests for CSS3 calc
+ https://bugs.webkit.org/show_bug.cgi?id=75819
+
+ Reviewed by Eric Seidel.
+
+ 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/color-hsl-expected.txt: Added.
+ * css3/calc/color-hsl.html: Added.
+ * css3/calc/color-rgb-expected.txt: Added.
+ * css3/calc/color-rgb.html: Added.
+
+2012-01-08 Mike Lawther <[email protected]>
+
font tests for CSS3 calc
https://bugs.webkit.org/show_bug.cgi?id=75818
Added: trunk/LayoutTests/css3/calc/color-hsl-expected.txt (0 => 104432)
--- trunk/LayoutTests/css3/calc/color-hsl-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/calc/color-hsl-expected.txt 2012-01-09 06:56:18 UTC (rev 104432)
@@ -0,0 +1,5 @@
+These two sentences should be the same color (simple)
+These two sentences should be the same color (simple)
+These two sentences should be the same color (alpha)
+These two sentences should be the same color (alpha)
+FAIL
Added: trunk/LayoutTests/css3/calc/color-hsl.html (0 => 104432)
--- trunk/LayoutTests/css3/calc/color-hsl.html (rev 0)
+++ trunk/LayoutTests/css3/calc/color-hsl.html 2012-01-09 06:56:18 UTC (rev 104432)
@@ -0,0 +1,41 @@
+<style>
+div {color: red;}
+#controlsimple {color: hsl(120,75%,50%);}
+#simple {color: hsl(-webkit-calc(120),-webkit-calc(75%),-webkit-calc(50%));}
+
+#controlalpha {color: hsla(120,75%,50%,0.7);}
+#alpha {color: hsla(-webkit-calc(120),-webkit-calc(75%),-webkit-calc(50%), -webkit-calc(0.7));}
+</style>
+
+<div id="controlsimple">These two sentences should be the same color (simple)</div>
+<div id="simple">These two sentences should be the same color (simple)</div>
+<hr/>
+<div id="controlalpha">These two sentences should be the same color (alpha)</div>
+<div id="alpha">These two sentences should be the same color (alpha)</div>
+<hr/>
+<div id="results"></div>
+
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+tests = ["simple", "alpha"];
+
+var success = true;
+
+for (i = 0; i < tests.length; i++) {
+ var test = tests[i];
+ var expected = getComputedStyle(document.getElementById("control" + test), null).color;
+ var actual = getComputedStyle(document.getElementById(test), null).color;
+ success = success && (actual == expected);
+}
+
+var results = document.getElementById("results");
+if (success) {
+ results.style.color = "green";
+ results.innerHTML = "PASS";
+} else {
+ results.style.color = "red";
+ results.innerHTML = "FAIL";
+}
+</script>
Added: trunk/LayoutTests/css3/calc/color-rgb-expected.txt (0 => 104432)
--- trunk/LayoutTests/css3/calc/color-rgb-expected.txt (rev 0)
+++ trunk/LayoutTests/css3/calc/color-rgb-expected.txt 2012-01-09 06:56:18 UTC (rev 104432)
@@ -0,0 +1,9 @@
+These two sentences should be the same color (simple)
+These two sentences should be the same color (simple)
+B. These two sentences should be the same color (simple percent)
+B. These two sentences should be the same color (simple percent)
+C. These two sentences should be the same color (alpha)
+C. These two sentences should be the same color (alpha)
+These two sentences should be the same color (percent alpha)
+These two sentences should be the same color (percent alpha)
+FAIL
Added: trunk/LayoutTests/css3/calc/color-rgb.html (0 => 104432)
--- trunk/LayoutTests/css3/calc/color-rgb.html (rev 0)
+++ trunk/LayoutTests/css3/calc/color-rgb.html 2012-01-09 06:56:18 UTC (rev 104432)
@@ -0,0 +1,53 @@
+<style>
+div {color: red;}
+#controlsimple {color: rgb(10,180,30);}
+#simple {color: rgb(-webkit-calc(10),-webkit-calc(18 * 10),-webkit-calc(30));}
+#controlpercentsimple {color: rgb(10%,95%,30%);}
+#percentsimple {color: rgb(-webkit-calc(2% + 8%),-webkit-calc(95%),-webkit-calc(3% * 10));}
+
+#controlalpha {color: rgba(10,180,30,0.7);}
+#alpha {color: rgba(-webkit-calc(10),-webkit-calc(180),-webkit-calc(30), -webkit-calc(0.35 * 2));}
+#controlpercentalpha {color: rgba(10%,95%,30%,0.7);}
+#percentalpha {color: rgba(-webkit-calc(2 * 5%),-webkit-calc(100% - 5%),-webkit-calc(30%),-webkit-calc(0.2 * 3 + 0.1));}
+</style>
+
+<div id="controlsimple">These two sentences should be the same color (simple)</div>
+<div id="simple">These two sentences should be the same color (simple)</div>
+<hr/>
+<div id="controlpercentsimple">B. These two sentences should be the same color (simple percent)</div>
+<div id="percentsimple">B. These two sentences should be the same color (simple percent)</div>
+<hr/>
+<div id="controlalpha">C. These two sentences should be the same color (alpha)</div>
+<div id="alpha">C. These two sentences should be the same color (alpha)</div>
+<hr/>
+<div id="controlpercentalpha">These two sentences should be the same color (percent alpha)</div>
+<div id="percentalpha">These two sentences should be the same color (percent alpha)</div>
+<hr/>
+<div id="results"></div>
+
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+tests = ["simple", "alpha"];
+
+var success = true;
+
+for (i = 0; i < tests.length; i++) {
+ var test = tests[i];
+ var expectedsimple = getComputedStyle(document.getElementById("control" + test), null).color;
+ var actualsimple = getComputedStyle(document.getElementById(test), null).color;
+ var expectedpercent = getComputedStyle(document.getElementById("controlpercent" + test), null).color;
+ var actualpercent = getComputedStyle(document.getElementById("percent" + test), null).color;
+ success = success && (actualsimple == expectedsimple) && (actualpercent == expectedpercent);
+}
+
+var results = document.getElementById("results");
+if (success) {
+ results.style.color = "green";
+ results.innerHTML = "PASS";
+} else {
+ results.style.color = "red";
+ results.innerHTML = "FAIL";
+}
+</script>