예제 #1
0
        public void TestSimpleAny()
        {
            var testBitmap = TestingHelper.GetTestBitmap();
            using (var provider = new SlowBitmapPixelProvider(testBitmap))
            {
                var scanner = new DefaultScanner(provider);

                bool actual = scanner.Any(Colors.White);
                Assert.AreEqual(true, actual);

                actual = scanner.Any(new NativeColor(255, 255, 255, 255));
                Assert.AreEqual(true, actual);
            }
        }
예제 #2
0
        public void TestSimpleTolerance()
        {
            var testBitmap = TestingHelper.GetToleranceBitmap();
            using (var provider = new SlowBitmapPixelProvider(testBitmap, false))
            {
                var scanner = new DefaultScanner(provider);
                bool actual = scanner.Any(new NativeColor(255, 100, 100, 100), new ColorTolerance(60, true));
                Assert.AreEqual(true, actual);

                actual = scanner.Any(new NativeColor(255, 100, 100, 100), new ColorTolerance(60, false));
                Assert.AreEqual(true, actual);

                actual = scanner.Any(new NativeColor(255, 100, 100, 100), new ColorTolerance(30, true));
                Assert.AreEqual(false, actual);

                actual = scanner.Any(new NativeColor(255, 100, 100, 100), new ColorTolerance(30, false));
                Assert.AreEqual(false, actual);
            }
        }