Title: [104431] trunk/LayoutTests
Revision
104431
Author
[email protected]
Date
2012-01-08 22:14:33 -0800 (Sun, 08 Jan 2012)

Log Message

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

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/font-expected.txt: Added.
* css3/calc/font-monospace-expected.txt: Added.
* css3/calc/font-monospace.html: Added.
* css3/calc/font-size-expected.txt: Added.
* css3/calc/font-size-fractional-expected.txt: Added.
* css3/calc/font-size-fractional.html: Added.
* css3/calc/font-size.html: Added.
* css3/calc/font.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104430 => 104431)


--- trunk/LayoutTests/ChangeLog	2012-01-09 06:01:14 UTC (rev 104430)
+++ trunk/LayoutTests/ChangeLog	2012-01-09 06:14:33 UTC (rev 104431)
@@ -1,5 +1,26 @@
 2012-01-08  Mike Lawther  <[email protected]>
 
+        font tests for CSS3 calc
+        https://bugs.webkit.org/show_bug.cgi?id=75818
+
+        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/font-expected.txt: Added.
+        * css3/calc/font-monospace-expected.txt: Added.
+        * css3/calc/font-monospace.html: Added.
+        * css3/calc/font-size-expected.txt: Added.
+        * css3/calc/font-size-fractional-expected.txt: Added.
+        * css3/calc/font-size-fractional.html: Added.
+        * css3/calc/font-size.html: Added.
+        * css3/calc/font.html: Added.
+
+2012-01-08  Mike Lawther  <[email protected]>
+
         border tests for CSS3 calc
         https://bugs.webkit.org/show_bug.cgi?id=75815
 

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


--- trunk/LayoutTests/css3/calc/font-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-expected.txt	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,9 @@
+The font size and line height of these lines should be identical
+The font size and line height of these lines should be identical
+The font size and line height of these lines should be identical
+The font size and line height of these lines should be identical
+The font size and line height of these lines should be identical
+FAIL
+Line heights do not match
+
+Line widths do not match

Added: trunk/LayoutTests/css3/calc/font-monospace-expected.txt (0 => 104431)


--- trunk/LayoutTests/css3/calc/font-monospace-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-monospace-expected.txt	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,6 @@
+The font size and line height of these lines should be identical
+The font size and line height of these lines should be identical
+FAIL
+Line heights do not match
+
+Font sizes do not match

Added: trunk/LayoutTests/css3/calc/font-monospace.html (0 => 104431)


--- trunk/LayoutTests/css3/calc/font-monospace.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-monospace.html	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,45 @@
+<style> 
+body     {font-size: 12px;}
+#control {font: italic small-caps 900 150%/2em monospace;}
+#calc    {font: italic small-caps 900 -webkit-calc(150%)/2em monospace;}
+</style>
+
+<div>
+<span id="control">The font size and line height of these lines should be identical</span>
+<hr/>
+<span id="calc">The font size and line height of these lines should be identical</span>
+</div>
+<hr/>
+<div id="results"></div>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+var controlHeight = getComputedStyle(document.getElementById("control"), null).lineHeight;
+var controlSize = getComputedStyle(document.getElementById("control"), null).fontSize;
+
+var spans = document.getElementsByTagName("span");
+var sameHeight = true;
+var sameSize = true;
+for (var i = 0; i < spans.length; ++i) {
+    var current = spans[i];
+    if (sameHeight)
+        sameHeight = getComputedStyle(current, null).lineHeight == controlHeight;
+    if (sameSize)
+        sameSize = getComputedStyle(current, null).fontSize == controlSize;
+}
+
+var results = document.getElementById("results");
+if (sameHeight && sameSize) {
+    results.style.color = "green";
+    results.innerHTML = "PASS";
+} else {
+    results.style.color = "red";
+    results.innerHTML = "FAIL";    
+    if (!sameHeight)
+        results.innerHTML += "<p>Line heights do not match</p>";
+    if (!sameSize)
+        results.innerHTML += "<p>Font sizes do not match</p>";
+}
+
+</script>

Added: trunk/LayoutTests/css3/calc/font-size-expected.txt (0 => 104431)


--- trunk/LayoutTests/css3/calc/font-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-size-expected.txt	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,5 @@
+The font size of these lines should be identical 
+The font size of these lines should be identical 
+The font size of these lines should be identical
+FAIL
+Computed font sizes do not match

Added: trunk/LayoutTests/css3/calc/font-size-fractional-expected.txt (0 => 104431)


--- trunk/LayoutTests/css3/calc/font-size-fractional-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-size-fractional-expected.txt	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,6 @@
+The font size and line height of these lines should be identical
+The font size and line height of these lines should be identical
+FAIL
+Line heights do not match
+
+Font sizes do not match

Added: trunk/LayoutTests/css3/calc/font-size-fractional.html (0 => 104431)


