summaryrefslogtreecommitdiff
path: root/dev-java/zxing-javase/files/3.5.1-test-available-formats.patch
blob: 62e154f0dad438299e76b103cce0bddd17b06166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
https://github.com/zxing/zxing/pull/1668
https://bugs.gentoo.org/910497
--- a/src/test/java/com/google/zxing/client/j2se/MatrixToImageWriterTestCase.java
+++ b/src/test/java/com/google/zxing/client/j2se/MatrixToImageWriterTestCase.java
@@ -17,7 +17,9 @@
 package com.google.zxing.client.j2se;
 
 import com.google.zxing.common.BitMatrix;
+import static org.hamcrest.CoreMatchers.hasItem;
 import org.junit.Assert;
+import static org.junit.Assume.assumeThat;
 import org.junit.Test;
 
 import javax.imageio.ImageIO;
@@ -25,6 +27,7 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.Arrays;
 
 /**
  * Tests {@link MatrixToImageWriter}.
@@ -52,6 +55,8 @@ private static void doTest(MatrixToImageConfig config) throws IOException {
   }
 
   private static void doTestFormat(String format, MatrixToImageConfig config) throws IOException {
+    assumeThat(Arrays.asList(ImageIO.getWriterFormatNames()), hasItem(format));
+
     int width = 2;
     int height = 3;
     BitMatrix matrix = new BitMatrix(width, height);