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.");
}
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);
}
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;
}
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);
}
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);
}
Aggregations