Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

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

Raw
import QtQuick
import QtQuick.Window
import Quickshell
import "../../.." as N
import "../../../features/vault" as VaultFeature

// `just load-test vault`: the registry entry's own panel, bound to the vault
// double the load harness overlays. A real SurfaceManager opens the entry, so the
// host's `opening` reaches the double and the registry's panelOpen follows the
// popup; unlocking turns the chip active and fills the results. No native vault
// boundary, compositor, input, or pixels.
ShellRoot {
    id: root

    readonly property N.FeatureEntry feature: featureRegistry.popup("vault")
    property int step: 0
    // The overlaid double's fixture surface; production Vault has no `opens`.
    readonly property var vaultDouble: featureRegistry.vault

    function finish(): void {
        const panel = loader.item as VaultFeature.VaultPanel;
        if (!panel)
            return;
        if (root.step === 0 && panel.locked && !root.feature.barActive && root.feature.width === 840 && root.feature.height === 580 && root.vaultDouble.opens === 0 && !root.vaultDouble.panelOpen) {
            root.step = 1;
            surfaceManager.openRegisteredPopup("vault");
        } else if (root.step === 1 && root.vaultDouble.opens === 1 && root.vaultDouble.context === "" && root.vaultDouble.panelOpen) {
            root.step = 2;
            root.vaultDouble.unlock("");
        } else if (root.step === 2 && !panel.locked && root.feature.barActive && root.vaultDouble.visibleItems.length === 20 && root.vaultDouble.selectedId === "item-0") {
            root.step = 3;
            surfaceManager.closePopup("escape-key");
        } else if (root.step === 3 && !root.vaultDouble.panelOpen && root.vaultDouble.opens === 1) {
            console.log("load vault: PASS");
            Qt.quit();
        }
    }

    N.Theme {
        id: nuguTheme
    }

    N.Registry {
        id: featureRegistry

        theme: nuguTheme
        surfaces: surfaceManager
    }

    N.SurfaceManager {
        id: surfaceManager

        registry: featureRegistry
    }

    // Plain Window: Quickshell windows set input masks the offscreen platform rejects.
    Window {
        width: 808
        height: 548
        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 vault: the entry never followed the double through opening and unlock");
            Qt.quit();
        }
    }
}