-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ERE-731 extended the possible information in the datamatrix code from…
… 696 to 1051
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/test/java/health/ere/ps/service/pdf/BarcodeElementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package health.ere.ps.service.pdf; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
import java.awt.Dimension; | ||
|
||
import org.apache.fop.apps.FOPException; | ||
import org.junit.jupiter.api.Test; | ||
import org.krysalis.barcode4j.impl.datamatrix.DataMatrixSymbolInfo; | ||
import org.krysalis.barcode4j.impl.datamatrix.SymbolShapeHint; | ||
|
||
public class BarcodeElementTest { | ||
@Test | ||
public void test() throws FOPException { | ||
int dataCodewords=719; | ||
assertThrows(IllegalArgumentException.class, () -> | ||
lookup(dataCodewords) | ||
); | ||
} | ||
|
||
@Test | ||
public void test2() throws FOPException { | ||
int dataCodewords=698; | ||
assertThrows(IllegalArgumentException.class, () -> | ||
lookup(dataCodewords) | ||
); | ||
} | ||
|
||
private void lookup(int dataCodewords) { | ||
return lookup(dataCodewords, 90, 100); | ||
} | ||
private void lookup(int dataCodewords, int minSizeInt, int maxSizeInt) { | ||
SymbolShapeHint shape = SymbolShapeHint.FORCE_SQUARE; | ||
Dimension minSize = new Dimension(minSizeInt, minSizeInt); | ||
Dimension maxSize = new Dimension(maxSizeInt, maxSizeInt); | ||
|
||
DataMatrixSymbolInfo.lookup(dataCodewords, | ||
shape, minSize, maxSize, true); | ||
} | ||
|
||
@Test | ||
public void test3() throws FOPException { | ||
for(int i = 0; i<1051; i++) { | ||
lookup(i, 90, 120); | ||
} | ||
|
||
} | ||
} |