-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
352 additions
and
8 deletions.
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
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
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
49 changes: 49 additions & 0 deletions
49
generator/src/test/java/net/codecrete/qrbill/generator/PaymentPartTest.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,49 @@ | ||
// | ||
// Swiss QR Bill Generator | ||
// Copyright (c) 2024 Manuel Bleichenbacher | ||
// Licensed under MIT License | ||
// https://opensource.org/licenses/MIT | ||
// | ||
package net.codecrete.qrbill.generator; | ||
|
||
import net.codecrete.qrbill.testhelper.FileComparison; | ||
import net.codecrete.qrbill.testhelper.SampleData; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Unit tests for generation of payment part only (PDF, PNG and SVG) | ||
* <p> | ||
* Resulting output is compared byte by byte. | ||
* </p> | ||
*/ | ||
@DisplayName("Generation of payment part only") | ||
class PaymentPartTest { | ||
|
||
@Test | ||
void createQRBill1() { | ||
Bill bill = SampleData.getExample1(); | ||
bill.getFormat().setOutputSize(OutputSize.PAYMENT_PART_ONLY); | ||
bill.getFormat().setGraphicsFormat(GraphicsFormat.SVG); | ||
byte[] svg = QRBill.generate(bill); | ||
FileComparison.assertFileContentsEqual(svg, "payment_part1.svg"); | ||
} | ||
|
||
@Test | ||
void createQRBill2() { | ||
Bill bill = SampleData.getExample2(); | ||
bill.getFormat().setOutputSize(OutputSize.PAYMENT_PART_ONLY); | ||
bill.getFormat().setGraphicsFormat(GraphicsFormat.PDF); | ||
byte[] pdf = QRBill.generate(bill); | ||
FileComparison.assertFileContentsEqual(pdf, "payment_part2.pdf"); | ||
} | ||
|
||
@Test | ||
void createQRBill3() { | ||
Bill bill = SampleData.getExample3(); | ||
bill.getFormat().setOutputSize(OutputSize.PAYMENT_PART_ONLY); | ||
bill.getFormat().setGraphicsFormat(GraphicsFormat.PNG); | ||
byte[] png = QRBill.generate(bill); | ||
FileComparison.assertFileContentsEqual(png, "payment_part2.png"); | ||
} | ||
} |
Oops, something went wrong.