-
Notifications
You must be signed in to change notification settings - Fork 0
/
svg_test.go
41 lines (35 loc) · 907 Bytes
/
svg_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2018, The Goki Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package svg
import (
"fmt"
"path/filepath"
"strings"
"testing"
"goki.dev/girl/paint"
"goki.dev/glop/dirs"
"goki.dev/grows/images"
)
func TestSVG(t *testing.T) {
paint.FontLibrary.InitFontPaths(paint.FontPaths...)
dir := filepath.Join("testdata", "svg")
files := dirs.ExtFileNames(dir, []string{".svg"})
for _, fn := range files {
// if fn != "fig_bp_compute_delta.svg" {
// continue
// }
sv := NewSVG(640, 480)
sv.Norm = true
svfn := filepath.Join(dir, fn)
err := sv.OpenXML(svfn)
if err != nil {
fmt.Println("error opening xml:", err)
continue
}
// fmt.Println(sv.Root.ViewBox)
sv.Render()
imfn := filepath.Join("png", strings.TrimSuffix(fn, ".svg"))
images.Assert(t, sv.Pixels, imfn)
}
}