refactor: reset

This commit is contained in:
vicanso 2022-05-16 20:58:41 +08:00
parent 7e80e9a848
commit c363d1d5e3
50 changed files with 55 additions and 10282 deletions

View file

@ -80,13 +80,15 @@ func TestGetRadius(t *testing.T) {
func TestMeasureTextMaxWidthHeight(t *testing.T) {
assert := assert.New(t)
r, err := chart.SVG(400, 300)
p, err := NewPainter(PainterOptions{
Width: 400,
Height: 300,
})
assert.Nil(err)
style := chart.Style{
FontSize: 10,
}
style.Font, _ = chart.GetDefaultFont()
style.WriteToRenderer(r)
p.SetStyle(style)
maxWidth, maxHeight := measureTextMaxWidthHeight([]string{
"Mon",
@ -96,7 +98,7 @@ func TestMeasureTextMaxWidthHeight(t *testing.T) {
"Fri",
"Sat",
"Sun",
}, r)
}, p)
assert.Equal(26, maxWidth)
assert.Equal(12, maxHeight)
}