Add samples test - no outputs yet
This commit is contained in:
parent
cdf301b7be
commit
bd7567e331
4 changed files with 69 additions and 2 deletions
65
draw2dsvg/samples_test.go
Normal file
65
draw2dsvg/samples_test.go
Normal file
|
@ -0,0 +1,65 @@
|
|||
// Copyright 2015 The draw2d Authors. All rights reserved.
|
||||
// created: 26/06/2015 by Stani Michiels
|
||||
// See also test_test.go
|
||||
|
||||
package draw2dsvg_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/llgcode/draw2d"
|
||||
"github.com/llgcode/draw2d/samples/android"
|
||||
"github.com/llgcode/draw2d/samples/frameimage"
|
||||
"github.com/llgcode/draw2d/samples/geometry"
|
||||
"github.com/llgcode/draw2d/samples/gopher"
|
||||
"github.com/llgcode/draw2d/samples/gopher2"
|
||||
"github.com/llgcode/draw2d/samples/helloworld"
|
||||
"github.com/llgcode/draw2d/samples/line"
|
||||
"github.com/llgcode/draw2d/samples/linecapjoin"
|
||||
"github.com/llgcode/draw2d/samples/postscript"
|
||||
)
|
||||
|
||||
func TestSampleAndroid(t *testing.T) {
|
||||
test(t, android.Main)
|
||||
}
|
||||
|
||||
// TODO: FillString: w (width) is incorrect
|
||||
func TestSampleGeometry(t *testing.T) {
|
||||
// Set the global folder for searching fonts
|
||||
// The pdf backend needs for every ttf file its corresponding
|
||||
// json/.z file which is generated by gofpdf/makefont.
|
||||
draw2d.SetFontFolder("../resource/font")
|
||||
test(t, geometry.Main)
|
||||
}
|
||||
|
||||
func TestSampleGopher(t *testing.T) {
|
||||
test(t, gopher.Main)
|
||||
}
|
||||
|
||||
func TestSampleGopher2(t *testing.T) {
|
||||
test(t, gopher2.Main)
|
||||
}
|
||||
|
||||
func TestSampleHelloWorld(t *testing.T) {
|
||||
// Set the global folder for searching fonts
|
||||
// The pdf backend needs for every ttf file its corresponding
|
||||
// json/.z file which is generated by gofpdf/makefont.
|
||||
draw2d.SetFontFolder("../resource/font")
|
||||
test(t, helloworld.Main)
|
||||
}
|
||||
|
||||
func TestSampleFrameImage(t *testing.T) {
|
||||
test(t, frameimage.Main)
|
||||
}
|
||||
|
||||
func TestSampleLine(t *testing.T) {
|
||||
test(t, line.Main)
|
||||
}
|
||||
|
||||
func TestSampleLineCap(t *testing.T) {
|
||||
test(t, linecapjoin.Main)
|
||||
}
|
||||
|
||||
func TestSamplePostscript(t *testing.T) {
|
||||
test(t, postscript.Main)
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright 2015 The draw2d Authors. All rights reserved.
|
||||
// created: 16/12/2017 by Drahoslav Bednář
|
||||
|
||||
package draw2dsvg
|
||||
|
||||
import (
|
||||
|
|
|
@ -8,6 +8,7 @@ package draw2dsvg_test
|
|||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/llgcode/draw2d"
|
||||
"github.com/llgcode/draw2d/draw2dsvg"
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import "fmt"
|
|||
// Resource returns a resource filename for testing.
|
||||
func Resource(folder, filename, ext string) string {
|
||||
var root string
|
||||
if ext == "pdf" {
|
||||
if ext == "pdf" || ext == "svg" {
|
||||
root = "../"
|
||||
}
|
||||
return fmt.Sprintf("%sresource/%s/%s", root, folder, filename)
|
||||
|
@ -17,7 +17,7 @@ func Resource(folder, filename, ext string) string {
|
|||
// Output returns the output filename for testing.
|
||||
func Output(name, ext string) string {
|
||||
var root string
|
||||
if ext == "pdf" {
|
||||
if ext == "pdf" || ext == "svg" {
|
||||
root = "../"
|
||||
}
|
||||
return fmt.Sprintf("%soutput/samples/%s.%s", root, name, ext)
|
||||
|
|
Loading…
Reference in a new issue