diff options
author | Kurt <kurt.w.jung@gmail.com> | 2019-05-22 13:22:20 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2019-05-22 13:22:20 -0400 |
commit | 8060f8371088d63b5935a6eeb617328705387ace (patch) | |
tree | 67c429291c6c45f8ffb70c531e218c15d149cfa7 /contrib/barcode/barcode_test.go | |
parent | 5f4e2f65402b9aa611f93b2fa14ea69bf7b26d2d (diff) | |
parent | 290b8c334e0f9ce3f5fc95bb70002b13d3300bb5 (diff) |
Merge branch 'jrs526-master'
Diffstat (limited to 'contrib/barcode/barcode_test.go')
-rw-r--r-- | contrib/barcode/barcode_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/barcode/barcode_test.go b/contrib/barcode/barcode_test.go index 2b402a3..066ac41 100644 --- a/contrib/barcode/barcode_test.go +++ b/contrib/barcode/barcode_test.go @@ -199,3 +199,24 @@ func TestGetUnscaledBarcodeDimensions(t *testing.T) { // Output: // Successfully generated ../../pdf/contrib_barcode_GetBarcodeDimensions.pdf } + +// TestBarcodeNonIntegerScalingFactors shows that the barcode may be scaled to non-integer sizes +func TestBarcodeNonIntegerScalingFactors(t *testing.T) { + pdf := gofpdf.New("L", "in", "A4", "") + pdf.SetFont("Helvetica", "", 12) + pdf.SetFillColor(200, 200, 220) + pdf.AddPage() + + key := barcode.RegisterQR(pdf, "qrcode", qr.H, qr.Unicode) + var scale float64 = 1.5 + barcode.BarcodeUnscalable(pdf, key, 0.5, 0.5, &scale, &scale, false) + + pdf.SetDrawColor(255, 0, 0) + pdf.Line(0.5, 0.5, 0.5+scale, 0.5+scale) + + fileStr := example.Filename("contrib_barcode_BarcodeScaling") + err := pdf.OutputFileAndClose(fileStr) + example.Summary(err, fileStr) + // Output: + // Successfully generated ../../pdf/contrib_barcode_BarcodeScaling.pdf +} |