voelin-gpui: the sample pictures only when asked and removed at close; two small fixes

- The sample servers' pictures were written to a folder of the temporary
  directory by every state that showed them, tests included, and the folder
  went only with a dropped state, which the test platform and a killed run
  never do. The pictures are now a switch (Switches::demo_pictures: what
  VOELIN_DEMO_UI sets, and what a test asks for by name) and the folder is
  removed when the window closes (AppState::shutdown) as well as with the
  state.
- The tree does not redraw for a change of the people's count, which is the
  members panel's, and an unfolded channel leaves no empty entry in what the
  trees remember.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-28 00:40:25 +03:00
1 parent 68a1694d7b
commit faef1325ab
4 files changed
+83 -34

No files matched your search

+11 -2
View File
@@ -8,7 +8,9 @@
//! other pages do not exist here yet; they are named in a warning and
//! skipped.
//! - `VOELIN_DEMO_UI=1`: the Slint front end's sample servers, shown through
//! the app's own events; nothing is sent to the engine or kept in the store.
//! the app's own events, with their pictures as files of a folder in the
//! temporary directory (removed when the window closes); nothing is sent to
//! the engine or kept in the store.
//! - `VOELIN_DEMO_SERVER=2`: with `VOELIN_DEMO_UI`, the sample server on
//! screen, counting from 0 (the first, which is connected and populated, is
//! the default; the second is observed, the third not connected).
@@ -42,6 +44,11 @@ pub struct Switches {
pub open: Page,
/// Show the sample servers instead of the stored ones.
pub demo_ui: bool,
/// Write the sample servers' pictures to a folder of the temporary
/// directory and deliver them: what the binary does with the sample
/// servers, and what a test asks for by name (a test that does not leaves
/// nothing behind).
pub demo_pictures: bool,
/// The sample server to show, by its place in the list, when the switch
/// names one.
pub demo_server: Option<usize>,
@@ -63,6 +70,7 @@ impl Default for Switches {
Self {
open: Page::Shell,
demo_ui: false,
demo_pictures: false,
demo_server: None,
demo_talk: None,
theme: None,
@@ -125,6 +133,7 @@ impl Switches {
}
let flag = |name: &str| get(name).is_some_and(|v| !matches!(v.trim(), "" | "0"));
switches.demo_ui = flag("VOELIN_DEMO_UI");
switches.demo_pictures = switches.demo_ui;
switches.meter = flag("VOELIN_METER");
switches
}
@@ -167,7 +176,7 @@ mod tests {
("VOELIN_METER", "1"),
]);
assert_eq!(s.open, Page::Swatch);
assert!(s.demo_ui);
assert!(s.demo_ui && s.demo_pictures, "the sample servers come with their pictures");
assert_eq!(s.demo_server, Some(2));
assert_eq!(s.demo_talk, Some(10.0));
assert_eq!(s.theme, Some(Choice::Light));