diff options
author | xuri <xuri.me@gmail.com> | 2022-11-12 00:02:11 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2022-11-12 00:16:23 +0800 |
commit | bd5dd17673f767b9f4643423c77eec486f2ad53f (patch) | |
tree | d1ceaf5f7eeff101bcf5b3f9a861a8b115088718 /col_test.go | |
parent | 58b5dae5eb4948a3cde238ced1ae05db159749f5 (diff) |
This is a breaking change, remove partial internal error log print, throw XML deserialize error
- Add error return value for the `GetComments`, `GetDefaultFont` and `SetDefaultFont` functions
- Update unit tests
Diffstat (limited to 'col_test.go')
-rw-r--r-- | col_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/col_test.go b/col_test.go index f786335..0ed1906 100644 --- a/col_test.go +++ b/col_test.go @@ -56,6 +56,15 @@ func TestCols(t *testing.T) { }) _, err = f.Rows("Sheet1") assert.NoError(t, err) + + // Test columns iterator with unsupported charset shared strings table. + f.SharedStrings = nil + f.Pkg.Store(defaultXMLPathSharedStrings, MacintoshCyrillicCharset) + cols, err = f.Cols("Sheet1") + assert.NoError(t, err) + cols.Next() + _, err = cols.Rows() + assert.EqualError(t, err, "XML syntax error on line 1: invalid UTF-8") } func TestColumnsIterator(t *testing.T) { @@ -316,6 +325,10 @@ func TestSetColStyle(t *testing.T) { assert.NoError(t, err) assert.Equal(t, styleID, cellStyleID) assert.NoError(t, f.SaveAs(filepath.Join("test", "TestSetColStyle.xlsx"))) + // Test set column style with unsupported charset style sheet. + f.Styles = nil + f.Pkg.Store(defaultXMLPathStyles, MacintoshCyrillicCharset) + assert.EqualError(t, f.SetColStyle("Sheet1", "C:F", styleID), "XML syntax error on line 1: invalid UTF-8") } func TestColWidth(t *testing.T) { |