zntg/ui/debug_test.go

22 lines
715 B
Go

package ui
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestControlName(t *testing.T) {
assert.Equal(t, "ControlBase", controlName(&ControlBase{}))
assert.Equal(t, "Label", controlName(&Label{}))
}
func TestControlChildren(t *testing.T) {
assert.Len(t, controlChildren(&ContainerBase{}), 0)
assert.Len(t, controlChildren(&ControlBase{}), 0)
assert.Len(t, controlChildren(&ContainerBase{Children: []Control{nil, nil}}), 2)
assert.Len(t, controlChildren(&StackPanel{ContainerBase: ContainerBase{Children: []Control{nil, nil}}}), 2)
assert.Len(t, controlChildren(&Proxy{Content: &ControlBase{}}), 1)
assert.Len(t, controlChildren(&overflow{Proxy: Proxy{Content: &ControlBase{}}}), 1)
}