make sample interface private
This commit is contained in:
parent
cf81b0b120
commit
8c807d1289
3 changed files with 7 additions and 5 deletions
|
@ -11,12 +11,14 @@ import (
|
||||||
"github.com/llgcode/draw2d/draw2dpdf"
|
"github.com/llgcode/draw2d/draw2dpdf"
|
||||||
)
|
)
|
||||||
|
|
||||||
func test(t *testing.T, sample draw2d.Sample) {
|
type sample func(gc draw2d.GraphicContext, ext string) (string, error)
|
||||||
|
|
||||||
|
func test(t *testing.T, draw sample) {
|
||||||
// Initialize the graphic context on an pdf document
|
// Initialize the graphic context on an pdf document
|
||||||
dest := draw2dpdf.NewPdf("L", "mm", "A4")
|
dest := draw2dpdf.NewPdf("L", "mm", "A4")
|
||||||
gc := draw2dpdf.NewGraphicContext(dest)
|
gc := draw2dpdf.NewGraphicContext(dest)
|
||||||
// Draw sample
|
// Draw sample
|
||||||
fn, err := sample(gc, "pdf")
|
fn, err := draw(gc, "pdf")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Drawing %q failed: %v", fn, err)
|
t.Errorf("Drawing %q failed: %v", fn, err)
|
||||||
return
|
return
|
||||||
|
|
2
gc.go
2
gc.go
|
@ -15,8 +15,6 @@ const (
|
||||||
FillRuleWinding
|
FillRuleWinding
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sample func(gc GraphicContext, ext string) (string, error)
|
|
||||||
|
|
||||||
type GraphicContext interface {
|
type GraphicContext interface {
|
||||||
Path
|
Path
|
||||||
// Create a new path
|
// Create a new path
|
||||||
|
|
|
@ -9,7 +9,9 @@ import (
|
||||||
"github.com/llgcode/draw2d"
|
"github.com/llgcode/draw2d"
|
||||||
)
|
)
|
||||||
|
|
||||||
func test(t *testing.T, draw draw2d.Sample) {
|
type sample func(gc draw2d.GraphicContext, ext string) (string, error)
|
||||||
|
|
||||||
|
func test(t *testing.T, draw sample) {
|
||||||
// Initialize the graphic context on an RGBA image
|
// Initialize the graphic context on an RGBA image
|
||||||
dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
|
dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
|
||||||
gc := draw2d.NewGraphicContext(dest)
|
gc := draw2d.NewGraphicContext(dest)
|
||||||
|
|
Loading…
Reference in a new issue