Skip to content

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

Merge PR #339

Claude7b082660e7e3
diff --cc apps/lightcraft/src/main.rs
index 409519be6,4f838e323..97aa338b0
--- a/apps/lightcraft/src/main.rs
+++ b/apps/lightcraft/src/main.rs
@@@ -744,16 -626,17 +754,27 @@@ mod tests
assert!(!b.is_empty());
}
+ /// Issue #234: Windows opens links with the URL protocol handler (the default browser), not
+ /// File Explorer, and passes the whole map link, `?`, `&` and `#` included, as one argument.
+ #[test]
+ fn windows_links_open_in_the_browser() {
+ let url = "https://www.openstreetmap.org/?mlat=48.856600&mlon=2.352200#map=15/48.856600/2.352200";
+ let c = windows_open_url_command(url);
+ assert_eq!(c.get_program(), "rundll32");
+ let args: Vec<&std::ffi::OsStr> = c.get_args().collect();
+ assert_eq!(args, ["url.dll,FileProtocolHandler", url]);
+ }
+
+ #[test]
+ fn a_control_port_that_is_not_a_number_is_ignored() {
+ assert_eq!(control_port_from("--control", Some("7980".into())), Some(7980));
+ assert_eq!(control_port_from("--control", Some(" 18001 ".into())), Some(18001));
+ assert_eq!(control_port_from("--control", Some("nope".into())), None);
+ assert_eq!(control_port_from("--control", Some(String::new())), None);
+ assert_eq!(control_port_from("--control", Some("70000".into())), None);
+ assert_eq!(control_port_from("LIGHTCRAFT_CONTROL_PORT", None), None);
+ }
+
#[test]
fn ui_json_is_written_atomically() {
let d = dir("atomic");