Adds support for go mod (finally) (#164)
This commit is contained in:
parent
962b9abdec
commit
c1468e8ae4
89 changed files with 1162 additions and 965 deletions
|
|
@ -3,17 +3,17 @@ package chart
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/blend/go-sdk/assert"
|
||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
||||
)
|
||||
|
||||
func TestYAxisGetTicks(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// replaced new assertions helper
|
||||
|
||||
r, err := PNG(1024, 1024)
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
|
||||
f, err := GetDefaultFont()
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
|
||||
ya := YAxis{}
|
||||
yr := &ContinuousRange{Min: 10, Max: 100, Domain: 1024}
|
||||
|
|
@ -23,17 +23,17 @@ func TestYAxisGetTicks(t *testing.T) {
|
|||
}
|
||||
vf := FloatValueFormatter
|
||||
ticks := ya.GetTicks(r, yr, styleDefaults, vf)
|
||||
assert.Len(ticks, 32)
|
||||
testutil.AssertLen(t, ticks, 32)
|
||||
}
|
||||
|
||||
func TestYAxisGetTicksWithUserDefaults(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// replaced new assertions helper
|
||||
|
||||
r, err := PNG(1024, 1024)
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
|
||||
f, err := GetDefaultFont()
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
|
||||
ya := YAxis{
|
||||
Ticks: []Tick{{Value: 1.0, Label: "1.0"}},
|
||||
|
|
@ -45,41 +45,41 @@ func TestYAxisGetTicksWithUserDefaults(t *testing.T) {
|
|||
}
|
||||
vf := FloatValueFormatter
|
||||
ticks := ya.GetTicks(r, yr, styleDefaults, vf)
|
||||
assert.Len(ticks, 1)
|
||||
testutil.AssertLen(t, ticks, 1)
|
||||
}
|
||||
|
||||
func TestYAxisMeasure(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// replaced new assertions helper
|
||||
|
||||
f, err := GetDefaultFont()
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
style := Style{
|
||||
Font: f,
|
||||
FontSize: 10.0,
|
||||
}
|
||||
r, err := PNG(100, 100)
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
ticks := []Tick{{Value: 1.0, Label: "1.0"}, {Value: 2.0, Label: "2.0"}, {Value: 3.0, Label: "3.0"}}
|
||||
ya := YAxis{}
|
||||
yab := ya.Measure(r, NewBox(0, 0, 100, 100), &ContinuousRange{Min: 1.0, Max: 3.0, Domain: 100}, style, ticks)
|
||||
assert.Equal(32, yab.Width())
|
||||
assert.Equal(110, yab.Height())
|
||||
testutil.AssertEqual(t, 32, yab.Width())
|
||||
testutil.AssertEqual(t, 110, yab.Height())
|
||||
}
|
||||
|
||||
func TestYAxisSecondaryMeasure(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// replaced new assertions helper
|
||||
|
||||
f, err := GetDefaultFont()
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
style := Style{
|
||||
Font: f,
|
||||
FontSize: 10.0,
|
||||
}
|
||||
r, err := PNG(100, 100)
|
||||
assert.Nil(err)
|
||||
testutil.AssertNil(t, err)
|
||||
ticks := []Tick{{Value: 1.0, Label: "1.0"}, {Value: 2.0, Label: "2.0"}, {Value: 3.0, Label: "3.0"}}
|
||||
ya := YAxis{AxisType: YAxisSecondary}
|
||||
yab := ya.Measure(r, NewBox(0, 0, 100, 100), &ContinuousRange{Min: 1.0, Max: 3.0, Domain: 100}, style, ticks)
|
||||
assert.Equal(32, yab.Width())
|
||||
assert.Equal(110, yab.Height())
|
||||
testutil.AssertEqual(t, 32, yab.Width())
|
||||
testutil.AssertEqual(t, 110, yab.Height())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue