Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/features/tray/fixtures/load.qml

Raw
import QtQuick
import QtQuick.Window
import Quickshell
import "../../.." as N
import "../../../features/tray" as TrayFeature

// `just load-test tray`: the registry entry's own panel, bound to the tray
// double the load harness overlays. One item renders, then emptying the double
// flips the entry's empty flag and shows the empty state. No SystemTray,
// compositor, input, or pixels.
ShellRoot {
    id: root

    readonly property N.FeatureEntry feature: registry.popup("tray")
    property bool emptied: false
    // The overlaid double's fixture surface; production Tray has no setEmpty.
    readonly property var trayDouble: registry.tray

    function finish(): void {
        const panel = loader.item as TrayFeature.TrayPanel;
        if (!panel || panel.contentHeight <= 0)
            return;
        if (!root.emptied) {
            if (panel.items.length === 1 && !root.feature.empty && root.feature.barLabel === "tray" && root.feature.barActive) {
                root.emptied = true;
                root.trayDouble.setEmpty(true);
            }
            return;
        }
        if (!panel.hasItems && root.feature.empty && root.feature.barLabel === "tray" && !root.feature.barActive) {
            console.log("load tray: PASS");
            Qt.quit();
        }
    }

    N.Theme {
        id: nuguTheme
    }

    N.Registry {
        id: registry

        theme: nuguTheme
    }

    // Plain Window: Quickshell windows set input masks the offscreen platform rejects.
    Window {
        width: 504
        height: 424
        visible: true
        color: "transparent"

        Loader {
            id: loader

            anchors.fill: parent
            sourceComponent: root.feature ? root.feature.panel : null
        }
    }

    Timer {
        interval: 25
        running: true
        repeat: true
        onTriggered: root.finish()
    }

    Timer {
        interval: 5000
        running: true
        onTriggered: {
            console.error("ERROR load tray: registry panel never rendered its populated and empty fixture states");
            Qt.quit();
        }
    }
}