Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

The expected behavior of Image Comparison

$
0
0
01.[CodedStep(@"ImageComp")]
02.publicvoidComparison_CodedStep()
03.{
04.    System.Drawing.Bitmap actualbmp = newSystem.Drawing.Bitmap(@"pink3.png");
05.    System.Drawing.Bitmap expectedbmp = newSystem.Drawing.Bitmap(@"pink5.png");
06.    ArtOfTest.Common.PixelMap expected = ArtOfTest.Common.PixelMap.FromBitmap(expectedbmp);
07.    ArtOfTest.Common.PixelMap actual = ArtOfTest.Common.PixelMap.FromBitmap(actualbmp);
08. 
09.    Assert.IsTrue(expected.Compare(actual, 0.0));
10.}

Above is my code for the image comparison I am carrying out with the 2 attached PNGs. Both pink squares are 300 by 300 pixels. Each black square contained inside each pink square is 50 x 50 pixels. In examining the images, it is inherently obvious that they are different, the black squares are in completely separate locations. But, with a tolerance of 0, the test I have this coded step in still passes. So it brings me to my question...

How is this test passing?

What is the Compare function testing for? A summation of pixel values?

Is there a workaround to this? How can I make this test fail without modifying the images?

~ Max


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>