From f90b2f482093319254b23853e840e374582684cd Mon Sep 17 00:00:00 2001 From: Steven Edwards Date: Tue, 1 Sep 2015 16:09:21 -0400 Subject: [PATCH] Add tests for Name, Style funcs using luxisr font. --- truetype/truetype_test.go | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/truetype/truetype_test.go b/truetype/truetype_test.go index ce7f127..088b5ec 100644 --- a/truetype/truetype_test.go +++ b/truetype/truetype_test.go @@ -211,6 +211,48 @@ func TestIndex(t *testing.T) { } } +func TestName(t *testing.T) { + testCases := map[string]string{ + "luxisr": "Luxi Sans", + } + + for name, want := range testCases { + f, testdataIsOptional, err := parseTestdataFont(name) + if err != nil { + if testdataIsOptional { + t.Log(err) + } else { + t.Fatal(err) + } + continue + } + if got := f.Name(); got != want { + t.Errorf("%s: got %s, want %s", name, got, want) + } + } +} + +func TestStyle(t *testing.T) { + testCases := map[string]string{ + "luxisr": "Regular", + } + + for name, want := range testCases { + f, testdataIsOptional, err := parseTestdataFont(name) + if err != nil { + if testdataIsOptional { + t.Log(err) + } else { + t.Fatal(err) + } + continue + } + if got := f.Style(); got != want { + t.Errorf("%s: got %s, want %s", name, got, want) + } + } +} + type scalingTestData struct { advanceWidth fixed.Int26_6 bounds fixed.Rectangle26_6