generated from clevergo/pkg-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmath_test.go
63 lines (54 loc) · 1.24 KB
/
math_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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2020 CleverGo. All rights reserved.
// Use of this source code is governed by a MIT style license that can be found
// in the LICENSE file.
package drivers
import (
"image/color"
"reflect"
"testing"
)
func TestMathHeight(t *testing.T) {
m := &Math{}
MathHeight(4)(m)
if m.height != 4 {
t.Errorf("expected height %d, got %d", 4, m.height)
}
}
func TestMathWidth(t *testing.T) {
m := &Math{}
MathWidth(4)(m)
if m.width != 4 {
t.Errorf("expected width %d, got %d", 4, m.width)
}
}
func TestMathFonts(t *testing.T) {
m := &Math{}
fonts := []string{"wqy_microhei.ttc"}
MathFonts(fonts)(m)
if !reflect.DeepEqual(fonts, m.fonts) {
t.Errorf("expected fonts %v, got %v", fonts, m.fonts)
}
}
func TestMathNoiseCount(t *testing.T) {
m := &Math{}
MathNoiseCount(4)(m)
if m.noiseCount != 4 {
t.Errorf("expected noise count %d, got %d", 4, m.noiseCount)
}
}
func TestMathBGColor(t *testing.T) {
m := &Math{}
color := &color.RGBA{1, 2, 3, 4}
MathBGColor(color)(m)
if !reflect.DeepEqual(color, m.bgColor) {
t.Errorf("expected background color %v, got %v", color, m.bgColor)
}
}
func TestNewMath(t *testing.T) {
m := NewMath(
MathHeight(3),
)
if m.height != 3 {
t.Errorf("expected height %d, got %d", 3, m.height)
}
}