summaryrefslogtreecommitdiff
path: root/picture_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-09-18 23:20:24 +0800
committerxuri <xuri.me@gmail.com>2021-09-19 11:06:54 +0800
commit790c363cceaaa09e91ad579e2d25cb13c1582bba (patch)
treeb5747f30edeac96a7fdadec574f1a5b1d332ca18 /picture_test.go
parent2add938798cdd1456616869298319528b0c76913 (diff)
This closes #833, closes #845, and closes #1022, breaking changes
- Close spreadsheet and row's iterator required - New options `WorksheetUnzipMemLimit` have been added - Improve streaming reading performance, memory usage decrease about 93.7%
Diffstat (limited to 'picture_test.go')
-rw-r--r--picture_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/picture_test.go b/picture_test.go
index 3e12f5f..2927976 100644
--- a/picture_test.go
+++ b/picture_test.go
@@ -68,6 +68,7 @@ func TestAddPicture(t *testing.T) {
// Test write file to given path.
assert.NoError(t, f.SaveAs(filepath.Join("test", "TestAddPicture.xlsx")))
+ assert.NoError(t, f.Close())
}
func TestAddPictureErrors(t *testing.T) {
@@ -90,6 +91,7 @@ func TestAddPictureErrors(t *testing.T) {
// Test add picture to worksheet with invalid file data.
err = f.AddPictureFromBytes("Sheet1", "G21", "", "Excel Logo", ".jpg", make([]byte, 1))
assert.EqualError(t, err, "image: unknown format")
+ assert.NoError(t, f.Close())
}
func TestGetPicture(t *testing.T) {
@@ -137,7 +139,6 @@ func TestGetPicture(t *testing.T) {
assert.NoError(t, err)
if !assert.NotEmpty(t, filepath.Join("test", file)) || !assert.NotEmpty(t, raw) ||
!assert.NoError(t, ioutil.WriteFile(filepath.Join("test", file), raw, 0644)) {
-
t.FailNow()
}
@@ -146,6 +147,7 @@ func TestGetPicture(t *testing.T) {
assert.NoError(t, err)
assert.Empty(t, file)
assert.Empty(t, raw)
+ assert.NoError(t, f.Close())
// Test get picture from none drawing worksheet.
f = NewFile()
@@ -194,6 +196,7 @@ func TestDeletePicture(t *testing.T) {
assert.EqualError(t, f.DeletePicture("SheetN", "A1"), "sheet SheetN is not exist")
// Test delete picture with invalid coordinates.
assert.EqualError(t, f.DeletePicture("Sheet1", ""), `cannot convert cell "" to coordinates: invalid cell name ""`)
+ assert.NoError(t, f.Close())
// Test delete picture on no chart worksheet.
assert.NoError(t, NewFile().DeletePicture("Sheet1", "A1"))
}