-
Notifications
You must be signed in to change notification settings - Fork 4
/
hpagebreaks_test.go
66 lines (52 loc) · 1004 Bytes
/
hpagebreaks_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
package goxcel
import (
"github.com/devlights/goxcel/testutil"
"testing"
)
// TestHPageBreaks_Misc is tested function following cases
//
// - Count
// - Item
func TestHPageBreaks_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(10, 1)
_ = c.SetValue("helloworld")
ra, _ := ws.Range(10, 1, 10, 1)
// Act
hpbs, err := ws.HPageBreaks()
if err != nil {
t.Error(err)
}
err = hpbs.Add(ra)
if err != nil {
t.Error(err)
}
// Assert
count, err := hpbs.Count()
if err != nil {
t.Error(err)
}
if count != 1 {
t.Errorf("want: 1\tgot: %v", count)
}
hpb, err := hpbs.Item(1)
if err != nil {
t.Error(err)
}
if hpb == nil {
t.Errorf("want: not nil\tgot nil")
}
_ = g.SetVisible(true)
testutil.Interval()
testutil.Interval()
}