Skip to content

[Tests] Re-enable five flaky runtime tests (InputPane occlusion scrolling, ScrollViewer backwards chaining, BitmapIcon monochrome) #24489

Open

Description

@MartinZikmund

Current behavior 🐛

Five runtime tests are flaky and are being disabled alongside this issue. This issue tracks making them reliable and re-enabling them.

Four are disabled on all targets with [Ignore]:

test file
Given_InputPane.When_Focused_TextBox_Has_Content_Below_Then_Scrolled_Above_Occlusion src/Uno.UI.RuntimeTests/Tests/Windows_UI_ViewManagement/Given_InputPane.cs
Given_InputPane.When_Focused_Element_Not_Occluded_Then_Centered_Content_Is_Not_Moved same
Given_InputPane.When_Occluded_Field_In_Viewport_Sized_Content_Then_Scrolled_Above_Occlusion same
Given_ScrollViewer_ScrollChaining.When_Chaining_Backwards_Then_Residual_Chains_To_Outer src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/ScrollViewerTests/Given_ScrollViewer_ScrollChaining.cs

One is flaky only on Skia iOS and Skia tvOS and is excluded just there, with [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.SkiaUIKit)]:

test file
Given_BitmapIcon.When_Foreground_Changed_With_ShowAsMonochrome_True src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Icons/Given_BitmapIcon.cs

The three Given_InputPane tests were [PlatformCondition(ConditionMode.Include, RuntimeTestPlatforms.Skia)]; the [Ignore] now supersedes that. The remaining Given_InputPane tests (When_OccludedRect_Set_Then_Focused_TextBox_Scrolled_Into_View, When_OccludedRect_Cleared_Then_ScrollViewer_Padding_Restored, When_App_Ensured_Focused_Element_In_View_Then_No_Pad_Is_Applied) and the other Given_ScrollViewer_ScrollChaining tests stay enabled, so the occlusion-pad and chaining features keep coverage. Given_BitmapIcon.When_Foreground_Changed_With_ShowAsMonochrome_True keeps running on every other Skia target, and When_ShowAsMonochrome_False_Foreground_Change_Does_Not_Reload_Image is untouched.

Expected behavior 🎯

All five tests pass reliably on every target they are meant to run on, and the [Ignore] / [PlatformCondition] exclusions added alongside this issue are removed.

How to reproduce it (as minimally and precisely as possible) 🔬

Run the runtime tests repeatedly; the failures are intermittent rather than tied to a single branch.

Workaround 🛠️

Retry the affected runtime test stage.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

All targets for the first four (the Given_InputPane tests are Skia-only by design); Skia iOS and Skia tvOS for Given_BitmapIcon.When_Foreground_Changed_With_ShowAsMonochrome_True.

Uno.Sdk version (and other relevant versions) 📦

master (repo-internal runtime tests, no Uno.Sdk involved)

Anything else we need to know? 💬

Related: #9080 (flaky tests roundup epic). The Given_InputPane occlusion tests came from #24410 and the scroll-chaining tests from the native-chaining series; Given_BitmapIcon.When_Foreground_Changed_With_ShowAsMonochrome_True is unrelated to both and is only grouped here because it was disabled in the same PR.

Not root-caused — the following are hypotheses from reading the tests, offered as starting points, not measured conclusions:

1. Half-pixel tolerances on transformed positions — When_Focused_Element_Not_Occluded_Then_Centered_Content_Is_Not_Moved

Every position assert uses a 0.5 delta on a TransformToVisual(null) result:

Assert.AreEqual(cardTopBefore, GetTop(card), 0.5, ...);
Assert.AreEqual(viewportHeight, scrollViewer.ExtentHeight, 0.5, ...);

A 200px card centered in a viewport of odd height lands on a .5 coordinate, and applying/removing the occlusion pad changes the extent's parity — so the card can legitimately shift by exactly 0.5px, right at the tolerance boundary. This class of assert is also scale-sensitive: sub-pixel geometry asserts fail at display scales other than 100%, which is why [RequiresScaling] exists.

2. Viewport-height-dependent setup arithmetic — When_Focused_TextBox_Has_Content_Below_Then_Scrolled_Above_Occlusion

The setup scrolls to a hardcoded content offset computed against the live viewport:

scrollViewer.ChangeView(null, 1240 - (0.55 * viewportHeight), null, disableAnimation: true);

with 1200 + 40 + 800 of content. The intent ("TextBox inside the viewport with a ~45% gap below it") only holds for a band of window heights; the [RequiresFullWindow] window size varies by host, so on a short or tall window the TextBox starts in a different place and either the setup assert or the "minimal scroll" upper bound can miss. Same shape in When_Occluded_Field_In_Viewport_Sized_Content_Then_Scrolled_Above_Occlusion, whose upper bound is occludedTop - textBox.ActualHeight - 40 — a 40px margin with no slack for a layout pass that lands one scroll line further.

3. WaitForIdle vs. the RequestUpdate offset refresh — When_Chaining_Backwards_Then_Residual_Chains_To_Outer

