From 5af1c46fe2b920d85ee31371ac168e2b6a8eb60b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Oct 2026 11:51:00 +0000 Subject: [PATCH 1/3] Initial plan From b137775b72c72bb07289007d8130e2211bf7791c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Oct 2026 11:53:38 +0000 Subject: [PATCH 2/3] Stabilize async context menu test Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com> --- MarkEditMac/Tests/ContextMenuTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MarkEditMac/Tests/ContextMenuTests.swift b/MarkEditMac/Tests/ContextMenuTests.swift index 72a90fd65..7d2224cce 100644 --- a/MarkEditMac/Tests/ContextMenuTests.swift +++ b/MarkEditMac/Tests/ContextMenuTests.swift @@ -103,7 +103,7 @@ final class ContextMenuTests: XCTestCase { target: self, selector: #selector(checkContextMenuHighlight(_:)), userInfo: (editor, expectedIndex, checked), - repeats: false + repeats: true ) RunLoop.main.add(timer, forMode: .eventTracking) @@ -116,7 +116,6 @@ final class ContextMenuTests: XCTestCase { @objc private func checkContextMenuHighlight(_ timer: Timer) { guard let (editor, expectedIndex, checked) = timer.userInfo as? (EditorViewController, Int?, XCTestExpectation), let menu = editor.presentedMenu else { - XCTFail("Missing context menu") return } @@ -127,6 +126,7 @@ final class ContextMenuTests: XCTestCase { } checked.fulfill() + timer.invalidate() menu.cancelTracking() } } From ea595ad9b6fb9a050a0bc704804d0fd5fd445214 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Oct 2026 12:12:38 +0000 Subject: [PATCH 3/3] Close context menu test panels Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com> --- MarkEditMac/Tests/ContextMenuTests.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MarkEditMac/Tests/ContextMenuTests.swift b/MarkEditMac/Tests/ContextMenuTests.swift index 7d2224cce..405450af5 100644 --- a/MarkEditMac/Tests/ContextMenuTests.swift +++ b/MarkEditMac/Tests/ContextMenuTests.swift @@ -22,7 +22,7 @@ final class ContextMenuTests: XCTestCase { let editor = EditorViewController(preloadDelay: 60) window.contentViewController = editor window.makeKeyAndOrderFront(nil) - defer { window.orderOut(nil) } + defer { window.close() } let api = EditorModuleAPI(delegate: editor) let cases: [(index: Int?, expected: Int?)] = [ @@ -63,7 +63,7 @@ final class ContextMenuTests: XCTestCase { let editor = EditorViewController() window.contentViewController = editor window.makeKeyAndOrderFront(nil) - defer { window.orderOut(nil) } + defer { window.close() } let deadline = ContinuousClock.now + .seconds(10) while !editor.hasFinishedLoading, ContinuousClock.now < deadline { @@ -103,7 +103,7 @@ final class ContextMenuTests: XCTestCase { target: self, selector: #selector(checkContextMenuHighlight(_:)), userInfo: (editor, expectedIndex, checked), - repeats: true + repeats: false ) RunLoop.main.add(timer, forMode: .eventTracking) @@ -116,6 +116,7 @@ final class ContextMenuTests: XCTestCase { @objc private func checkContextMenuHighlight(_ timer: Timer) { guard let (editor, expectedIndex, checked) = timer.userInfo as? (EditorViewController, Int?, XCTestExpectation), let menu = editor.presentedMenu else { + XCTFail("Missing context menu") return } @@ -126,7 +127,6 @@ final class ContextMenuTests: XCTestCase { } checked.fulfill() - timer.invalidate() menu.cancelTracking() } }