Search in sources :

Example 6 with RowLayout

use of org.terasology.nui.layouts.RowLayout in project Terasology by MovingBlocks.

the class RowLayoutTest method setup.

@BeforeEach
public void setup() {
    rowLayout = new RowLayout();
    itemAt1x1 = mock(UIWidget.class);
    itemAt1x2 = mock(UIWidget.class);
    itemAt1x3 = mock(UIWidget.class);
    canvas = mock(Canvas.class);
    // +-----------------------------------+  +---+  +-------+
    // |                                   |  |1x2|  |       |
    // |               1x1                 |  +---+  |       |
    // |                                   |         |  1x3  |
    // +-----------------------------------+         |       |
    // |       |
    // +-------+
    when(canvas.calculateRestrictedSize(eq(itemAt1x1), any(Vector2i.class))).thenReturn(new Vector2i(50, 10));
    when(canvas.calculateRestrictedSize(eq(itemAt1x2), any(Vector2i.class))).thenReturn(new Vector2i(5, 5));
    when(canvas.calculateRestrictedSize(eq(itemAt1x3), any(Vector2i.class))).thenReturn(new Vector2i(10, 15));
    Vector2i availableSize = new Vector2i(CANVAS_WIDTH, CANVAS_HEIGHT);
    when(canvas.size()).thenReturn(availableSize);
    rowLayout.addWidget(itemAt1x1, null);
    rowLayout.addWidget(itemAt1x2, null);
    rowLayout.addWidget(itemAt1x3, null);
}
Also used : RowLayout(org.terasology.nui.layouts.RowLayout) Canvas(org.terasology.nui.Canvas) Vector2i(org.joml.Vector2i) UIWidget(org.terasology.nui.UIWidget) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

RowLayout (org.terasology.nui.layouts.RowLayout)6 UILabel (org.terasology.nui.widgets.UILabel)5 UICheckbox (org.terasology.nui.widgets.UICheckbox)4 Vector2i (org.joml.Vector2i)3 UISpace (org.terasology.nui.widgets.UISpace)3 UIButton (org.terasology.nui.widgets.UIButton)2 UISlider (org.terasology.nui.widgets.UISlider)2 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 BindsConfig (org.terasology.engine.config.BindsConfig)1 ControllerInfo (org.terasology.engine.config.ControllerConfig.ControllerInfo)1 SimpleUri (org.terasology.engine.core.SimpleUri)1 RegisterBindButton (org.terasology.engine.input.RegisterBindButton)1 Module (org.terasology.gestalt.module.Module)1 ModuleEnvironment (org.terasology.gestalt.module.ModuleEnvironment)1 DependencyResolver (org.terasology.gestalt.module.dependencyresolution.DependencyResolver)1 ResolutionResult (org.terasology.gestalt.module.dependencyresolution.ResolutionResult)1