[ActivePlatforms(Platform.Android, Platform.Browser)] // Disabled for iOS because HasColor() behaves strangely: https://github.com/unoplatform/uno/issues/1955 public void When_Rectangle_Fill_Animated() { Run("UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Fill"); _app.WaitForElement("PlayColorAnimation"); _app.FastTap("PlayColorAnimation"); _app.WaitForText("StatusText", "Completed"); var targetRect = _app.GetRect("TargetRectangle"); using var bmp = TakeScreenshot("Completed"); ImageAssert.HasColorAt(bmp, targetRect.CenterX, targetRect.CenterY, Color.Brown); }
public void ClosedPath() { // Navigate to this x:Class control name Run("SamplesApp.Windows_UI_Xaml_Media.Geometry.ClosedFigurePage"); // Define elements that will be interacted with at the start of the test var path = _app.Marked("Path"); // Specify what user interface element to wait on before starting test execution _app.WaitForElement(path); // if closed path, there should be black color on left hand side var screenshot = TakeScreenshot("Closed state"); ImageAssert.HasColorAt(screenshot, 50, 300, Color.Black); }
public void When_Background_Static() { Run("UITests.Windows_UI_Xaml_Controls.PageTests.Page_Automated"); _app.WaitForElement(_app.Marked("_empty")); using var content = TakeScreenshot("afterColor", ignoreInSnapshotCompare: true); var emptyRect = _app.GetPhysicalRect("_empty"); var transparentRect = _app.GetPhysicalRect("_transparent"); var solidRect = _app.GetPhysicalRect("_colored"); var offset = LogicalToPhysical(30); ImageAssert.HasColorAt(content, (emptyRect.X + offset), (emptyRect.Y + offset), Color.Red); ImageAssert.HasColorAt(content, (transparentRect.X + offset), (transparentRect.Y + offset), Color.Red); ImageAssert.HasColorAt(content, (solidRect.X + offset), (solidRect.Y + offset), Color.Blue); }
public void When_Background_Updated() { Run("UITests.Windows_UI_Xaml_Controls.PageTests.Page_Update_Background"); _app.WaitForElement("TargetPage"); var rect = _app.GetPhysicalRect("TargetPage"); using var before = TakeScreenshot("Before SolidColorBrush.Color update", ignoreInSnapshotCompare: true); ImageAssert.HasColorAt(before, rect.CenterX, rect.CenterY, Color.Blue); _app.FastTap("AdvanceTestButton"); _app.WaitForText("StatusTextBlock", "Color changed"); using var after = TakeScreenshot("After SolidColorBrush.Color update"); ImageAssert.HasColorAt(after, rect.CenterX, rect.CenterY, Color.Green); }
public void When_Background_Static() { Run("UITests.Windows_UI_Xaml_Controls.PageTests.Page_Automated"); _app.WaitForElement(_app.Marked("_empty")); var content = TakeScreenshot("afterColor"); var scale = (float)GetDisplayScreenScaling(); var emptyRect = _app.GetRect("_empty"); var transparentRect = _app.GetRect("_transparent"); var solidRect = _app.GetRect("_colored"); const int offset = 30; ImageAssert.HasColorAt(content, (emptyRect.X + offset) * scale, (emptyRect.Y + offset) * scale, Color.Red); ImageAssert.HasColorAt(content, (transparentRect.X + offset) * scale, (transparentRect.Y + offset) * scale, Color.Red); ImageAssert.HasColorAt(content, (solidRect.X + offset) * scale, (solidRect.Y + offset) * scale, Color.Blue); }
public void When_Clipped_Rounded_Corners() { Run("UITests.Windows_UI_Xaml.Clipping.Clipping4273"); _app.WaitForElement("RoundedGrid"); var rect = _app.GetRect("RoundedGrid"); var centre = GetScaledCenter(rect); var scale = GetDisplayScreenScaling(); var offset = 5 * (float)scale; var innerCornerX = rect.X + offset; var innerCornerY = rect.Y + offset; var screenshot = TakeScreenshot("ClippedCorners"); ImageAssert.HasColorAt(screenshot, centre.X, centre.Y, Color.Blue); ImageAssert.HasColorAt(screenshot, innerCornerX, innerCornerY, Color.Red); }
public void Test_Reorder(int from, int to) { Run("UITests.Windows_UI_Xaml.DragAndDrop.DragDrop_ListView", skipInitialScreenshot: true); var sut = _app.Marked("SUT"); _app.WaitForElement(sut); var sutBounds = _app.Query(sut).Single().Rect; var x = sutBounds.X + 50; var srcY = Item(sutBounds, from); var dstY = Item(sutBounds, to); _app.DragCoordinates(x, srcY, x, dstY); var result = TakeScreenshot("Result", ignoreInSnapshotCompare: true); ImageAssert.HasColorAt(result, x, dstY, _items[from], tolerance: 10); }
public void When_Foreground_Brush_Color_Changed() { Run("Uno.UI.Samples.Content.UITests.TextBlockControl.TextBlock_BrushColorChanging"); var textColor = _app.Marked("textColor"); var rectBefore = _app.GetRect("textResult"); var beforeColorChanged = TakeScreenshot("beforeColor"); textColor.SetDependencyPropertyValue("Text", "Blue"); var afterColorChanged = TakeScreenshot("afterColor"); ImageAssert.AreNotEqual(afterColorChanged, beforeColorChanged); var scale = (float)GetDisplayScreenScaling(); ImageAssert.HasColorAt(afterColorChanged, (rectBefore.X + 10) * scale, (rectBefore.Y + 10) * scale, Color.Blue); }
private void FlipView_WithButtons_BtnNavTest(int expectedIndex, params bool[] forwardNavigations) { Run("UITests.Windows_UI_Xaml_Controls.FlipView.FlipView_Buttons"); var flipview = _app.Marked("SUT"); var nextButton = _app.Marked("NextButtonHorizontal"); var previousButton = _app.Marked("PreviousButtonHorizontal"); // using tap to ensure navigation buttons are visible, since we cant mouse-over _app.WaitForElement(flipview); _app.FastTap(flipview); // perform navigations foreach (var navigation in forwardNavigations.Select((x, i) => new { Step = i, Forward = x })) { string GetCurrentNavigationContext() => $"step#{navigation.Step} of" + new string(forwardNavigations .Select(x => x ? 'N' : 'P').ToArray()) .Insert(navigation.Step, "*"); // tap previous or next var targetButton = navigation.Forward ? nextButton : previousButton; _app.WaitForElement(targetButton, $"Timeout waiting for the {(navigation.Forward ? "next" : "previous")} button in {GetCurrentNavigationContext()}"); _app.FastTap(targetButton); } var flipviewRect = _app.GetPhysicalRect(flipview); var navigationContext = new string(forwardNavigations.Select(x => x ? 'N' : 'P').ToArray()); var previousButtonRect = _app.GetPhysicalRect(previousButton); // check for selection index && content Assert.AreEqual(expectedIndex, flipview.GetDependencyPropertyValue <int>("SelectedIndex")); using (var screenshot = TakeScreenshot($"Post_{navigationContext}_Navigation", ignoreInSnapshotCompare: true)) { ImageAssert.HasColorAt( screenshot, flipviewRect.X + previousButtonRect.Width + 2, flipviewRect.CenterY, ButtonColors.Split(',').ElementAtOrDefault(expectedIndex) ?? throw new IndexOutOfRangeException($"{nameof(expectedIndex)} is out of range") ); } }
public void When_Background_Updated() { Run("UITests.Windows_UI_Xaml_Controls.PageTests.Page_Update_Background"); _app.WaitForElement("TargetPage"); var pageRectCenter = GetRectCenterScaled("TargetPage"); var before = TakeScreenshot("Before SolidColorBrush.Color update"); ImageAssert.HasColorAt(before, pageRectCenter.X, pageRectCenter.Y, Color.Blue); _app.FastTap("AdvanceTestButton"); _app.WaitForText("StatusTextBlock", "Color changed"); var after = TakeScreenshot("After SolidColorBrush.Color update"); ImageAssert.HasColorAt(after, pageRectCenter.X, pageRectCenter.Y, Color.Green); }
public void Shape_StrokeColor_ShouldRerenderWithChange() { Run("UITests.Windows_UI_Xaml_Shapes.Shape_StrokeTest"); var rect = _app.GetPhysicalRect("TestTarget").ToRectangle(); var center = rect.Location + new Size(rect.Size.Width / 2, rect.Size.Height / 2); var initialColor = Color.Red; var invertedColor = Color.FromArgb(255, 0, 255, 255); // UpdateBrushColor: flip (x => x^255) all rgb channels, except alpha // check color before using var before = TakeScreenshot("Shape_StrokeTest_Before"); ImageAssert.HasColorAt(before, center.X, center.Y, initialColor); // update brush color _app.FastTap("UpdateBrushColorButton"); // check color after using var after = TakeScreenshot("Shape_StrokeTest_After"); ImageAssert.HasColorAt(after, center.X, center.Y, invertedColor); }
[ActivePlatforms(Platform.Browser)] // EvenOdd fill not working on Android and iOS - https://github.com/unoplatform/uno/issues/6703 public void Test_FillRule() { Run("UITests.Windows_UI_Xaml_Shapes.PathTestsControl.Path_FillRule"); _app.WaitForElement("MainTargetEvenOdd"); var scrn = TakeScreenshot("Rendered", true); AssertHasColorAtCenter("MainTargetEvenOdd", Color.Beige); AssertHasColorAtCenter("RightTargetEvenOdd", Color.Green); AssertHasColorAtCenter("MainTargetNonZero", Color.Blue); AssertHasColorAtCenter("RightTargetNonZero", Color.Blue); void AssertHasColorAtCenter(string element, Color color) { var rect = _app.GetPhysicalRect(element); ImageAssert.HasColorAt(scrn, rect.CenterX, rect.CenterY, color); } }
public void When_Foreground_Brush_Color_Changed() { Run("Uno.UI.Samples.Content.UITests.TextBlockControl.TextBlock_BrushColorChanging"); var textColor = _app.Marked("textColor"); var rect = _app.GetPhysicalRect("textResult"); var xCheck = rect.CenterX; var yCheck = rect.CenterY; using var beforeColorChanged = TakeScreenshot("beforeColor", ignoreInSnapshotCompare: true); ImageAssert.HasColorAt(beforeColorChanged, xCheck, yCheck, Color.Red); textColor.SetDependencyPropertyValue("Text", "Blue"); using var afterColorChanged = TakeScreenshot("afterColor"); ImageAssert.AreNotEqual(afterColorChanged, beforeColorChanged); ImageAssert.HasColorAt(afterColorChanged, xCheck, yCheck, Color.Blue); }
public void When_Clip_Is_Set_On_Container_Element() { Run("UITests.Windows_UI_Xaml.Clipping.Clipping652"); var grid1 = _app.Marked("ClippingGrid1"); var grid2 = _app.Marked("ClippingGrid2"); _app.WaitForElement(grid1); _app.WaitForElement(grid2); var rect1 = grid1.FirstResult().Rect; var rect2 = grid2.FirstResult().Rect; var screenshot = TakeScreenshot("Clipping"); ImageAssert.HasColorAt(screenshot, rect1.Right + 8, rect1.Y + 75, Color.Blue); ImageAssert.HasColorAt(screenshot, rect1.X + 75, rect1.Bottom + 8, Color.Blue); ImageAssert.HasColorAt(screenshot, rect2.Right + 8, rect2.Y + 75, Color.Blue); ImageAssert.HasColorAt(screenshot, rect2.X + 75, rect2.Bottom + 8, Color.Blue); }
private void Test_Reorder(int from, int to, int?expectedTo = null) { Run("UITests.Windows_UI_Xaml.DragAndDrop.DragDrop_ListView", skipInitialScreenshot: true); var sut = _app.Marked("SUT"); var op = _app.Marked("Operation"); _app.WaitForElement(sut); var sutBounds = _app.Query(sut).Single().Rect; var x = sutBounds.X + 50; var srcY = Item(sutBounds, from); var dstY = Item(sutBounds, to); var expectedY = expectedTo is null ? dstY : Item(sutBounds, expectedTo.Value); _app.DragCoordinates(x, srcY, x, dstY); var result = TakeScreenshot("Result", ignoreInSnapshotCompare: true); ImageAssert.HasColorAt(result, x, expectedY, _items[from], tolerance: 10); Assert.IsTrue(op.GetDependencyPropertyValue <string>("Text").Contains("Move")); }
private async Task When_InScrollableContainer(string testName) { QueryEx sut = new QueryEx(q => q.All().Marked("SUT")); QueryEx output = new QueryEx(q => q.All().Marked("Output")); Run(testName, skipInitialScreenshot: true); var sutPhyRect = _app.GetPhysicalRect(sut); var item2PhyPosition = new Point((int)sutPhyRect.X + 150, (int)sutPhyRect.Y + 150).LogicalToPhysicalPixels(_app); // Validate initial state var initial = TakeScreenshot("initial"); ImageAssert.HasColorAt(initial, item2PhyPosition.X, item2PhyPosition.Y, "#FFFFA52C"); // Execute left command on item 2 _app.DragCoordinates(item2PhyPosition.X, item2PhyPosition.Y, item2PhyPosition.X + 300.LogicalToPhysicalPixels(_app), item2PhyPosition.Y); await Task.Delay(1000); // We cannot detect the animation ... var swippedItem = output.GetDependencyPropertyValue <string>("Text"); Assert.AreEqual("#FFFFA52C", swippedItem); // Scroll up _app.DragCoordinates(sutPhyRect.CenterX, sutPhyRect.Bottom - 10.LogicalToPhysicalPixels(_app), sutPhyRect.CenterX, sutPhyRect.Y + 10.LogicalToPhysicalPixels(_app)); // Validate scrolled successfully var postScroll = TakeScreenshot("after scroll"); ImageAssert.DoesNotHaveColorAt(postScroll, item2PhyPosition.X, item2PhyPosition.Y, "#FFFFA52C"); // Execute left command on item that is now at item 2 location _app.DragCoordinates(item2PhyPosition.X, item2PhyPosition.Y, item2PhyPosition.X + 300.LogicalToPhysicalPixels(_app), item2PhyPosition.Y); await Task.Delay(1000); // We cannot detect the animation ... swippedItem = output.GetDependencyPropertyValue <string>("Text"); Assert.AreNotEqual("#FFFFA52C", swippedItem); }
public void ScrollViewer_Margin_Centered() { Run("UITests.Windows_UI_Xaml_Controls.ScrollViewerTests.ScrollViewer_Margin_Centered"); _app.Marked("shapeWidth").SetDependencyPropertyValue("Value", "100"); _app.Marked("shapeHeight").SetDependencyPropertyValue("Value", "340"); _app.WaitForElement("ctl2"); using var screenshot = TakeScreenshot("test", ignoreInSnapshotCompare: true); for (byte i = 1; i <= 2; i++) { using var _ = new AssertionScope(); var logicalRect = _app.GetLogicalRect($"ctl{i}"); logicalRect.Width.Should().Be(100); logicalRect.Height.Should().Be(340); var physicalRect = _app.GetPhysicalRect($"ctl{i}"); // Left / Top ImageAssert.HasColorAt(screenshot, physicalRect.X + LogicalToPhysical(10), physicalRect.Y + LogicalToPhysical(10), Color.Orange); ImageAssert.HasColorAt(screenshot, physicalRect.X + LogicalToPhysical(20), physicalRect.Y + LogicalToPhysical(20), Color.Red); // Right / Top ImageAssert.HasColorAt(screenshot, physicalRect.Right - LogicalToPhysical(11), physicalRect.Y + LogicalToPhysical(10), Color.Orange); ImageAssert.HasColorAt(screenshot, physicalRect.Right - LogicalToPhysical(21), physicalRect.Y + LogicalToPhysical(20), Color.Red); // Middle ImageAssert.HasColorAt(screenshot, physicalRect.CenterX, physicalRect.CenterY, Color.Red); // Left / Bottom ImageAssert.HasColorAt(screenshot, physicalRect.X + LogicalToPhysical(10), physicalRect.Bottom - LogicalToPhysical(11), Color.Orange); ImageAssert.HasColorAt(screenshot, physicalRect.X + LogicalToPhysical(20), physicalRect.Bottom - LogicalToPhysical(21), Color.Red); // Right / Bottom ImageAssert.HasColorAt(screenshot, physicalRect.Right - LogicalToPhysical(11), physicalRect.Bottom - LogicalToPhysical(11), Color.Orange); ImageAssert.HasColorAt(screenshot, physicalRect.Right - LogicalToPhysical(21), physicalRect.Bottom - LogicalToPhysical(21), Color.Red); } }
public void When_FallbackColor_Set() { Run("UITests.Windows_UI_Xaml_Media.BrushesTests.RevealBrush_Fallback"); _app.WaitForElement("StatusTextBlock"); var views = new[] { "RevealGrid", "RevealGridCR", "RevealBorder", "RevealBorderCR", }; using var initial = TakeScreenshot("Initial"); foreach (var view in views) { AssertHasColor(view, initial, Color.Orange); } _app.FastTap("ChangeColorButton"); _app.WaitForText("StatusTextBlock", "Color changed"); using var after = TakeScreenshot("After"); foreach (var view in views) { AssertHasColor(view, after, Color.ForestGreen); } void AssertHasColor(string view, ScreenshotInfo screenshot, Color expectedColor) { var rect = _app.GetPhysicalRect(view); ImageAssert.HasColorAt(screenshot, rect.CenterX, rect.CenterY, expectedColor); } }
public void When_RightPanne_Clipped() { Run("UITests.Windows_UI_Xaml_Controls.SplitView.SplitViewClip"); _app.WaitForElement("Split"); var targetGridRectangle = _app.GetPhysicalRect("TargetRect"); using var compactScreenshot = TakeScreenshot("Compact", ignoreInSnapshotCompare: true); // Compact pane is 48 pixels wide ImageAssert.HasColorAt(compactScreenshot, targetGridRectangle.Right - 4, targetGridRectangle.CenterY, Color.Blue); var toggleButton = _app.Marked("PaneToggle"); toggleButton.FastTap(); using var expandedScreenshot = TakeScreenshot("Expanded"); ImageAssert.HasColorAt(expandedScreenshot, targetGridRectangle.Right - 4, targetGridRectangle.CenterY, Color.Red); toggleButton.FastTap(); using var compactAgainScreenshot = TakeScreenshot("Compact again"); ImageAssert.HasColorAt(compactAgainScreenshot, targetGridRectangle.Right - 4, targetGridRectangle.CenterY, Color.Blue); }
public async Task NativeCommandBar_Size() { Run("Uno.UI.Samples.Content.UITests.CommandBar.CommandBar_Dynamic"); const string rootElementName = "RootPanel"; _app.WaitForElement(rootElementName); var supportsRotation = GetSupportsRotation(); var isLandscape = GetIsCurrentRotationLandscape(rootElementName); var currentModeIsLandscape = isLandscape; async Task ToggleOrientation() { if (currentModeIsLandscape) { _app.SetOrientationPortrait(); } else { _app.SetOrientationLandscape(); } currentModeIsLandscape = !currentModeIsLandscape; _app.WaitFor(() => GetIsCurrentRotationLandscape(rootElementName) == currentModeIsLandscape); await Task.Delay(125); // A delay ia required after rotation for the test to succeed } try { var firstScreenShot = TakeScreenshot("FirstOrientation"); var firstCommandBarRect = _app.GetRect("TheCommandBar"); var firstYellowBorderRect = _app.GetRect("TheBorder"); firstCommandBarRect.Bottom.Should().Be(firstYellowBorderRect.Y); var firstCommandBarPhysicalRect = ToPhysicalRect(firstCommandBarRect); var x1 = firstCommandBarPhysicalRect.X + (firstCommandBarPhysicalRect.Width * 0.75f); ImageAssert.HasColorAt(firstScreenShot, x1, firstCommandBarPhysicalRect.Bottom - 1, Color.Red); if (!supportsRotation) { return; // We're on a platform not supporting rotations. } await ToggleOrientation(); var secondScreenShot = TakeScreenshot("SecondOrientation"); var secondCommandBarRect = _app.GetRect("TheCommandBar"); var secondYellowBorderRect = _app.GetRect("TheBorder"); secondCommandBarRect.Bottom.Should().Be(secondYellowBorderRect.Y); var secondCommandBarPhysicalRect = ToPhysicalRect(secondCommandBarRect); var x2 = secondCommandBarPhysicalRect.X + (secondCommandBarPhysicalRect.Width * 0.75f); ImageAssert.HasColorAt(secondScreenShot, x2, secondCommandBarPhysicalRect.Bottom - 1, Color.Red); await ToggleOrientation(); var thirdScreenShot = TakeScreenshot("thirdOrientation"); var thirdCommandBarRect = _app.GetRect("TheCommandBar"); var thirdYellowBorderRect = _app.GetRect("TheBorder"); thirdCommandBarRect.Bottom.Should().Be(thirdYellowBorderRect.Y); var thirdCommandBarPhysicalRect = ToPhysicalRect(thirdCommandBarRect); var x3 = thirdCommandBarPhysicalRect.X + (thirdCommandBarPhysicalRect.Width * 0.75f); ImageAssert.HasColorAt(thirdScreenShot, x3, thirdCommandBarPhysicalRect.Bottom - 1, Color.Red); } finally { // Reset orientation to original value if (isLandscape) { _app.SetOrientationLandscape(); } else { _app.SetOrientationPortrait(); } _app.WaitFor(() => GetIsCurrentRotationLandscape(rootElementName) == isLandscape); } }
private void TestOpacityFinalState([CallerMemberName] string testName = null) { var match = Regex.Match(testName, @"When_Opacity_(?<type>\w+)_With_FillBehavior(?<fill>\w+)_Then_(?<expected>\w+)"); if (!match.Success) { throw new InvalidOperationException("Invalid test name."); } var type = match.Groups["type"].Value; var fill = match.Groups["fill"].Value; var expected = match.Groups["expected"].Value; bool isSame = false, isGray = false, isDifferent = false; switch (type) { case "Completed" when expected == "Hold": isGray = true; break; case "Completed" when expected == "Rollback": isSame = true; break; case "Paused": isDifferent = true; break; case "Canceled": isSame = true; break; default: throw new InvalidOperationException("Invalid test name."); } Run(_finalStateOpacityTestControl, skipInitialScreenshot: true); using var initial = TakeScreenshot("Initial", ignoreInSnapshotCompare: true); var element = _app.WaitForElement($"{type}AnimationHost_{fill}").Single().Rect; _app.Marked("StartButton").FastTap(); _app.WaitForDependencyPropertyValue(_app.Marked("Status"), "Text", "Completed"); // Assert using var final = TakeScreenshot("Final", ignoreInSnapshotCompare: true); if (isSame) { ImageAssert.AreEqual(initial, final, element); } else if (isGray) { ImageAssert.HasColorAt(final, element.CenterX, element.CenterY, Color.LightGray); } else if (isDifferent) { ImageAssert.AreNotEqual(initial, final, element); ImageAssert.DoesNotHaveColorAt(final, element.CenterX, element.CenterY, Color.LightGray); } }
public void Default_StrokeThickness() { const string red = "#FF0000"; string reddish = GetReddish(); var shapeExpectations = new[] { new ShapeExpectation { Name = "MyLine", Offsets = new [] { 0, 0, 0, 0 }, Colors = red, }, new ShapeExpectation { Name = "MyRect", Offsets = new [] { 0, 0, -1, -1 }, Colors = red, }, new ShapeExpectation { Name = "MyPolyline", Offsets = new [] { 2, 2, -1, -1 }, Colors = reddish, }, new ShapeExpectation { Name = "MyPolygon", Offsets = new [] { 2, 2, -1, -1 }, Colors = reddish, }, new ShapeExpectation { Name = "MyEllipse", Offsets = new [] { 0, 0, -1, -1 }, Colors = red, }, new ShapeExpectation { Name = "MyPath", Offsets = new [] { 0, 0, 0, 0 }, Colors = red, }, }; Run("UITests.Windows_UI_Xaml_Shapes.Shapes_Default_StrokeThickness"); _app.WaitForElement("TestZone"); foreach (var expectation in shapeExpectations) { _app.Marked($"{expectation.Name}Selector").FastTap(); using var screenshot = TakeScreenshot($"{expectation}"); if (expectation.Name == "MyLine" || expectation.Name == "MyPath") { var targetRect = _app.GetPhysicalRect($"{expectation.Name}Target"); ImageAssert.DoesNotHaveColorAt(screenshot, targetRect.CenterX, targetRect.CenterY, Color.White); _app.Marked("StrokeThicknessButton").FastTap(); using var zeroStrokeThicknessScreenshot = TakeScreenshot($"{expectation.Name}_0_StrokeThickness"); ImageAssert.HasColorAt(zeroStrokeThicknessScreenshot, targetRect.CenterX, targetRect.CenterY, Color.White); } else { var shapeContainer = _app.GetPhysicalRect($"{expectation}Grid"); ImageAssert.HasColorAt(screenshot, shapeContainer.X + expectation.Offsets[0], shapeContainer.CenterY, expectation.Colors, tolerance: 15); ImageAssert.HasColorAt(screenshot, shapeContainer.CenterX, shapeContainer.Y + expectation.Offsets[1], expectation.Colors, tolerance: 15); ImageAssert.HasColorAt(screenshot, shapeContainer.Right + expectation.Offsets[2], shapeContainer.CenterY, expectation.Colors, tolerance: 15); ImageAssert.HasColorAt(screenshot, shapeContainer.CenterX, shapeContainer.Bottom + expectation.Offsets[3], expectation.Colors, tolerance: 15); _app.Marked("StrokeThicknessButton").FastTap(); using var zeroStrokeThicknessScreenshot = TakeScreenshot($"{expectation.Name}_0_StrokeThickness"); ImageAssert.DoesNotHaveColorAt(zeroStrokeThicknessScreenshot, shapeContainer.X + expectation.Offsets[0], shapeContainer.CenterY, expectation.Colors); ImageAssert.DoesNotHaveColorAt(zeroStrokeThicknessScreenshot, shapeContainer.CenterX, shapeContainer.Y + expectation.Offsets[1], expectation.Colors); ImageAssert.DoesNotHaveColorAt(zeroStrokeThicknessScreenshot, shapeContainer.Right + expectation.Offsets[2], shapeContainer.CenterY, expectation.Colors); ImageAssert.DoesNotHaveColorAt(zeroStrokeThicknessScreenshot, shapeContainer.CenterX, shapeContainer.Bottom + expectation.Offsets[3], expectation.Colors); } } }