--- trunk/LayoutTests/css3/calc/font-size-fractional.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-size-fractional.html	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,45 @@
+<style> 
+body         {font-size: 12px;}
+#control     {font: normal 400 80%/2.5 sans-serif;}
+#calc-reduce {font: normal 400 -webkit-calc(80%)/2.5 sans-serif;}
+</style>
+
+<div>
+<span id="control">The font size and line height of these lines should be identical</span>
+<hr/>
+<span id="calc-reduce">The font size and line height of these lines should be identical</span>
+</div>
+<hr/>
+<div id="results"></div>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+var controlHeight = getComputedStyle(document.getElementById("control"), null).lineHeight;
+var controlSize = getComputedStyle(document.getElementById("control"), null).fontSize;
+
+var spans = document.getElementsByTagName("span");
+var sameHeight = true;
+var sameSize = true;
+for (var i = 0; i < spans.length; ++i) {
+    var current = spans[i];
+    if (sameHeight)
+        sameHeight = getComputedStyle(current, null).lineHeight == controlHeight;
+    if (sameSize)
+        sameSize = getComputedStyle(current, null).fontSize == controlSize;
+}
+
+var results = document.getElementById("results");
+if (sameHeight && sameSize) {
+    results.style.color = "green";
+    results.innerHTML = "PASS";
+} else {
+    results.style.color = "red";
+    results.innerHTML = "FAIL";    
+    if (!sameHeight)
+        results.innerHTML += "<p>Line heights do not match</p>";
+    if (!sameSize)
+        results.innerHTML += "<p>Font sizes do not match</p>";
+}
+
+</script>

Added: trunk/LayoutTests/css3/calc/font-size.html (0 => 104431)


--- trunk/LayoutTests/css3/calc/font-size.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font-size.html	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,40 @@
+<style> 
+#control {font-size: 200%;}
+#calc-percent {font-size: -webkit-calc(200%);}
+#calc-percent-pixels {font-size: -webkit-calc(150% + 10px);}
+</style>
+
+<div style="font-size: 20px;">
+<span id="control">The font size of these lines should be identical</span>
+<br/>
+<span id="calc-percent">The font size of these lines should be identical</span>
+<br/>
+<span id="calc-percent-pixels">The font size of these lines should be identical</span>
+<hr/>
+</div>
+<div id="results"></div>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+var controlSize =  getComputedStyle(document.getElementById("control"), null).fontSize
+
+var spans = document.getElementsByTagName("span");
+var sameSize = true;
+for (var i = 0; i < spans.length; ++i) {
+    var current = spans[i];
+    if (sameSize)
+        sameSize = getComputedStyle(current, null).fontSize == controlSize;
+}
+
+var results = document.getElementById("results");
+if (sameSize) {
+    results.style.color = "green";
+    results.innerHTML = "PASS";
+} else {
+    results.style.color = "red";
+    results.innerHTML = "FAIL";    
+    results.innerHTML += "<p>Computed font sizes do not match</p>";
+}
+
+</script>

Added: trunk/LayoutTests/css3/calc/font.html (0 => 104431)


--- trunk/LayoutTests/css3/calc/font.html	                        (rev 0)
+++ trunk/LayoutTests/css3/calc/font.html	2012-01-09 06:14:33 UTC (rev 104431)
@@ -0,0 +1,53 @@
+<style> 
+#control             {font: 1.5em/63px sans-serif;}
+#calc-size           {font: -webkit-calc(1.5em)/63px sans-serif}
+#calc-height         {font: 1.5em/-webkit-calc(126px / 2) sans-serif}
+#calc-both           {font: -webkit-calc(1.5em)/-webkit-calc(63px) sans-serif}
+#calc-percent-size   {font: -webkit-calc(100% + 0.5em)/63px sans-serif}
+</style>
+
+<div>
+<span id="control">The font size and line height of these lines should be identical</span>
+<hr/>
+<span id="calc-size">The font size and line height of these lines should be identical</span>
+<hr/>
+<span id="calc-height">The font size and line height of these lines should be identical</span>
+<hr/>
+<span id="calc-both">The font size and line height of these lines should be identical</span>
+<hr/>
+<span id="calc-percent-size">The font size and line height of these lines should be identical</span>
+</div>
+<hr/>
+<div id="results"></div>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+var controlHeight = getComputedStyle(document.getElementById("control"), null).lineHeight;
+var controlSize = getComputedStyle(document.getElementById("control"), null).fontSize;
+
+var spans = document.getElementsByTagName("span");
+var sameHeight = true;
+var sameSize = true;
+for (var i = 0; i < spans.length; ++i) {
+    var current = spans[i];
+    if (sameHeight)
+        sameHeight = getComputedStyle(current, null).lineHeight == controlHeight;
+    if (sameSize)
+        sameSize = getComputedStyle(current, null).fontSize == controlSize;
+}
+
+var results = document.getElementById("results");
+if (sameHeight && sameSize) {
+    results.style.color = "green";
+    results.innerHTML = "PASS";
+} else {
+    results.style.color = "red";
+    results.innerHTML = "FAIL";    
+    if (!sameHeight)
+        results.innerHTML += "<p>Line heights do not match</p>";
+    if (!sameSize)
+        results.innerHTML += "<p>Line widths do not match</p>";
+}
+
+</script>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to