The test file's own header notes that a chained delta commits in the presenter synchronously while the ScrollViewer's public HorizontalOffset/VerticalOffset are refreshed through RequestUpdate, hence the await WindowHelper.WaitForIdle() before reading offsets. This test is the only one in the class that chains twice — forward, then backwards — so it reads the public offsets at two points and depends on the refresh having landed both times. The asserts are exact (0.01 delta on 200 and 50), with no retry. A WaitFor on the expected offset, rather than a single idle wait, would tell flake from real failure here.

4. Shared across all four: the occlusion path runs through two dispatcher hops plus a layout pass, and the tests poll for the outcome with WindowHelper.WaitFor. A WaitFor that releases on the first pass satisfying the predicate can observe an intermediate layout state — the same first-non-zero-latch pattern that made Given_AutoSuggestBox.When_Popup_Above flaky (#24480).

5. Given_BitmapIcon.When_Foreground_Changed_With_ShowAsMonochrome_True (Skia iOS / tvOS only) — not analysed at all; no hypothesis offered. What is visible from the test: it screenshots, changes Foreground, awaits a single WaitForIdle, then screenshots again and asserts the old red is gone and the new blue is present. Image.skia.cs updates the surface brush's colour filter in place rather than reloading, so if that repaint lands a frame after idle on UIKit the second screenshot still carries the old tint. It is also the only assert pair in the test with no WaitFor retry. Treat that as a thing to check, not a diagnosis — it has not been reproduced or measured.

Activity

  1. added
    kind/bug
    triage/untriaged
    area/tests 🧪
    on Sep 10, 2026
  2. changed the title [-][Tests] Re-enable four flaky runtime tests (InputPane occlusion scrolling, ScrollViewer backwards chaining)[/-] [+][Tests] Re-enable five flaky runtime tests (InputPane occlusion scrolling, ScrollViewer backwards chaining, BitmapIcon monochrome)[/+] on Sep 10, 2026
  3. MartinZikmund commented on Sep 10, 2026

    @MartinZikmund
    MemberAuthor

    Why the first four are "all targets" and not scoped to a platform

    Recording this here because it came up repeatedly in review on #24491 and is worth having on the tracking issue rather than only in a PR description.

    RuntimeTestPlatforms.Skia is SkiaDesktop | SkiaWasm | SkiaMobile — every leg that runs runtime tests: Skia desktop (Windows, Linux, Linux Framebuffer, macOS), Skia WASM, Skia Android, Skia iOS, Skia tvOS. The only thing it excludes is WinAppSDK.

    So the [PlatformCondition(ConditionMode.Include, RuntimeTestPlatforms.Skia)] on the three Given_InputPane tests is the feature's platform scope — soft-keyboard occlusion scrolling only exists on Skia, and on WinAppSDK it is the OS's job — not the flake's. The flake covers everything inside that gate. Given_ScrollViewer_ScrollChaining isn't platform-gated at all (#if HAS_UNO && UNO_HAS_MANAGED_SCROLL_PRESENTER) and When_Chaining_Backwards_Then_Residual_Chains_To_Outer fails on every leg that compiles it.

    That is why these four are [Ignore] rather than [PlatformCondition(Exclude, …)]: there is no configuration to keep them enabled on. They are timing races on a dispatcher/layout round-trip, not platform-specific defects, so a scoped exclusion would have to name every leg — which [Ignore] already is, with one attribute instead of eight.

    Given_BitmapIcon.When_Foreground_Changed_With_ShowAsMonochrome_True is the contrast, and the reason the distinction is legible: it genuinely is platform-specific, so it is scoped with [PlatformCondition(Exclude, SkiaUIKit)] and keeps running on every other Skia leg.

    The [Ignore] reasons now read "Flaky on all targets, not one platform" so this doesn't need re-deriving from the test report, and the Given_BitmapIcon comment names Skia iOS/tvOS explicitly.

    One cost to keep in view when picking this up: When_Chaining_Backwards_Then_Residual_Chains_To_Outer is the only test in its class that chains twice and reads the public offsets at two points, so while it is quarantined the reverse-residual hand-off to the outer scroller is genuinely uncovered — the forward-chain tests do not substitute for it. The most promising lead there is still hypothesis 3 above: a WaitFor on the expected offset instead of a single WaitForIdle would separate a flake from a real failure.

  4. added a commit that references this issue on Sep 15, 2026
  5. mikernet commented on Oct 18, 2026

    @mikernet
    Contributor

    I ran into When_Foreground_Changed_With_ShowAsMonochrome_True while running the image test classes for some imaging PRs, and it isn't only Skia iOS/tvOS: it also fails locally on Skia desktop and WebAssembly. It failed the first attempt in about a third of broad runs (a few times all three attempts), and never when Given_BitmapIcon ran on its own.

    Every failure is the first assertion: the first screenshot is fully transparent. The test screenshots right after UITestHelper.Load, while the bitmap is still being decoded in the background, so it races the decode. Waiting until the icon has drawn before that first screenshot (for example, wrapping the first assertions in TestHelper.RetryAssert) should make it deterministic.

    I'm happy to open a PR for it if you'd like to reassign it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/tests 🧪kind/bugtriage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions