From 790c363cceaaa09e91ad579e2d25cb13c1582bba Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 18 Sep 2021 23:20:24 +0800 Subject: 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% --- picture_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'picture_test.go') 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")) } -- cgit v1.2.1