use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class RpsPositionIconTest method testShow.
public void testShow() {
if (GraphicsEnvironment.isHeadless()) {
// can't Assume in TestCase
return;
}
JmriJFrame jf = new JmriJFrame("RpsPositionIcon Test");
jf.getContentPane().setLayout(new java.awt.FlowLayout());
RpsPositionIcon rpsIcon = new RpsPositionIcon(panel);
jf.getContentPane().add(rpsIcon);
// test buttons
JButton originButton = new JButton("Set 0,0");
originButton.addActionListener((java.awt.event.ActionEvent e) -> {
measButtonPushed(0., 0., rpsIcon);
});
jf.getContentPane().add(originButton);
JButton tentenButton = new JButton("Set 10,10");
tentenButton.addActionListener((java.awt.event.ActionEvent e) -> {
measButtonPushed(10., 10., rpsIcon);
});
jf.getContentPane().add(tentenButton);
JButton fivetenButton = new JButton("Set 5,10");
fivetenButton.addActionListener((java.awt.event.ActionEvent e) -> {
measButtonPushed(5., 10., rpsIcon);
});
jf.getContentPane().add(fivetenButton);
JButton loco21Button = new JButton("Loco 21");
loco21Button.addActionListener((java.awt.event.ActionEvent e) -> {
locoButtonPushed("21");
});
jf.getContentPane().add(loco21Button);
JButton loco33Button = new JButton("Loco 33");
loco33Button.addActionListener((java.awt.event.ActionEvent e) -> {
locoButtonPushed("33");
});
jf.getContentPane().add(loco33Button);
jf.pack();
jf.setSize(300, 300);
jf.setVisible(true);
JFrame f = jmri.util.JmriJFrame.getFrame("RpsPositionIcon Test");
Assert.assertTrue("found frame", f != null);
f.dispose();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class AutomationsTableFrameTest method testFrameCreation.
@Test
public void testFrameCreation() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
AutomationManager manager = AutomationManager.instance();
Assert.assertEquals("Number of automations", 0, manager.getSize());
AutomationsTableFrame f = new AutomationsTableFrame();
Assert.assertNotNull("test creation", f);
// confirm that the add automation frame isn't available
JmriJFrame addAutomationFrame = JmriJFrame.getFrame("Add Automation");
Assert.assertNull(addAutomationFrame);
// now create the add automation frame
f.addButton.doClick();
// the following fails on a 13" laptop
//enterClickAndLeave(f.addButton);
addAutomationFrame = JmriJFrame.getFrame("Add Automation");
Assert.assertNotNull(addAutomationFrame);
addAutomationFrame.dispose();
f.dispose();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class AbstractMonPaneTestBase method checkAutoScrollCheckBox.
// Test checking the AutoScroll checkbox.
@Test
public void checkAutoScrollCheckBox() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
AbstractMonPaneScaffold s = new AbstractMonPaneScaffold(pane);
// for Jemmy to work, we need the pane inside of a frame
JmriJFrame f = new JmriJFrame();
try {
pane.initComponents();
} catch (Exception ex) {
Assert.fail("Could not load pane: " + ex);
}
f.add(pane);
// set title if available
if (pane.getTitle() != null) {
f.setTitle(pane.getTitle());
}
f.pack();
f.setVisible(true);
Assert.assertFalse(s.getAutoScrollCheckBoxValue());
s.checkAutoScrollCheckBox();
Assert.assertTrue(s.getAutoScrollCheckBoxValue());
f.setVisible(false);
f.dispose();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class AbstractMonPaneTestBase method testFreezeButton.
@Test
public void testFreezeButton() throws Exception {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
AbstractMonPaneScaffold s = new AbstractMonPaneScaffold(pane);
// for Jemmy to work, we need the pane inside of a frame
JmriJFrame f = new JmriJFrame();
try {
pane.initComponents();
} catch (Exception ex) {
Assert.fail("Could not load pane: " + ex);
}
f.add(pane);
// set title if available
if (pane.getTitle() != null) {
f.setTitle(pane.getTitle());
}
f.pack();
f.setVisible(true);
Assert.assertFalse(s.getFreezeButtonState());
// there is no label on the entryField, so we access that directly.
pane.entryField.setText("foo");
s.clickEnterButton();
s.clickFreezeButton();
Assert.assertTrue(s.getFreezeButtonState());
pane.entryField.setText("bar");
s.clickEnterButton();
JUnitUtil.waitFor(() -> {
return pane.getFrameText().equals("foo\n");
}, "frame text");
Assert.assertEquals("foo\n", pane.getFrameText());
f.dispose();
}
use of jmri.util.JmriJFrame in project JMRI by JMRI.
the class EcosMonPaneTest method checkAutoScrollCheckBox.
// Test checking the AutoScroll checkbox.
// for some reason the EcosMonPane has the checkbox value reversed on
// startup compared to other AbstractMonPane derivatives.
@Override
@Test
public void checkAutoScrollCheckBox() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
AbstractMonPaneScaffold s = new AbstractMonPaneScaffold(pane);
// for Jemmy to work, we need the pane inside of a frame
JmriJFrame f = new JmriJFrame();
try {
pane.initComponents();
} catch (Exception ex) {
Assert.fail("Could not load pane: " + ex);
}
f.add(pane);
// set title if available
if (pane.getTitle() != null) {
f.setTitle(pane.getTitle());
}
f.pack();
f.setVisible(true);
Assert.assertTrue(s.getAutoScrollCheckBoxValue());
s.checkAutoScrollCheckBox();
Assert.assertFalse(s.getAutoScrollCheckBoxValue());
f.setVisible(false);
f.dispose();
}
Aggregations