From 68d690cca547dee232d0dec75d2b9bdf474d35ec Mon Sep 17 00:00:00 2001 From: Manuel Bl Date: Mon, 27 May 2024 18:05:34 +0200 Subject: [PATCH] Activate SonarQube --- .github/workflows/continuous-integration.yml | 15 +++++++-------- generator/build.gradle | 8 +++++++- .../codecrete/qrbill/canvas/PdfCanvasTest.java | 13 +++++++++++++ .../codecrete/qrbill/generator/QRBillTest.java | 2 -- .../qrbill/generator/SPSCharacterSetTest.java | 1 - .../test/resources/pdfcanvas-colored-line.pdf | Bin 0 -> 736 bytes 6 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 generator/src/test/resources/pdfcanvas-colored-line.pdf diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0931c8e..9cde9db 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -7,35 +7,34 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 + uses: gradle/wrapper-validation-action@v3 - name: Build with Gradle working-directory: ./generator run: ./gradlew build - name: Upload received files from failing tests - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: Received-${{ runner.os }} path: "generator/actual_*" - name: Upload test results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: TestResults-${{ runner.os }} path: generator/build/reports/tests/test - name: SonarQube env: - SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} working-directory: ./generator - if: ${{ github.ref == 'refs/heads/v3' }} - run: ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN + run: ./gradlew jacocoTestReport sonar -Dsonar.token=$SONAR_TOKEN diff --git a/generator/build.gradle b/generator/build.gradle index ef20202..ad79020 100644 --- a/generator/build.gradle +++ b/generator/build.gradle @@ -35,7 +35,6 @@ jar { 'Implementation-Version': archiveVersion, 'Implementation-Vendor': 'Manuel Bleichenbacher' ) - } } @@ -47,6 +46,10 @@ javadoc { options.addBooleanOption('html5', true) } +test { + useJUnitPlatform() +} + artifacts { archives javadocJar, sourcesJar } @@ -112,8 +115,11 @@ sonar { } jacocoTestReport { + dependsOn test reports { xml.required = true + html.required = false + csv.required = false } } diff --git a/generator/src/test/java/net/codecrete/qrbill/canvas/PdfCanvasTest.java b/generator/src/test/java/net/codecrete/qrbill/canvas/PdfCanvasTest.java index 3992d64..02e13a0 100644 --- a/generator/src/test/java/net/codecrete/qrbill/canvas/PdfCanvasTest.java +++ b/generator/src/test/java/net/codecrete/qrbill/canvas/PdfCanvasTest.java @@ -83,6 +83,19 @@ void addPageToOpenPdfDocument() throws IOException { compareResult(path, "pdfcanvas-opendoc.pdf"); } + @Test + void coloredLines() throws IOException { + Path path = Files.createTempFile("pdfcanvas-", ".pdf"); + try (PDFCanvas canvas = new PDFCanvas(100, 100)) { + canvas.moveTo(10, 10); + canvas.lineTo(90, 90); + canvas.strokePath(2, 0xFF00FF, Canvas.LineStyle.Dashed, true); + canvas.saveAs(path); + } + + compareResult(path, "pdfcanvas-colored-line.pdf"); + } + @Test void addPageToOpenContentStream() throws IOException { PDDocument document = new PDDocument(); diff --git a/generator/src/test/java/net/codecrete/qrbill/generator/QRBillTest.java b/generator/src/test/java/net/codecrete/qrbill/generator/QRBillTest.java index df235ea..4f69bcf 100644 --- a/generator/src/test/java/net/codecrete/qrbill/generator/QRBillTest.java +++ b/generator/src/test/java/net/codecrete/qrbill/generator/QRBillTest.java @@ -11,8 +11,6 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; - /** * Unit tests for generation of A6 bills (PDF and SVG) *

diff --git a/generator/src/test/java/net/codecrete/qrbill/generator/SPSCharacterSetTest.java b/generator/src/test/java/net/codecrete/qrbill/generator/SPSCharacterSetTest.java index a50da56..5fb0c67 100644 --- a/generator/src/test/java/net/codecrete/qrbill/generator/SPSCharacterSetTest.java +++ b/generator/src/test/java/net/codecrete/qrbill/generator/SPSCharacterSetTest.java @@ -1,7 +1,6 @@ package net.codecrete.qrbill.generator; import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; diff --git a/generator/src/test/resources/pdfcanvas-colored-line.pdf b/generator/src/test/resources/pdfcanvas-colored-line.pdf new file mode 100644 index 0000000000000000000000000000000000000000..47633fc9638c82fd0432a74503836195e1db0382 GIT binary patch literal 736 zcmY!laBZ^4=fsl4ocwey{jk)c;>`R! z1$~fe{eZ;u)M5oApz5UAIVGt@3i@t2i6yBn zsmb{%sUS_oB}J);xx8EzbF`lrZMtA=W@u~}++bX^v&YBxD-W+OkLZIQ89irKW>)7` zg>pS+R{eDu+^rD`_N}Kq7S7S0p*?|{fvtg$nHOX|#4wmc%rPBeXlexWlYdfHa7iwg zzMldP#{pejR9vE9WQgj_(B9pAO%4LC^-rhW+VF;3hl6#>F_(*d0RlH?_?oRrRCslN zcehxSk5TdSCvuG;jv2nj7)9u@h7fv;py*QAyzsK0()Tj9@ z)-w)%n_9ofcd|&~5kEDpV5|Q(cXjxym2_;KWZL$}D7M+Fw&_-X@ekoIRqGe6KYQ+6 zLUCP$(j2LfYddpU?(r@%nUBT$7MR{QvgFba%Fi!R07Y>Sm%e9STE2oAl}G0dX>Ms@Vrr*ASV=4_gd>7d)4245GpkY+fcARk zrKDCUL>nkr02PEQL>mGfVF+XrOc%)sKhB>xf8Yq8OOMYRpPo7gHsi;oYz(rVOo>>0 YU0jk_R8mm{wAsYmfJ;@?)!&T^0F>bLq5uE@ literal 0 HcmV?d00001