From 62098c8add6b9e5f0803f0c515200d1bee447eb4 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 22 Sep 2026 22:14:35 -0400 Subject: [PATCH] rename test --- ...ellite-click.qml => bar-widget-cursor.qml} | 59 ++++++++----------- 1 file changed, 24 insertions(+), 35 deletions(-) rename quickshell/tests/qml/{island-satellite-click.qml => bar-widget-cursor.qml} (57%) diff --git a/quickshell/tests/qml/island-satellite-click.qml b/quickshell/tests/qml/bar-widget-cursor.qml similarity index 57% rename from quickshell/tests/qml/island-satellite-click.qml rename to quickshell/tests/qml/bar-widget-cursor.qml index 46e02e908..3ed446d8f 100644 --- a/quickshell/tests/qml/island-satellite-click.qml +++ b/quickshell/tests/qml/bar-widget-cursor.qml @@ -1,18 +1,14 @@ import QtQuick -import QtTest import Quickshell import qs.Common import qs.Services import qs.Modules.DankBar -import qs.Modules.DankIsland import qs.DankCommon.Common as DC -// A press on a satellite widget of a docked island must reach the widget's own MouseArea, -// and no MouseArea may paint over it: MouseArea installs an arrow cursor that hides the widget's. +// Every MouseArea owns an arrow cursor, so one painted over a widget hides the widget's pointer cursor. ShellRoot { id: root - TestCase { id: input; when: false } Item { Repeater { model: ScriptModel { @@ -25,18 +21,12 @@ ShellRoot { } } } - DankIsland { id: islands } - function check(value, label) { - if (!value) - throw new Error(label); - } - - function pressAreas(item, found) { + function mouseAreas(item, found) { if (item.containsPress !== undefined && item.acceptedButtons !== undefined) found.push(item); for (const child of item.children || []) - pressAreas(child, found); + mouseAreas(child, found); return found; } @@ -63,8 +53,9 @@ ShellRoot { return siblings.indexOf(ca[i]) > siblings.indexOf(cb[i]); } - function areasAbove(widget, x, y) { - return pressAreas(widget.Window.window.contentItem, []).filter(area => { + function areasCovering(widget) { + const x = widget.width / 2, y = widget.height / 2; + return mouseAreas(widget.Window.window.contentItem, []).filter(area => { if (!area.visible || !area.enabled || chain(area).includes(widget) || !paintsAbove(area, widget)) return false; return area.contains(widget.mapToItem(area, x, y)); @@ -77,25 +68,35 @@ ShellRoot { DC.Style.settings = SettingsData; DC.I18n.backend = I18n; } + Timer { interval: 0 running: SettingsData._hasLoaded && SessionData._hasLoaded onTriggered: { SettingsData.frameEnabled = false; SettingsData.reduceMotion = true; - SettingsData.barConfigs = [{ id: "isle", island: true, enabled: true, visible: true, position: 0, leftWidgets: ["launcherButton"], rightWidgets: ["clock"] }]; + SettingsData.barConfigs = [ + { + id: "bar", + enabled: true, + visible: true, + position: 0, + leftWidgets: ["launcherButton"], + rightWidgets: ["clock"] + } + ]; } } + Timer { id: steps property int waited: 0 - readonly property var screen: Quickshell.screens[0] - readonly property var widget: BarWidgetService.getWidget("launcherButton", screen.name) + readonly property var widget: BarWidgetService.getWidget("launcherButton", Quickshell.screens[0].name) interval: 25 repeat: true - running: islands.hosts().length === 1 + running: SettingsData.barConfigs.length === 1 function finish(message) { running = false; @@ -108,24 +109,12 @@ ShellRoot { onTriggered: { if (!widget || widget.width <= 0 || !widget.visible) { - if (++waited > 400) - finish("launcher button never appeared: widget=" + widget + " width=" + (widget?.width) + " visible=" + (widget?.visible) + " hosts=" + islands.hosts().length); + if (++waited > 800) + finish("launcher button never appeared: widget=" + widget + " width=" + widget?.width + " visible=" + widget?.visible); return; } - try { - const areas = root.pressAreas(widget, []); - root.check(areas.length > 0, "widget has a press area"); - const above = root.areasAbove(widget, widget.width / 2, widget.height / 2); - root.check(above.length === 0, "no MouseArea painted above the widget covers it: " + above); - input.mouseMove(widget, widget.width / 2, widget.height / 2, 0); - input.mousePress(widget, widget.width / 2, widget.height / 2, Qt.LeftButton, Qt.NoModifier, 0); - const pressedArea = areas.some(area => area.containsPress || area.pressed); - input.mouseRelease(widget, widget.width / 2, widget.height / 2, Qt.LeftButton, Qt.NoModifier, 0); - root.check(pressedArea, "press reaches the satellite widget"); - finish(""); - } catch (error) { - finish(error.message); - } + const covering = root.areasCovering(widget); + finish(covering.length ? "MouseArea painted over the launcher button: " + covering : ""); } } }