aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-09-09 09:42:37 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-09-09 09:42:37 +0200
commit500caaeda74dd9c660279036293f4b2997cf0b03 (patch)
tree1226f60231a408b0aae67867faaa3f2cfbac8c83 /vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go
parent413560591fc2d89a73eb8a33ba28b0cc3407b1db (diff)
Add vendor
Diffstat (limited to 'vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go')
-rw-r--r--vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go b/vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go
new file mode 100644
index 0000000..801ff36
--- /dev/null
+++ b/vendor/github.com/llgcode/draw2d/draw2dpdf/test_test.go
@@ -0,0 +1,39 @@
+// Copyright 2015 The draw2d Authors. All rights reserved.
+// created: 26/06/2015 by Stani Michiels
+
+// Package draw2dpdf_test gives test coverage with the command:
+// go test -cover ./... | grep -v "no test"
+// (It should be run from its parent draw2d directory.)
+package draw2dpdf_test
+
+import (
+ "testing"
+
+ "github.com/llgcode/draw2d"
+ "github.com/llgcode/draw2d/draw2dpdf"
+)
+
+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
+ output, err := draw(gc, "pdf")
+ if err != nil {
+ t.Errorf("Drawing %q failed: %v", output, err)
+ return
+ }
+ /*
+ // Save to pdf only if it doesn't exist because of git
+ if _, err = os.Stat(output); err == nil {
+ t.Skipf("Saving %q skipped, as it exists already. (Git would consider it modified.)", output)
+ return
+ }
+ */
+ err = draw2dpdf.SaveToPdfFile(output, dest)
+ if err != nil {
+ t.Errorf("Saving %q failed: %v", output, err)
+ }
+}