-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_margins_test.go
48 lines (36 loc) · 1.71 KB
/
block_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 TestBlockMargin(t *testing.T) {
block := Block().
Margin(5, 4, 3, 2)
assert.Equal(t, float32(5), block.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(4), block.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(3), block.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(2), block.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
block = Block().
MarginTop(5).
MarginRight(4).
MarginBottom(3).
MarginLeft(2)
assert.Equal(t, float32(5), block.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(4), block.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(3), block.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(2), block.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
block = Block().
MarginVertical(6).
MarginHorizontal(5)
assert.Equal(t, float32(6), block.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(6), block.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(5), block.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(5), block.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
block = Block().
MarginAll(6)
assert.Equal(t, float32(6), block.getFlexNode().StyleGetMargin(flex.EdgeTop).Value)
assert.Equal(t, float32(6), block.getFlexNode().StyleGetMargin(flex.EdgeRight).Value)
assert.Equal(t, float32(6), block.getFlexNode().StyleGetMargin(flex.EdgeBottom).Value)
assert.Equal(t, float32(6), block.getFlexNode().StyleGetMargin(flex.EdgeLeft).Value)
}