fix(ci): compare editor directories against a fixture the Windows gate can match
Two tag_editor_qt tests compared editor_directory() — the parent() of a
file inside std::env::temp_dir() — against temp_dir() itself. On Windows
temp_dir() ends in a separator ("C:\...\Temp\") and Path::parent never
yields one, so the strings differ and the Windows Qt gate failed on every
run since 2026-08-28, the v2.1.0 tag push included. Linux never saw it.
Both tests now use a created subdirectory of temp, which normalises the
two sides on every platform.
cc
This commit is contained in:
1 file changed
+12
-2
@@ -2028,10 +2028,20 @@ mod tests {
|
|||||||
assert_eq!(editor_remote_source(&track), "plex");
|
assert_eq!(editor_remote_source(&track), "plex");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A fixture directory INSIDE the temp dir. `std::env::temp_dir()` itself
|
||||||
|
/// ends in a separator on Windows (`C:\...\Temp\`) while `Path::parent`
|
||||||
|
/// never yields one, so comparing the two strings failed the Windows gate
|
||||||
|
/// on every run since 2026-08-28. Joining a component normalises both.
|
||||||
|
fn fixture_directory(name: &str) -> std::path::PathBuf {
|
||||||
|
let directory = std::env::temp_dir().join(name);
|
||||||
|
std::fs::create_dir_all(&directory).expect("fixture directory");
|
||||||
|
directory
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sacd_editor_resolves_image_directory_and_refuses_direct_writes() {
|
fn sacd_editor_resolves_image_directory_and_refuses_direct_writes() {
|
||||||
let mut open = session_fixture();
|
let mut open = session_fixture();
|
||||||
let directory = std::env::temp_dir();
|
let directory = fixture_directory("qbz-editor-sacd-fixture");
|
||||||
let image = directory.join("Disc #1.iso");
|
let image = directory.join("Disc #1.iso");
|
||||||
for (index, track) in open.tracks.iter_mut().enumerate() {
|
for (index, track) in open.tracks.iter_mut().enumerate() {
|
||||||
track.file_path = qbz_disc::SacdRef {
|
track.file_path = qbz_disc::SacdRef {
|
||||||
@@ -2064,7 +2074,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn editor_directory_uses_real_parent_for_non_path_group_identity() {
|
fn editor_directory_uses_real_parent_for_non_path_group_identity() {
|
||||||
let directory = std::env::temp_dir();
|
let directory = fixture_directory("qbz-editor-location-fixture");
|
||||||
let file = directory.join("qbz-editor-location-fixture.flac");
|
let file = directory.join("qbz-editor-location-fixture.flac");
|
||||||
let track = LocalTrack {
|
let track = LocalTrack {
|
||||||
file_path: file.to_string_lossy().into_owned(),
|
file_path: file.to_string_lossy().into_owned(),
|
||||||
|
|||||||
Reference in new issue
Block a user