Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: LayoutTests/cssom/ahem-ex-units.html

Issue 890013004: Check Ahem font ex units on multiple platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add float tolerance Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/cssom/ahem-ex-units-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/cssom/ahem-ex-units-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698