use of com.thecoderscorner.menu.domain.CustomBuilderMenuItem in project tcMenu by davetcc.
the class UIRemoteAndFloatMenuItemTest method testAuthenticationItem.
@Test
void testAuthenticationItem(FxRobot robot) throws InterruptedException {
MenuItem authItem = new CustomBuilderMenuItemBuilder().withId(1001).withName("Auth test").withEepromAddr(-1).withMenuType(CustomBuilderMenuItem.CustomMenuType.AUTHENTICATION).withFunctionName("onAuth").menuItem();
menuTree.addMenuItem(MenuTree.ROOT, authItem);
VariableNameGenerator vng = new VariableNameGenerator(menuTree, false);
var uiAuthPanel = editorUI.createPanelForMenuItem(authItem, menuTree, vng, mockedConsumer);
// open the sub menu item editor panel
createMainPanel(uiAuthPanel);
// firstly check that all the fields are populated properly
performAllCommonChecks(authItem, false);
TestUtils.writeIntoField(robot, "#nameField", "new name", 10);
ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
verify(mockedConsumer, atLeastOnce()).accept(any(), captor.capture());
var item = (CustomBuilderMenuItem) captor.getValue();
assertEquals("new name", item.getName());
assertEquals(CustomBuilderMenuItem.CustomMenuType.AUTHENTICATION, item.getMenuType());
FxAssert.verifyThat("#onlineDocsHyperlink", LabeledMatchers.hasText("Online documentation for AuthenticationItem"));
}
use of com.thecoderscorner.menu.domain.CustomBuilderMenuItem in project tcMenu by davetcc.
the class UIRemoteAndFloatMenuItemTest method testRemoteMenuItem.
@Test
void testRemoteMenuItem(FxRobot robot) throws InterruptedException {
MenuItem remoteItem = new CustomBuilderMenuItemBuilder().withId(1001).withName("Remote Test").withEepromAddr(-1).withMenuType(CustomBuilderMenuItem.CustomMenuType.REMOTE_IOT_MONITOR).withFunctionName("onRemo").menuItem();
menuTree.addMenuItem(MenuTree.ROOT, remoteItem);
VariableNameGenerator vng = new VariableNameGenerator(menuTree, false);
var uiRemotePanel = editorUI.createPanelForMenuItem(remoteItem, menuTree, vng, mockedConsumer);
// open the sub menu item editor panel
createMainPanel(uiRemotePanel);
// firstly check that all the fields are populated properly
performAllCommonChecks(remoteItem, false);
TestUtils.writeIntoField(robot, "#nameField", "abc123", 11);
ArgumentCaptor<MenuItem> captor = ArgumentCaptor.forClass(MenuItem.class);
verify(mockedConsumer, atLeastOnce()).accept(any(), captor.capture());
var item = (CustomBuilderMenuItem) captor.getValue();
assertEquals("abc123", item.getName());
assertEquals(CustomBuilderMenuItem.CustomMenuType.REMOTE_IOT_MONITOR, item.getMenuType());
FxAssert.verifyThat("#onlineDocsHyperlink", LabeledMatchers.hasText("Online documentation for Remote/IoT Monitor"));
}
Aggregations