From e388ed46c02e8f283b42f0880feefed4fe73f3d6 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 17 Nov 2026 21:43:23 +0000 Subject: [PATCH] browse: link and relink tests use paths that are absolute on Windows --- crates/browse/src/links/tests.rs | 17 ++++++++++------- crates/browse/tests/it/relink.rs | 8 ++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/crates/browse/src/links/tests.rs b/crates/browse/src/links/tests.rs index d667d0ec6..fa5cb12cb 100644 --- a/crates/browse/src/links/tests.rs +++ b/crates/browse/src/links/tests.rs @@ -49,18 +49,21 @@ fn monitor(files: &Arc, jobs: &Arc) -> LinkMonitor { LinkMonitor::new(files.clone(), jobs.clone(), Wake::none()) } +/// Absolute on every platform: a link path that is not is refused as invalid. +const FILE: &str = if cfg!(windows) { r"C:\p\a.png" } else { "/p/a.png" }; + // A file changes once: one LinkChange Ok -> Modified, and nothing on the following passes. #[trial] fn the_monitor_reports_a_change_once() { - let files = Disk::new(FakeLinkFiles::new().with("/p/a.png", b"abc", 1)); - let a = link(1, "/p/a.png", files.identity_of("/p/a.png")); + let files = Disk::new(FakeLinkFiles::new().with(FILE, b"abc", 1)); + let a = link(1, FILE, files.identity_of(FILE)); let jobs = Arc::new(ManualJobs::new()); let mut m = monitor(&files, &jobs); m.set(&[a], None); jobs.run_all(); assert_eq!(m.take_changes(), vec![LinkChange { key: 1, before: None, status: LinkStatus::Ok }]); - files.change(FakeLinkFiles::new().with("/p/a.png", b"abcd", 2)); + files.change(FakeLinkFiles::new().with(FILE, b"abcd", 2)); m.window_focused(); jobs.run_all(); assert_eq!(m.take_changes(), vec![LinkChange { key: 1, before: Some(LinkStatus::Ok), status: LinkStatus::Modified }]); @@ -77,10 +80,10 @@ fn the_monitor_reports_a_change_once() { // A check that finished before the link was updated is stale when it is taken in: it reports nothing, and the newer check decides. #[trial] fn a_check_older_than_known_now_is_dropped() { - let files = Disk::new(FakeLinkFiles::new().with("/p/a.png", b"abc", 1)); - let old = link(1, "/p/a.png", files.identity_of("/p/a.png")); - files.change(FakeLinkFiles::new().with("/p/a.png", b"abcd", 2)); - let updated = link(1, "/p/a.png", files.identity_of("/p/a.png")); + let files = Disk::new(FakeLinkFiles::new().with(FILE, b"abc", 1)); + let old = link(1, FILE, files.identity_of(FILE)); + files.change(FakeLinkFiles::new().with(FILE, b"abcd", 2)); + let updated = link(1, FILE, files.identity_of(FILE)); let jobs = Arc::new(ManualJobs::new()); let mut m = monitor(&files, &jobs); m.set(&[old], None); diff --git a/crates/browse/tests/it/relink.rs b/crates/browse/tests/it/relink.rs index 4de218139..275dc78d0 100644 --- a/crates/browse/tests/it/relink.rs +++ b/crates/browse/tests/it/relink.rs @@ -101,11 +101,15 @@ fn linked_keys(result: &DialogResult>) -> (Vec, Vec (outcome.linked.iter().map(|(key, _)| *key).collect(), outcome.offline.clone()) } +/// A folder path is absolute only with a drive on Windows. +const DRIVE: &str = if cfg!(windows) { "D:" } else { "" }; + #[trial] fn relink_others_offers_the_rows_the_remap_fits() { - let files = files(&[("/T7/shoot/a.mov", SAME), ("/T7/shoot/b.mov", SAME), ("/T7/shoot/c.mov", OTHER)]); + let files = + files(&[(&format!("{DRIVE}/T7/shoot/a.mov"), SAME), (&format!("{DRIVE}/T7/shoot/b.mov"), SAME), (&format!("{DRIVE}/T7/shoot/c.mov"), OTHER)]); let rows = vec![row(1, "Clip A", "C:\\shoot\\a.mov"), row(2, "Clip B", "C:\\shoot\\b.mov"), row(3, "Clip C", "C:\\shoot\\c.mov")]; - let mut rig = rig(rows, &files, "/T7/shoot", true, true); + let mut rig = rig(rows, &files, &format!("{DRIVE}/T7/shoot"), true, true); rig.search(); rig.click("Link"); rig.jobs.run_all();