Skip to content

Commit

Permalink
chore: Adjust tests for fluent
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Jul 8, 2024
1 parent 1ec1c73 commit 7b61989
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void AssertHasColorAtCenterAndBorder(string element, Color centerColor, Color bo
var rect = _app.GetPhysicalRect(element);
var borderCenterOffset = rect.Width / 50f * 7.5f;

const byte tolerance = 4;
const byte tolerance = 6;

ImageAssert.HasColorAt(scrn, rect.CenterX, rect.CenterY, centerColor, tolerance);
ImageAssert.HasColorAt(scrn, rect.X + borderCenterOffset, rect.CenterY, borderColor, tolerance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ public void PasswordShouldBeObscured()
Run("UITests.Shared.Windows_UI_Xaml_Controls.PasswordBoxTests.PasswordBoxPage");
var passwordBox = _app.Marked("redPasswordBox");
passwordBox.EnterText(" ");

// PasswordBox has to be unfocused for Foreground to be red.
// Otherwise, animations from template would take precedence and set the Foreground to black.
var rect = _app.Query("redPasswordBox").Single().Rect;
_app.TapCoordinates(rect.CenterX, rect.Bottom + 5);
using var screenshot = TakeScreenshot("Spaces typed in PasswordBox.");
ImageAssert.HasColorInRectangle(screenshot, _app.Query("redPasswordBox").Single().Rect.ToRectangle(), Color.Red);
ImageAssert.HasColorInRectangle(screenshot, rect.ToRectangle(), Color.Red);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private async Task When_InScrollableContainer(string testName)
Run(testName, skipInitialScreenshot: true);

var sutPhyRect = _app.GetPhysicalRect(sut);
var item2PhyPosition = new Point((int)sutPhyRect.X + 150, (int)sutPhyRect.Y + 150).LogicalToPhysicalPixels(_app);
var item2PhyPosition = new Point((int)sutPhyRect.CenterX, (int)sutPhyRect.Y + 150).LogicalToPhysicalPixels(_app);

// Validate initial state
var initial = TakeScreenshot("initial");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void When_Opacity_Is_Specified()

var grid = _app.Query("TestGrid").Single().Rect;
using var screenshot = TakeScreenshot(nameof(When_Opacity_Is_Specified));
ImageAssert.HasColorAt(screenshot, grid.CenterX, grid.CenterY, Color.FromArgb(255, 255, 128, 128));
ImageAssert.HasColorAt(screenshot, grid.CenterX, grid.CenterY, Color.FromArgb(255, 249, 122, 122));
}
}
}

0 comments on commit 7b61989

Please sign in to comment.