Search in sources :

Example 1 with BackendAPI

use of com.willwinder.universalgcodesender.model.BackendAPI in project Universal-G-Code-Sender by winder.

the class MacroHelperTest method testExecuteCustomGcode.

/**
 * Test of executeCustomGcode method, of class MacroHelper.
 */
@Test
@Ignore
public void testExecuteCustomGcode() {
    System.out.println("executeCustomGcode");
    String str = "";
    BackendAPI backend = null;
    try {
        MacroHelper.executeCustomGcode(str, backend);
    } catch (Exception ex) {
    // guaranteed NullPointerException because of null backend passed into MacroHelper.substituteValues()
    }
    // TODO review the generated test code and remove the default call to fail.
    fail("The test case is a prototype.");
}
Also used : BackendAPI(com.willwinder.universalgcodesender.model.BackendAPI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with BackendAPI

use of com.willwinder.universalgcodesender.model.BackendAPI in project Universal-G-Code-Sender by winder.

the class MacroHelperTest method testSubstitutePrompt.

@Test
// This test creates a modal dialog.
@Ignore
public void testSubstitutePrompt() {
    System.out.println("substituteValuesPrompt");
    BackendAPI backend = EasyMock.mock(BackendAPI.class);
    EasyMock.reset(backend);
    final Capture<SystemStateBean> capture = EasyMock.newCapture();
    backend.updateSystemState(EasyMock.capture(capture));
    EasyMock.expect(EasyMock.expectLastCall());
    EasyMock.replay(backend);
    String result = MacroHelper.substituteValues("{prompt|value 1} {prompt|value 2} {prompt|value 3}", backend);
    System.out.println(result);
}
Also used : BackendAPI(com.willwinder.universalgcodesender.model.BackendAPI) SystemStateBean(com.willwinder.universalgcodesender.pendantui.SystemStateBean) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with BackendAPI

use of com.willwinder.universalgcodesender.model.BackendAPI in project Universal-G-Code-Sender by winder.

the class SendStatusLineService method getStatusLineElement.

@Override
public Component getStatusLineElement() {
    BackendAPI backend = CentralLookup.getDefault().lookup(BackendAPI.class);
    JPanel panel = new JPanel();
    panel.add(new SendStatusLine(backend));
    return panel;
}
Also used : BackendAPI(com.willwinder.universalgcodesender.model.BackendAPI) SendStatusLine(com.willwinder.universalgcodesender.uielements.toolbars.SendStatusLine)

Example 4 with BackendAPI

use of com.willwinder.universalgcodesender.model.BackendAPI in project Universal-G-Code-Sender by winder.

the class VisualizerTestMain method start.

private void start() throws Exception {
    BackendAPI backendAPI = CentralLookup.getDefault().lookup(BackendAPI.class);
    setPreferredSize(new Dimension(1024, 768));
    Visualizer2TopComponent visualizer = new Visualizer2TopComponent();
    getContentPane().add(visualizer);
    visualizer.componentOpened();
    createMenuBar(backendAPI);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    pack();
    setVisible(true);
}
Also used : BackendAPI(com.willwinder.universalgcodesender.model.BackendAPI)

Example 5 with BackendAPI

use of com.willwinder.universalgcodesender.model.BackendAPI in project Universal-G-Code-Sender by winder.

the class MacroHelperTest method testSubstituteValues.

/**
 * Test of substituteValues method, of class MacroHelper.
 */
@Test
public void testSubstituteValues() {
    System.out.println("substituteValues");
    BackendAPI backend = EasyMock.mock(BackendAPI.class);
    EasyMock.reset(backend);
    final Capture<SystemStateBean> capture = EasyMock.newCapture();
    backend.updateSystemState(EasyMock.capture(capture));
    EasyMock.expect(EasyMock.expectLastCall()).andAnswer(() -> {
        capture.getValue().setMachineX("1");
        capture.getValue().setMachineY("2");
        capture.getValue().setMachineZ("3");
        capture.getValue().setWorkX("4");
        capture.getValue().setWorkY("5");
        capture.getValue().setWorkZ("6");
        return null;
    });
    EasyMock.replay(backend);
    String result = MacroHelper.substituteValues("{machine_x} {machine_y} {machine_z} {work_x} {work_y} {work_z}", backend);
    assertEquals("1 2 3 4 5 6", result);
}
Also used : BackendAPI(com.willwinder.universalgcodesender.model.BackendAPI) SystemStateBean(com.willwinder.universalgcodesender.pendantui.SystemStateBean) Test(org.junit.Test)

Aggregations

BackendAPI (com.willwinder.universalgcodesender.model.BackendAPI)8 Test (org.junit.Test)3 SystemStateBean (com.willwinder.universalgcodesender.pendantui.SystemStateBean)2 Ignore (org.junit.Ignore)2 ActionRegistrationService (com.willwinder.ugs.nbp.lib.services.ActionRegistrationService)1 GUIBackend (com.willwinder.universalgcodesender.model.GUIBackend)1 JogService (com.willwinder.universalgcodesender.services.JogService)1 Macro (com.willwinder.universalgcodesender.types.Macro)1 CommandTextArea (com.willwinder.universalgcodesender.uielements.components.CommandTextArea)1 JogPanel (com.willwinder.universalgcodesender.uielements.jog.JogPanel)1 MacroActionPanel (com.willwinder.universalgcodesender.uielements.macros.MacroActionPanel)1 MacroPanel (com.willwinder.universalgcodesender.uielements.macros.MacroPanel)1 ActionButtonPanel (com.willwinder.universalgcodesender.uielements.panels.ActionButtonPanel)1 ActionPanel (com.willwinder.universalgcodesender.uielements.panels.ActionPanel)1 CommandPanel (com.willwinder.universalgcodesender.uielements.panels.CommandPanel)1 ConnectionPanelGroup (com.willwinder.universalgcodesender.uielements.panels.ConnectionPanelGroup)1 ConnectionSettingsPanel (com.willwinder.universalgcodesender.uielements.panels.ConnectionSettingsPanel)1 ControllerProcessorSettingsPanel (com.willwinder.universalgcodesender.uielements.panels.ControllerProcessorSettingsPanel)1 MachineStatusPanel (com.willwinder.universalgcodesender.uielements.panels.MachineStatusPanel)1 OverridesPanel (com.willwinder.universalgcodesender.uielements.panels.OverridesPanel)1