make sample interface private

This commit is contained in:
Stani 2015-07-07 23:35:03 +02:00
parent cf81b0b120
commit 8c807d1289
3 changed files with 7 additions and 5 deletions

View file

@ -11,12 +11,14 @@ import (
"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
dest := draw2dpdf.NewPdf("L", "mm", "A4")
gc := draw2dpdf.NewGraphicContext(dest)
// Draw sample
fn, err := sample(gc, "pdf")
fn, err := draw(gc, "pdf")
if err != nil {
t.Errorf("Drawing %q failed: %v", fn, err)
return

2
gc.go
View file

@ -15,8 +15,6 @@ const (
FillRuleWinding
)
type Sample func(gc GraphicContext, ext string) (string, error)
type GraphicContext interface {
Path
// Create a new path

View file

@ -9,7 +9,9 @@ import (
"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
dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
gc := draw2d.NewGraphicContext(dest)