CSS3 calc: update font-size test to use pre/post js
https://bugs.webkit.org/show_bug.cgi?id=78325
Reviewed by Ojan Vafai.
* css3/calc/font-size-expected.txt:
* css3/calc/font-size.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107425 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/css3/calc/font-size.html b/LayoutTests/css3/calc/font-size.html
index 928fff4..5fa15b1 100644
--- a/LayoutTests/css3/calc/font-size.html
+++ b/LayoutTests/css3/calc/font-size.html
@@ -1,40 +1,28 @@
+<!DOCTYPE HTML>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
<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;">
+<div id="test-container" 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>
+<span class="fonttest" 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/>
+<span class="fonttest" id="calc-percent-pixels">The font size of these lines should be identical</span>
</div>
-<div id="results"></div>
<script>
-if (window.layoutTestController)
- layoutTestController.dumpAsText();
-var controlSize = getComputedStyle(document.getElementById("control"), null).fontSize
+description("Tests that CSS3 calc() can be used with the font-size property");
-var spans = document.getElementsByTagName("span");
-var sameSize = true;
+var spans = document.getElementsByClassName("fonttest");
for (var i = 0; i < spans.length; ++i) {
- var current = spans[i];
- if (sameSize)
- sameSize = getComputedStyle(current, null).fontSize == controlSize;
+ shouldBeEqualToString('getComputedStyle(document.getElementById("' + spans[i].id + '"), null).fontSize', getComputedStyle(document.getElementById("control"), null).fontSize);
}
-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>";
-}
-
+if (window.layoutTestController)
+ document.body.removeChild(document.getElementById("test-container"));
</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>