Skip to content
Permalink
Browse files

tests for Speed Spinner

  • Loading branch information...
pabender committed Sep 25, 2018
1 parent ccb38fa commit 7a3712a7af05421e4a09abc881faf7602bd5e669
@@ -196,12 +196,9 @@ public void testIdleButton() {
to.pushReleaseButton();
}


@Test
public void testSliderMaximumSpeed() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
frame.setExtendedState( frame.getExtendedState()|java.awt.Frame.MAXIMIZED_BOTH );
panel.toFront();

to.setAddressValue(new DccLocoAddress(42,false));

@@ -250,6 +247,45 @@ public void testReverseButtonPress() {
to.pushReleaseButton();
}

@Test
public void testChangeToSpeedStepMode() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());

to.setAddressValue(new DccLocoAddress(42,false));

to.setSpeedStepDisplay();

to.pushReleaseButton();
}

@Test
public void testSpinnerMaximumSpeed() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());

to.setAddressValue(new DccLocoAddress(42,false));
to.setSpeedStepDisplay();

to.speedSpinnerMaximum();

Assert.assertEquals("Throttle Speed Maximum",1.0,to.getAttachedThrottle().getSpeedSetting(),0.005);

to.pushReleaseButton();
}

@Test
public void testSpinnerMinimumSpeed() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());

to.setAddressValue(new DccLocoAddress(42,false));
to.setSpeedStepDisplay();

to.setSpeedSpinner(28);
to.speedSpinnerMinimum();
Assert.assertEquals("Throttle Speed Minimum",0.0,to.getAttachedThrottle().getSpeedSetting(),0.005);

to.pushReleaseButton();
}

@Before
public void setUp() {
JUnitUtil.setUp();
@@ -19,6 +19,7 @@
import org.netbeans.jemmy.operators.JToggleButtonOperator;
import org.netbeans.jemmy.operators.JRadioButtonOperator;
import org.netbeans.jemmy.operators.JSliderOperator;
import org.netbeans.jemmy.operators.JSpinnerOperator;
import org.netbeans.jemmy.util.NameComponentChooser;

/*
@@ -239,5 +240,32 @@ public void speedSliderMinimum(){
new JSliderOperator(getControlPanelOperator()).scrollToMinimum();
}

public void openControlPanelPopupMenu(){
JInternalFrameOperator jifo = getControlPanelOperator();
jifo.clickForPopup();
JPopupMenuOperator jpmo = new JPopupMenuOperator();
jpmo.pushMenu(Bundle.getMessage("ControlPanelProperties"));
}

public void setSpeedStepDisplay(){
openControlPanelPopupMenu();
JDialogOperator jdo = new JDialogOperator(Bundle.getMessage("TitleEditSpeedControlPanel"));
(new JRadioButtonOperator(jdo,Bundle.getMessage("ButtonDisplaySpeedSteps"))).doClick();
(new JButtonOperator(jdo,Bundle.getMessage("ButtonOK"))).doClick();

}

public void setSpeedSpinner(int i){
new JSpinnerOperator(getControlPanelOperator()).setValue(i);
}

public void speedSpinnerMaximum(){
new JSpinnerOperator(getControlPanelOperator()).scrollToMaximum();
}

public void speedSpinnerMinimum(){
new JSpinnerOperator(getControlPanelOperator()).scrollToMinimum();
}


}

0 comments on commit 7a3712a

Please sign in to comment.
You can’t perform that action at this time.