Skip to content

test: add app-level theme change scenario + fix DatePicker/TimePicker theme test failures - #23211

Merged
MartinZikmund merged 2 commits into
masterfrom
dev/agzi/fix-csharpmarkup-theme-tests
May 7, 2026
Merged

MartinZikmund merged 2 commits into
masterfrom
dev/agzi/fix-csharpmarkup-theme-tests

Conversation

@agneszitte

@agneszitte agneszitte commented May 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a runtime test covering the exact CSharpMarkup ThemeBindingProvider pattern: app-level theme change → ActualThemeChanged fires → handler reads ActualTheme to 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

  • New test: When_AppTheme_Changes_ThemeResource_Resolved_During_Event_Returns_New_Value
  • Validates that ActualTheme returns the new theme (not stale) when resolved inside ActualThemeChanged during an app-level theme switch, and that ThemeResource lookup from the correct dictionary succeeds.
  • Adds missing [RequiresFullWindow] attribute to Given_DatePicker.When_App_Theme_Dark_Native_Flyout_Theme (iOS) and Given_TimePicker.When_App_Theme_Dark_Native_Flyout_Theme (Apple UIKit).

Why

PR #23197 fixed the root cause (SetTheme was called after RaiseActualThemeChanged instead of before) and included tests for:

  • Local RequestedTheme change with resource resolution (When_ThemeResource_Resolved_During_ActualThemeChanged_Returns_New_Value)
  • App-level theme change without resource resolution (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 call UseApplicationDarkTheme() which now requires the test method to be annotated with [RequiresFullWindow].

Related

Copilot AI review requested due to automatic review settings May 5, 2026 23:33
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 inside ActualThemeChanged during an app-level Light→Dark switch.
  • Use distinct sentinel values in ThemeDictionaries to detect stale ActualTheme/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.

@unodevops

Copy link
Copy Markdown
Contributor

@agneszitte
agneszitte marked this pull request as draft May 6, 2026 00:29
@agneszitte
agneszitte marked this pull request as ready for review May 6, 2026 02:50
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 211068 has failed on Uno.UI - CI.

@agneszitte agneszitte changed the title test: add app-level theme change + resource resolution scenario test: add app-level theme change scenario + fix DatePicker/TimePicker theme test failures May 7, 2026
@MartinZikmund
MartinZikmund enabled auto-merge May 7, 2026 06:34
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 211372 has failed on Uno.UI - CI.

@MartinZikmund
MartinZikmund merged commit 441c767 into master May 7, 2026
45 checks passed
@MartinZikmund
MartinZikmund deleted the dev/agzi/fix-csharpmarkup-theme-tests branch May 7, 2026 12:34
@agneszitte

Copy link
Copy Markdown
Member Author

@Mergifyio backport release/stable/6.6

@mergify

mergify Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.6

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request May 11, 2026
…6.6/pr-23211

test: add app-level theme change scenario + fix DatePicker/TimePicker theme test failures (backport #23211)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants