Repository navigation
test: add app-level theme change scenario + fix DatePicker/TimePicker theme test failures - #23211
Conversation
Adds runtime test covering the exact CSharpMarkup ThemeBindingProvider pattern: app-level theme change → ActualThemeChanged fires → handler reads ActualTheme to select theme dictionary → resolves resource. This test targets the combination not covered by existing tests: - When_AppTheme_Changes_ActualTheme_Returns_New_Value_In_Handler covers app-level theme (no resource resolution) - When_ThemeResource_Resolved_During_ActualThemeChanged_Returns_New_Value covers resource resolution (local RequestedTheme only) The new test validates both together, matching the real-world failure that caused the CSharpMarkup canary regression. Related to #23178, #23197
There was a problem hiding this comment.
Pull request overview
Adds a new Uno-only runtime test to harden theming behavior for the specific CSharpMarkup ThemeBindingProvider flow where an app-level theme switch triggers ActualThemeChanged, and the handler immediately reads ActualTheme to select a theme dictionary and resolve a resource.
Changes:
- Add a new
[RequiresFullWindow]runtime test validating resource resolution insideActualThemeChangedduring an app-level Light→Dark switch. - Use distinct sentinel values in
ThemeDictionariesto detect staleActualTheme/wrong dictionary selection.
Process note (PR description requirement):
- The PR description does not include a required issue footer (e.g.,
Fixes https://github.com/unoplatform/uno/issues/#...). Please add the issue link, or add the approved “no related issue” note per repo guidelines.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23211/wasm-skia-net9/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23211/wasm-skia-net9/index.html |
|
|
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23211/wasm-skia-net9/index.html |
|
|
|
@Mergifyio backport release/stable/6.6 |
✅ Backports have been createdDetails
|
…6.6/pr-23211 test: add app-level theme change scenario + fix DatePicker/TimePicker theme test failures (backport #23211)
Summary
Adds a runtime test covering the exact CSharpMarkup
ThemeBindingProviderpattern: app-level theme change →ActualThemeChangedfires → handler readsActualThemeto select theme dictionary → resolves resource from it.Also fixes iOS DatePicker/TimePicker native flyout theme tests that fail because
ThemeHelper.UseApplicationDarkTheme()now requires[RequiresFullWindow].What
When_AppTheme_Changes_ThemeResource_Resolved_During_Event_Returns_New_ValueActualThemereturns the new theme (not stale) when resolved insideActualThemeChangedduring an app-level theme switch, and that ThemeResource lookup from the correct dictionary succeeds.[RequiresFullWindow]attribute toGiven_DatePicker.When_App_Theme_Dark_Native_Flyout_Theme(iOS) andGiven_TimePicker.When_App_Theme_Dark_Native_Flyout_Theme(Apple UIKit).Why
PR #23197 fixed the root cause (
SetThemewas called afterRaiseActualThemeChangedinstead of before) and included tests for:RequestedThemechange with resource resolution (When_ThemeResource_Resolved_During_ActualThemeChanged_Returns_New_Value)When_AppTheme_Changes_ActualTheme_Returns_New_Value_In_Handler)This PR adds the missing combination: app-level theme change with resource resolution — which is the exact scenario that caused the CSharpMarkup canary regression.
The DatePicker/TimePicker fix addresses
ThemeHelper.AssertFullWindowForApplicationTheme()guard failures introduced by the same theme infrastructure changes — the tests callUseApplicationDarkTheme()which now requires the test method to be annotated with[RequiresFullWindow].Related