voelin-gpui: the banner test removes the sample pictures' folder it made

a_banner_is_drawn_under_a_veil opens the sample servers with their pictures,
which are files of a folder named voelin-gpui-demo-<pid>-N in the temporary
directory; the window's close removes it (AppState::shutdown), but the test
never closes the window and the entity of a gpui test is not released when the
test ends, so every run of the lib binary left a folder: eight runs with TMPDIR
pointing at an empty directory left eight. The test ends with the app's
shutdown now, after asserting that the folder was there and is gone; eight
runs leave TMPDIR empty.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-28 08:03:17 +03:00
1 parent 244226d15c
commit 5a5fd9978d
2 files changed
+14

No files matched your search

+6
View File
@@ -566,6 +566,12 @@ impl AppState {
std::mem::take(&mut *self.sent.borrow_mut())
}
/// The folder the sample pictures were written to, while there is one.
#[cfg(test)]
pub(crate) fn demo_dir(&self) -> Option<&PathBuf> {
self.demo_dir.as_ref()
}
/// A command for the session on screen.
fn command(&self, f: impl FnOnce(u64) -> Command) {
if let Some(id) = self.vm.current {
+8
View File
@@ -1289,6 +1289,14 @@ mod tests {
assert!(!tinted(cx, second));
click(cx, &format!("tree-channel-{second}"));
assert!(tinted(cx, second) && !tinted(cx, first), "and the tint follows the selection");
// The sample pictures are files of a folder of the state's own in the
// temporary directory; the window's close, as the app ends, removes it
// (the entity of a test is not released when the test ends).
let folder = shell.app.read_with(cx, |app, _| app.demo_dir().cloned());
assert!(folder.as_ref().is_some_and(|folder| folder.is_dir()), "{folder:?}");
shell.app.update(cx, |app, cx| app.shutdown(cx));
assert!(!folder.is_some_and(|folder| folder.exists()), "the close removes it");
}
/// A person who changes channel makes the rows between the two places