< prev index next >

test/jdk/sanity/client/SwingSet/src/SliderDemoTest.java

Print this page




  65     private static final int VERTICAL_MINOR_TICKS_SLIDER_MAXIMUM = 100;
  66 
  67     @Test
  68     public void test() throws Exception {
  69         new ClassReference(SliderDemo.class.getCanonicalName()).startApplication();
  70         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
  71         plain(frame, HORIZONTAL_PLAIN_SLIDER);
  72         majorTicks(frame, HORIZONTAL_MAJOR_TICKS_SLIDER);
  73         minorTicks(frame, HORIZONTAL_MINOR_TICKS_SLIDER);
  74         disabled(frame, HORIZONTAL_DISABLED_SLIDER);
  75         plain(frame, VERTICAL_PLAIN_SLIDER);
  76         majorTicks(frame, VERTICAL_MAJOR_TICKS_SLIDER);
  77         minorTicks(frame, VERTICAL_MINOR_TICKS_SLIDER);
  78         disabled(frame, VERTICAL_DISABLED_SLIDER);
  79     }
  80 
  81     private void plain(JFrameOperator jfo, String accessibleName) {
  82         JSliderOperator jso = new JSliderOperator(jfo,
  83                 new AccessibleNameChooser(accessibleName));
  84         if (accessibleName.equals(HORIZONTAL_PLAIN_SLIDER)) {

  85             checkKeyboard(jso);
  86             checkMouse(jso);
  87         }
  88         checkMaximum(jso, PLAIN_SLIDER_MAXIMUM);
  89         checkMinimum(jso, PLAIN_SLIDER_MINIMUM);
  90         checkMoveForward(jso, 10);
  91     }
  92 
  93     private void majorTicks(JFrameOperator jfo, String accessibleName) {
  94         JSliderOperator jso = new JSliderOperator(jfo,
  95                 new AccessibleNameChooser(accessibleName));
  96         checkMoveForward(jso, 40);
  97         assertTrue(jso.getPaintTicks());
  98         assertEquals(100, jso.getMajorTickSpacing());
  99     }
 100 
 101     private void minorTicks(JFrameOperator jfo, String accessibleName) {
 102         JSliderOperator jso = new JSliderOperator(jfo,
 103                 new AccessibleNameChooser(accessibleName));
 104         if (accessibleName.equals(HORIZONTAL_MINOR_TICKS_SLIDER)) {




  65     private static final int VERTICAL_MINOR_TICKS_SLIDER_MAXIMUM = 100;
  66 
  67     @Test
  68     public void test() throws Exception {
  69         new ClassReference(SliderDemo.class.getCanonicalName()).startApplication();
  70         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
  71         plain(frame, HORIZONTAL_PLAIN_SLIDER);
  72         majorTicks(frame, HORIZONTAL_MAJOR_TICKS_SLIDER);
  73         minorTicks(frame, HORIZONTAL_MINOR_TICKS_SLIDER);
  74         disabled(frame, HORIZONTAL_DISABLED_SLIDER);
  75         plain(frame, VERTICAL_PLAIN_SLIDER);
  76         majorTicks(frame, VERTICAL_MAJOR_TICKS_SLIDER);
  77         minorTicks(frame, VERTICAL_MINOR_TICKS_SLIDER);
  78         disabled(frame, VERTICAL_DISABLED_SLIDER);
  79     }
  80 
  81     private void plain(JFrameOperator jfo, String accessibleName) {
  82         JSliderOperator jso = new JSliderOperator(jfo,
  83                 new AccessibleNameChooser(accessibleName));
  84         if (accessibleName.equals(HORIZONTAL_PLAIN_SLIDER)) {
  85             jso.waitHasFocus();
  86             checkKeyboard(jso);
  87             checkMouse(jso);
  88         }
  89         checkMaximum(jso, PLAIN_SLIDER_MAXIMUM);
  90         checkMinimum(jso, PLAIN_SLIDER_MINIMUM);
  91         checkMoveForward(jso, 10);
  92     }
  93 
  94     private void majorTicks(JFrameOperator jfo, String accessibleName) {
  95         JSliderOperator jso = new JSliderOperator(jfo,
  96                 new AccessibleNameChooser(accessibleName));
  97         checkMoveForward(jso, 40);
  98         assertTrue(jso.getPaintTicks());
  99         assertEquals(100, jso.getMajorTickSpacing());
 100     }
 101 
 102     private void minorTicks(JFrameOperator jfo, String accessibleName) {
 103         JSliderOperator jso = new JSliderOperator(jfo,
 104                 new AccessibleNameChooser(accessibleName));
 105         if (accessibleName.equals(HORIZONTAL_MINOR_TICKS_SLIDER)) {


< prev index next >