Title: [107420] trunk/LayoutTests
Revision
107420
Author
[email protected]
Date
2012-02-10 11:33:59 -0800 (Fri, 10 Feb 2012)

Log Message

CSS3 calc: convert font test to use pre/post js
https://bugs.webkit.org/show_bug.cgi?id=78321

Reviewed by Ojan Vafai.

* css3/calc/font-expected.txt:
* css3/calc/font.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107419 => 107420)


--- trunk/LayoutTests/ChangeLog	2012-02-10 19:31:47 UTC (rev 107419)
+++ trunk/LayoutTests/ChangeLog	2012-02-10 19:33:59 UTC (rev 107420)
@@ -1,3 +1,13 @@
+2012-02-10  Mike Lawther  <[email protected]>
+
+        CSS3 calc: convert font test to use pre/post js
+        https://bugs.webkit.org/show_bug.cgi?id=78321
+
+        Reviewed by Ojan Vafai.
+
+        * css3/calc/font-expected.txt:
+        * css3/calc/font.html:
+
 2012-02-10  Tony Chang  <[email protected]>
 
         [chromium] Unreviewed: Add baselines on Mac for 2 tests that got

Modified: trunk/LayoutTests/css3/calc/font-expected.txt (107419 => 107420)


--- trunk/LayoutTests/css3/calc/font-expected.txt	2012-02-10 19:31:47 UTC (rev 107419)
+++ trunk/LayoutTests/css3/calc/font-expected.txt	2012-02-10 19:33:59 UTC (rev 107420)
@@ -1,9 +1,17 @@
-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
+Tests that CSS3 calc() can be used with the font property
 
-Line widths do not match
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL getComputedStyle(document.getElementById("calc-size"), null).lineHeight should be 63px. Was normal.
+FAIL getComputedStyle(document.getElementById("calc-size"), null).fontSize should be 24px. Was 16px.
+FAIL getComputedStyle(document.getElementById("calc-height"), null).lineHeight should be 63px. Was normal.
+PASS getComputedStyle(document.getElementById("calc-height"), null).fontSize is "24px"
+FAIL getComputedStyle(document.getElementById("calc-both"), null).lineHeight should be 63px. Was normal.
+FAIL getComputedStyle(document.getElementById("calc-both"), null).fontSize should be 24px. Was 16px.
+FAIL getComputedStyle(document.getElementById("calc-percent-size"), null).lineHeight should be 63px. Was normal.
+FAIL getComputedStyle(document.getElementById("calc-percent-size"), null).fontSize should be 24px. Was 16px.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/css3/calc/font.html (107419 => 107420)


--- trunk/LayoutTests/css3/calc/font.html	2012-02-10 19:31:47 UTC (rev 107419)
+++ trunk/LayoutTests/css3/calc/font.html	2012-02-10 19:33:59 UTC (rev 107420)
@@ -1,3 +1,5 @@
+<!DOCTYPE HTML>
+<script src=""
 <style> 
 #control             {font: 1.5em/63px sans-serif;}
 #calc-size           {font: -webkit-calc(1.5em)/63px sans-serif}
@@ -6,48 +8,29 @@
 #calc-percent-size   {font: -webkit-calc(100% + 0.5em)/63px sans-serif}
 </style>
 
-<div>
+<div id="test-container">
 <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>
+<span class="fonttest" 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>
+<span class="fonttest" 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>
+<span class="fonttest" 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>
+<span class="fonttest" 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;
+description("Tests that CSS3 calc() can be used with the font property");
 
-var spans = document.getElementsByTagName("span");
-var sameHeight = true;
-var sameSize = true;
+var spans = document.getElementsByClassName("fonttest");
 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;
+    shouldBeEqualToString('getComputedStyle(document.getElementById("' + current.id + '"), null).lineHeight', getComputedStyle(document.getElementById("control"), null).lineHeight);
+    shouldBeEqualToString('getComputedStyle(document.getElementById("' + current.id + '"), null).fontSize', getComputedStyle(document.getElementById("control"), null).fontSize);
 }
 
-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>";
-}
-
+if (window.layoutTestController)
+    document.body.removeChild(document.getElementById("test-container"));
 </script>
+<script src=""
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to