From 0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Sat, 15 Feb 2025 14:56:00 +0200 Subject: Checkpoint: preserve all uncommitted rust-rewrite worktree work Safety commit before reconciling this worktree with main, which has diverged with its own separate fixes today. Nothing here is reviewed or curated yet - this exists purely so none of this work can be lost to a git operation, disk issue, or worktree cleanup while that reconciliation happens. --- crates/wayland/src/state/tests.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'crates/wayland/src/state/tests.rs') diff --git a/crates/wayland/src/state/tests.rs b/crates/wayland/src/state/tests.rs index bccbae2..8d1d8b3 100644 --- a/crates/wayland/src/state/tests.rs +++ b/crates/wayland/src/state/tests.rs @@ -2,12 +2,15 @@ #[test] fn focused_window_keeps_its_configured_colour() { - assert_eq!(effective_border_color((136, 192, 208), true), (136, 192, 208)); + // The dim factor is irrelevant when focused - passing an + // obviously-wrong one here doubles as proof the early return never + // even looks at it. + assert_eq!(effective_border_color((136, 192, 208), true, 0.0), (136, 192, 208)); } #[test] fn unfocused_window_is_dimmed_but_still_recognisably_that_colour() { - let dimmed = effective_border_color((136, 192, 208), false); + let dimmed = effective_border_color((136, 192, 208), false, 0.35); // Dimmer in every channel... assert!(dimmed.0 < 136 && dimmed.1 < 192 && dimmed.2 < 208); // ...but not black, and the channels' relative order is preserved @@ -18,6 +21,15 @@ assert!(dimmed.2 >= dimmed.1 && dimmed.1 >= dimmed.0); } + #[test] + fn inactive_dim_factor_is_actually_configurable() { + // `theme.decorations.border.inactive_dim` - `1.0` keeps an + // unfocused border identical to focused, `0.0` removes it entirely + // (fully black, matching every channel scaled to zero). + assert_eq!(effective_border_color((136, 192, 208), false, 1.0), (136, 192, 208)); + assert_eq!(effective_border_color((136, 192, 208), false, 0.0), (0, 0, 0)); + } + #[test] fn window_anim_starts_at_from_and_ends_at_to() { let anim = WindowAnim { -- cgit v1.2.3