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 /shape_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 'shape_test.go')
-rw-r--r-- | shape_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shape_test.go b/shape_test.go index 829a9e5..9d1da8a 100644 --- a/shape_test.go +++ b/shape_test.go @@ -87,4 +87,15 @@ func TestAddShape(t *testing.T) { } }`)) assert.NoError(t, f.SaveAs(filepath.Join("test", "TestAddShape2.xlsx"))) + // Test set row style with unsupported charset style sheet. + f.Styles = nil + f.Pkg.Store(defaultXMLPathStyles, MacintoshCyrillicCharset) + assert.EqualError(t, f.AddShape("Sheet1", "B30", `{"type":"rect","paragraph":[{"text":"Rectangle"},{}]}`), "XML syntax error on line 1: invalid UTF-8") +} + +func TestAddDrawingShape(t *testing.T) { + f := NewFile() + path := "xl/drawings/drawing1.xml" + f.Pkg.Store(path, MacintoshCyrillicCharset) + assert.EqualError(t, f.addDrawingShape("sheet1", path, "A1", &shapeOptions{}), "XML syntax error on line 1: invalid UTF-8") } |