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,34 @@
|
||||
import QtQuick
|
||||
import QtTest
|
||||
import "../services/NotificationPolicy.js" as Policy
|
||||
|
||||
TestCase {
|
||||
name: "NotificationPolicy"
|
||||
function test_timeout() {
|
||||
compare(Policy.timeoutMs(-1, 0), 3000);
|
||||
compare(Policy.timeoutMs(-1, 1), 6000);
|
||||
compare(Policy.timeoutMs(250, 1), 250);
|
||||
compare(Policy.timeoutMs(0, 1), 0);
|
||||
compare(Policy.timeoutMs(1, 2), 0);
|
||||
compare(Policy.timeoutMs(1e20, 1), 2147483647);
|
||||
}
|
||||
function entry(key) { return {key: key, appName: "Test", summary: "Summary", body: "Body", state: "received", urgency: 1, time: 100}; }
|
||||
function test_history_limit_and_replace() {
|
||||
let history = [];
|
||||
for (let i = 0; i < 110; i++) history = Policy.upsert(history, entry(String(i)));
|
||||
compare(history.length, 100);
|
||||
compare(history[0].key, "109");
|
||||
const replacement = entry("109"); replacement.summary = "Updated";
|
||||
history = Policy.upsert(history, replacement);
|
||||
compare(history.length, 100);
|
||||
compare(history[0].summary, "Updated");
|
||||
}
|
||||
function test_validation() {
|
||||
compare(Policy.validate({version: 1, entries: [entry("a")]}).length, 1);
|
||||
for (const invalid of [{version: 2, entries: []}, {version: 1, entries: [entry("a"), entry("a")]}, {version: 1, entries: [{key: "bad"}]}, {version: 1, entries: [Object.assign(entry("a"), {deadline: "soon"})]}]) {
|
||||
let rejected = false;
|
||||
try { Policy.validate(invalid); } catch(e) { rejected = true; }
|
||||
verify(rejected);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user