Skip to content

Mixed MVVM and Non-MVVM Windows Regression Coverage#1043

Merged
wieslawsoltes merged 1 commit intomasterfrom
feature/mixed-docksite-regression-tests
Feb 11, 2026
Merged

Mixed MVVM and Non-MVVM Windows Regression Coverage#1043
wieslawsoltes merged 1 commit intomasterfrom
feature/mixed-docksite-regression-tests

Conversation

@wieslawsoltes
Copy link
Copy Markdown
Owner

PR Summary: Mixed MVVM and Non-MVVM Windows Regression Coverage

Branch

  • feature/mixed-docksite-regression-tests

Scope

This change implements feature 7: Mixed MVVM and non-MVVM windows in one dock site by adding focused regression tests only (no API changes).

The tests validate that a single root layout can host both:

  • statically-defined dockables (non-ItemsSource/manual windows), and
  • runtime-generated dockables from ItemsSource (MVVM-driven windows),

while preserving stable close and restore semantics.

Why

Dock already supports both static layouts and ItemsSource-generated dockables. The missing piece was explicit regression coverage ensuring these modes remain compatible when used together in one dock tree.

Without this coverage, regressions could appear in:

  • close routing (hide vs remove behavior),
  • source list synchronization,
  • restore behavior for hidden dockables, and
  • item-to-container tracking cleanup.

Implementation Details

New test file

  • tests/Dock.Model.Avalonia.UnitTests/Controls/MixedDockSiteItemsSourceRegressionTests.cs

Test topology

A helper fixture builds a mixed dock site with:

  • one RootDock,
  • one DocumentDock,
  • one ToolDock,
  • one manual Document and one manual Tool,
  • one ItemsSource collection for documents and one for tools,
  • one generated Document and one generated Tool tracked via IFactory.GetContainerFromItem.

Factory options:

  • HideDocumentsOnClose = true
  • HideToolsOnClose = true

This forces a clear behavioral split:

  • static dockables should hide on close,
  • ItemsSource-generated dockables should be removed and synchronized with their source lists.

Added regression tests

  1. MixedDockSite_CloseSemantics_DistinguishesGeneratedAndStaticDockables
  • closes generated document + tool first,
  • asserts source collections are updated (items removed),
  • asserts generated items are not moved to HiddenDockables,
  • closes manual document + tool,
  • asserts manual items are hidden and no longer visible,
  • asserts generated items are not present in hidden collection.
  1. MixedDockSite_RestoreSemantics_RestoresOnlyHiddenStaticDockables
  • closes both generated and manual dockables,
  • attempts to restore generated dockables (expected no-op, no exception),
  • restores manual dockables,
  • asserts manual dockables return to visible docks,
  • asserts hidden collection is empty after restore,
  • asserts source collections remain stable and generated item mapping remains cleared.

Behavioral Guarantees Added by Tests

  • Mixed static + ItemsSource windows can coexist in one root without semantic conflicts.
  • Generated windows preserve source-of-truth behavior on close (remove from backing collection).
  • Manual windows preserve hide/restore workflow under hide-on-close settings.
  • GetContainerFromItem tracking for removed generated items is cleaned up and stays null after close/restore flows.

API / Compatibility

  • No public API additions.
  • No behavior changes introduced by this PR; tests codify expected current behavior.
  • Backward compatibility impact: none.

Validation

Executed:

  • dotnet test tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj --filter FullyQualifiedName~MixedDockSiteItemsSourceRegressionTests
  • dotnet test tests/Dock.Model.Avalonia.UnitTests/Dock.Model.Avalonia.UnitTests.csproj

Result:

  • new test class: passed
  • full test project: passed (167 tests)

Commit(s)

  1. 2c87f9681
  • test: add mixed dock site items-source regression coverage
  • Adds the new regression test class and scenarios described above.

@wieslawsoltes wieslawsoltes merged commit 8f2188c into master Feb 11, 2026
5 checks passed
@wieslawsoltes wieslawsoltes deleted the feature/mixed-docksite-regression-tests branch February 11, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant