diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/base/content/test/zoom/browser_mousewheel_zoom.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | browser/base/content/test/zoom/browser_mousewheel_zoom.js | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/browser/base/content/test/zoom/browser_mousewheel_zoom.js b/browser/base/content/test/zoom/browser_mousewheel_zoom.js new file mode 100644 index 0000000000..a814f1dba6 --- /dev/null +++ b/browser/base/content/test/zoom/browser_mousewheel_zoom.js @@ -0,0 +1,72 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +const TEST_PAGE = + // eslint-disable-next-line @microsoft/sdl/no-insecure-url + "http://example.org/browser/browser/base/content/test/zoom/zoom_test.html"; + +var gTab1, gTab2, gLevel1; + +function test() { + waitForExplicitFinish(); + + // Scroll on Ctrl + mousewheel + SpecialPowers.pushPrefEnv({ set: [["mousewheel.with_control.action", 3]] }); + + (async function () { + gTab1 = BrowserTestUtils.addTab(gBrowser); + gTab2 = BrowserTestUtils.addTab(gBrowser); + + await FullZoomHelper.selectTabAndWaitForLocationChange(gTab1); + await FullZoomHelper.load(gTab1, TEST_PAGE); + await FullZoomHelper.load(gTab2, TEST_PAGE); + })().then(zoomTab1, FullZoomHelper.failAndContinue(finish)); +} + +function zoomTab1() { + (async function () { + is(gBrowser.selectedTab, gTab1, "Tab 1 is selected"); + FullZoomHelper.zoomTest(gTab1, 1, "Initial zoom of tab 1 should be 1"); + FullZoomHelper.zoomTest(gTab2, 1, "Initial zoom of tab 2 should be 1"); + + let browser1 = gBrowser.getBrowserForTab(gTab1); + await BrowserTestUtils.synthesizeMouse( + null, + 10, + 10, + { + wheel: true, + ctrlKey: true, + deltaY: -1, + deltaMode: WheelEvent.DOM_DELTA_LINE, + }, + browser1 + ); + + info("Waiting for tab 1 to be zoomed"); + await TestUtils.waitForCondition(() => { + gLevel1 = ZoomManager.getZoomForBrowser(browser1); + return gLevel1 > 1; + }); + + await FullZoomHelper.selectTabAndWaitForLocationChange(gTab2); + FullZoomHelper.zoomTest( + gTab2, + gLevel1, + "Tab 2 should have zoomed along with tab 1" + ); + })().then(finishTest, FullZoomHelper.failAndContinue(finish)); +} + +function finishTest() { + (async function () { + await FullZoomHelper.selectTabAndWaitForLocationChange(gTab1); + await FullZoom.reset(); + await FullZoomHelper.removeTabAndWaitForLocationChange(gTab1); + await FullZoomHelper.selectTabAndWaitForLocationChange(gTab2); + await FullZoom.reset(); + await FullZoomHelper.removeTabAndWaitForLocationChange(gTab2); + })().then(finish, FullZoomHelper.failAndContinue(finish)); +} |