From 343237725f65445bab306e3fe4cdbd10949d4d4b Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 13 Jun 2026 18:47:36 +0800
Subject: [PATCH] Fix Finder tab page activation

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

diff --git a/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift b/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift
index 042e94c..cbc65ff 100644
--- a/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift
+++ b/C1.source/Tests/AlignerCoreTests/AlignerCoreTests.swift
@@ -533,6 +533,58 @@
         XCTAssertTrue(attributed[1].isFullscreen)
     }
 
+    func testFinderTabSpaceAttributionRejectsContainingHostsWithDifferentSize() {
+        let finderApp = AlignerApp(
+            bundleIdentifier: "com.apple.finder",
+            name: "访达",
+            category: .finder,
+            processIdentifier: 74678
+        )
+        let splitRightFrame = CGRect(x: 960, y: 0, width: 960, height: 1080)
+        let fullDisplayFrame = CGRect(x: 0, y: 0, width: 1920, height: 1080)
+        let splitHost = WindowEnumerationRecord(
+            id: 33112,
+            app: finderApp,
+            title: "下载",
+            size: splitRightFrame.size,
+            frame: splitRightFrame,
+            subrole: .standard,
+            isFullscreen: true,
+            hasAXBacking: true,
+            spaceIDs: [843]
+        )
+        let containingHost = WindowEnumerationRecord(
+            id: 41557,
+            app: finderApp,
+            title: "应用程序",
+            size: fullDisplayFrame.size,
+            frame: fullDisplayFrame,
+            subrole: .standard,
+            isFullscreen: true,
+            hasAXBacking: true,
+            spaceIDs: [1112]
+        )
+        let inactiveTab = WindowEnumerationRecord(
+            id: 42286,
+            app: finderApp,
+            title: "Appcache",
+            size: splitRightFrame.size,
+            frame: splitRightFrame,
+            subrole: .standard,
+            hasAXBacking: false,
+            isOnscreen: false
+        )
+
+        let attributed = FinderTabSpaceAttributionPolicy.attributedRecords([
+            inactiveTab,
+            containingHost,
+            splitHost
+        ])
+
+        XCTAssertEqual(attributed[0].spaceIDs, [843])
+        XCTAssertTrue(attributed[0].isFullscreen)
+    }
+
     func testWindowEnumerationPolicyKeepsMinimizedAndFullscreenCGOnlyOffscreenWindows() {
         let minimized = makeWindowRecord(
             title: "Minimized Document.md",

--
Gitblit v1.9.3