mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-31 21:56:50 -06:00
Merge pull request #1778 from dotCooCoo/fix/link-tests-on-windows
Links: the folder relink and IDML link tests expect Windows paths on Windows
This commit is contained in:
@@ -605,8 +605,10 @@ mod tests {
|
||||
for link in links {
|
||||
let (idml, _) = linked_idml(link, false).unwrap();
|
||||
let (doc, seen) = crate::io::touched(|| import(&idml, Some(&package)).unwrap());
|
||||
// Beside the package, and the link itself where it is on this computer.
|
||||
assert!(seen.iter().all(|p| p.starts_with(&dir) || p == std::path::Path::new(link)), "{link}: {seen:?}");
|
||||
// Beside the package, and the link itself where it is on this computer (on Windows,
|
||||
// `/dev/zero` is `\dev\zero` on the package's drive).
|
||||
let itself = crate::io::document_path(link, Some(&package)).ok();
|
||||
assert!(seen.iter().all(|p| p.starts_with(&dir) || itself.as_ref() == Some(p)), "{link}: {seen:?}");
|
||||
let asset = doc.assets.values().next().unwrap();
|
||||
assert!(asset.data.is_empty(), "{link}");
|
||||
assert_eq!(super::super::links::status(asset, None), "missing", "{link}");
|
||||
|
||||
@@ -858,7 +858,7 @@ mod tests {
|
||||
assert_eq!(a.pixels, Some((60, 20)));
|
||||
assert_eq!(a.mime, "application/postscript");
|
||||
assert_eq!(a.data.as_slice(), eps(30).as_bytes());
|
||||
let moved = dir.join("new/replacement.eps");
|
||||
let moved = dir.join("new").join("replacement.eps");
|
||||
std::fs::rename(&replacement, &moved).unwrap();
|
||||
assert_eq!(s.execute("links.relinkFolder", &json!({"dir": dir.join("new").to_string_lossy()})).unwrap()["relinked"], 1);
|
||||
assert_eq!(s.doc().unwrap().doc.assets[&aid].link.as_deref(), moved.to_str());
|
||||
|
||||
Reference in New Issue
Block a user