Пример #1
0
        public void SearchBitmapTestMegaServerErrorFindTest()
        {
            // string solution_dir = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.TestDir));
            Console.WriteLine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName);
            var haystackBitmap = (Bitmap)Image.FromFile(@".\serverErrorShot.bmp");

            Assert.IsNotNull(haystackBitmap);

            var needleBitmap = (Bitmap)Image.FromFile(@".\serverError.bmp");

            Assert.IsNotNull(needleBitmap);
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var points = ImageProcessing.FindBitmapsEntry(haystackBitmap, needleBitmap, true);

            stopwatch.Stop();
            Console.WriteLine($"Image Find Took {stopwatch.ElapsedMilliseconds} milliseconds");
            Assert.IsTrue(points.Count > 0);
            points.ForEach(x => Console.WriteLine(x.ToString()));
            stopwatch.Start();
            var shotsManager = new ScreenShotsManager();
            var pt           = shotsManager.Find(haystackBitmap, needleBitmap);

            stopwatch.Stop();
            Console.WriteLine($"Image Find GetPixel way Took {stopwatch.ElapsedMilliseconds} milliseconds");
            Assert.IsTrue(pt.HasValue);
        }
Пример #2
0
        public void FindNemoCloseTest()
        {
            var shotcBmp     = @"shotc.bmp";
            var nemoCloseBmp = @"1.bmp";

            var directoryInfo = Directory.GetParent(Directory.GetCurrentDirectory()).Parent;

            if (directoryInfo != null)
            {
                Console.WriteLine(directoryInfo.FullName);
            }
            var hayStackShotPath = Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\FindImageInImage\\bin\\Debug", shotcBmp);
            var needlePath       = Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\FindImageInImage\\bin\\Debug\\NemoCloses", nemoCloseBmp);

            Console.WriteLine(File.Exists(hayStackShotPath) ? $"  {hayStackShotPath} Exists" : $" {hayStackShotPath} does not Exist");
            Console.WriteLine(File.Exists(needlePath) ? $"  {needlePath} Exists" : $" {needlePath} does not Exist");
            var haystackBitmap = (Bitmap)Image.FromFile(hayStackShotPath);

            Assert.IsNotNull(haystackBitmap);

            var needleBitmap = (Bitmap)Image.FromFile(needlePath);

            Assert.IsNotNull(needleBitmap);
            var screenShotsManager = new ScreenShotsManager();
            var result             = screenShotsManager.Find(haystackBitmap, needleBitmap);

            Assert.IsNotNull(result);
            Console.WriteLine($"Needle in Haystack Found? {result}");
        }
Пример #3
0
        public void FindTest()
        {
            // string solution_dir = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.TestDir));
            Console.WriteLine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName);
            var haystackBitmap = (Bitmap)Image.FromFile(@"testStrip2.bmp");

            Assert.IsNotNull(haystackBitmap);

            var needleBitmap = (Bitmap)Image.FromFile(@".\eyepop.bmp");

            Assert.IsNotNull(needleBitmap);
            var screenShotsManager = new ScreenShotsManager();
            var result             = screenShotsManager.Find(haystackBitmap, needleBitmap);

            Console.WriteLine(result.ToString());
        }
Пример #4
0
        public void SearchBitmapTestNeoUsingFindByPixelTest()
        {
            // string solution_dir = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.TestDir));
            Console.WriteLine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName);
            var haystackBitmap = (Bitmap)Image.FromFile(@".\neofindAdTest.bmp");

            Assert.IsNotNull(haystackBitmap);

            var needleBitmap = (Bitmap)Image.FromFile(@".\ToFind.bmp");

            Assert.IsNotNull(needleBitmap);
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            var shotsManager = new ScreenShotsManager();
            var pt           = shotsManager.Find(haystackBitmap, needleBitmap);

            stopwatch.Stop();
            Console.WriteLine($"Image Find GetPixel way Took {stopwatch.ElapsedMilliseconds} milliseconds");
            Assert.IsTrue(pt.HasValue);
        }