21 lines
399 B
Go
21 lines
399 B
Go
package svgtemplate
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildSVGRootMatchesViewBox(t *testing.T) {
|
|
data := Build(10, 80, 1, 1, 1, 1)
|
|
var buf bytes.Buffer
|
|
if err := Write(&buf, data); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
s := buf.String()
|
|
want := `width="26mm" height="96mm" viewBox="-8 -8 26 96"`
|
|
if !strings.Contains(s, want) {
|
|
t.Fatalf("expected root %q in:\n%s", want, s)
|
|
}
|
|
}
|