diff options
| author | srdusr <[email protected]> | 2025-02-15 14:56:00 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2025-02-15 14:56:00 +0200 |
| commit | 0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd (patch) | |
| tree | 7672d0af277664f457c6c9462925c0005fe35dcf /crates/wayland/src/state/tests.rs | |
| parent | 413daa7ba2ea0ebd1424c024fd0566423aaea3f8 (diff) | |
| download | srdwm-0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd.tar.gz srdwm-0a4c4b5941fe982ccb3d3175e26d9d83f0025ffd.zip | |
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.
Diffstat (limited to 'crates/wayland/src/state/tests.rs')
| -rw-r--r-- | crates/wayland/src/state/tests.rs | 16 |
1 files changed, 14 insertions, 2 deletions
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 @@ -19,6 +22,15 @@ } #[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 { from: srdwm_core::Rect::new(0, 100, 300, 200), |