Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge PR #2336: Treat Unicode minus and dash characters as negative in parse_gps

aiongg551defa04ee2
diff --cc crates/engine/src/cmd/library.rs
index dc6fb5464,9249ed588..40d3e4197
--- a/crates/engine/src/cmd/library.rs
+++ b/crates/engine/src/cmd/library.rs
@@@ -1753,9 -1748,7 +1755,10 @@@ mod gps_tests
assert!((la - 51.50722).abs() < 1e-4 && (lo + 0.1275).abs() < 1e-4, "{la} {lo}");
let (la, lo) = p("33.8688 S, 151.2093 E").unwrap();
assert!((la + 33.8688).abs() < 1e-9 && (lo - 151.2093).abs() < 1e-9);
+ assert_eq!(p("51.5 N 0.1 W"), Some((51.5, -0.1)));
+ assert_eq!(p("N 51.5072 W 0.1276"), Some((51.5072, -0.1276)));
+ assert_eq!(p("S 33.8688 E 151.2093"), Some((-33.8688, 151.2093)));
+ assert_eq!(p("\u{2212}33.8688, 151.2093"), Some((-33.8688, 151.2093)));
assert_eq!(p("95, 10"), None);
assert_eq!(p("hello"), None);
}