Search in sources :

Example 1 with FloatMenuItem

use of com.thecoderscorner.menu.domain.FloatMenuItem in project tcMenu by davetcc.

the class TagValMenuCommandProtocolTest method testWritingFloatItem.

@Test
public void testWritingFloatItem() {
    FloatMenuItem floatItem = DomainFixtures.aFloatMenu("FloatMenu", 1);
    floatItem = new FloatMenuItemBuilder().withExisting(floatItem).withVisible(false).menuItem();
    protocol.toChannel(bb, new MenuFloatBootCommand(22, floatItem, (float) 12.0));
    testBufferAgainstExpected(FLOAT_BOOT_ITEM, "PI=22|ID=1|IE=105|NM=FloatMenu|RO=0|VI=0|FD=3|VC=12.0|\u0002");
}
Also used : FloatMenuItem(com.thecoderscorner.menu.domain.FloatMenuItem) FloatMenuItemBuilder(com.thecoderscorner.menu.domain.FloatMenuItemBuilder) Test(org.junit.Test)

Example 2 with FloatMenuItem

use of com.thecoderscorner.menu.domain.FloatMenuItem in project tcMenu by davetcc.

the class UIRemoteAndFloatMenuItemTest method testFloatMenuItemEditing.

@Test
void testFloatMenuItemEditing(FxRobot robot) throws InterruptedException {
    MenuItem floatItem = menuTree.getMenuById(6).get();
    VariableNameGenerator vng = new VariableNameGenerator(menuTree, false);
    var uiFloatPanel = editorUI.createPanelForMenuItem(floatItem, menuTree, vng, mockedConsumer);
    // open the sub menu item editor panel
    createMainPanel(uiFloatPanel);
    // firstly check that all the fields are populated properly
    performAllCommonChecks(floatItem, false);
    tryToEnterBadValueIntoField(robot, "decimalPlacesField", "nameField", "100", "Decimal Places - Value must be between 1 and 6");
    robot.clickOn("#decimalPlacesField");
    robot.eraseText(4);
    robot.write("3");
    ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
    verify(mockedConsumer, atLeastOnce()).accept(any(), captor.capture());
    FloatMenuItem item = (FloatMenuItem) captor.getValue();
    assertEquals(3, item.getNumDecimalPlaces());
    FxAssert.verifyThat("#onlineDocsHyperlink", LabeledMatchers.hasText("Online documentation for FloatMenuItem"));
}
Also used : FloatMenuItem(com.thecoderscorner.menu.domain.FloatMenuItem) FloatMenuItem(com.thecoderscorner.menu.domain.FloatMenuItem) CustomBuilderMenuItem(com.thecoderscorner.menu.domain.CustomBuilderMenuItem) UIMenuItem(com.thecoderscorner.menu.editorui.uimodel.UIMenuItem) MenuItem(com.thecoderscorner.menu.domain.MenuItem) VariableNameGenerator(com.thecoderscorner.menu.editorui.generator.core.VariableNameGenerator) Test(org.junit.jupiter.api.Test)

Aggregations

FloatMenuItem (com.thecoderscorner.menu.domain.FloatMenuItem)2 CustomBuilderMenuItem (com.thecoderscorner.menu.domain.CustomBuilderMenuItem)1 FloatMenuItemBuilder (com.thecoderscorner.menu.domain.FloatMenuItemBuilder)1 MenuItem (com.thecoderscorner.menu.domain.MenuItem)1 VariableNameGenerator (com.thecoderscorner.menu.editorui.generator.core.VariableNameGenerator)1 UIMenuItem (com.thecoderscorner.menu.editorui.uimodel.UIMenuItem)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1