8172489: [TESTBUG] Create test for SwingSet DialogDemo
authormrkam
Wed, 15 Feb 2017 23:43:50 -0800
changeset 44133 9f5e29c3c4b4
parent 44132 f903d3a18abf
child 44134 0821d790675b
8172489: [TESTBUG] Create test for SwingSet DialogDemo Reviewed-by: shurailine, prr, mrkam Contributed-by: Vikrant Agarwal <vikrant.v.agarwal@oracle.com>
jdk/test/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java
--- a/jdk/test/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java	Wed Feb 15 23:37:49 2017 -0800
+++ b/jdk/test/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java	Wed Feb 15 23:43:50 2017 -0800
@@ -66,20 +66,15 @@
         if (adj.getScrollDirection() == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
             newValue = (scroll.getValue() > scroll.getMinimum()
                     + getUnitIncrement(scroll))
-                    ? scroll.getValue() - getUnitIncrement(scroll)
-                    : scroll.getMinimum();
+                            ? scroll.getValue() - getUnitIncrement(scroll)
+                            : scroll.getMinimum();
+            scroll.setValue(newValue);
         } else if (adj.getScrollDirection() == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
             newValue = (scroll.getValue() < scroll.getMaximum()
                     - getUnitIncrement(scroll))
-                    ? scroll.getValue() + getUnitIncrement(scroll)
-                    : scroll.getMaximum();
-        }
-        setValue(oper, newValue);
-    }
-
-    private void setValue(ComponentOperator oper, int value) {
-        if (value != -1) {
-            ((JSliderOperator) oper).setValue(value);
+                            ? scroll.getValue() + getUnitIncrement(scroll)
+                            : scroll.getMaximum();
+            scroll.setValue(newValue);
         }
     }
 
@@ -96,15 +91,16 @@
         if (adj.getScrollDirection() == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
             newValue = (scroll.getValue() > scroll.getMinimum()
                     + getBlockIncrement(scroll))
-                    ? scroll.getValue() - getBlockIncrement(scroll)
-                    : scroll.getMinimum();
+                            ? scroll.getValue() - getBlockIncrement(scroll)
+                            : scroll.getMinimum();
+            scroll.setValue(newValue);
         } else if (adj.getScrollDirection() == ScrollAdjuster.INCREASE_SCROLL_DIRECTION) {
             newValue = (scroll.getValue() < scroll.getMaximum()
                     - getBlockIncrement(scroll))
-                    ? scroll.getValue() + getBlockIncrement(scroll)
-                    : scroll.getMaximum();
+                            ? scroll.getValue() + getBlockIncrement(scroll)
+                            : scroll.getMaximum();
+            scroll.setValue(newValue);
         }
-        setValue(oper, newValue);
     }
 
     @Override