Repository navigation
Description
Current behavior 🐛
The shared input helpers used by the MUX-imported runtime tests do not work when the runtime tests run against native WinUI (the WINAPPSDK / !HAS_UNO build). Tests that use them either fail, hang the whole run, or have to be excluded with RuntimeTestPlatforms.NativeWinUI, so WinUI parity for those scenarios is not verified on the WinAppSDK CI leg.
There are four independent problems (all confirmed by code inspection on master @ bfc8dffd7f; the first three were also observed in local WinAppSDK runs):
ControlHelper.DoClickUsingAPdetachesClickoff the UI thread. Theusing var _ = Disposable.Create(() => button.Click -= ...)runs afterawait clickEvent.Task, i.e. on a non-UI continuation. On WinUI,ButtonBase.remove_ClickthrowsCOMException 0x8001010E(RPC_E_WRONG_THREAD). ControlHelper.cs#L43-L64.DoClickUsingTap(L20-L40) has the same pattern.DoClickUsingTap/DoClickUsingAPwait on theClickTaskCompletionSource with no timeout. When the injected tap never produces aClickon WinUI, the test hangs until the runner kills the process, and no results file is written for the entire shard ("Test results file was not created within 600 seconds").Finger.At(!HAS_UNO) scales the window origin a second time.GetWindowRectalready returns physical pixels, but the code computes(rect.Left + x) * scale, so the origin is multiplied by the rasterization scale again. With a window not at (0,0) on a display above 100%, the injected touch lands in the wrong place, which is a likely reason the tap in (2) never clicks. Finger.cs#L168-L183. The same formula is inMouse.ToNormalizedScreenCoordinates(Mouse.cs#L390-L397).TestServices.KeyboardHelper.PressKeySequenceis compiled out underWINAPPSDK(#if !WINAPPSDKbody, so it silently does nothing). TestServices.KeyboardHelper.cs#L134-L136. EveryKeyboardHelpermethod built on it (Down,Up,Tab,Enter, ...) is a no-op on native WinUI.
Expected behavior 🎯
The helpers behave the same on native WinUI as in Uno, so the MUX-imported tests can run on the WinAppSDK leg and validate parity:
- Event handlers are detached on the UI thread (e.g. inside
RunOnUIThread.ExecuteAsync). - Click waits have a timeout, so a missing click fails one test instead of killing the shard.
Finger.At/Mouseuserect.Left + x * scale(origin physical, offset scaled once).PressKeySequencehas a WinUI implementation (e.g.InputInjectorkeyboard injection), or tests that need it are explicitly excluded.
How to reproduce it 🔬
- Check out
master. On Windows, set the display scale to e.g. 150%. - Run the runtime tests against native WinUI (the WinAppSDK SamplesApp flow), filtered to a test that uses the helpers, e.g.
DatePickerIntegrationTests.CanChooseDateorDatePickerShouldMaintainTime, after removing itsNativeWinUIexclusion. - Observe:
CanChooseDate/SelectingDateSetsSelectedDatefail withCOMException (0x8001010E) ... ButtonBase.remove_Click ... ControlHelper.DoClickUsingAP;DatePickerShouldMaintainTimehangs inDoClickUsingTapuntil the 600 s timeout and the whole run produces no results file.
Workaround
Tests that depend on the helpers are excluded with [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)].
Works on UWP/WinUI
N/A - this is test infrastructure for the WinUI parity leg.
Impact
About 14 runtime test files call DoClickUsingAP / DoClickUsingTap / ClickFlyoutCloseButton / InputHelper.Tap, directly or via DateTimePickerHelper, FlyoutHelper and ComboBoxHelper (DatePicker, TimePicker, ComboBox, CalendarView, CalendarDatePicker, CommandBar, AppBar, MenuFlyout, SwipeControl, FocusManager). PressKeySequence is used by about 19 files. Explicit exclusions citing these problems include 3 tests in DatePickerIntegrationTests and Given_FocusManager.When_Tapped_Empty_Space (comment: "focus is not cleared after the injected tap on empty space"; probably the same mis-targeted injected tap from (3), not verified at runtime). Helper-based tests that are not excluded can hang or fail the WinAppSDK leg.
Suggested fix
- Unsubscribe inside
RunOnUIThread.ExecuteAsync. - Add a timeout (e.g.
Task.WhenAny(clickEvent.Task, Task.Delay(...))) to both click waits and fail with a clear message. - Fix
Finger.AtandMouse.ToNormalizedScreenCoordinatestorect.Left + x * scale. - Provide a WinAppSDK keyboard injection for
PressKeySequence. - Then drop the
NativeWinUIexclusions and re-check.
Environment
- Master @
bfc8dffd7f; WinAppSDK SamplesAppnet10.0-windows10.0.19041.0 - Originally observed on a local run with a display scale above 100%.
Affected platforms: Windows (native WinUI / WinAppSDK runtime-test leg). Verified by: code inspection on master plus earlier local WinAppSDK runs; no fresh native run for this report.
Activity
fix(extras): Scale only pointer offset in Mouse