Documentation ¶
Overview ¶
Package mock provides a mock widget to be used for testing the layout algorithms of container widgets.
Unlike most other widgets, the type for the element is also made public. Container widgets can therefore directly created instances, as if they were mounted, to test layout algorithms.
If used in a real GUI, the mock object will not create any controls.
Index ¶
- func NewIfNotZero(size base.Size) base.Element
- func NewList(sizes ...base.Size) []base.Element
- type Element
- func (w *Element) Bounds() base.Rectangle
- func (w *Element) Close()
- func (*Element) Kind() *base.Kind
- func (w *Element) Layout(bc base.Constraints) base.Size
- func (w *Element) MinIntrinsicHeight(base.Length) base.Length
- func (w *Element) MinIntrinsicWidth(base.Length) base.Length
- func (w *Element) Props() base.Widget
- func (w *Element) SetBounds(bounds base.Rectangle)
- func (w *Element) UpdateProps(data base.Widget) error
- type Widget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIfNotZero ¶
NewIfNotZero returns a new mock element if the size is not zero, otherwise it returns the nil element.
Types ¶
type Element ¶
Element is a mock element. Although this is a leaf element (i.e. it does not have any children), there is no control associated with this element.
func (*Element) Close ¶
func (w *Element) Close()
Close removes the widget from the GUI, and frees any associated resources. This is a no-op for a mock element.
func (*Element) Layout ¶
func (w *Element) Layout(bc base.Constraints) base.Size
Layout determines the best size for an element that satisfies the constraints. For a mock element, it will try to match the specific size in the field Size.
func (*Element) MinIntrinsicHeight ¶
MinIntrinsicHeight returns the minimum height that this element requires to be correctly displayed.
func (*Element) MinIntrinsicWidth ¶
MinIntrinsicWidth returns the minimum width that this element requires to be correctly displayed.