2017-03-05 19:54:40 -05:00
|
|
|
package drawing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-10-27 22:52:38 -04:00
|
|
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
2017-03-05 19:54:40 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
type point struct {
|
|
|
|
X, Y float64
|
|
|
|
}
|
|
|
|
|
|
|
|
type mockLine struct {
|
|
|
|
inner []point
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ml *mockLine) LineTo(x, y float64) {
|
|
|
|
ml.inner = append(ml.inner, point{x, y})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ml mockLine) Len() int {
|
|
|
|
return len(ml.inner)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestTraceQuad(t *testing.T) {
|
2020-11-22 19:45:10 -05:00
|
|
|
// replaced new assertions helper
|
2017-03-05 19:54:40 -05:00
|
|
|
|
|
|
|
// Quad
|
|
|
|
// x1, y1, cpx1, cpy2, x2, y2 float64
|
|
|
|
// do the 9->12 circle segment
|
|
|
|
quad := []float64{10, 20, 20, 20, 20, 10}
|
|
|
|
liner := &mockLine{}
|
|
|
|
TraceQuad(liner, quad, 0.5)
|
2020-11-22 19:45:10 -05:00
|
|
|
testutil.AssertNotZero(t, liner.Len())
|
2017-03-05 19:54:40 -05:00
|
|
|
}
|