test: fix test

This commit is contained in:
vicanso 2022-02-12 13:01:37 +08:00
parent bff06b2aa5
commit 1c89ed29be
6 changed files with 152 additions and 53 deletions

View file

@ -90,6 +90,40 @@ func TestWidthHeightOption(t *testing.T) {
}, d.Box)
}
func TestBoxOption(t *testing.T) {
assert := assert.New(t)
d, err := NewDraw(DrawOption{
Width: 400,
Height: 300,
})
assert.Nil(err)
err = BoxOption(chart.Box{
Left: 10,
Top: 20,
Right: 50,
Bottom: 100,
})(d)
assert.Nil(err)
assert.Equal(chart.Box{
Left: 10,
Top: 20,
Right: 50,
Bottom: 100,
}, d.Box)
// zero box will be ignored
err = BoxOption(chart.Box{})(d)
assert.Nil(err)
assert.Equal(chart.Box{
Left: 10,
Top: 20,
Right: 50,
Bottom: 100,
}, d.Box)
}
func TestPaddingOption(t *testing.T) {
assert := assert.New(t)