Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions components/ColorPicker/tests/ExampleColorPickerTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,22 @@ await EnqueueAsync(() =>

// If you want to load other content not within a XAML page using the UIThreadTestMethod above.
// Then you can do that using the Load/UnloadTestContentAsync methods.
[TestMethod]
[UIThreadTestMethod]
public async Task ComplexAsyncLoadUIExampleTest()
{
await EnqueueAsync(async () =>
{
var component = new ColorPicker();
Assert.IsNotNull(component);
Assert.IsFalse(component.IsLoaded);
var component = new ColorPicker();
Assert.IsNotNull(component);
Assert.IsFalse(component.IsLoaded);

await LoadTestContentAsync(component);
await LoadTestContentAsync(component);
await CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync(() => { });

Assert.IsTrue(component.IsLoaded);
Assert.IsTrue(component.IsLoaded);

await UnloadTestContentAsync(component);
await UnloadTestContentAsync(component);
await CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync(() => { });

Assert.IsFalse(component.IsLoaded);
});
Assert.IsFalse(component.IsLoaded);
}

// You can still use the UIThreadTestMethod to remove the extra layer for the dispatcher as well:
Expand Down
25 changes: 12 additions & 13 deletions components/Sizers/tests/ExampleSizerBaseTestClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@ namespace SizersTests;
[TestClass]
public partial class ExampleSizerBaseTestClass : VisualUITestBase
{
[TestMethod]
[UIThreadTestMethod]
public async Task ShouldConfigureGridSplitterAutomationPeer()
{
await EnqueueAsync(() =>
{
const string automationName = "MyCustomAutomationName";
const string name = "Sizer";
const string automationName = "MyCustomAutomationName";
const string name = "Sizer";

var gridSplitter = new GridSplitter();
var gridSplitterAutomationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(gridSplitter) as SizerAutomationPeer;
var gridSplitter = new GridSplitter();
var gridSplitterAutomationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(gridSplitter) as SizerAutomationPeer;

Assert.IsNotNull(gridSplitterAutomationPeer, "Verify that the AutomationPeer is SizerAutomationPeer.");
Assert.IsNotNull(gridSplitterAutomationPeer, "Verify that the AutomationPeer is SizerAutomationPeer.");

gridSplitter.Name = name;
Assert.IsTrue(gridSplitterAutomationPeer.GetName().Contains(name), "Verify that the UIA name contains the given Name of the GridSplitter (Sizer).");
gridSplitter.Name = name;
await CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync(() => { });
Assert.IsTrue(gridSplitterAutomationPeer.GetName().Contains(name), "Verify that the UIA name contains the given Name of the GridSplitter (Sizer).");

gridSplitter.SetValue(AutomationProperties.NameProperty, automationName);
Assert.IsTrue(gridSplitterAutomationPeer.GetName().Contains(automationName), "Verify that the UIA name contains the customized AutomationProperties.Name of the GridSplitter.");
});
gridSplitter.SetValue(AutomationProperties.NameProperty, automationName);
await CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync(() => { });
Assert.IsTrue(gridSplitterAutomationPeer.GetName().Contains(automationName), "Verify that the UIA name contains the customized AutomationProperties.Name of the GridSplitter.");
}

[UIThreadTestMethod]
Expand Down
Loading