summaryrefslogtreecommitdiff
path: root/tests/integration.rs
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2026-05-02 20:23:21 +0300
committerAsko Nõmm <asko@nmm.ee>2026-05-02 20:24:26 +0300
commita5024b35f61cf58c01a0731b9d1ca8adf872b0a8 (patch)
tree9c6ab792ba9821ee63d7013a86dbe57889ab6be5 /tests/integration.rs
parent7a01ab83f3f8db5538fdf76dad8f6c5eee805e64 (diff)
Fix Chrome notifications not matching due to space vs hyphen in app nameHEADmaster
Normalize separators (hyphens, spaces, underscores) during pattern matching so that Chrome's app_name "Google Chrome" matches KWin's desktopFile "google-chrome".
Diffstat (limited to 'tests/integration.rs')
-rw-r--r--tests/integration.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration.rs b/tests/integration.rs
index e4bd9f8..b009b1f 100644
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -273,3 +273,40 @@ signal time=1700000000.400 sender=:1.1 -> destination=(null destination) serial=
("application://org.mozilla.firefox.desktop".into(), 1)
);
}
+
+/// Google Chrome: app_name "Google Chrome" must match pattern "google-chrome" (space vs hyphen).
+#[test]
+fn test_google_chrome_space_vs_hyphen() {
+ let mut map = AppMap::new();
+ let mut patterns = HashMap::new();
+ patterns.insert(
+ "google-chrome".into(),
+ "application://google-chrome.desktop".into(),
+ );
+ map.update_patterns(patterns);
+
+ let stream = r#"method call time=1700000000.000 sender=:1.100 -> destination=:1.5 serial=500 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
+ string "Google Chrome"
+ uint32 0
+ string ""
+ string "New message"
+ string ""
+method return time=1700000000.100 sender=:1.5 -> destination=:1.100 serial=600 reply_serial=500
+ uint32 55
+signal time=1700000001.000 sender=:1.5 -> destination=(null destination) serial=700 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=NotificationClosed
+ uint32 55
+ uint32 2
+"#;
+
+ let updates = process_stream(stream, &mut map);
+
+ assert_eq!(updates.len(), 2);
+ assert_eq!(
+ updates[0],
+ ("application://google-chrome.desktop".into(), 1)
+ );
+ assert_eq!(
+ updates[1],
+ ("application://google-chrome.desktop".into(), 0)
+ );
+}