From ac564afa56a691e378ab9bb04cb14bb283886a16 Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 13 Nov 2022 00:40:04 +0800 Subject: Remove internal error log print, throw XML deserialize error --- pivotTable_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pivotTable_test.go') diff --git a/pivotTable_test.go b/pivotTable_test.go index 5d2e537..fc9e090 100644 --- a/pivotTable_test.go +++ b/pivotTable_test.go @@ -259,6 +259,15 @@ func TestAddPivotTable(t *testing.T) { // Test get pivot fields index with empty data range _, err = f.getPivotFieldsIndex([]PivotTableField{}, &PivotTableOptions{}) assert.EqualError(t, err, `parameter 'DataRange' parsing error: parameter is required`) + // Test add pivot table with unsupported charset content types. + f = NewFile() + f.ContentTypes = nil + f.Pkg.Store(defaultXMLPathContentTypes, MacintoshCyrillicCharset) + assert.EqualError(t, f.AddPivotTable(&PivotTableOptions{ + DataRange: "Sheet1!$A$1:$E$31", + PivotTableRange: "Sheet1!$G$2:$M$34", + Rows: []PivotTableField{{Data: "Year"}}, + }), "XML syntax error on line 1: invalid UTF-8") } func TestAddPivotRowFields(t *testing.T) { -- cgit v1.2.1