public static void AreAlmostEqual(ScreenshotInfo expected, Rectangle expectedRect, ScreenshotInfo actual, Rectangle actualRect, int permittedPixelError, double expectedToActualScale = 1, [CallerLineNumber] int line = 0) => AreEqualImpl(expected, expectedRect, actual, actualRect, expectedToActualScale, PixelTolerance.Cummulative(permittedPixelError), line);
public static void AreAlmostEqual(ScreenshotInfo expected, ScreenshotInfo actual, Rectangle?rect = null, int permittedPixelError = 5, double expectedToActualScale = 1, [CallerLineNumber] int line = 0) => AreEqualImpl(expected, rect ?? FirstQuadrant, actual, rect ?? FirstQuadrant, expectedToActualScale, PixelTolerance.Cummulative(permittedPixelError), line);
public void BitmapImage_vs_SvgImageSource_SvgRemote() { Run("UITests.Windows_UI_Xaml_Controls.ImageTests.BitmapImage_vs_SvgImageSource"); var url = _app.Marked("url"); var btnSvg = _app.Marked("btnSvg"); var streamMode = _app.Marked("streamMode"); var showLow = _app.Marked("showLow"); var img = _app.Marked("img"); showLow.SetDependencyPropertyValue("IsCheked", "False"); // Load image from url url.SetDependencyPropertyValue("Text", "https://nv-assets.azurewebsites.net/tests/images/uno-overalls.svg"); streamMode.SetDependencyPropertyValue("IsChecked", "False"); btnSvg.FastTap(); WaitForBitmapOrSvgLoaded(); using var screenshotDirect = TakeScreenshot("url_direct"); streamMode.SetDependencyPropertyValue("IsChecked", "True"); btnSvg.FastTap(); WaitForBitmapOrSvgLoaded(); using var screenshotStream = TakeScreenshot("url_stream"); var rect = _app.GetPhysicalRect(img); // Both images should be the same ImageAssert.AreEqual(screenshotDirect, screenshotStream, rect, tolerance: PixelTolerance.Cummulative(2)); }
/// <summary> /// Asserts that two screenshots are equal to each other inside the area of the nominated rect to within the given pixel error /// (ie, the A, R, G, or B values cumulatively differ by more than the permitted error for any pixel). /// </summary> public static void AreAlmostEqual(ScreenshotInfo expected, IAppRect expectedRect, ScreenshotInfo actual, IAppRect actualRect, int permittedPixelError, [CallerLineNumber] int line = 0) => AreEqualImpl(expected, expectedRect.ToRectangle(), actual, actualRect.ToRectangle(), 1, PixelTolerance.Cummulative(permittedPixelError), line);
/// <summary> /// Asserts that two screenshots are equal to each other inside the area of the nominated rect to within the given pixel error /// (ie, the A, R, G, or B values cumulatively differ by more than the permitted error for any pixel). /// </summary> public static void AreAlmostEqual(FileInfo expected, Rectangle expectedRect, FileInfo actual, Rectangle actualRect, int permittedPixelError, [CallerLineNumber] int line = 0) => AreEqualImpl(expected, expectedRect, actual, actualRect, 1, PixelTolerance.Cummulative(permittedPixelError), line);
/// <summary> /// Asserts that two screenshots are equal to each other inside the area of the nominated rect to within the given pixel error /// (ie, the A, R, G, or B values cumulatively differ by more than the permitted error for any pixel). /// </summary> public static void AreAlmostEqual(FileInfo expected, FileInfo actual, Rectangle?rect = null, int permittedPixelError = 5, [CallerLineNumber] int line = 0) => AreEqualImpl(expected, rect ?? FirstQuadrant, actual, rect ?? FirstQuadrant, 1, PixelTolerance.Cummulative(permittedPixelError), line);