-
Notifications
You must be signed in to change notification settings - Fork 0
/
page_margins_test.go
48 lines (36 loc) · 1.8 KB
/
page_margins_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
package pdflexgo
import (
"testing"
"github.com/kjk/flex"
"github.com/stretchr/testify/assert"
)
func TestPageMargin(t *testing.T) {
page := Page().
Margin(5, 4, 3, 2)
assert.Equal(t, float32(5), page.layout.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(4), page.layout.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(3), page.layout.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(2), page.layout.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
page = Page().
MarginTop(5).
MarginRight(4).
MarginBottom(3).
MarginLeft(2)
assert.Equal(t, float32(5), page.layout.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(4), page.layout.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(3), page.layout.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(2), page.layout.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
page = Page().
MarginVertical(6).
MarginHorizontal(5)
assert.Equal(t, float32(6), page.layout.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(6), page.layout.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(5), page.layout.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(5), page.layout.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
page = Page().
MarginAll(6)
assert.Equal(t, float32(6), page.layout.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(6), page.layout.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(6), page.layout.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(6), page.layout.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
}