Beispiel #1
0
        public void DiffImageTest()
        {
            var imageProcessor = new ImageComparator();

            var fileNames = Directory.GetFiles(@"e:\Temp\Screen\");

            for (int index = 0; index < fileNames.Length - 3;)
            {
                var imageInfo = new ImageComparisonInfo()
                {
                    FirstImagePath  = fileNames[index],
                    SecondImagePath = fileNames[index + 1],
                    DiffImagePath   = outputFile + "_" + index + ".png"
                };

                imageProcessor.ImageComparisonInfo = imageInfo;

                var isImageDifferent = imageProcessor.GetCompositeImageDiff();
                index += 2;
            }
        }
Beispiel #2
0
        private ImageComparisonInfo GetImageDiff(ImageComparator imageComparator)
        {
            ImageComparisonInfo diffImage;

            try
            {
                diffImage = imageComparator.GetCompositeImageDiff();
            }
            catch (Exception ex)
            {
                var errorMessage = $"{ex.Message} {ex.StackTrace}";

                diffImage = new ImageComparisonInfo()
                {
                    ErrorMessage = errorMessage,
                    ScreenShotId = imageComparator.ImageComparisonInfo.ScreenShotId
                };

                new RestKeplerServiceClient().LogError(errorMessage);
            }

            return(diffImage);
        }