diff options
author | Kurt <kurt.w.jung@gmail.com> | 2018-09-19 15:51:34 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2018-09-19 15:51:34 -0400 |
commit | 6421d61dcdc4da19badab16dc2a8af331c4fbbeb (patch) | |
tree | d0676e7ed421cd20c9ddfb56e83cc1b3985a16b1 | |
parent | 7d57599b9d9c5fb48ea733596cbb812d7f84a8d6 (diff) |
Add beginning of test to study issue 193
-rw-r--r-- | fpdf_test.go | 22 | ||||
-rw-r--r-- | image/sweden.png | bin | 0 -> 472 bytes |
2 files changed, 22 insertions, 0 deletions
diff --git a/fpdf_test.go b/fpdf_test.go index e82217a..4774ec6 100644 --- a/fpdf_test.go +++ b/fpdf_test.go @@ -78,6 +78,28 @@ func TestIssue0116(t *testing.T) { } } +// TestIssue0193 addresses issue 193 in which the error io.EOF is incorrectly +// assigned to the FPDF instance error. +func TestIssue0193(t *testing.T) { + var png []byte + var pdf *gofpdf.Fpdf + var err error + var rdr *bytes.Reader + + png, err = ioutil.ReadFile(example.ImageFile("sweden.png")) + if err == nil { + rdr = bytes.NewReader(png) + pdf = gofpdf.New("P", "mm", "A4", "") + pdf.AddPage() + _ = pdf.RegisterImageOptionsReader("sweden", gofpdf.ImageOptions{ImageType: "png", ReadDpi: true}, rdr) + err = pdf.Error() + } + if err != nil { + t.Fatalf("issue 193 error: %s", err) + } + +} + // Test to make sure the footer is not call twice and SetFooterFuncLpi can work // without SetFooterFunc. func TestFooterFuncLpi(t *testing.T) { diff --git a/image/sweden.png b/image/sweden.png Binary files differnew file mode 100644 index 0000000..22f6e7e --- /dev/null +++ b/image/sweden.png |