Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Sources/ZoomItMacCore/App/AppInfo.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import Foundation

/// Static product identity used across the UI (settings footer, about text).
/// Product identity used across the UI (settings footer, about text).
public enum AppInfo {
public static let productName = "Sysinternals ZoomIt"
public static let version = "1.0"
public static var version: String {
resolveVersion(from: Bundle.main.infoDictionary)
}
public static let copyright = "Copyright © 2026 Mark Russinovich"

static func resolveVersion(from infoDictionary: [String: Any]?) -> String {
for key in ["CFBundleShortVersionString", "CFBundleVersion"] {
if let value = infoDictionary?[key] as? String, !value.isEmpty {
return value
}
}
return "Development"
}
}
16 changes: 16 additions & 0 deletions Sources/ZoomItMacCore/SelfTest/SelfTestRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private final class FlippedBackgroundHostView: NSView {
@MainActor
public enum SelfTestRunner {
public static func run() throws {
try testAppInfoVersionResolution()
try testViewportClampsZoom()
try testViewportZoomAnimation()
try testViewportSourceRect()
Expand Down Expand Up @@ -77,6 +78,21 @@ public enum SelfTestRunner {
try testPanoramaLockedAxisRejectsShortFallback()
}

private static func testAppInfoVersionResolution() throws {
try expect(
AppInfo.resolveVersion(from: ["CFBundleShortVersionString": "12.2.0"]) == "12.2.0",
"Expected the settings version to use CFBundleShortVersionString"
)
try expect(
AppInfo.resolveVersion(from: ["CFBundleVersion": "42"]) == "42",
"Expected the settings version to fall back to CFBundleVersion"
)
try expect(
AppInfo.resolveVersion(from: nil) == "Development",
"Expected an unbundled development build to identify itself as Development"
)
}

private static func testViewportClampsZoom() throws {
let controller = ZoomViewportController()

Expand Down