// SPDX-License-Identifier: MIT import QtQuick import QtTest import "../controller/contents/ui/areas.js" as Areas Item { width: 600 height: 100 Item { id: panel x: 30 y: 20 width: 500 height: 40 Item { width: 200 height: 40 property alias applet: tasks Item { id: tasks anchors.fill: parent property QtObject plasmoid: QtObject { property string pluginName: "org.kde.plasma.taskmanager" } Item { id: button width: 80 height: 40 property Item tasksRoot: tasks property bool isWindow: true property int index: 0 } } } Item { x: 200 width: 60 height: 40 property QtObject applet: QtObject { property QtObject plasmoid: QtObject { property string pluginName: "org.kde.plasma.systemtray" } } } Item { id: arbitraryWidget x: 260 width: 60 height: 40 property QtObject applet: QtObject { property QtObject plasmoid: QtObject { property string pluginName: "third.party.widget" } } } } TestCase { name: "PanelAreas" when: windowShown function test_taskButtonsVersusUnusedSpace() { compare(Areas.areaAt(panel, 40, 30), "tasks"); compare(Areas.areaAt(panel, 150, 30), "empty"); button.isWindow = false; // pinned launchers still count as buttons compare(Areas.areaAt(panel, 40, 30), "tasks"); button.visible = false; compare(Areas.areaAt(panel, 40, 30), "empty"); button.visible = true; } function test_trayAndUnrecognizedWidgetsKeepClicks() { compare(Areas.areaAt(panel, 240, 30), "tray"); compare(Areas.areaAt(panel, 300, 30), "other"); arbitraryWidget.visible = false; compare(Areas.areaAt(panel, 300, 30), "empty"); arbitraryWidget.visible = true; compare(Areas.areaAt(null, 40, 30), ""); } } }