-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfont_test.go
89 lines (73 loc) · 1.29 KB
/
font_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
81
82
83
84
85
86
87
88
89
package goxcel
import (
"github.com/devlights/goxcel/constants"
"github.com/devlights/goxcel/testutil"
"testing"
)
// TestFont_Misc is tested function following cases
//
// - Bold
//
// - Italic
//
// - Underline
//
// - Strikethrough
//
// - Size
//
// - Name
//
// - Color
func TestFont_Misc(t *testing.T) {
testutil.Interval()
defer testutil.Interval()
// Arrange
g, r, _ := NewGoxcel()
defer r()
_ = g.SetDisplayAlerts(false)
_ = g.SetVisible(false)
wbs, _ := g.Workbooks()
wb, wbReleaseFn, _ := wbs.Add()
defer wbReleaseFn()
ws, _ := wb.Sheets(1)
c, _ := ws.Cells(1, 1)
_ = c.SetValue("helloworld")
f, _ := c.Font()
// Pre assert
if isBold, err := f.Bold(); isBold || err != nil {
t.Errorf("want not bold\tgot bold")
}
// Act
err := f.SetBold(true)
if err != nil {
t.Error(err)
}
err = f.SetItalic(true)
if err != nil {
t.Error(err)
}
err = f.SetUnderline(constants.XlUnderlineStyleDouble)
if err != nil {
t.Error(err)
}
err = f.SetStrikethrough(true)
if err != nil {
t.Error(err)
}
err = f.SetSize(40)
if err != nil {
t.Error(err)
}
err = f.SetName("MS ゴシック")
if err != nil {
t.Error(err)
}
err = f.SetColor(constants.RgbRed)
if err != nil {
t.Error(err)
}
_ = g.SetVisible(true)
testutil.Interval()
testutil.Interval()
}