added adaptive quickshell
This commit is contained in:
1 parent
6eb56d2065
commit
5b33a73fd8
189 files changed
+8678
-15
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import QtQuick
|
||||
import QtTest
|
||||
import "../services/HardwarePolicy.js" as Policy
|
||||
|
||||
TestCase {
|
||||
name: "HardwarePolicy"
|
||||
function test_ethernet_only() {
|
||||
const devices = [{type: 2, name: "enp3s0", connected: true}, {type: 2, name: "enp4s0", connected: false}];
|
||||
const caps = Policy.networkCapabilities(devices, 1, 2);
|
||||
compare(caps.wifi, false);
|
||||
compare(caps.wired.length, 2);
|
||||
compare(Policy.ethernetSummary(caps.wired), "Ethernet · 1/2");
|
||||
}
|
||||
function test_disabled_wifi_remains_visible() {
|
||||
const caps = Policy.networkCapabilities([{type: 1, enabled: false}], 1, 2);
|
||||
compare(caps.wifi, true);
|
||||
compare(caps.wired.length, 0);
|
||||
}
|
||||
function test_hotplug_recomputed() {
|
||||
const initial = Policy.networkCapabilities([], 1, 2);
|
||||
const plugged = Policy.networkCapabilities([{type: 2, connected: false}], 1, 2);
|
||||
compare(initial.hasNetworkDevices, false);
|
||||
compare(plugged.hasNetworkDevices, true);
|
||||
compare(Policy.ethernetSummary(plugged.wired), "Ethernet · нет подключения");
|
||||
}
|
||||
function test_battery_hotplug() {
|
||||
const withBattery = Policy.visibleSettingsSections(false, false, false, false, true);
|
||||
compare(withBattery.map(s => s.id).join(","), "appearance,wallpaper,battery,system");
|
||||
compare(Policy.pageIndex("battery"), 7);
|
||||
compare(Policy.visibleSettingsSections(false, false, false, false, false).some(s => s.id === "battery"), false);
|
||||
}
|
||||
function test_settings_capabilities() {
|
||||
const sections = Policy.visibleSettingsSections(false, true, false);
|
||||
compare(sections.map(s => s.id).join(","), "appearance,network,wallpaper,system");
|
||||
}
|
||||
function test_settings_order_and_pages() {
|
||||
const sections = Policy.visibleSettingsSections(true, true, true);
|
||||
compare(sections.map(s => s.id).join(","), "appearance,audio,network,wallpaper,bluetooth,system");
|
||||
compare(Policy.sectionIndex(sections, "bluetooth"), 4);
|
||||
compare(Policy.pageIndex("bluetooth"), 4);
|
||||
compare(Policy.pageIndex("network"), 2);
|
||||
}
|
||||
function test_hotplug_removes_section_without_reindexing_page() {
|
||||
const plugged = Policy.visibleSettingsSections(false, true, true);
|
||||
const unplugged = Policy.visibleSettingsSections(false, true, false);
|
||||
compare(Policy.sectionIndex(plugged, "bluetooth"), 3);
|
||||
compare(Policy.sectionIndex(unplugged, "bluetooth"), -1);
|
||||
compare(Policy.pageIndex("network"), 2);
|
||||
compare(Policy.pageIndex("missing"), 0);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user