|
|
@ -58,7 +58,7 @@ func TestStreamWriter(t *testing.T) {
|
|
|
|
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("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)"}}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A5", []interface{}{&Cell{StyleID: styleID, Value: "cell"}, &Cell{Formula: "SUM(A10,B10)"}}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A6", []interface{}{time.Now()}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A6", []interface{}{time.Now()}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A7", nil, RowOpts{Hidden: true}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A7", nil, RowOpts{Height: 20, Hidden: true, StyleID: styleID}))
|
|
|
|
assert.EqualError(t, streamWriter.SetRow("A7", nil, RowOpts{Height: MaxRowHeight + 1}), ErrMaxRowHeight.Error())
|
|
|
|
assert.EqualError(t, streamWriter.SetRow("A7", nil, RowOpts{Height: MaxRowHeight + 1}), ErrMaxRowHeight.Error())
|
|
|
|
|
|
|
|
|
|
|
|
for rowID := 10; rowID <= 51200; rowID++ {
|
|
|
|
for rowID := 10; rowID <= 51200; rowID++ {
|
|
|
@ -208,24 +208,27 @@ func TestSetRow(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestSetCellValFunc(t *testing.T) {
|
|
|
|
func TestSetCellValFunc(t *testing.T) {
|
|
|
|
|
|
|
|
f := NewFile()
|
|
|
|
|
|
|
|
sw, err := f.NewStreamWriter("Sheet1")
|
|
|
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
c := &xlsxC{}
|
|
|
|
c := &xlsxC{}
|
|
|
|
assert.NoError(t, setCellValFunc(c, 128))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, 128))
|
|
|
|
assert.NoError(t, setCellValFunc(c, int8(-128)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, int8(-128)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, int16(-32768)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, int16(-32768)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, int32(-2147483648)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, int32(-2147483648)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, int64(-9223372036854775808)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, int64(-9223372036854775808)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, uint(128)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, uint(128)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, uint8(255)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, uint8(255)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, uint16(65535)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, uint16(65535)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, uint32(4294967295)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, uint32(4294967295)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, uint64(18446744073709551615)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, uint64(18446744073709551615)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, float32(100.1588)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, float32(100.1588)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, float64(100.1588)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, float64(100.1588)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, " Hello"))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, " Hello"))
|
|
|
|
assert.NoError(t, setCellValFunc(c, []byte(" Hello")))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, []byte(" Hello")))
|
|
|
|
assert.NoError(t, setCellValFunc(c, time.Now().UTC()))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, time.Now().UTC()))
|
|
|
|
assert.NoError(t, setCellValFunc(c, time.Duration(1e13)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, time.Duration(1e13)))
|
|
|
|
assert.NoError(t, setCellValFunc(c, true))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, true))
|
|
|
|
assert.NoError(t, setCellValFunc(c, nil))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, nil))
|
|
|
|
assert.NoError(t, setCellValFunc(c, complex64(5+10i)))
|
|
|
|
assert.NoError(t, sw.setCellValFunc(c, complex64(5+10i)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|