Skip to content

Remove obsolete code from tree layout plugins#1149

Merged
dalyIsaac merged 3 commits intomainfrom
remove-obsolete-treelayout-bar
Jul 12, 2025
Merged

Remove obsolete code from tree layout plugins#1149
dalyIsaac merged 3 commits intomainfrom
remove-obsolete-treelayout-bar

Conversation

@dalyIsaac
Copy link
Copy Markdown
Owner

No description provided.

@dalyIsaac dalyIsaac requested a review from Copilot July 12, 2025 07:07
@dalyIsaac dalyIsaac added refactor The code can be simplified/moved/cleaned up tree layout Whim.TreeLayout labels Jul 12, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MonitorManager and WorkspaceManager hooks with Store.MapEvents and Store.WorkspaceEvents
  • Update command palette logic to use Store.Pick(Pickers.PickActiveMonitor())
  • Refactor multiple test suites to use StoreTestUtils and unified Customization patterns

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(...).TryGet returning false and asserts that Logger.Error is 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 AddWindowDirectionChanged on the plugin isn’t asserted with a Received(1) check; update this to plugin.Received(1).AddWindowDirectionChanged -= ... so the test properly verifies that the handler was removed.
		plugin.AddWindowDirectionChanged -= Arg.Any<EventHandler<AddWindowDirectionChangedEventArgs>>();

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 12, 2025

Codecov Report

Attention: Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.

Project coverage is 81.06%. Comparing base (4dbb212) to head (9b73d13).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
....TreeLayout.Bar/TreeLayoutEngineWidgetViewModel.cs 50.00% 5 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@dalyIsaac dalyIsaac marked this pull request as ready for review July 12, 2025 07:19
@dalyIsaac dalyIsaac merged commit 89a9a60 into main Jul 12, 2025
9 of 12 checks passed
@dalyIsaac dalyIsaac deleted the remove-obsolete-treelayout-bar branch July 12, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor The code can be simplified/moved/cleaned up tree layout Whim.TreeLayout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants