generated from clevergo/pkg-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathchinese_test.go
80 lines (69 loc) · 1.63 KB
/
chinese_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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// 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 TestChineseHeight(t *testing.T) {
c := &Chinese{}
ChineseHeight(4)(c)
if c.height != 4 {
t.Errorf("expected height %d, got %d", 4, c.height)
}
}
func TestChineseWidth(t *testing.T) {
c := &Chinese{}
ChineseWidth(4)(c)
if c.width != 4 {
t.Errorf("expected width %d, got %d", 4, c.width)
}
}
func TestChineseLength(t *testing.T) {
c := &Chinese{}
ChineseLength(4)(c)
if c.length != 4 {
t.Errorf("expected length %d, got %d", 4, c.length)
}
}
func TestChineseFonts(t *testing.T) {
c := &Chinese{}
fonts := []string{"wqy_microhei.ttc"}
ChineseFonts(fonts)(c)
if !reflect.DeepEqual(fonts, c.fonts) {
t.Errorf("expected fonts %v, got %v", fonts, c.fonts)
}
}
func TestChineseSource(t *testing.T) {
c := &Chinese{}
source := "foobar"
ChineseSource(source)(c)
if c.source != source {
t.Errorf("expected source %s, got %s", source, c.source)
}
}
func TestChineseNoiseCount(t *testing.T) {
c := &Chinese{}
ChineseNoiseCount(4)(c)
if c.noiseCount != 4 {
t.Errorf("expected noise count %d, got %d", 4, c.noiseCount)
}
}
func TestChineseBGColor(t *testing.T) {
c := &Chinese{}
color := &color.RGBA{1, 2, 3, 4}
ChineseBGColor(color)(c)
if !reflect.DeepEqual(color, c.bgColor) {
t.Errorf("expected background color %v, got %v", color, c.bgColor)
}
}
func TestNewChinese(t *testing.T) {
c := NewChinese(
ChineseLength(3),
)
if c.length != 3 {
t.Errorf("expected length %d, got %d", 3, c.length)
}
}