aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/monitors/test_mon.js
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-30 20:36:17 +0100
committerDanilo M. <danix@danix.xyz>2026-10-30 20:36:17 +0100
commit29d0c022b1557cef6b93efbc76734b816b92f62e (patch)
treea780be5c1704a18a2d9d8efcd5b965a215d9b006 /desktop/modules/monitors/test_mon.js
parentffe1a7ccdd51f760fa1e742c0d09cc229a405544 (diff)
downloadquickshell-29d0c022b1557cef6b93efbc76734b816b92f62e.tar.gz
quickshell-29d0c022b1557cef6b93efbc76734b816b92f62e.zip
monitors: draw a scale being typed at 1
The page binds the canvas to size(), and an empty or partial scale gave Infinity or NaN and broke the fit. Apply is still held back until the scale is a positive number. Also marks the per-axis snap as a ceiling and checks a rotated scaled monitor and a two-monitor file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/monitors/test_mon.js')
-rw-r--r--desktop/modules/monitors/test_mon.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/desktop/modules/monitors/test_mon.js b/desktop/modules/monitors/test_mon.js
index 6b12ee7..5d28ce4 100644
--- a/desktop/modules/monitors/test_mon.js
+++ b/desktop/modules/monitors/test_mon.js
@@ -40,6 +40,9 @@ assert.deepStrictEqual([d.mode, d.scale, d.transform, d.vrr, d.position, d.x, d.
// Logical size: an odd transform swaps, scale divides.
assert.deepStrictEqual(M.size("1920x1080@100.00", "1", 1), { w: 1080, h: 1920 });
assert.deepStrictEqual(M.size("2560x1440@60.00", "1.25", 0), { w: 2048, h: 1152 });
+assert.deepStrictEqual(M.size("2560x1440@60.00", "2", 7), { w: 720, h: 1280 });
+// A scale mid-typing draws at 1 rather than Infinity or NaN.
+assert.deepStrictEqual(M.size("1920x1080@60.00", "", 0), { w: 1920, h: 1080 });
// Exact positions parse, auto ones fall back to where Hyprland put it.
assert.deepStrictEqual(M.xy({ position: "-1080x-960", x: 0, y: 0 }), { x: -1080, y: -960 });
@@ -55,6 +58,9 @@ assert.ok(M.lua(Object.assign({}, d, { vrr: true })).endsWith("transform = 1, vr
const f = M.file([d]);
assert.ok(f.startsWith("-- Monitors, written by the keystone settings window"));
assert.ok(f.includes("-- DP-3: ASUS VG279Q3A\n" + M.lua(d) + "\n"));
+// Two monitors, in order, a blank line before each.
+const two = M.file([d, Object.assign({}, d, { name: "DP-1" })]);
+assert.ok(two.indexOf("-- DP-3") < two.indexOf("-- DP-1") && two.includes(M.lua(d) + "\n\n-- DP-1"));
// Snapping: DP-1 is 2560x1080 at 0,-540. A 1080x1920 monitor dropped with
// its right edge 30px short of DP-1's left edge snaps flush; 200px short