From bdeb7ea25e4f1bfdcd5f04f6a9af14bdd75c25fb Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 13 Jun 2026 08:15:18 -0700 Subject: [PATCH] Skip saving state for utility windows when running unit tests. Skip opening utility windows when running unit tests. --- Mac/AppDelegate.swift | 46 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 42f627fa0..9343ac704 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -223,28 +223,25 @@ let appName = "NetNewsWire" self.unreadCount = AccountManager.shared.unreadCount } - if InspectorWindowController.shouldOpenAtStartup { - toggleInspectorWindow(self) - } - - if CurrentActivityWindowController.shouldOpenAtStartup { - showActivityWindow(self) - } - - if ActivityLogWindowController.shouldOpenAtStartup { - showActivityLog(self) - } - - if ErrorLogWindowController.shouldOpenAtStartup { - showErrorLog(self) - } - - if AccountStatsWindowController.shouldOpenAtStartup { - showAccountStats(self) - } - - if DinosaursWindowController.shouldOpenAtStartup { - showDinosaursWindow(self) + if !Platform.isRunningUnitTests { + if InspectorWindowController.shouldOpenAtStartup { + toggleInspectorWindow(self) + } + if CurrentActivityWindowController.shouldOpenAtStartup { + showActivityWindow(self) + } + if ActivityLogWindowController.shouldOpenAtStartup { + showActivityLog(self) + } + if ErrorLogWindowController.shouldOpenAtStartup { + showErrorLog(self) + } + if AccountStatsWindowController.shouldOpenAtStartup { + showAccountStats(self) + } + if DinosaursWindowController.shouldOpenAtStartup { + showDinosaursWindow(self) + } } ArticleThemesManager.shared.start() @@ -892,7 +889,12 @@ extension AppDelegate { } func saveState() { + guard !Platform.isRunningUnitTests else { + return + } + mainWindowController?.saveStateToUserDefaults() + inspectorWindowController?.saveState() activityWindowController?.saveState() activityLogWindowController?.saveState()