Exemplo n.º 1
0
        public void When_BitmapIcon_Generic()
        {
            Run("UITests.Shared.Windows_UI_Xaml_Controls.BitmapIconTests.BitmapIcon_Generic");

            var colorChange = _app.Marked("colorChange");
            var icon1       = _app.Query("icon1").Single();
            var icon2       = _app.Query("icon2").Single();

            _app.WaitForElement(colorChange);

            using var initial = TakeScreenshot("Initial");

            ImageAssert.HasColorInRectangle(initial, icon1.Rect.ToRectangle(), Color.Red);
            ImageAssert.HasColorInRectangle(initial, icon2.Rect.ToRectangle(), Color.Blue);

            _app.FastTap(colorChange);

            using var afterColorChange = TakeScreenshot("Changed");

            ImageAssert.HasColorInRectangle(afterColorChange, icon1.Rect.ToRectangle(), Color.Yellow);
            ImageAssert.HasColorInRectangle(afterColorChange, icon2.Rect.ToRectangle(), Color.Green);

            _app.WaitForDependencyPropertyValue(_app.Marked("icon1"), "Foreground", "[SolidColorBrush #FFFFFF00]");
            _app.WaitForDependencyPropertyValue(_app.Marked("icon2"), "Foreground", "[SolidColorBrush #FF008000]");
        }
Exemplo n.º 2
0
        public void PasswordShouldBeObscured()
        {
            Run("UITests.Shared.Windows_UI_Xaml_Controls.PasswordBoxTests.PasswordBoxPage");
            var passwordBox = _app.Marked("redPasswordBox");

            passwordBox.EnterText("         ");
            using var screenshot = TakeScreenshot("Spaces typed in PasswordBox.");
            ImageAssert.HasColorInRectangle(screenshot, _app.Query("redPasswordBox").Single().Rect.ToRectangle(), Color.Red);
        }
Exemplo n.º 3
0
        public void Border_AntiAlias()
        {
            const string firstRectBlueish  = "#ffd8d8ff";
            const string secondRectBlueish = "#ff9e9eff";

            Run("UITests.Windows_UI_Xaml_Controls.BorderTests.BorderAntiAlias");

            var firstBorderRect  = _app.GetPhysicalRect("firstBorder");
            var secondBorderRect = _app.GetPhysicalRect("secondBorder");

            using var screenshot = TakeScreenshot(nameof(Border_AntiAlias));

            ImageAssert.HasColorInRectangle(
                screenshot,
                firstBorderRect.ToRectangle(),
                ColorCodeParser.Parse(firstRectBlueish)
                );

            ImageAssert.HasPixels(
                screenshot,
                ExpectedPixels
                .At($"top-left", secondBorderRect.X, secondBorderRect.Y)
                .WithPixelTolerance(1, 1)
                .Pixel(secondRectBlueish),
                ExpectedPixels
                .At($"top-right", secondBorderRect.Right, secondBorderRect.Y)
                .WithPixelTolerance(1, 1)
                .Pixel(secondRectBlueish),
                ExpectedPixels
                .At($"bottom-right", secondBorderRect.Right, secondBorderRect.Bottom)
                .WithPixelTolerance(1, 1)
                .Pixel(secondRectBlueish),
                ExpectedPixels
                .At($"bottom-left", secondBorderRect.X, secondBorderRect.Bottom)
                .WithPixelTolerance(1, 1)
                .Pixel(secondRectBlueish)
                );
        }