summaryrefslogtreecommitdiffstats
path: root/toolkit/content/tests/chrome/test_righttoleft.xul
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/content/tests/chrome/test_righttoleft.xul
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/content/tests/chrome/test_righttoleft.xul')
-rw-r--r--toolkit/content/tests/chrome/test_righttoleft.xul126
1 files changed, 126 insertions, 0 deletions
diff --git a/toolkit/content/tests/chrome/test_righttoleft.xul b/toolkit/content/tests/chrome/test_righttoleft.xul
new file mode 100644
index 000000000..64b1419da
--- /dev/null
+++ b/toolkit/content/tests/chrome/test_righttoleft.xul
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet
+ href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+
+<window title="Right to Left UI Test"
+ onload="runTest()"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/chrome-harness.js"></script>
+ <script type="application/javascript"
+ src="RegisterUnregisterChrome.js"></script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test">
+ </pre>
+ </body>
+
+ <iframe id="subframe" width="100" height="100" onload="frameLoaded();"/>
+
+ <script type="application/javascript">
+ <![CDATA[
+
+ SimpleTest.waitForExplicitFinish();
+
+ let prefs = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefBranch);
+ const UI_DIRECTION_PREF = "intl.uidirection.ar";
+ prefs.setCharPref(UI_DIRECTION_PREF, "rtl");
+
+ let rootDir = getRootDirectory(window.location.href);
+ registerManifestPermanently(rootDir + "rtltest/righttoleft.manifest");
+
+ function runTest()
+ {
+ var subframe = document.getElementById("subframe");
+ subframe.setAttribute("src", "chrome://ltrtest/content/dirtest.xul");
+ }
+
+ function frameLoaded()
+ {
+ var subframe = document.getElementById("subframe");
+ var subwin = subframe.contentWindow;
+ var subdoc = subframe.contentDocument;
+ var url = String(subwin.location);
+ if (url.indexOf("chrome://ltrtest") == 0) {
+ is(subwin.getComputedStyle(subdoc.getElementById("hbox"), "").backgroundColor,
+ "rgb(255, 255, 0)", "left to right with :-moz-locale-dir(ltr)");
+ is(subwin.getComputedStyle(subdoc.getElementById("vbox"), "").backgroundColor,
+ "rgb(255, 255, 255)", "left to right with :-moz-locale-dir(rtl)");
+
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "ltr",
+ "left to right direction");
+
+ subdoc.documentElement.setAttribute("localedir", "rtl");
+
+ is(subwin.getComputedStyle(subdoc.getElementById("hbox"), "").backgroundColor,
+ "rgb(255, 255, 255)", "left to right with :-moz-locale-dir(ltr) and localedir='rtl'");
+ is(subwin.getComputedStyle(subdoc.getElementById("vbox"), "").backgroundColor,
+ "rgb(0, 128, 0)", "left to right with :-moz-locale-dir(rtl) and localedir='rtl'");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "rtl",
+ "left to right direction with localedir='rtl'");
+
+ subdoc.documentElement.removeAttribute("localedir");
+
+ is(subwin.getComputedStyle(subdoc.getElementById("hbox"), "").backgroundColor,
+ "rgb(255, 255, 0)", "left to right with :-moz-locale-dir(ltr) and localedir removed");
+ is(subwin.getComputedStyle(subdoc.getElementById("vbox"), "").backgroundColor,
+ "rgb(255, 255, 255)", "left to right with :-moz-locale-dir(rtl) and localedir removed");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "ltr",
+ "left to right direction with localedir removed");
+
+ subframe.setAttribute("src", "chrome://rtltest/content/dirtest.xul");
+ }
+ else if (url.indexOf("chrome://rtltest") == 0) {
+ is(subwin.getComputedStyle(subdoc.getElementById("hbox"), "").backgroundColor,
+ "rgb(255, 255, 255)", "right to left with :-moz-locale-dir(ltr)");
+ is(subwin.getComputedStyle(subdoc.getElementById("vbox"), "").backgroundColor,
+ "rgb(0, 128, 0)", "right to left with :-moz-locale-dir(rtl)");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "rtl",
+ "right to left direction");
+
+ subdoc.documentElement.setAttribute("localedir", "ltr");
+
+ is(subwin.getComputedStyle(subdoc.getElementById("hbox"), "").backgroundColor,
+ "rgb(255, 255, 0)", "right to left with :-moz-locale-dir(ltr) and localedir='ltr'");
+ is(subwin.getComputedStyle(subdoc.getElementById("vbox"), "").backgroundColor,
+ "rgb(255, 255, 255)", "right to left with :-moz-locale-dir(rtl) and localedir='ltr'");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "ltr",
+ "right to left direction with localedir='ltr'");
+
+ subdoc.documentElement.removeAttribute("localedir");
+
+ prefs.setCharPref(UI_DIRECTION_PREF, "");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "ltr",
+ "left to right direction with no preference set");
+ prefs.setCharPref(UI_DIRECTION_PREF + "-QA", "rtl");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "rtl",
+ "right to left direction with more specific preference set");
+ prefs.setCharPref(UI_DIRECTION_PREF, "ltr");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "rtl",
+ "right to left direction with less specific and more specific preference set");
+ prefs.setCharPref(UI_DIRECTION_PREF, "rtl");
+ prefs.setCharPref(UI_DIRECTION_PREF + "-QA", "ltr");
+ is(subwin.getComputedStyle(subdoc.documentElement, "").direction, "ltr",
+ "left to right direction specific preference overrides");
+ if (prefs.prefHasUserValue(UI_DIRECTION_PREF + "-QA"))
+ prefs.clearUserPref(UI_DIRECTION_PREF + "-QA");
+
+ if (prefs.prefHasUserValue(UI_DIRECTION_PREF))
+ prefs.clearUserPref(UI_DIRECTION_PREF);
+
+ SimpleTest.finish();
+ }
+ }
+ ]]>
+ </script>
+
+</window>