Import Coucou 0.1.9 (Louis-CFM/coucou@83708fe), Mac app only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-06 19:34:32 +03:00
commit 53b4f60da1
158 changed files with 29442 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
import Foundation
@main
enum IslandScreenGeometryTests {
static func main() {
// Regression: absent auxiliary areas must never mean "screen-wide notch".
for screenWidth: CGFloat in [1080, 1920, 2560, 3840] {
let geometry = IslandScreenGeometry(
screenWidth: screenWidth, safeAreaTop: 0,
auxiliaryLeftWidth: nil, auxiliaryRightWidth: nil, menuBarHeight: 30
)
precondition(!geometry.hasNotch)
precondition(geometry.width == 80)
precondition(geometry.height == 24)
}
// A shorter menu bar must also contain the resting island.
let shortMenuBar = IslandScreenGeometry(
screenWidth: 1920, safeAreaTop: 0,
auxiliaryLeftWidth: nil, auxiliaryRightWidth: nil, menuBarHeight: 22
)
precondition(shortMenuBar.height == 22)
// Real MacBook notch measurements retain their physical dimensions.
let macBook = IslandScreenGeometry(
screenWidth: 1512, safeAreaTop: 32,
auxiliaryLeftWidth: 660, auxiliaryRightWidth: 660, menuBarHeight: 32
)
precondition(macBook.hasNotch)
precondition(macBook.width == 192 && macBook.height == 32)
// Incomplete or invalid measurements use the notch fallback, not the screen.
for auxiliaryWidth: CGFloat? in [nil, 0, 1000] {
let geometry = IslandScreenGeometry(
screenWidth: 1512, safeAreaTop: 32,
auxiliaryLeftWidth: auxiliaryWidth, auxiliaryRightWidth: auxiliaryWidth,
menuBarHeight: 32
)
precondition(geometry.width == 184 && geometry.height == 32)
}
// Compact/greeting destinations share the measured resting height.
for height: CGFloat in [22, 24, 32, 38] {
let compact = IslandRestingLayout(width: 240, height: height)
precondition(compact.botCenterY == height / 2)
precondition(compact.botDiameter == min(20, height - 6))
precondition(compact.botCenterY - compact.botDiameter / 2 >= 3)
precondition(compact.botCenterY + compact.botDiameter / 2 <= height - 3)
precondition(compact.miniGridCenterX == 200)
precondition(compact.miniGridScale * 28 <= height - 4)
}
print("Island screen geometry and resting layout: 13 cases passed")
}
}