From f0f11765ff73bc4bfa3353301186f2c379bcf3cb Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 06 Jun 2026 23:34:46 +0800
Subject: [PATCH] fix: 严格 Space Lane hit test 垂直 band 检查,空区域(非 lane y band)直接 nil,彻底防止 hoveredSpaceLaneID 误设导致 spaceFocused 粘住 (v0.0.32)

---
 C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift b/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift
index 11c41ed..2dcabd3 100644
--- a/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift
+++ b/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift
@@ -314,6 +314,45 @@
         XCTAssertNil(WindowEnumerationPolicy.window(from: utilityRecord))
     }
 
+    func testWindowEnumerationPolicyKeepsFinderCGOnlyOffscreenMainWindows() {
+        let finderApp = AlignerApp(
+            bundleIdentifier: "com.apple.finder",
+            name: "访达",
+            category: .finder
+        )
+        let record = WindowEnumerationRecord(
+            id: 83_664,
+            app: finderApp,
+            title: "Screencapture",
+            size: CGSize(width: 920, height: 436),
+            subrole: .standard,
+            hasAXBacking: false,
+            isOnscreen: false
+        )
+        let emptyTitleRecord = WindowEnumerationRecord(
+            id: 83_665,
+            app: finderApp,
+            title: "",
+            size: CGSize(width: 920, height: 436),
+            subrole: .standard,
+            hasAXBacking: false,
+            isOnscreen: false
+        )
+        let tinyRecord = WindowEnumerationRecord(
+            id: 83_666,
+            app: finderApp,
+            title: "Finder Utility",
+            size: CGSize(width: 80, height: 40),
+            subrole: .standard,
+            hasAXBacking: false,
+            isOnscreen: false
+        )
+
+        XCTAssertEqual(WindowEnumerationPolicy.window(from: record)?.title, "Screencapture")
+        XCTAssertNil(WindowEnumerationPolicy.window(from: emptyTitleRecord))
+        XCTAssertNil(WindowEnumerationPolicy.window(from: tinyRecord))
+    }
+
     func testWindowEnumerationPolicyKeepsMinimizedAndFullscreenCGOnlyOffscreenWindows() {
         let minimized = makeWindowRecord(
             title: "Minimized Document.md",

--
Gitblit v1.9.3