diff --git a/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml b/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml index cff3937..b7685ff 100644 --- a/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml +++ b/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml @@ -59,7 +59,7 @@ - + diff --git a/tests/Avalonia.Smoke/Program.cs b/tests/Avalonia.Smoke/Program.cs index 3bf61d9..c376f09 100644 --- a/tests/Avalonia.Smoke/Program.cs +++ b/tests/Avalonia.Smoke/Program.cs @@ -65,6 +65,7 @@ internal static class Smoke var sopView=window.GetVisualDescendants().OfType().Single(); Check(!sopView.GetVisualDescendants().Any(c=>c is ComboBox or Slider),"Operator page contains no camera, recipe or parameter editors"); Check(sop.ActiveRecipe=="未应用配方","No recipe is reported active before applying"); + Check(!string.IsNullOrWhiteSpace(sop.SelectedRecipe)&&sopView.GetVisualDescendants().OfType().Any(t=>t.Text==sop.SelectedRecipe),"Operator page displays the selected recipe before applying or starting"); navigation.SelectedIndex=2;await Task.Delay(100); var settings=window.GetVisualDescendants().OfType().Single(); Check(ReferenceEquals(settings.DataContext,sop),"Settings and operator page share runtime state"); @@ -74,7 +75,11 @@ internal static class Smoke var applied=sop.ActiveRecipe;var selected=sop.SelectedRecipe; sop.SelectedRecipe="pending.yaml"; Check(sop.ActiveRecipe==applied,"Unapplied recipe selection does not change current recipe"); - sop.SelectedRecipe=selected; + navigation.SelectedIndex=0;await Task.Delay(80); + Check(window.GetVisualDescendants().OfType().Single().GetVisualDescendants().OfType().Any(t=>t.Text=="pending.yaml"),"Operator page updates to the selected recipe without applying or starting"); + sop.SelectedRecipe=selected;await Task.Delay(80); + Check(window.GetVisualDescendants().OfType().Single().GetVisualDescendants().OfType().Any(t=>t.Text==selected),"Recipe selection changes notify the operator page immediately"); + navigation.SelectedIndex=2;await Task.Delay(80); Save(window,"runtime-settings"); navigation.SelectedIndex=0;await Task.Delay(100); Check(window.GetVisualDescendants().OfType().Single().GetVisualDescendants().OfType().Any(t=>t.Text==applied),"Operator page displays the applied recipe");