summaryrefslogtreecommitdiff
path: root/rows_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-12-27 23:34:14 +0800
committerxuri <xuri.me@gmail.com>2021-12-27 23:49:28 +0800
commit89b85934f60ba0012f3de6da03eb12959e4b4b72 (patch)
tree3d913c2bdabf06b79b7c2f223cfe26b64aacd8cc /rows_test.go
parent6b1e592cbc7b1412da5f6d0badeaf1083117c762 (diff)
This closes #1096, memory usage optimization and another 4 changes
- Unzip shared string table to system temporary file when large inner XML, reduce memory usage about 70% - Remove unnecessary exported variable `XMLHeader`, we can using `encoding/xml` package's `xml.Header` instead of it - Using constant instead of inline text for default XML path - Rename exported option field `WorksheetUnzipMemLimit` to `UnzipXMLSizeLimit` - Unit test and documentation updated
Diffstat (limited to 'rows_test.go')
-rw-r--r--rows_test.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/rows_test.go b/rows_test.go
index 0c154a4..63321ce 100644
--- a/rows_test.go
+++ b/rows_test.go
@@ -56,11 +56,18 @@ func TestRows(t *testing.T) {
assert.NoError(t, err)
// Test reload the file to memory from system temporary directory.
- f, err = OpenFile(filepath.Join("test", "Book1.xlsx"), Options{WorksheetUnzipMemLimit: 1024})
+ f, err = OpenFile(filepath.Join("test", "Book1.xlsx"), Options{UnzipXMLSizeLimit: 128})
assert.NoError(t, err)
value, err := f.GetCellValue("Sheet1", "A19")
assert.NoError(t, err)
assert.Equal(t, "Total:", value)
+ // Test load shared string table to memory
+ err = f.SetCellValue("Sheet1", "A19", "A19")
+ assert.NoError(t, err)
+ value, err = f.GetCellValue("Sheet1", "A19")
+ assert.NoError(t, err)
+ assert.Equal(t, "A19", value)
+ assert.NoError(t, f.SaveAs(filepath.Join("test", "TestSetRow.xlsx")))
assert.NoError(t, f.Close())
}
@@ -200,7 +207,7 @@ func TestColumns(t *testing.T) {
func TestSharedStringsReader(t *testing.T) {
f := NewFile()
- f.Pkg.Store("xl/sharedStrings.xml", MacintoshCyrillicCharset)
+ f.Pkg.Store(dafaultXMLPathSharedStrings, MacintoshCyrillicCharset)
f.sharedStringsReader()
si := xlsxSI{}
assert.EqualValues(t, "", si.String())