01.
[CodedStep(@
"ImageComp"
)]
02.
public
void
Comparison_CodedStep()
03.
{
04.
System.Drawing.Bitmap actualbmp =
new
System.Drawing.Bitmap(@
"pink3.png"
);
05.
System.Drawing.Bitmap expectedbmp =
new
System.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