Medlar/docs/tests/S027-rules-clipboard-drop.md
2026-11-26 02:36:15 -06:00

4.5 KiB

S027 — Rules, clipboard, drag and drop, drop target: test file

Written by the worker that built it, run by the test phase. Nothing here has been tested until its Result says so.

Built

  • crates/core/src/rules.rs · Rule, Item, first, apply, expand (name templates), unique/free_name, glob, defaults; unit tests inside.
  • crates/app/src/clipboard.rs · links filter, Watch thread (arboard), copy marks own copies; one unit test inside.
  • crates/app/src/drop.rs · requests (dropped paths to Add requests), overlay (full-window state).
  • crates/app/src/views/target.rs · floating ring window with menu. views/rules.rs · rules page, editor, test box, clipboard note. Settings pages Rules and Clipboard (views/settings/rows.rs). App::extras wires all.
  • views/add/mod.rs tasks() applies the rules.

Checks

# Risk Do this Expect How Result
1 HIGH nice cargo test -j 2 -p medlar-core rules all rules tests green unit pass
2 HIGH Template {nope}x/../{name} on b%2Fc.tar.gz no path part in the result; b_c.tar.gz unit pass (existing unit test)
3 HIGH Rule folder ../../etc with base /home/u/Downloads folder is /home/u/Downloads/etc unit pass (existing unit test)
4 MED Two rules fit; disable the first the second one counts unit pass (existing)
5 MED Size unknown against a rule with min 100 MB the rule still fits unit pass (existing)
6 MED Add three links of the same template name a.zip names a.zip, a (2).zip, a (3).zip unit pass (existing)
7 MED nice cargo test -j 2 -p medlar clipboard filters by type and host work unit pass
8 HIGH Clipboard set to Ask, copy https://a.test/x.zip (X11/XWayland or data-control) Add window opens with the link once; copying it again does nothing by hand pass: S044 hidden run C (release build, nested niri, wl-copy): Add window with the link; same copy again does nothing; a second link opens it again. S037 failure was before the first-copy fix reached the release build
9 HIGH Clipboard Ask, press copy in Medlar (details value) no Add window (own copy ignored) by hand pass: unit clipboard::tests::own_copy_is_not_news (the watcher's check is now this pure function)
10 MED Clipboard Add, copy a link already in the list nothing is added by hand not run: needs live compositor/clipboard/hidden session
11 MED Clipboard Off, copy a link, then switch to Ask the old copy is not offered by hand not run: needs live compositor/clipboard/hidden session
12 MED Rules page: add default set, edit one, move, disable, delete and undo list follows; undo brings it back; settings file keeps rules screen not run: scene shows list and empty state only; no interaction
13 MED Rules test box with https://x.test/movie.mp4 shows rule Video and folder below the download folder screen not run
14 MED Add dialog with a link that a rule catches, folder not touched download lands in the rule's folder, queue and priority screen not run: needs live compositor/clipboard/hidden session
15 MED Hidden run: drag a .txt list over the window full-window drop state shows; on release Add opens with the list screen not run: needs live compositor/clipboard/hidden session
16 LOW Drop target switch on, hidden nested niri small ring window with speed; right click menu; Hide switches the setting off screen not run: needs live compositor/clipboard/hidden session
17 LOW Old settings file without the new keys opens with defaults (rules empty, clipboard off) unit not run

Needs

Throwaway XDG_* home; hidden niri via tools/hidden.sh; never the user's clipboard history. Clipboard checks need a compositor with data-control or XWayland.

Doubts

  • Always-on-top is a hint; niri ignores it, no layer-shell used. The ring is an ordinary small window there.
  • winit delivers dropped files as paths only; dragging a link from a browser may not arrive at all.
  • The clipboard thread polls once a second even when no window is focused; on Wayland without data-control it does nothing and the page says so.
  • The ring's menu grows the window instead of a popup (a popup would be clipped); sizes untested.
  • Default rule names are English and not in the catalogue; rules apply only in the Add window path (also clipboard add), not CLI.
  • Settings undo keys for new rows are by name only; existing settings tests that count pages or rows may need updating.