Ejemplo n.º 1
0
        public static UIImage AssertContainsColor(this UIImage bitmap, UIColor expectedColor)
        {
            for (int x = 0; x < bitmap.Size.Width; x++)
            {
                for (int y = 0; y < bitmap.Size.Height; y++)
                {
                    if (ColorComparison.ARGBEquivalent(bitmap.ColorAtPoint(x, y), expectedColor))
                    {
                        return(bitmap);
                    }
                }
            }

            Assert.True(false, CreateColorError(bitmap, $"Color {expectedColor} not found."));
            return(bitmap);
        }
Ejemplo n.º 2
0
        public static UIImage AssertColorAtPoint(this UIImage bitmap, UIColor expectedColor, int x, int y)
        {
            try
            {
                var cap = bitmap.ColorAtPoint(x, y);

                if (!ColorComparison.ARGBEquivalent(cap, expectedColor))
                {
                    System.Diagnostics.Debug.WriteLine("Here");
                }

                Assert.Equal(cap, expectedColor, new ColorComparison());

                return(bitmap);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }

            return(null);
        }