Bug 687297 - Added Mochitest to verify that the per-presentation base minimum font size is propagated without being influenced by the language-specific global preference. r=dbaron
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Wed, 26 Feb 2014 16:01:38 -0800
changeset 171740 d30b9a757fc2bd8c21c0cc51f07e695ad958d89b
parent 171739 d86dd791088bf0f92fbe4b346d13d0a614ce58b1
child 171741 5960820bd2fd635fdad27b4eeae8739169bef77e
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersdbaron
bugs687297, 948948
milestone30.0a1
Bug 687297 - Added Mochitest to verify that the per-presentation base minimum font size is propagated without being influenced by the language-specific global preference. r=dbaron This test applies a large value to the font.minimum-size.ja preference, opens a new window, advances the url through an iso-8859-1 page, a Shift-JIS page, and back to an iso-8859-1 page. If the height of a div containing text on the first iso-8859-1 page and last iso-8859-1 page do not match, then the test is failed. This test has been excluded from B2G Desktop Client tests due to bug 948948.
layout/base/tests/bug687297_a.html
layout/base/tests/bug687297_b.html
layout/base/tests/bug687297_c.html
layout/base/tests/mochitest.ini
layout/base/tests/test_bug687297.html
testing/mochitest/b2g-desktop.json
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug687297_a.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+  <title>Test companion for Bug 687297</title>
+  <style type="text/css"> * { font-size:9px; } </style>
+</head>
+<body>
+  <div id="test_content">ABCDEFG 0123456</div>
+</body>
+<script type="application/javascript">
+  window.onload = function() {
+    opener.report_size_a(document.getElementById("test_content").clientHeight);
+    window.location.href = "bug687297_b.html";
+  };
+</script>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug687297_b.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
+  <title>Test companion for Bug 687297</title>
+  <style type="text/css"> * { font-size:9px; } </style>
+</head>
+<body>
+  <div id="test_content">ABCDEFG 0123456</div>
+</body>
+<script type="application/javascript">
+  window.onload = function() {
+    opener.report_size_b(document.getElementById("test_content").clientHeight);
+    window.location.href = "bug687297_c.html";
+  };
+</script>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/bug687297_c.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+  <title>Test companion for Bug 687297</title>
+  <style type="text/css"> * { font-size:9px; } </style>
+</head>
+<body>
+  <div id="test_content">ABCDEFG 0123456</div>
+</body>
+<script type="application/javascript">
+  window.onload = function() {
+    opener.report_size_c(document.getElementById("test_content").clientHeight);
+    window.close();
+  };
+</script>
+</html>
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -448,8 +448,13 @@ skip-if = toolkit == "win"
 [test_bug570378-persian-5g.html]
 skip-if = toolkit == "win"
 [test_bug749186.html]
 skip-if = toolkit == "win"
 [test_bug644768.html]
 skip-if = toolkit == "win"
 [test_flush_on_paint.html]
 skip-if = true || (toolkit == 'android') || (toolkit == "cocoa") # Bug 688128, bug 539356
+[test_bug687297.html]
+support-files =
+  bug687297_a.html
+  bug687297_b.html
+  bug687297_c.html
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug687297.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=687297
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 687297</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=687297">Mozilla Bug 687297</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+  <script class="testbody" type="text/javascript">
+    /** Test for Bug 687297 **/
+    
+    SimpleTest.waitForExplicitFinish();
+  
+    var size_a=0, size_b=0, size_c=0;
+    
+    window.report_size_a = function(s) {
+      size_a = s;
+    };
+  
+    window.report_size_b = function(s) {
+      size_b = s;
+    };
+  
+    window.report_size_c = function(s) {
+      size_c = s;
+      
+      isnot(size_a, size_b, "Font sizes are changing with global language-specific minimum font size");
+      is(size_c, size_a, "Font sizes are equal, propagating only the presentation-level base minimum font size");
+
+      SimpleTest.finish();
+    };
+  
+    SpecialPowers.pushPrefEnv(
+      {'set':[["font.minimum-size.ja", 120]]},
+      function() {
+        window.open("bug687297_a.html", '_blank');
+      }
+    );
+  
+  </script>
+</pre>
+</body>
+</html>
--- a/testing/mochitest/b2g-desktop.json
+++ b/testing/mochitest/b2g-desktop.json
@@ -382,16 +382,17 @@
     "dom/workers/test/test_errorwarning.html":"Failed to load script: errorwarning_worker.js",
     "dom/workers/test/test_fibonacci.html":"Failed to load script: fibonacci_worker.js",
     "dom/workers/test/test_relativeLoad.html":"Failed to load script: relativeLoad_import.js",
 
     "layout/base/tests/test_bug450930.xhtml":"times out",
     "layout/base/tests/test_bug603550.html":"Components.classes[@mozilla.org/widget/dragservice;1] is undefined",
     "layout/base/tests/test_bug629838.html":"depends on plugins support",
     "layout/base/tests/test_mozPaintCount.html":"depends on plugins support",
+    "layout/base/tests/test_bug687297.html":"Bug 948948",
     "layout/forms/test/test_bug348236.html":"select form control popup",
     "layout/forms/test/test_bug446663.html":"needs copy support",
     "layout/forms/test/test_bug564115.html":"times out on window.open and focus event",
     "layout/forms/test/test_bug571352.html":"shift-click multi-select not working?",
     "layout/forms/test/test_textarea_resize.html":"resizing textarea not available in b2g",
     "layout/forms/test/test_bug903715.html":"select elements don't use an in-page popup in B2G",
     "layout/forms/test/test_bug935876.html":"Esc key is consumed by another event handler only on desktop B2G",
     "layout/forms/test/test_listcontrol_search.html" : "select elements don't use an in-page popup in B2G",