Skip to content
Snippets Groups Projects
Commit 0498ec6f authored by kaloyane's avatar kaloyane
Browse files

minor: slower, but more reliable way to test BufferedImage equality. hopefully...

minor: slower, but more reliable way to test BufferedImage equality. hopefully fixes the CI test failures

SVN: 20722
parent ecf630d1
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package ch.systemsx.cisd.openbis.dss.etl.biozentrum; package ch.systemsx.cisd.openbis.dss.etl.biozentrum;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.io.File; import java.io.File;
import org.testng.AssertJUnit; import org.testng.AssertJUnit;
...@@ -58,18 +57,24 @@ public class ConvertToolImageTransformerTest extends AssertJUnit ...@@ -58,18 +57,24 @@ public class ConvertToolImageTransformerTest extends AssertJUnit
private void assertEqualImages(BufferedImage expected, BufferedImage actual) private void assertEqualImages(BufferedImage expected, BufferedImage actual)
{ {
DataBuffer expectedDB = expected.getData().getDataBuffer();
DataBuffer actualDB = actual.getData().getDataBuffer(); int columns = expected.getWidth();
int rows = expected.getHeight();
String notEqualError = "Converted image not equal to expected result"; String notEqualError = "Converted image not equal to expected result";
assertEquals(notEqualError, expectedDB.getSize(), actualDB.getSize()); assertEquals(notEqualError, columns, actual.getWidth());
assertEquals(notEqualError, rows, actual.getHeight());
for (int i = 0; i < expectedDB.getSize(); i++) for (int row = 0; row < rows; row++)
{ {
assertEquals(notEqualError, expectedDB.getElem(i), actualDB.getElem(i)); for (int col = 0; col < columns; col++)
{
int expectedPixel = expected.getRGB(col, row);
int actualPixel = actual.getRGB(col, row);
assertEquals(notEqualError, expectedPixel, actualPixel);
}
} }
} }
private BufferedImage readImage(String image) private BufferedImage readImage(String image)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment