diff --git a/captcha.go b/captcha.go index cbfc396..ce7d7c4 100644 --- a/captcha.go +++ b/captcha.go @@ -71,11 +71,7 @@ func (data *Data) WriteTo(w io.Writer) error { } func init() { - var err error - ttfFont, err = freetype.ParseFont(ttf) - if err != nil { - panic(err) - } + ttfFont, _ = freetype.ParseFont(ttf) } // LoadFont let you load an external font diff --git a/captcha_test.go b/captcha_test.go index eaebc66..5f7383c 100644 --- a/captcha_test.go +++ b/captcha_test.go @@ -8,7 +8,6 @@ import ( ) func TestNewCaptcha(t *testing.T) { - New(36, 12) data, err := New(150, 50) if err != nil { t.Fatal(err) @@ -17,6 +16,13 @@ func TestNewCaptcha(t *testing.T) { data.WriteTo(buf) } +func TestSmallCaptcha(t *testing.T) { + _, err := New(36, 12) + if err != nil { + t.Fatal(err) + } +} + func TestNewCaptchaOptions(t *testing.T) { New(100, 34, func(options *Options) { options.BackgroundColor = color.Opaque @@ -46,6 +52,6 @@ func TestLoadFont(t *testing.T) { err = LoadFont([]byte("invalid")) if err == nil { - t.Fatal("LoadFont incorrecly parse an invalid font") + t.Fatal("LoadFont incorrectly parse an invalid font") } }