Skip to content

Commit d743f27

Browse files
fix(selftest): stabilize HostControlMountFunc and Tab/RadioButtons selection fixtures (#139)
Three flake clusters in `Reactor.AppTests.Host --self-test` (18/100 run-fail rate before; 0/100 after for the targeted clusters across a 100x sweep): - `HostCtrlFunc_Mounted/Initial/Updated`: standalone ReactorHostControl doesn't register with ReactorApp.ActiveHost, so Harness.Render() can't wait on its render loop. Use Harness.Render(200) to give wall-clock time, matching the sibling HostControlMountComponent/HostControlFactory fixtures. - `TabViewSel_*` and `RadioButtonsSel_*`: TabView and RadioButtons can raise SelectionChanged via the dispatcher rather than synchronously in the SelectedIndex setter (unlike ComboBox/ListView/GridView/FlipView/Pivot). Pump once with Harness.Render() between the mutation and the assertion so the queued event lands before the counter is read. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f91176e commit d743f27

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

tests/Reactor.AppTests.Host/SelfTest/Fixtures/HostingCoverageFixtures.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ public override async Task RunAsync()
9292
);
9393
});
9494

95+
// Standalone ReactorHostControl doesn't register with ReactorApp.ActiveHost,
96+
// so Harness.Render() can't wait on its render loop directly — give it
97+
// wall-clock time, same as the sibling Component / Factory fixtures.
9598
var container = new Border { Child = hostControl };
9699
H.SetContent(container);
97-
await Harness.Render();
100+
await Harness.Render(200);
98101

99102
var text = FindInContainer<TextBlock>(hostControl, tb => tb.Text?.StartsWith("Func:") == true);
100103
H.Check("HostCtrlFunc_Mounted", text is not null);
@@ -107,7 +110,7 @@ public override async Task RunAsync()
107110
((Microsoft.UI.Xaml.Automation.Provider.IInvokeProvider)
108111
peer.GetPattern(Microsoft.UI.Xaml.Automation.Peers.PatternInterface.Invoke)).Invoke();
109112
}
110-
await Harness.Render();
113+
await Harness.Render(200);
111114
text = FindInContainer<TextBlock>(hostControl, tb => tb.Text?.StartsWith("Func:") == true);
112115
H.Check("HostCtrlFunc_Updated", text?.Text == "Func:world");
113116

tests/Reactor.AppTests.Host/SelfTest/Fixtures/SelectionEventFixtures.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ public override async Task RunAsync()
7171
count = 0; lastIndex = -1;
7272
if (rbs is not null) rbs.SelectedIndex = 1;
7373

74+
// RadioButtons can raise SelectionChanged via the dispatcher (unlike
75+
// ComboBox/ListView/etc. which fire it synchronously in the setter),
76+
// so pump once before asserting on the counter.
77+
await Harness.Render();
78+
7479
H.Check("RadioButtonsSel_CallbackFired", count >= 1);
7580
H.Check("RadioButtonsSel_PayloadIndex", lastIndex == 1);
7681
}
@@ -199,6 +204,11 @@ public override async Task RunAsync()
199204
count = 0; lastIndex = -1;
200205
if (tv is not null) tv.SelectedIndex = 2;
201206

207+
// TabView can raise SelectionChanged via the dispatcher (unlike
208+
// ComboBox/ListView/etc. which fire it synchronously in the setter),
209+
// so pump once before asserting on the counter.
210+
await Harness.Render();
211+
202212
H.Check("TabViewSel_CallbackFired", count >= 1);
203213
H.Check("TabViewSel_PayloadIndex", lastIndex == 2);
204214
}

0 commit comments

Comments
 (0)