// SPDX-License-Identifier: MIT import QtQuick import QtTest TestCase { name: "PanelConfiguration" function test_savedValuesAndDefaults() { const component = Qt.createComponent("../src/ConfigGeneral.qml"); compare(component.status, Component.Ready, component.errorString()); const config = component.createObject(this, { width: 600, height: 800, cfg_emptyAction: "brightness", cfg_tasksAction: "normal", cfg_launcherAction: "volume", cfg_clockAction: "keyboard", cfg_trayAction: "desktops", cfg_otherAction: "normal", cfg_leftClick: "mute", cfg_middleClick: "overview", cfg_leftDoubleClick: "command", cfg_leftDoubleClickCommand: "true", cfg_middleDoubleClick: "application", cfg_middleDoubleClickApplication: "test.desktop", applications: [{text: "Test application", value: "test.desktop"}], cfg_spacerLength: 100 }); verify(config !== null); compare(findChild(config, "emptyAction").currentValue, "brightness"); compare(findChild(config, "tasksAction").currentValue, "normal"); compare(findChild(config, "leftDoubleClick").currentValue, "command"); compare(findChild(config, "leftDoubleClickCommand").text, "true"); compare(findChild(config, "middleDoubleClickApplication").currentValue, "test.desktop"); config.cfg_emptyAction = "keyboard"; compare(findChild(config, "emptyAction").currentValue, "keyboard"); findChild(config, "restoreDefaults").clicked(); for (const area of ["empty", "tasks", "launcher", "clock", "tray", "other"]) { compare(config["cfg_" + area + "Action"], "volume"); compare(findChild(config, area + "Action").currentValue, "volume"); } compare(config.cfg_leftClick, "normal"); compare(config.cfg_middleClick, "normal"); compare(config.cfg_leftDoubleClick, "normal"); compare(config.cfg_middleDoubleClick, "normal"); compare(config.cfg_leftDoubleClickCommand, ""); compare(config.cfg_middleDoubleClickApplication, ""); compare(config.cfg_spacerLength, 48); config.destroy(); component.destroy(); } }