kinow commented on code in PR #271:
URL: https://github.com/apache/commons-imaging/pull/271#discussion_r1099204587
##########
src/test/java/org/apache/commons/imaging/formats/bmp/BmpRoundtripTest.java:
##########
@@ -140,17 +139,21 @@ private void writeAndReadImageData(final int[][] rawData)
throws IOException, Im
final byte[] bytes = Imaging.writeImageToBytes(srcImage,
ImageFormats.BMP);
- final File tempFile = Files.createTempFile("temp", ".bmp").toFile();
- FileUtils.writeByteArrayToFile(tempFile, bytes);
-
final BufferedImage dstImage = Imaging.getBufferedImage(bytes);
- assertNotNull(dstImage);
- assertEquals(srcImage.getWidth(), dstImage.getWidth());
- assertEquals(srcImage.getHeight(), dstImage.getHeight());
-
- final int[][] dstData = bufferedImageToImageData(dstImage);
- compare(rawData, dstData);
+ try {
+ assertNotNull(dstImage);
+ assertEquals(srcImage.getWidth(), dstImage.getWidth());
+ assertEquals(srcImage.getHeight(), dstImage.getHeight());
+
+ final int[][] dstData = bufferedImageToImageData(dstImage);
+ compare(rawData, dstData);
+ } catch (final Throwable e) {
+ final Path tempFile = Files.createTempFile("temp", ".bmp");
+ Files.write(tempFile, bytes);
+ System.err.println("Failed tempFile " + tempFile);
Review Comment:
>Hi, in fact I could undo the change that automatically write the tmp file
as it is probably useless in case of automatic tests. But add back the code
that writes the file but commented out so it could be activated manually by a
developper if needed ?
That'd be useful! I really think that'd be better than just writing whenever
there's an exception. Sorry for the extra work @kpouer !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]