Index: LayoutTests/cssom/ahem-ex-units.html |
diff --git a/LayoutTests/cssom/ahem-ex-units.html b/LayoutTests/cssom/ahem-ex-units.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..55fdcf4240604a34f7a3e053f39465a3a216ddfc |
--- /dev/null |
+++ b/LayoutTests/cssom/ahem-ex-units.html |
@@ -0,0 +1,41 @@ |
+<!DOCTYPE html> |
+<html> |
+<style> |
+* { font-size: 16px; } |
+svg, rect, div { font-family: 'Ahem'; } |
+</style> |
+<html> |
+<svg id="svg" width="0" height="0"></svg> |
+<script src="../resources/js-test.js"></script> |
+<script> |
+description("Test ex unit with Ahem font"); |
+ |
+function computedStyleDiv(property, value) { |
+ var div = document.createElement("div"); |
+ document.body.appendChild(div); |
+ div.style[property] = value; |
+ var computedValue = getComputedStyle(div).getPropertyValue(property); |
+ document.body.removeChild(div); |
+ return computedValue; |
+} |
+ |
+function computedStyleRect(property, value) { |
+ var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); |
+ document.getElementById("svg").appendChild(rect); |
+ rect.setAttribute(property, value); |
+ var computedValue = getComputedStyle(rect).getPropertyValue(property); |
+ document.getElementById("svg").removeChild(rect); |
+ return computedValue; |
+} |
+ |
+ |
+function testComputed(property, value, expected) { |
+ var tolerance = 0.05; |
+ shouldBeCloseTo('parseFloat(computedStyleDiv("' + property + '", "' + value + '"))', expected, tolerance); |
+ shouldBeCloseTo('parseFloat(computedStyleRect("' + property + '", "' + value + '"))', expected, tolerance); |
+} |
+ |
+testComputed("word-spacing", "1ex", 12.8); |
+</script> |
+</body> |
+</html> |