Add dock module: dock-style quick launcher with magnifying app tiles
CI / test (push) Failing after 23s
CI / test (push) Failing after 23s
- lib/dock: tile layout, hit-testing, magnification, per-app colours (tested) - components/dock: plasmoid module (imports only app-catalog + app-launch) - shell: panel widgets now get pointer-move / pointer-leave while hovered Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79321790a1
commit
6fc921b431
15 files changed
+930
No files matched your search
@@ -0,0 +1,57 @@
|
||||
///|
|
||||
fn apps() -> Array[@types.AppEntry] {
|
||||
["a", "b", "c"].map(id => { id, name: id + "!", comment: "", category: "", glyph: id.to_upper() })
|
||||
}
|
||||
|
||||
///|
|
||||
test "tiles hit-test by slot and grow around the hovered one" {
|
||||
let h = 34
|
||||
assert_eq(tile_at(3, h, 0, 10), -1)
|
||||
assert_eq(tile_at(3, h, 12, 10), 0)
|
||||
assert_eq(tile_at(3, h, 12 + pitch(h), 10), 1)
|
||||
assert_eq(tile_at(3, h, 12 + 5 * pitch(h), 10), -1)
|
||||
assert_true(tile_size(1, 1, h) > tile_size(0, 1, h))
|
||||
assert_eq(tile_size(2, 0, h), base_size(h))
|
||||
}
|
||||
|
||||
///|
|
||||
test "click launches the app under the pointer; move sets hover" {
|
||||
let a = apps()
|
||||
let (hv, redraw, launch) = handle(a, -1, 34, PointerMove({ x: 12, y: 10 }))
|
||||
assert_eq(hv, 0)
|
||||
assert_true(redraw)
|
||||
assert_true(launch is None)
|
||||
let (_, _, launch) = handle(a, hv, 34, PointerDown({ x: 12 + pitch(34), y: 10 }))
|
||||
assert_eq(launch, Some("b"))
|
||||
let (hv, redraw, _) = handle(a, 0, 34, PointerLeave)
|
||||
assert_eq(hv, -1)
|
||||
assert_true(redraw)
|
||||
}
|
||||
|
||||
///|
|
||||
test "render draws one tile and glyph per app, capped at max_tiles" {
|
||||
let t : @theme.Tokens = {
|
||||
name: "t",
|
||||
palette: {
|
||||
desktop_top: @ui.color(0, 0, 0, 255),
|
||||
desktop_bottom: @ui.color(0, 0, 0, 255),
|
||||
surface: @ui.color(30, 30, 30, 255),
|
||||
surface_hover: @ui.color(40, 40, 40, 255),
|
||||
surface_popup: @ui.color(30, 30, 30, 255),
|
||||
foreground: @ui.color(255, 255, 255, 255),
|
||||
foreground_muted: @ui.color(150, 150, 150, 255),
|
||||
accent: @ui.color(60, 120, 220, 255),
|
||||
accent_foreground: @ui.color(255, 255, 255, 255),
|
||||
border: @ui.color(60, 60, 60, 255),
|
||||
},
|
||||
font_size: 14U,
|
||||
radius: 6U,
|
||||
spacing: 6U,
|
||||
panel_height: 44U,
|
||||
}
|
||||
assert_eq(render(@ui.size(preferred_width(3), 34), t, apps(), -1).length(), 1 + 3 * 2)
|
||||
let many = Array::makei(20, i => ({ id: i.to_string(), name: "n", comment: "", category: "", glyph: "x" } : @types.AppEntry))
|
||||
assert_eq(render(@ui.size(300, 34), t, many, 2).length(), 1 + max_tiles * 2)
|
||||
assert_eq(tile_name(apps(), 1), "b!")
|
||||
assert_eq(tile_name(apps(), 9), "")
|
||||
}
|
||||
Reference in new issue
Block a user