summaryrefslogtreecommitdiff
path: root/stream_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-04-30 00:14:42 +0800
committerxuri <xuri.me@gmail.com>2021-04-30 00:14:42 +0800
commit7e429c5b464b53f305e94cc355f14ba9e1d9849c (patch)
treec732503f48464b6303291d2538f80d170c4bc913 /stream_test.go
parentaf5e87dbcf5a89201072f5ca07d532258ece278f (diff)
Fixe issue generated file corrupted caused by incorrect default XML namespace attributes
Diffstat (limited to 'stream_test.go')
-rw-r--r--stream_test.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/stream_test.go b/stream_test.go
index 26732d8..d36883a 100644
--- a/stream_test.go
+++ b/stream_test.go
@@ -40,7 +40,7 @@ func TestStreamWriter(t *testing.T) {
// Test max characters in a cell.
row := make([]interface{}, 1)
- row[0] = strings.Repeat("c", 32769)
+ row[0] = strings.Repeat("c", TotalCellChars+2)
assert.NoError(t, streamWriter.SetRow("A1", row))
// Test leading and ending space(s) character characters in a cell.
@@ -100,6 +100,16 @@ func TestStreamWriter(t *testing.T) {
file.XLSX["xl/worksheets/sheet1.xml"] = MacintoshCyrillicCharset
_, err = file.NewStreamWriter("Sheet1")
assert.EqualError(t, err, "xml decode error: XML syntax error on line 1: invalid UTF-8")
+
+ // Test read cell.
+ file = NewFile()
+ streamWriter, err = file.NewStreamWriter("Sheet1")
+ assert.NoError(t, err)
+ assert.NoError(t, streamWriter.SetRow("A1", []interface{}{Cell{StyleID: styleID, Value: "Data"}}))
+ assert.NoError(t, streamWriter.Flush())
+ cellValue, err := file.GetCellValue("Sheet1", "A1")
+ assert.NoError(t, err)
+ assert.Equal(t, "Data", cellValue)
}
func TestStreamTable(t *testing.T) {