Bug 832313 Part 2: Add a mochitest to confirm the default font has increasing line heights for increasing font sizes. r?jfkthame
MozReview-Commit-ID: 9ULq9Oa2WVI
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -207,16 +207,17 @@ skip-if = (toolkit == 'gonk' && debug) #
[test_ident_escaping.html]
[test_inherit_computation.html]
skip-if = toolkit == 'android'
[test_inherit_storage.html]
[test_initial_computation.html]
skip-if = toolkit == 'android'
[test_initial_storage.html]
[test_keyframes_rules.html]
+[test_line_height_continuity.html]
[test_load_events_on_stylesheets.html]
[test_logical_properties.html]
skip-if = (toolkit == 'gonk' && debug) # Bug 1186224
[test_media_queries.html]
skip-if = (toolkit == 'gonk' && debug) || android_version == '18' #debug-only failure; timed out #Android 4.3 aws only; bug 1030419
[test_media_queries_dynamic.html]
[test_media_queries_dynamic_xbl.html]
[test_media_query_list.html]
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_line_height_continuity.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for continuous line height increase with increasing font size</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+
+<script>
+'use strict';
+
+SimpleTest.waitForExplicitFinish();
+
+function runTests() {
+ function testFontOfSize(fontSize) {
+ let lineDiv = document.createElement("div");
+ let fontSizeSpan = document.createElement("span");
+ fontSizeSpan.textContent = "font-size " + fontSize + ", ";
+ fontSizeSpan.style.fontSize = fontSize + "px";
+
+ let lineHeight = getComputedStyle(fontSizeSpan).getPropertyValue("line-height");
+
+ let lineHeightSpan = document.createElement("span");
+ lineHeightSpan.style.fontSize = fontSize + "px";
+ lineHeightSpan.textContent = "and line-height is " + lineHeight;
+
+ lineDiv.appendChild(fontSizeSpan);
+ lineDiv.appendChild(lineHeightSpan);
+
+ document.body.appendChild(lineDiv);
+
+ // Return the lineHeight without the "px".
+ return lineHeight.substring(0, lineHeight.length - 2);
+ }
+
+ let minFontSize = 10;
+ let maxFontSize = 32;
+ let stepFontSize = .5;
+
+ let lastLineHeight = 0;
+ for (let i = minFontSize; i <= maxFontSize; i += stepFontSize) {
+ let thisLineHeight = testFontOfSize(i);
+
+ ok(thisLineHeight >= lastLineHeight, "Font size " + i + " line height " + thisLineHeight + " should be at least as large as font size " + (i - stepFontSize) + " line height of " + lastLineHeight + ".");
+ lastLineHeight = thisLineHeight;
+ }
+
+ SimpleTest.finish();
+}
+</script>
+</head>
+<body onLoad="runTests()">
+
+</body></html>
\ No newline at end of file