diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/base/content/test/general/browser_tab_dragdrop2_frame1.xhtml | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/general/browser_tab_dragdrop2_frame1.xhtml')
-rw-r--r-- | browser/base/content/test/general/browser_tab_dragdrop2_frame1.xhtml | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/browser/base/content/test/general/browser_tab_dragdrop2_frame1.xhtml b/browser/base/content/test/general/browser_tab_dragdrop2_frame1.xhtml new file mode 100644 index 0000000000..d64f37c289 --- /dev/null +++ b/browser/base/content/test/general/browser_tab_dragdrop2_frame1.xhtml @@ -0,0 +1,158 @@ +<?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"?> +<!-- + XUL Widget Test for panels + --> +<window title="Titlebar" width="200" height="200" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> + +<tree id="tree" seltype="single" width="100" height="100"> + <treecols> + <treecol flex="1"/> + <treecol flex="1"/> + </treecols> + <treechildren id="treechildren"> + <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem> + <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem> + <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem> + <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem> + <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem> + <treeitem><treerow><treecell label="One"/><treecell label="Two"/></treerow></treeitem> + </treechildren> +</tree> + + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/> + + <!-- test code goes here --> + <script type="application/javascript"><![CDATA[ + +SimpleTest.waitForExplicitFinish(); + +var currentTest = null; + +var i, waitSteps; +var my_debug = false; +function test_panels() +{ + i = waitSteps = 0; + checkTreeCoords(); + + addEventListener("popupshown", popupShown, false); + addEventListener("popuphidden", nextTest, false); + return nextTest(); +} + +function nextTest() +{ + ok(true,"popuphidden " + i) + if (i == tests.length) { + let details = {bubbles: true, cancelable: false}; + document.dispatchEvent(new CustomEvent("TestsDone", details)); + return i; + } + + currentTest = tests[i]; + var panel = createPanel(currentTest.attrs); + SimpleTest.waitForFocus(() => currentTest.test(panel)); + return i; +} + +function popupShown(event) +{ + var panel = event.target; + if (waitSteps > 0 && navigator.platform.includes("Linux") && + panel.screenY == 210) { + waitSteps--; + /* eslint-disable mozilla/no-arbitrary-setTimeout */ + setTimeout(popupShown, 10, event); + return; + } + ++i; + + currentTest.result(currentTest.testname + " ", panel); + panel.hidePopup(); +} + +function createPanel(attrs) +{ + var panel = document.createXULElement("panel"); + for (var a in attrs) { + panel.setAttribute(a, attrs[a]); + } + + var button = document.createXULElement("button"); + panel.appendChild(button); + button.label = "OK"; + button.setAttribute("style", "-moz-appearance: none; border: 0; margin: 0; height: 40px; width: 120px;"); + panel.setAttribute("style", "-moz-appearance: none; border: 0; margin: 0;"); + return document.documentElement.appendChild(panel); +} + +function checkTreeCoords() +{ + var tree = $("tree"); + var treechildren = $("treechildren"); + tree.currentIndex = 0; + tree.scrollToRow(0); + synthesizeMouse(treechildren, 10, tree.rowHeight + 2, { }); + + tree.scrollToRow(2); + synthesizeMouse(treechildren, 10, tree.rowHeight + 2, { }); +} + +var tests = [ + { + testname: "normal panel", + attrs: { }, + test(panel) { + panel.openPopupAtScreen(200, 210); + }, + result(testname, panel) { + if (my_debug) alert(testname); + panel.getBoundingClientRect(); + } + }, + { + // only noautohide panels support titlebars, so one shouldn't be shown here + testname: "autohide panel with titlebar", + attrs: { titlebar: "normal" }, + test(panel) { + panel.openPopupAtScreen(200, 210); + }, + result(testname, panel) { + if (my_debug) alert(testname); + panel.getBoundingClientRect(); + } + }, + { + testname: "noautohide panel with titlebar", + attrs: { noautohide: true, titlebar: "normal" }, + test(panel) { + waitSteps = 25; + panel.openPopupAtScreen(200, 210); + }, + result(testname, panel) { + if (my_debug) alert(testname); + panel.getBoundingClientRect(); + + synthesizeMouse(panel, 10, 10, { type: "mousemove" }); + + var tree = $("tree"); + tree.currentIndex = 0; + panel.appendChild(tree); + checkTreeCoords(); + } + } +]; + +SimpleTest.waitForFocus(test_panels); + +]]> +</script> + +</window> |