From 6ceb291fa6402b70a4eb6734f5e6f9e8afa8a344 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Mon, 25 May 2026 05:10:36 +0800
Subject: [PATCH] Allow latin app name romanized fuzzy search

---
 Scripts/window_logic_qa.sh |   68 ++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/Scripts/window_logic_qa.sh b/Scripts/window_logic_qa.sh
index 4990885..7460258 100755
--- a/Scripts/window_logic_qa.sh
+++ b/Scripts/window_logic_qa.sh
@@ -93,6 +93,26 @@
   osascript -e 'tell application "System Events" to keystroke "w" using {command down}'
 }
 
+close_settings_window() {
+  osascript <<'OSA' >/dev/null 2>&1 || true
+tell application "System Events"
+  tell process "TagLauncher"
+    repeat 20 times
+      repeat with windowRef in windows
+        try
+          if (name of windowRef as text) is not "" then
+            click button 1 of windowRef
+            return
+          end if
+        end try
+      end repeat
+      delay 0.1
+    end repeat
+  end tell
+end tell
+OSA
+}
+
 dismiss_reopen_dialog() {
   osascript <<'OSA' >/dev/null 2>&1 || true
 tell application "System Events"
@@ -439,6 +459,20 @@
     }
     print("PASS fullscreen overlay above target: overlayLayer=\(tag[0].layer) targetLayer=\(target.layer)")
 
+case "fullscreen-settings":
+    guard tag.count == 2 else { fail("fullscreen settings expected 2 TagLauncher windows, got \(tag.count)") }
+    assertTagLayer(tag)
+    guard let target = windows.first(where: { $0.name == "TagLauncherFullscreenQATargetFullscreen" }) else {
+        fail("fullscreen target disappeared after opening settings; TagLauncher likely switched to another Space")
+    }
+    guard !tag[0].name.isEmpty, tag[1].name.isEmpty else {
+        fail("fullscreen settings order wrong: \(tag.map(\.name))")
+    }
+    guard tag.allSatisfy({ $0.layer > target.layer }) else {
+        fail("TagLauncher settings stack is not above fullscreen target")
+    }
+    print("PASS fullscreen settings above target: tagLayers=\(tag.map(\.layer)) targetLayer=\(target.layer)")
+
 case "split-geometry":
     func isSingleFullscreenWindow(_ windowFrame: CGRect, on screenFrame: CGRect) -> Bool {
         let widthMatches = abs(windowFrame.width - screenFrame.width) <= 12
@@ -587,6 +621,17 @@
     let overlayX = dimension(overlayBounds, "X")
     let overlayY = dimension(overlayBounds, "Y")
     print("\(Int(round(overlayX + 120))) \(Int(round(overlayY + 160)))")
+case "fullscreen-target-center":
+    guard let target = raw.first(where: { ($0[kCGWindowName as String] as? String) == "TagLauncherFullscreenQATargetFullscreen" }),
+          let bounds = target[kCGWindowBounds as String] as? NSDictionary else {
+        fputs("FAIL: could not find fullscreen target bounds\n", stderr)
+        exit(1)
+    }
+    let x = dimension(bounds, "X")
+    let y = dimension(bounds, "Y")
+    let width = dimension(bounds, "Width")
+    let height = dimension(bounds, "Height")
+    print("\(Int(round(x + width / 2))) \(Int(round(y + height / 2)))")
 default:
     fputs("FAIL: unknown coords mode \(mode)\n", stderr)
     exit(1)
@@ -752,6 +797,14 @@
   return 1
 }
 
+move_pointer_to_fullscreen_target() {
+  local coords
+  coords="$(swift "$coords_swift" fullscreen-target-center)"
+  read -r x y <<<"$coords"
+  move_xy "$x" "$y"
+  sleep 0.2
+}
+
 log "==> Building app"
 bash "$ROOT_DIR/build.sh" >/dev/null
 
@@ -794,9 +847,24 @@
   defaults write "$DEFAULTS_DOMAIN" showDockIcon -bool "$dock_value"
   prepare_isolated_app_instance
   start_fullscreen_qa_target
+  move_pointer_to_fullscreen_target
   send_main_hotkey
   wait_swift_assert fullscreen-overlay
   assert_fullscreen_overlay_stable
+  log "==> QA fullscreen Space: quick search from appgrid does not switch Space"
+  send_keycode 49
+  sleep 0.4
+  assert_fullscreen_overlay_stable
+  send_keycode 53
+  sleep 0.3
+  wait_swift_assert fullscreen-overlay
+  log "==> QA fullscreen Space: settings from appgrid does not switch Space"
+  send_cmd_comma
+  sleep 0.7
+  wait_swift_assert fullscreen-settings
+  close_settings_window
+  sleep 0.5
+  wait_swift_assert fullscreen-overlay
   send_keycode 53
   sleep 0.4
   wait_swift_assert no-overlay

--
Gitblit v1.9.3