Skip to content

Commit

Permalink
added tests data
Browse files Browse the repository at this point in the history
  • Loading branch information
tafel committed Aug 30, 2024
1 parent 522a82e commit 82025d3
Show file tree
Hide file tree
Showing 95 changed files with 3,393 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
/example/HtmlOutput/html-example.htm
/example/FpdfOutput/fpdf_example.pdf
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
.idea/
13 changes: 8 additions & 5 deletions src/PaymentPart/Output/FpdfOutput/FpdfOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ final class FpdfOutput extends AbstractOutput
private const ALIGN_CENTER = 'C';
private const FONT = 'Helvetica';
private const FONT_UNICODE = 'zapfdingbats';
private const FONT_UNICODE_CHAR_SCISSORS = '"';

// Positioning
private const CURRENCY_AMOUNT_Y = 259.3;
Expand Down Expand Up @@ -228,7 +229,7 @@ private function addSeparatorContentIfNotPrintable(): void
if (!$this->isPrintable()) {
$this->fpdf->SetLineWidth(0.1);
if ($this->isScissors()) {
if (!method_exists($this->fpdf, 'swissQrBillSetDash') || !method_exists($this->fpdf, 'swissQrBillTextWithRotation')) {
if (!method_exists($this->fpdf, 'swissQrBillSetDash')) {
throw new MissingTraitException('Missing FpdfTrait in this fpdf instance. See fpdf-example.php within this library.');
}
$this->fpdf->swissQrBillSetDash(2, 1);
Expand All @@ -240,12 +241,14 @@ private function addSeparatorContentIfNotPrintable(): void
$this->fpdf->swissQrBillSetDash(0);

$this->fpdf->SetFont(self::FONT_UNICODE, '', self::FONT_SIZE_SCISSORS);
$scissorsCode = '"';
// horizontal scissors
$this->setXY(2 + $this->offsetX + 5, 193 + $this->offsetY + 0.2);
$this->fpdf->Cell(1, 0, $scissorsCode, 0, 0, 'C');
// vertical scissors
$this->fpdf->swissQrBillTextWithRotation(62 + $this->offsetX - 1.7, 193 + $this->offsetY + 4, $scissorsCode, -90);
$this->fpdf->Cell(1, 0, self::FONT_UNICODE_CHAR_SCISSORS, 0, 0, 'C');
// vertical scissors$
if (!method_exists($this->fpdf, 'swissQrBillTextWithRotation')) {
throw new MissingTraitException('Missing FpdfTrait in this fpdf instance. See fpdf-example.php within this library.');
}
$this->fpdf->swissQrBillTextWithRotation(62 + $this->offsetX - 1.7, 193 + $this->offsetY + 4, self::FONT_UNICODE_CHAR_SCISSORS, -90);
} else {
$this->fpdf->SetFont(self::FONT, '', self::FONT_SIZE_FURTHER_INFORMATION);
$this->setY(189.6);
Expand Down
16 changes: 7 additions & 9 deletions src/PaymentPart/Output/FpdfOutput/FpdfTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

trait FpdfTrait
{

/**
* Set dash line style for the next ->Line() command
* DO NOT USE IT. Its purpose is only for this library. Name and/or signature
* may change without any notification.
* DO NOT USE IT. Its purpose is only for the Swiss QR Bill library. Name and/or
* signature may change without any notification.
*
* @see http://www.fpdf.org/en/script/script33.php
* @param float $black Width
* @param ?float $white
* @param float $black Width of black dash. 0 to reset to solid line
* @param ?float $white Width of white dash. Defaults to same as black
* @return void
*/
public function swissQrBillSetDash(float $black = 0, ?float $white = null): void
Expand All @@ -28,8 +27,8 @@ public function swissQrBillSetDash(float $black = 0, ?float $white = null): void

/**
* Rotate text
* DO NOT USE IT. Its purpose is only for this library. Name and/or signature
* may change without any notification.
* DO NOT USE IT. Its purpose is only for the Swiss QR Bill library. Name and/or
* signature may change without any notification.
*
* @see http://www.fpdf.org/en/script/script31.php
* @param float $x
Expand Down Expand Up @@ -62,9 +61,8 @@ public function swissQrBillTextWithRotation(float $x, float $y, string $txt, flo
);

if ($this->ColorFlag) {
$s = 'q '. $this->TextColor .' ' . $s . ' Q';
$s = sprintf('q %s %s Q', $this->TextColor, $s);
}
$this->_out($s);
}

}
3 changes: 2 additions & 1 deletion src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class TcPdfOutput extends AbstractOutput
private const ALIGN_CENTER = 'C';
private const FONT = 'Helvetica';
private const FONT_UNICODE = 'freeserif';
private const FONT_UNICODE_CHAR_SCISSORS = '';

// Ratio
private const LEFT_CELL_HEIGHT_RATIO_COMMON = 1.2;
Expand Down Expand Up @@ -242,7 +243,7 @@ private function addSeparatorContentIfNotPrintable(): void
$this->setX($xmiddle);
$this->tcPdf->StartTransform();
$this->tcPdf->Rotate(-90);
$this->tcPdf->Cell(0, 10, '', 0, 0, 'L', false, '', 0, false, 'C');
$this->tcPdf->Cell(0, 10, self::FONT_UNICODE_CHAR_SCISSORS, 0, 0, 'L', false, '', 0, false, 'C');
$this->tcPdf->StopTransform();
} else {
$this->tcPdf->SetFont(self::FONT, '', self::FONT_SIZE_FURTHER_INFORMATION);
Expand Down
Binary file modified tests/TestData/FpdfOutput/qr-additional-information.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-additional-information.print.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-alternative-schemes.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-alternative-schemes.print.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-full-set.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-full-set.print.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-international-ultimate-debtor.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-minimal-setup.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-minimal-setup.print.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-information-zero-amount.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-non.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-non.print.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-scor.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-payment-reference-scor.print.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-ultimate-debtor.pdf
Binary file not shown.
Binary file modified tests/TestData/FpdfOutput/qr-ultimate-debtor.print.pdf
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

265 changes: 265 additions & 0 deletions tests/TestData/HtmlOutput/qr-full-set-compact.svg.scissors.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

258 changes: 258 additions & 0 deletions tests/TestData/HtmlOutput/qr-minimal-setup-compact.svg.scissors.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

262 changes: 262 additions & 0 deletions tests/TestData/HtmlOutput/qr-ultimate-debtor-compact.svg.scissors.html

Large diffs are not rendered by default.

Binary file modified tests/TestData/TcPdfOutput/qr-additional-information.svg.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-alternative-schemes.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-alternative-schemes.svg.print.pdf
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-full-set.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-full-set.svg.print.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-minimal-setup.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-minimal-setup.svg.print.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-payment-reference-non.svg.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-payment-reference-scor.svg.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-ultimate-debtor.svg.pdf
Binary file not shown.
Binary file modified tests/TestData/TcPdfOutput/qr-ultimate-debtor.svg.print.pdf
Binary file not shown.
Binary file not shown.

0 comments on commit 82025d3

Please sign in to comment.