-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathnode_child_test.go
More file actions
30 lines (22 loc) · 813 Bytes
/
node_child_test.go
File metadata and controls
30 lines (22 loc) · 813 Bytes
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
package flex
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestReset_layout_when_child_removed(t *testing.T) {
root := NewNode()
rootChild0 := NewNode()
rootChild0.StyleSetWidth(100)
rootChild0.StyleSetHeight(100)
root.InsertChild(rootChild0, 0)
CalculateLayout(root, Undefined, Undefined, DirectionLTR)
assertFloatEqual(t, 0, rootChild0.LayoutGetLeft())
assertFloatEqual(t, 0, rootChild0.LayoutGetTop())
assertFloatEqual(t, 100, rootChild0.LayoutGetWidth())
assertFloatEqual(t, 100, rootChild0.LayoutGetHeight())
root.RemoveChild(rootChild0)
assertFloatEqual(t, 0, rootChild0.LayoutGetLeft())
assertFloatEqual(t, 0, rootChild0.LayoutGetTop())
assert.True(t, FloatIsUndefined(rootChild0.LayoutGetWidth()))
assert.True(t, FloatIsUndefined(rootChild0.LayoutGetHeight()))
}