Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulino committed Aug 21, 2021
1 parent f458d51 commit 8eba48b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions UnitTests/UnitTests.UWP/UI/Triggers/Test_ControlSizeTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using Microsoft.Toolkit.Uwp;
using Microsoft.Toolkit.Uwp.UI.Triggers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -22,9 +23,10 @@ public class Test_ControlSizeTrigger : VisualUITestBase
[DataRow(400, 399, false)]
public async Task ControlSizeTriggerTest(double width, double height, bool expectedResult)
{
await App.DispatcherQueue.EnqueueAsync(() =>
await App.DispatcherQueue.EnqueueAsync(async () =>
{
Grid grid = CreateGrid(width, height);
await SetTestContentAsync(grid);
var trigger = new ControlSizeTrigger();

trigger.TargetElement = grid;
Expand All @@ -42,9 +44,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
[DataRow(400, 399, false)]
public async Task ControlSizeMinHeightTriggerTest(double width, double height, bool expectedResult)
{
await App.DispatcherQueue.EnqueueAsync(() =>
await App.DispatcherQueue.EnqueueAsync(async () =>
{
Grid grid = CreateGrid(width, height);
await SetTestContentAsync(grid);
var trigger = new ControlSizeTrigger();

trigger.TargetElement = grid;
Expand All @@ -59,9 +62,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
[DataRow(400, 400, true)]
public async Task ControlSizeMinWidthTriggerTest(double width, double height, bool expectedResult)
{
await App.DispatcherQueue.EnqueueAsync(() =>
await App.DispatcherQueue.EnqueueAsync(async () =>
{
Grid grid = CreateGrid(width, height);
await SetTestContentAsync(grid);
var trigger = new ControlSizeTrigger();

trigger.TargetElement = grid;
Expand All @@ -76,9 +80,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
[DataRow(450, 449, true)]
public async Task ControlSizeMaxHeightTriggerTest(double width, double height, bool expectedResult)
{
await App.DispatcherQueue.EnqueueAsync(() =>
await App.DispatcherQueue.EnqueueAsync(async () =>
{
Grid grid = CreateGrid(width, height);
await SetTestContentAsync(grid);
var trigger = new ControlSizeTrigger();

trigger.TargetElement = grid;
Expand All @@ -93,9 +98,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
[DataRow(449, 450, true)]
public async Task ControlSizeMaxWidthTriggerTest(double width, double height, bool expectedResult)
{
await App.DispatcherQueue.EnqueueAsync(() =>
await App.DispatcherQueue.EnqueueAsync(async () =>
{
Grid grid = CreateGrid(width, height);
await SetTestContentAsync(grid);
var trigger = new ControlSizeTrigger();

trigger.TargetElement = grid;
Expand All @@ -112,9 +118,6 @@ private Grid CreateGrid(double width, double height)
Height = height,
Width = width
};
grid.Measure(new Windows.Foundation.Size(1000, 1000));
grid.Arrange(new Windows.Foundation.Rect(0, 0, 1000, 1000));
grid.UpdateLayout();

return grid;
}
Expand Down

0 comments on commit 8eba48b

Please sign in to comment.