2015-07-10 00:11:22 +00:00
|
|
|
// Package samples provides examples which can be used with different
|
|
|
|
// backends. They are also used for testing and coverage of the
|
|
|
|
// draw2d package.
|
|
|
|
package samples
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
// Resource returns a resource filename for testing.
|
|
|
|
func Resource(folder, filename, ext string) string {
|
|
|
|
var root string
|
2017-12-22 08:59:31 +00:00
|
|
|
if ext == "pdf" || ext == "svg" {
|
2015-07-10 00:11:22 +00:00
|
|
|
root = "../"
|
|
|
|
}
|
|
|
|
return fmt.Sprintf("%sresource/%s/%s", root, folder, filename)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Output returns the output filename for testing.
|
|
|
|
func Output(name, ext string) string {
|
|
|
|
var root string
|
2017-12-22 08:59:31 +00:00
|
|
|
if ext == "pdf" || ext == "svg" {
|
2015-07-10 00:11:22 +00:00
|
|
|
root = "../"
|
|
|
|
}
|
2015-07-10 15:20:23 +00:00
|
|
|
return fmt.Sprintf("%soutput/samples/%s.%s", root, name, ext)
|
2015-07-10 00:11:22 +00:00
|
|
|
}
|