Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

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

Raw
import QtQuick
import QtQuick.Window
import Quickshell
import "../../.." as N
import "../../../features/system" as SystemFeature

// `just load-test system`: the registry entry's own panel, bound to the Resources
// double the load harness overlays. Entry opening enables the service's polling gate,
// turns its agent dispatch into the host close request, and follows the double
// to the all-clear state. No journal, processes, compositor, input, or pixels.
ShellRoot {
    id: root

    readonly property N.FeatureEntry feature: registry.popup("system")
    property int step: 0
    property string closeReason: ""
    // The overlaid double's fixture surface; production Resources has no agentResult.
    readonly property var resourcesDouble: registry.system

    function finish(): void {
        const panel = loader.item as SystemFeature.SystemPanel;
        if (!panel)
            return;
        if (root.step === 0 && root.feature.width === 780 && root.feature.height === 600 && root.resourcesDouble.popupOpen && panel.conditions.some(issue => issue.id === "fixture-unit")) {
            root.step = 1;
            panel.closeRequested.connect(reason => root.closeReason = reason);
            root.resourcesDouble.agentResult(true);
        } else if (root.step === 1 && root.closeReason === "agent-dispatched") {
            root.step = 2;
            root.resourcesDouble.clear();
        } else if (root.step === 2 && panel.conditions.length === 0 && panel.incidents.length === 0) {
            console.log("load system: PASS");
            Qt.quit();
        }
    }

    N.Theme {
        id: nuguTheme
    }

    N.Registry {
        id: registry

        theme: nuguTheme
    }

    Component.onCompleted: root.feature.opening()

    // Plain Window: Quickshell windows set input masks the offscreen platform rejects.
    Window {
        width: 764
        height: 584
        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 system: the panel never followed the double");
            Qt.quit();
        }
    }
}