Skip to content

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

Merged
agneszitte merged 2 commits into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23211
May 11, 2026
Merged

agneszitte merged 2 commits into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23211

Conversation

@mergify

@mergify mergify Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

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

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

(cherry picked from commit c6c9b39)
@agneszitte
agneszitte merged commit a4405cd into release/stable/6.6 May 11, 2026
6 of 9 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.6/pr-23211 branch May 11, 2026 17:36
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.

1 participant