test(macos): boost Clawdis coverage to 40%

This commit is contained in:
Peter Steinberger
2025-12-14 04:30:45 +00:00
parent 845b26a73b
commit 3ef910d23e
26 changed files with 1089 additions and 20 deletions

View File

@@ -4,6 +4,19 @@ import AppKit
enum WindowPlacement {
static func centeredFrame(size: NSSize, on screen: NSScreen? = NSScreen.main) -> NSRect {
let bounds = (screen?.visibleFrame ?? NSScreen.screens.first?.visibleFrame ?? .zero)
return self.centeredFrame(size: size, in: bounds)
}
static func topRightFrame(
size: NSSize,
padding: CGFloat,
on screen: NSScreen? = NSScreen.main) -> NSRect
{
let bounds = (screen?.visibleFrame ?? NSScreen.screens.first?.visibleFrame ?? .zero)
return self.topRightFrame(size: size, padding: padding, in: bounds)
}
static func centeredFrame(size: NSSize, in bounds: NSRect) -> NSRect {
if bounds == .zero {
return NSRect(origin: .zero, size: size)
}
@@ -16,12 +29,7 @@ enum WindowPlacement {
return NSRect(x: x, y: y, width: clampedWidth, height: clampedHeight)
}
static func topRightFrame(
size: NSSize,
padding: CGFloat,
on screen: NSScreen? = NSScreen.main) -> NSRect
{
let bounds = (screen?.visibleFrame ?? NSScreen.screens.first?.visibleFrame ?? .zero)
static func topRightFrame(size: NSSize, padding: CGFloat, in bounds: NSRect) -> NSRect {
if bounds == .zero {
return NSRect(origin: .zero, size: size)
}