Skip to content

Implement SetWindowSizeOverride for runtime tests #23018

Open

Description

@MartinZikmund

Background

TestServices.WindowHelper.SetWindowSizeOverride(Size) is widely used in ported WinUI runtime tests to constrain the test window so layout/viewport-dependent assertions are deterministic. Examples include StackPanelIntegrationTests, GridIntegrationTests, CalendarViewIntegrationTests, and DateTimePickerHelper.

In the current Uno runtime-tests harness, SetWindowSizeOverride is an empty stub:

// src/Uno.UI.RuntimeTests/IntegrationTests/common/TestServices.WindowHelper.cs:423
internal static void SetWindowSizeOverride(object p) { }

Because of this, tests that assume a bounded window size can pass on some targets (e.g. SkiaDesktop, where the default window happens to be small) and fail on others (e.g. SkiaWasm, SkiaIOS) where XamlRoot.VisualTree.VisibleBounds is effectively unbounded.

Observed impact

  • MenuFlyoutIntegrationTests.ValidateSubMenuItemWithLongItems fails on SkiaWasm/SkiaIOS because the flyout's MenuFlyoutPresenter.MaxHeight is computed from VisibleBounds, all 30 items fit, and ScrollableHeight == 0.
  • Any test that uses SetWindowSizeOverride to force a small viewport is silently running at the ambient window size instead.

Proposal

Wire TestServices.WindowHelper.SetWindowSizeOverride(Size) (and SetWindowSizeOverrideWithScale) to actually resize the test window / visible bounds across platforms:

  • SkiaDesktop (Wpf/Win32/X11/MacOS/Islands/FrameBuffer): resize the host Window or XAML island content area.
  • SkiaWasm: override NativeWindowWrapper.RaiseNativeSizeChanged inputs for the test, or set the XamlRoot size directly.
  • SkiaMobile (Android/iOS/MacCatalyst/tvOS): constrain the root visual's size or the VisibleBounds used by VisualTree.
  • Provide a ResetWindowSizeOverride() / per-test cleanup so subsequent tests don't inherit the override.
  • Document expectations (DPI/scale handling, behavior on fullscreen platforms).

Acceptance criteria

  • SetWindowSizeOverride measurably constrains XamlRoot.VisualTree.VisibleBounds on all Skia targets (Desktop, WASM, Mobile).
  • Override is cleaned up between tests.
  • Tests that depend on a bounded window (e.g. the MenuFlyout long-items scenario) produce consistent results across platforms without per-test workarounds.

Workaround (current)

Tests that need a constrained presenter size apply an explicit MaxHeight via a control style rather than relying on the window override. This works for scenarios where the size can be pushed into the control under test, but not for layout/viewport-level assertions.

Activity

  1. github-actions commented on Aug 11, 2026

    @github-actions
    Contributor

    This issue has had no activity for 120 days. It will be closed in 10 days if there is no further activity. Remove the Stale label or leave a comment to keep it open.

  2. added
    stale
    on Aug 11, 2026
  3. github-actions commented on Aug 22, 2026

    @github-actions
    Contributor

    This issue was closed because it had no activity for 10 days after being marked as stale. If you believe this is still relevant, feel free to reopen it or open a new issue with updated context.

  4. Jen-Uno commented on Oct 28, 2026

    @Jen-Uno
    Contributor

    This issue was closed as not planned, so there is nothing for QA to verify. Moving it from Ready for QA Review to Done on the Uno Team Backlog.

  5. removed
    stale
    on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions