diff options
author | xuri <xuri.me@gmail.com> | 2020-09-18 22:20:58 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2020-09-18 22:20:58 +0800 |
commit | 324f87bcaed9ec775c0b79627956a093ad481d36 (patch) | |
tree | 56a779bde041b3dae82ab0f2e827ed0021c3d602 /styles_test.go | |
parent | 96917e4617c9e7eb15c0ee1723a042f169321430 (diff) |
add checking and limits for the worksheet
Diffstat (limited to 'styles_test.go')
-rw-r--r-- | styles_test.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/styles_test.go b/styles_test.go index 9b8ba39..b68365b 100644 --- a/styles_test.go +++ b/styles_test.go @@ -3,6 +3,7 @@ package excelize import ( "fmt" "path/filepath" + "strings" "testing" "github.com/stretchr/testify/assert" @@ -200,6 +201,10 @@ func TestNewStyle(t *testing.T) { assert.NoError(t, err) _, err = f.NewStyle(Style{}) assert.EqualError(t, err, "invalid parameter type") + _, err = f.NewStyle(&Style{Font: &Font{Family: strings.Repeat("s", MaxFontFamilyLength+1)}}) + assert.EqualError(t, err, "the length of the font family name must be smaller than or equal to 31") + _, err = f.NewStyle(&Style{Font: &Font{Size: MaxFontSize + 1}}) + assert.EqualError(t, err, "font size must be between 1 and 409 points") } func TestGetDefaultFont(t *testing.T) { |