Adjust test to write the failing PNG in case expected and actual do not match

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1568740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-02-16 08:39:17 +00:00
parent e0bcd77fc2
commit 087d8d7786
1 changed files with 5 additions and 0 deletions

View File

@ -109,6 +109,11 @@ public class TestFontRendering {
DataBufferByte actualDB = (DataBufferByte)imgActual.getRaster().getDataBuffer();
byte[] expectedData = expectedDB.getData(0);
byte[] actualData = actualDB.getData(0);
// allow to find out what the actual difference is in CI where this fails currently
if(!Arrays.equals(expectedData, actualData)) {
ImageIO.write(imgActual, "PNG", File.createTempFile("TestFontRendering", ".png"));
}
assertTrue("Expected to have matching raster-arrays, but found differences, size " + expectedData.length + " and " + actualData.length,
Arrays.equals(expectedData, actualData));
}