Skip to content

Commit

Permalink
test: Translation should be applied after Loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Dec 6, 2024
1 parent 7801e28 commit 73de3fd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml/Given_UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,28 @@ public async Task When_Element_Has_Translation_And_Visual_Has_Offset()
}
#endif

[TestMethod]
[RunsOnUIThread]
public async Task When_Translation_On_Load()
{
var sut = new Rectangle()
{
Width = 100,
Height = 100,
Fill = new SolidColorBrush(Microsoft.UI.Colors.Blue),
};
var canvas = new Canvas();
canvas.Width = 200;
canvas.Height = 200;
canvas.Children.Add(sut);
TestServices.WindowHelper.WindowContent = canvas;
await TestServices.WindowHelper.WaitForLoaded(sut);
sut.Translation += new Vector3(200, 0, 128);
await TestServices.WindowHelper.WaitForIdle();
var bitmap = await UITestHelper.ScreenShot(canvas);
ImageAssert.DoesNotHaveColorAt(bitmap, new Windows.Foundation.Point(50, 50), Microsoft.UI.Colors.Blue, tolerance: 25);
}

#if HAS_UNO
[TestMethod]
[RunsOnUIThread]
Expand Down

0 comments on commit 73de3fd

Please sign in to comment.