mirror of
https://github.com/outbackdingo/hyprcosmic-session.git
synced 2026-08-25 14:53:23 +00:00
Point the autostart test at the wallpaper symlink
config/autostart now sets the wallpaper through the `current` symlink that `cosmic-conf import-theme --assets` maintains, rather than naming a file inside the theme directory. The test still asserted the old path and failed. The hazard it was written for is gone with it: the path no longer contains a space, because it no longer contains a theme name. That case is still covered on synthetic input by quotes_hold_arguments_containing_spaces_together, so this one now asserts what actually matters here -- that the script arrives as a single argument, that it names the link rather than one of the copies beside it, and that it waits for the daemon before setting an image. 11 profile tests pass.
This commit is contained in:
+35
-1
@@ -290,10 +290,44 @@ mod tests {
|
|||||||
fn the_shipped_autostart_parses_to_the_commands_it_documents() {
|
fn the_shipped_autostart_parses_to_the_commands_it_documents() {
|
||||||
let text = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../config/autostart"));
|
let text = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../config/autostart"));
|
||||||
let got = parse_extras(text);
|
let got = parse_extras(text);
|
||||||
assert_eq!(got.len(), 3, "{got:?}");
|
assert_eq!(got.len(), 5, "{got:?}");
|
||||||
// First, so its startup compile lands before the compositor settles.
|
// First, so its startup compile lands before the compositor settles.
|
||||||
assert_eq!(got[0], vec!["cosmic-conf", "watch"]);
|
assert_eq!(got[0], vec!["cosmic-conf", "watch"]);
|
||||||
assert_eq!(got[1][0], "waybar");
|
assert_eq!(got[1][0], "waybar");
|
||||||
assert_eq!(got[2], vec!["awww-daemon"]);
|
assert_eq!(got[2], vec!["awww-daemon"]);
|
||||||
|
// Last, so the fallback terminal is the topmost window.
|
||||||
|
assert_eq!(got[4], vec!["cosmic-term"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The wallpaper line is the one entry that is a shell invocation, so the
|
||||||
|
/// whole script has to arrive as a single argument. Getting the quoting
|
||||||
|
/// wrong splits it and awww sets nothing -- which is exactly the silent
|
||||||
|
/// blank screen this line was added to fix, so assert the argv rather than
|
||||||
|
/// trusting it by eye.
|
||||||
|
///
|
||||||
|
/// It once named a wallpaper directly and had to survive the space in
|
||||||
|
/// "Tokyo Night"; it now names the `current` symlink that
|
||||||
|
/// `cosmic-conf import-theme --assets` maintains, which has no space in it
|
||||||
|
/// and does not change when the theme does. Quoting a path that contains a
|
||||||
|
/// space is still covered, on synthetic input, by
|
||||||
|
/// `quotes_hold_arguments_containing_spaces_together`.
|
||||||
|
#[test]
|
||||||
|
fn the_wallpaper_line_survives_its_nested_quoting() {
|
||||||
|
let text = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../config/autostart"));
|
||||||
|
let argv = &parse_extras(text)[3];
|
||||||
|
assert_eq!(argv[0], "sh");
|
||||||
|
assert_eq!(argv[1], "-c");
|
||||||
|
// One argument, not several: the script stayed in one piece.
|
||||||
|
assert_eq!(argv.len(), 3, "{argv:?}");
|
||||||
|
// The symlink, not one of the copies beside it. Naming a copy would
|
||||||
|
// strand this line on a path the next theme import deletes.
|
||||||
|
assert!(
|
||||||
|
argv[2].contains(r#""/home/dingo/.local/share/wallpapers/hyprcosmic/current""#),
|
||||||
|
"{}",
|
||||||
|
argv[2]
|
||||||
|
);
|
||||||
|
// The daemon is not listening the instant it is forked, so the image
|
||||||
|
// must not be set until it answers.
|
||||||
|
assert!(argv[2].starts_with("until awww query"), "{}", argv[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user