Remove obsolete code from tree layout plugins#1149
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR removes obsolete Butler-based event subscriptions in the Tree Layout plugins and migrates to the new Store API, updates command palette monitor selection to use Store.Pick, and refactors tests to leverage StoreTestUtils and nested Customization classes.
- Replace
MonitorManagerandWorkspaceManagerhooks withStore.MapEventsandStore.WorkspaceEvents - Update command palette logic to use
Store.Pick(Pickers.PickActiveMonitor()) - Refactor multiple test suites to use
StoreTestUtilsand unifiedCustomizationpatterns
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Whim.TreeLayout.CommandPalette/TreeLayoutCommandPaletteCommands.cs | Switched from direct MonitorManager.ActiveMonitor calls to Store.Pick for monitor selection |
| src/Whim.TreeLayout.CommandPalette.Tests/TreeLayoutCommandPaletteCommandsTests.cs | Updated to use StoreTestUtils, nested Customization, and updated AutoSubstituteData attributes |
| src/Whim.TreeLayout.Bar/TreeLayoutEngineWidgetViewModel.cs | Migrated event subscriptions from Butler to Store.MapEvents/WorkspaceEvents, added null‐guard & logging |
| src/Whim.TreeLayout.Bar.Tests/TreeLayoutEngineWidgetViewModelTests.cs | Refactored tests to use StoreTestUtils, validated new event‐driven behavior, updated Dispose assertions |
| src/Whim.TreeLayout.Bar.Tests/ToggleDirectionCommandTests.cs | Refactored tests for ToggleDirectionCommand with StoreCustomization |
| src/Whim.TestUtils/Whim.TestUtils.csproj | Added InternalsVisibleTo for new test assemblies |
Comments suppressed due to low confidence (2)
src/Whim.TreeLayout.Bar/TreeLayoutEngineWidgetViewModel.cs:66
- The new guard branch logging an error when no workspace is found isn’t covered by existing tests; add a unit test that simulates
Store.Pick(...).TryGetreturning false and asserts thatLogger.Erroris called and no property change is triggered.
if (!_context.Store.Pick(Pickers.PickWorkspaceByMonitor(_monitor.Handle)).TryGet(out IWorkspace workspace))
src/Whim.TreeLayout.Bar.Tests/TreeLayoutEngineWidgetViewModelTests.cs:307
- In the Dispose test, the unsubscription of
AddWindowDirectionChangedon the plugin isn’t asserted with aReceived(1)check; update this toplugin.Received(1).AddWindowDirectionChanged -= ...so the test properly verifies that the handler was removed.
plugin.AddWindowDirectionChanged -= Arg.Any<EventHandler<AddWindowDirectionChangedEventArgs>>();
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1149 +/- ##
==========================================
- Coverage 81.11% 81.06% -0.06%
==========================================
Files 286 286
Lines 13177 13182 +5
Branches 1535 1536 +1
==========================================
- Hits 10689 10686 -3
- Misses 2288 2297 +9
+ Partials 200 199 -1 ☔ View full report in Codecov by Sentry. |
No description provided.