diff options
Diffstat (limited to 'stream_test.go')
-rw-r--r-- | stream_test.go | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/stream_test.go b/stream_test.go index dca06aa..925a6a7 100644 --- a/stream_test.go +++ b/stream_test.go @@ -58,11 +58,19 @@ func TestStreamWriter(t *testing.T) { // Test set cell with style and rich text. styleID, err := file.NewStyle(&Style{Font: &Font{Color: "#777777"}}) assert.NoError(t, err) - assert.NoError(t, streamWriter.SetRow("A4", []interface{}{Cell{StyleID: styleID}, Cell{Formula: "SUM(A10,B10)"}}, RowOpts{Height: 45, StyleID: styleID})) - assert.NoError(t, streamWriter.SetRow("A5", []interface{}{&Cell{StyleID: styleID, Value: "cell"}, &Cell{Formula: "SUM(A10,B10)"}, []RichTextRun{ - {Text: "Rich ", Font: &Font{Color: "2354e8"}}, - {Text: "Text", Font: &Font{Color: "e83723"}}, - }})) + assert.NoError(t, streamWriter.SetRow("A4", []interface{}{ + Cell{StyleID: styleID}, + Cell{Formula: "SUM(A10,B10)", Value: " preserve space "}, + }, + RowOpts{Height: 45, StyleID: styleID})) + assert.NoError(t, streamWriter.SetRow("A5", []interface{}{ + &Cell{StyleID: styleID, Value: "cell <>&'\""}, + &Cell{Formula: "SUM(A10,B10)"}, + []RichTextRun{ + {Text: "Rich ", Font: &Font{Color: "2354e8"}}, + {Text: "Text", Font: &Font{Color: "e83723"}}, + }, + })) assert.NoError(t, streamWriter.SetRow("A6", []interface{}{time.Now()})) assert.NoError(t, streamWriter.SetRow("A7", nil, RowOpts{Height: 20, Hidden: true, StyleID: styleID})) assert.EqualError(t, streamWriter.SetRow("A8", nil, RowOpts{Height: MaxRowHeight + 1}), ErrMaxRowHeight.Error()) |