From 2dedbc154f25fff0d5cdb761cf5dfd5c0c58b30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Wed, 15 Jan 2025 11:55:14 +0100 Subject: [PATCH] QR code test --- .../graphics/barcode/output/QRCodeTest.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/QRCodeTest.java b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/QRCodeTest.java index 48b14c4..07cba11 100644 --- a/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/QRCodeTest.java +++ b/graphics-barcode/src/test/java/org/xbib/graphics/barcode/output/QRCodeTest.java @@ -17,14 +17,11 @@ import java.nio.file.Paths; public class QRCodeTest { - /** - * The hard way by using Okapi Barcode. - * @throws IOException - */ @Test public void createQRCode() throws IOException { //String content = "IFLA-15: Kostenlimit überschritten, erneute Bestellung, wenn Kosten akzeptiert werden"; - String content = "IFLA-16:"; + //String content = "IFLA-16:"; + int x = 0; int y = 0; int width = 128; @@ -34,7 +31,7 @@ public class QRCodeTest { code.setQuietZoneHorizontal(1); code.setQuietZoneVertical(1); code.setEccMode(QrCode.EccMode.L); - code.setContent(content); + //code.setContent(content); double scalingFactor = 5.0d; BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); BarcodeGraphicsRenderer renderer = createRenderer(bufferedImage, x, y, scalingFactor, scalingFactor); @@ -56,14 +53,12 @@ public class QRCodeTest { /** * Easy way by using zxing. * @throws IOException - * @throws NotFoundException - * @throws WriterException */ @Test - public void testQrCode() throws IOException, NotFoundException, WriterException { + public void testQrCode() throws IOException { QRCodeWriter qrCodeWriter = new QRCodeWriter(); - try (OutputStream outputStream = Files.newOutputStream(Paths.get("build/ifla-20.png"))) { - qrCodeWriter.write("IFLA-20: Art der gewünschten Lieferung nicht möglich", + try (OutputStream outputStream = Files.newOutputStream(Paths.get("build/de-361-ifla-20.png"))) { + qrCodeWriter.write("DE-361: IFLA-20: Art der gewünschten Lieferung nicht möglich", outputStream, "png", 200, 200); } }