diff --git a/apps/macos/Sources/OpenClaw/MenuHostedItem.swift b/apps/macos/Sources/OpenClaw/MenuHostedItem.swift deleted file mode 100644 index c5a2b73cd947..000000000000 --- a/apps/macos/Sources/OpenClaw/MenuHostedItem.swift +++ /dev/null @@ -1,29 +0,0 @@ -import AppKit -import SwiftUI - -/// Hosts arbitrary SwiftUI content as an AppKit view so it can be embedded in a native `NSMenuItem.view`. -/// -/// SwiftUI `MenuBarExtraStyle.menu` aggressively simplifies many view hierarchies into a title + image. -/// Wrapping the content in an `NSViewRepresentable` forces AppKit-backed menu item rendering. -struct MenuHostedItem: NSViewRepresentable { - let width: CGFloat - let rootView: AnyView - - func makeNSView(context _: Context) -> NSHostingView { - let hosting = NSHostingView(rootView: self.rootView) - self.applySizing(to: hosting) - return hosting - } - - func updateNSView(_ nsView: NSHostingView, context _: Context) { - nsView.rootView = self.rootView - self.applySizing(to: nsView) - } - - private func applySizing(to hosting: NSHostingView) { - let width = max(1, self.width) - hosting.frame.size.width = width - let fitting = hosting.fittingSize - hosting.frame = NSRect(origin: .zero, size: NSSize(width: width, height: fitting.height)) - } -} diff --git a/apps/macos/Tests/OpenClawIPCTests/CoverageDumpTests.swift b/apps/macos/Tests/OpenClawIPCTests/CoverageDumpTests.swift deleted file mode 100644 index bf9bd81cfb4f..000000000000 --- a/apps/macos/Tests/OpenClawIPCTests/CoverageDumpTests.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Darwin -import Foundation -import Testing - -@Suite(.serialized) -struct CoverageDumpTests { - @Test func `periodically flush coverage`() async { - guard ProcessInfo.processInfo.environment["LLVM_PROFILE_FILE"] != nil else { return } - guard let writeProfile = resolveProfileWriteFile() else { return } - let deadline = Date().addingTimeInterval(4) - while Date() < deadline { - _ = writeProfile() - try? await Task.sleep(nanoseconds: 250_000_000) - } - } -} - -private typealias ProfileWriteFn = @convention(c) () -> Int32 - -private func resolveProfileWriteFile() -> ProfileWriteFn? { - let symbol = dlsym(UnsafeMutableRawPointer(bitPattern: -2), "__llvm_profile_write_file") - guard let symbol else { return nil } - return unsafeBitCast(symbol, to: ProfileWriteFn.self) -} diff --git a/apps/macos/Tests/OpenClawIPCTests/LowCoverageViewSmokeTests.swift b/apps/macos/Tests/OpenClawIPCTests/LowCoverageViewSmokeTests.swift index 72ead44262c4..3d1c319c3cb9 100644 --- a/apps/macos/Tests/OpenClawIPCTests/LowCoverageViewSmokeTests.swift +++ b/apps/macos/Tests/OpenClawIPCTests/LowCoverageViewSmokeTests.swift @@ -33,14 +33,6 @@ struct LowCoverageViewSmokeTests { _ = hosting.fittingSize } - @Test func `menu hosted item hosts content`() { - let view = MenuHostedItem(width: 240, rootView: AnyView(Text("Menu"))) - let hosting = NSHostingView(rootView: view) - _ = hosting.fittingSize - hosting.rootView = MenuHostedItem(width: 320, rootView: AnyView(Text("Updated"))) - _ = hosting.fittingSize - } - @Test func `dock icon manager updates visibility`() { _ = NSApplication.shared UserDefaults.standard.set(false, forKey: showDockIconKey)