summaryrefslogtreecommitdiffstats
path: root/dom/svg/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/svg/test
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/svg/test')
-rw-r--r--dom/svg/test/test_switch.xhtml107
-rw-r--r--dom/svg/test/test_tabindex.html15
2 files changed, 55 insertions, 67 deletions
diff --git a/dom/svg/test/test_switch.xhtml b/dom/svg/test/test_switch.xhtml
index d1fa546e26..a589a934c1 100644
--- a/dom/svg/test/test_switch.xhtml
+++ b/dom/svg/test/test_switch.xhtml
@@ -22,17 +22,6 @@ SimpleTest.waitForExplicitFinish();
var test = 1;
-function checkBounds(element, x, y, w, h) {
- var bbox = element.getBBox();
- var name = element.nodeName;
-
- is(bbox.x, x, test + " " + name + ".getBBox().x");
- is(bbox.y, y, test + " " + name + ".getBBox().y");
- is(bbox.width, w, test + " " + name + ".getBBox().width");
- is(bbox.height, h, test + " " + name + ".getBBox().height");
- ++test;
-}
-
function checkWidth(element, w) {
var bbox = element.getBBox();
var name = element.nodeName;
@@ -41,55 +30,65 @@ function checkWidth(element, w) {
++test;
}
-function run() {
- // Set accept_languages to something we know
- SpecialPowers.pushPrefEnv({"set": [["intl.accept_languages", "en-gb,en,it"]]}, run1);
-}
-
-function run1() {
+async function run() {
try {
- var doc = $("svg").contentDocument;
- var s = doc.getElementById("s");
- var first = doc.getElementById("first");
- var second = doc.getElementById("second");
- var third = doc.getElementById("third");
-
- first.setAttribute("systemLanguage", "fr");
-
- /* test for an exact match */
- second.setAttribute("systemLanguage", "en-gb");
- checkWidth(s, 50);
-
- /* test for a close match i.e. the same language prefix */
- second.setAttribute("systemLanguage", "en-us");
- checkWidth(s, 50);
-
- /* test that we pick the best match */
- second.setAttribute("systemLanguage", "it");
- checkWidth(s, 50);
-
- /* test that we use the default if nothing matches */
- second.setAttribute("systemLanguage", "fr");
- checkWidth(s, 80);
-
- /* test we still ignore non-matches */
- second.removeAttribute("systemLanguage");
- third.setAttribute("systemLanguage", "fr");
- checkWidth(s, 50);
-
- /* check what happens if nothing matches */
- second.setAttribute("systemLanguage", "fr");
- checkWidth(s, 0);
-
- /* test that we pick the best match */
- first.setAttribute("systemLanguage", "en");
- second.setAttribute("systemLanguage", "en-gb");
- checkWidth(s, 50);
+ // Set accept_languages to something we know
+ await SpecialPowers.pushPrefEnv({"set": [["intl.accept_languages", "en-gb,en,it"]]}, run1);
} finally {
SimpleTest.finish();
}
}
+function run1() {
+ let doc = $("svg").contentDocument;
+ let s = doc.getElementById("s");
+ let first = doc.getElementById("first");
+ let second = doc.getElementById("second");
+ let third = doc.getElementById("third");
+
+ first.setAttribute("systemLanguage", "fr");
+
+ /* test for an exact match */
+ second.setAttribute("systemLanguage", "en-gb");
+ checkWidth(s, 50);
+
+ /* test for a close match i.e. the same language prefix */
+ second.setAttribute("systemLanguage", "en");
+ checkWidth(s, 50);
+
+ /* test for a close match regardless of case */
+ second.setAttribute("systemLanguage", "eN");
+ checkWidth(s, 50);
+
+ /* test that different regions don't match */
+ second.setAttribute("systemLanguage", "en-us");
+ checkWidth(s, 80);
+
+ /* test that we pick the best match */
+ second.setAttribute("systemLanguage", "it");
+ checkWidth(s, 50);
+
+ /* test that we use the default if nothing matches */
+ second.setAttribute("systemLanguage", "fr");
+ checkWidth(s, 80);
+
+ /* test we still ignore non-matches */
+ second.removeAttribute("systemLanguage");
+ third.setAttribute("systemLanguage", "fr");
+ checkWidth(s, 50);
+
+ /* check what happens if nothing matches */
+ second.setAttribute("systemLanguage", "fr");
+ third.setAttribute("systemLanguage", "fr");
+ checkWidth(s, 0);
+
+ /* test that we pick the best match */
+ first.setAttribute("systemLanguage", "en");
+ second.setAttribute("systemLanguage", "en-gb");
+ third.removeAttribute("systemLanguage");
+ checkWidth(s, 50);
+}
+
window.addEventListener("load", run);
]]>
diff --git a/dom/svg/test/test_tabindex.html b/dom/svg/test/test_tabindex.html
index 65315420bc..3d29d1070b 100644
--- a/dom/svg/test/test_tabindex.html
+++ b/dom/svg/test/test_tabindex.html
@@ -37,7 +37,6 @@ function main() {
var t = document.getElementById("t");
var l1 = document.getElementById("l1");
var l2 = document.getElementById("l2");
- const isMac = ("nsILocalFileMac" in SpecialPowers.Ci);
try {
// Step 1: Checking by assigning tabIndex
@@ -74,20 +73,10 @@ function main() {
is(document.activeElement.tabIndex, 3, "The active element tabindex is 3");
synthesizeKey("KEY_Tab");
- // On Mac, SVG link elements should not be focused.
- if (isMac) {
- is(document.activeElement.tabIndex, 6, "The active element tabindex is 6");
- } else {
- is(document.activeElement.tabIndex, 4, "The active element tabindex is 4");
- }
+ is(document.activeElement.tabIndex, 4, "The active element tabindex is 4");
synthesizeKey("KEY_Tab");
- // On Mac, SVG link elements should not be focused.
- if (isMac) {
- is(document.activeElement.tabIndex, 7, "The active element tabindex is 7");
- } else {
- is(document.activeElement.tabIndex, 5, "The active element tabindex is 5");
- }
+ is(document.activeElement.tabIndex, 5, "The active element tabindex is 5");
} catch (e) {
ok(false, "Got unexpected exception" + e);
}