summaryrefslogtreecommitdiffstats
path: root/toolkit/content/tests/chrome/window_tooltip.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/content/tests/chrome/window_tooltip.xhtml
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/content/tests/chrome/window_tooltip.xhtml')
-rw-r--r--toolkit/content/tests/chrome/window_tooltip.xhtml55
1 files changed, 50 insertions, 5 deletions
diff --git a/toolkit/content/tests/chrome/window_tooltip.xhtml b/toolkit/content/tests/chrome/window_tooltip.xhtml
index b78075de45..e6ee5c6b42 100644
--- a/toolkit/content/tests/chrome/window_tooltip.xhtml
+++ b/toolkit/content/tests/chrome/window_tooltip.xhtml
@@ -30,6 +30,8 @@ var gOriginalWidth = -1;
var gOriginalHeight = -1;
var gButton = null;
+const kTooltipOffsetVertical = 10;
+
function runTest()
{
startPopupTests(popupTests);
@@ -112,7 +114,7 @@ var popupTests = [
Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 6),
testname + " left position of tooltip");
is(Math.round(rect.top),
- Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6),
+ Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6 + kTooltipOffsetVertical),
testname + " top position of tooltip");
var labelrect = document.getElementById("label").getBoundingClientRect();
@@ -159,7 +161,7 @@ var popupTests = [
Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 4),
testname + " left position of tooltip");
is(Math.round(rect.top),
- Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 4),
+ Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 4 + kTooltipOffsetVertical),
testname + " top position of tooltip");
var labelrect = document.getElementById("label").getBoundingClientRect();
@@ -204,7 +206,7 @@ var popupTests = [
Math.round(buttonrect.left + parseFloat(popupstyle.marginLeft) + 6),
testname + " left position of tooltip");
is(Math.round(rect.top),
- Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6),
+ Math.round(buttonrect.top + parseFloat(popupstyle.marginTop) + 6 + kTooltipOffsetVertical),
testname + " top position of tooltip");
var labelrect = document.getElementById("label").getBoundingClientRect();
@@ -327,7 +329,43 @@ var popupTests = [
// that the original height has increased by at least 10 pixels
ok(gOriginalHeight + 10 < rect.bottom - rect.top, testname + " tooltip is wrapped");
}
-}
+},
+{
+ testname: "anchored tooltip with no offset",
+ events: ["popupshowing thetooltip", "popupshown thetooltip"],
+ autohide: "thetooltip",
+ test() {
+ gButton = document.getElementById("withtooltip");
+ document
+ .getElementById("thetooltip")
+ .setAttribute(
+ "onpopupshowing",
+ "this.moveToAnchor(this.triggerNode, 'after_start');"
+ );
+ disableNonTestMouse(true);
+ synthesizeMouse(gButton, 2, 2, { type: "mouseover" });
+ synthesizeMouse(gButton, 4, 4, { type: "mousemove" });
+ synthesizeMouse(gButton, 6, 6, { type: "mousemove" });
+ disableNonTestMouse(false);
+ },
+ result(testname) {
+ var buttonrect = document
+ .getElementById("withtooltip")
+ .getBoundingClientRect();
+ var tooltip = document.getElementById("thetooltip");
+ var rect = tooltip.getBoundingClientRect();
+ var popupstyle = window.getComputedStyle(tooltip);
+
+ // Offset does not apply to anchored tooltips
+ is(
+ Math.round(rect.top),
+ Math.round(buttonrect.bottom + parseFloat(popupstyle.marginTop)),
+ testname + " top position of tooltip"
+ );
+
+ tooltip.removeAttribute("onpopupshowing");
+ },
+},
];
var waitSteps = 0;
@@ -359,7 +397,14 @@ function moveWindowTo(x, y, callback, arg)
}
}
-window.arguments[0].SimpleTest.waitForFocus(runTest, window);
+(async function() {
+ let parent = window.arguments[0];
+ await Promise.all([
+ parent.SimpleTest.promiseFocus(window),
+ parent.SpecialPowers.pushPrefEnv({set: [["ui.tooltipOffsetVertical", kTooltipOffsetVertical]]}),
+ ]);
+ runTest();
+})();
]]>
</script>