Search in sources :

Example 1 with JCheckBoxOperator

use of org.netbeans.jemmy.operators.JCheckBoxOperator in project JMRI by JMRI.

the class OperationsSetupFrameTest method testDirectionCheckBoxes.

@Test
public void testDirectionCheckBoxes() {
    // it may be possible to make this a headless test by only initializing the panel, not the frame
    Assume.assumeFalse(GraphicsEnvironment.isHeadless());
    OperationsSetupFrame f = new OperationsSetupFrame();
    // entire panel must be visible for tests to work properly
    f.setLocation(0, 0);
    f.initComponents();
    JFrameOperator jfo = new JFrameOperator(Bundle.getMessage("TitleOperationsSetup"));
    // first confirm that setup has all directions selected
    Assert.assertEquals("All directions selected", Setup.EAST + Setup.WEST + Setup.NORTH + Setup.SOUTH, Setup.getTrainDirection());
    JCheckBoxOperator northCheckBoxOperator = new JCheckBoxOperator(jfo, Bundle.getMessage("northsouth"));
    JCheckBoxOperator eastCheckBoxOperator = new JCheckBoxOperator(jfo, Bundle.getMessage("eastwest"));
    // both east/west and north/south checkboxes should be set
    Assert.assertTrue("North selected", northCheckBoxOperator.isSelected());
    Assert.assertTrue("East selected", eastCheckBoxOperator.isSelected());
    northCheckBoxOperator.push();
    Assert.assertFalse("North deselected", northCheckBoxOperator.isSelected());
    Assert.assertTrue("East selected", eastCheckBoxOperator.isSelected());
    eastCheckBoxOperator.push();
    Assert.assertTrue("North selected", northCheckBoxOperator.isSelected());
    Assert.assertFalse("East deselected", eastCheckBoxOperator.isSelected());
    eastCheckBoxOperator.push();
    Assert.assertTrue("North selected", northCheckBoxOperator.isSelected());
    Assert.assertTrue("East selected", eastCheckBoxOperator.isSelected());
    // done
    f.dispose();
}
Also used : JFrameOperator(org.netbeans.jemmy.operators.JFrameOperator) JCheckBoxOperator(org.netbeans.jemmy.operators.JCheckBoxOperator) Test(org.junit.Test)

Example 2 with JCheckBoxOperator

use of org.netbeans.jemmy.operators.JCheckBoxOperator in project JMRI by JMRI.

the class OperationsSwingTestCase method enterClickAndLeave.

protected void enterClickAndLeave(JCheckBox comp) {
    JCheckBoxOperator jbo = new JCheckBoxOperator(comp);
    jbo.doClick();
}
Also used : JCheckBoxOperator(org.netbeans.jemmy.operators.JCheckBoxOperator)

Aggregations

JCheckBoxOperator (org.netbeans.jemmy.operators.JCheckBoxOperator)2 Test (org.junit.Test)1 JFrameOperator (org.netbeans.jemmy.operators.JFrameOperator)1