Skip to content

Commit

Permalink
ERE-731 extended the possible information in the datamatrix code from…
Browse files Browse the repository at this point in the history
… 696 to 1051
  • Loading branch information
ManuelB committed Oct 8, 2024
1 parent 04ab744 commit 33ad108
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/resources/fop/ERezeptTemplate.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
<barcode:datamatrix>
<barcode:module-width>0.52mm</barcode:module-width>
<barcode:min-symbol-size>90</barcode:min-symbol-size>
<barcode:max-symbol-size>100</barcode:max-symbol-size>
<barcode:max-symbol-size>120</barcode:max-symbol-size>
</barcode:datamatrix>
</barcode:barcode>
</fo:instream-foreign-object>
Expand Down
48 changes: 48 additions & 0 deletions src/test/java/health/ere/ps/service/pdf/BarcodeElementTest.java
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);
}

}
}

0 comments on commit 33ad108

Please sign in to comment.