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,41 @@
|
||||
import QtQuick
|
||||
import QtTest
|
||||
import "../services/WallpaperPolicy.js" as Policy
|
||||
import "../services/Policy.js" as PreferencesPolicy
|
||||
|
||||
TestCase {
|
||||
name: "WallpaperPolicy"
|
||||
function test_local_paths() {
|
||||
const path = "/tmp/обои a '#%?.png";
|
||||
const url = Policy.localUrl(path);
|
||||
verify(url.startsWith("file:///tmp/"));
|
||||
verify(url.includes("%20"));
|
||||
verify(url.includes("%23"));
|
||||
compare(Policy.localUrl(url), url);
|
||||
compare(decodeURIComponent(url.slice(7)), path);
|
||||
compare(Policy.localUrl(""), "");
|
||||
}
|
||||
function test_reject_nonlocal() {
|
||||
for (const path of ["https://example.com/a.png", "../a.png", "~/a.png", "file://host/a.png", "file:///%GG", "file:///tmp/a%00b", "/tmp/a\u0000b", null]) {
|
||||
let rejected = false;
|
||||
try { Policy.localUrl(path); } catch(e) { rejected = true; }
|
||||
verify(rejected, String(path));
|
||||
}
|
||||
}
|
||||
function test_override_and_disable() {
|
||||
const wallpapers = {"*": "/tmp/all.png", "DP-1": ""};
|
||||
compare(Policy.sourceFor(wallpapers, "DP-1"), "");
|
||||
compare(Policy.sourceFor(wallpapers, "HDMI-A-1"), "file:///tmp/all.png");
|
||||
compare(Policy.sourceFor(undefined, "DP-1"), "");
|
||||
}
|
||||
function test_schema_compatibility() {
|
||||
const prefs = {version: 1, mode: "auto", theme: "dark", touch: false, reducedMotion: false, outputs: {}};
|
||||
compare(PreferencesPolicy.validate(prefs).version, 1);
|
||||
prefs.wallpapers = {"*": "/tmp/a.png"};
|
||||
compare(PreferencesPolicy.validate(prefs).wallpapers["*"], "/tmp/a.png");
|
||||
prefs.wallpapers = {"*": "https://example.com/a.png"};
|
||||
let rejected = false;
|
||||
try { PreferencesPolicy.validate(prefs); } catch(e) { rejected = true; }
|
||||
verify(rejected);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user