jdk/test/sanity/client/SwingSet/src/SplitPaneDemoTest.java
changeset 37677 9774eca96b01
parent 36744 a00905527ec2
child 39006 fd8c3312d043
equal deleted inserted replaced
37676:24ef455da1b0 37677:9774eca96b01
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 import org.jtregext.GuiTestListener;
    24 import com.sun.swingset3.demos.splitpane.SplitPaneDemo;
    25 import com.sun.swingset3.demos.splitpane.SplitPaneDemo;
    25 import static com.sun.swingset3.demos.splitpane.SplitPaneDemo.*;
    26 import static com.sun.swingset3.demos.splitpane.SplitPaneDemo.*;
    26 import java.awt.event.KeyEvent;
    27 import java.awt.event.KeyEvent;
    27 import javax.swing.JSplitPane;
    28 import javax.swing.JSplitPane;
    28 import static org.testng.AssertJUnit.*;
    29 import static org.testng.AssertJUnit.*;
    33 import org.netbeans.jemmy.operators.JFrameOperator;
    34 import org.netbeans.jemmy.operators.JFrameOperator;
    34 import org.netbeans.jemmy.operators.JRadioButtonOperator;
    35 import org.netbeans.jemmy.operators.JRadioButtonOperator;
    35 import org.netbeans.jemmy.operators.JSplitPaneOperator;
    36 import org.netbeans.jemmy.operators.JSplitPaneOperator;
    36 import org.netbeans.jemmy.operators.JTextFieldOperator;
    37 import org.netbeans.jemmy.operators.JTextFieldOperator;
    37 import static org.jemmy2ext.JemmyExt.*;
    38 import static org.jemmy2ext.JemmyExt.*;
       
    39 import org.testng.annotations.Listeners;
    38 
    40 
    39 /*
    41 /*
    40  * @test
    42  * @test
    41  * @key headful
    43  * @key headful
    42  * @summary Verifies SwingSet3 SplitPaneDemo by performing OneClick expansion,
    44  * @summary Verifies SwingSet3 SplitPaneDemo by performing OneClick expansion,
    43  *          changing size of the divier, moving the divider to different positions
    45  *          changing size of the divier, moving the divider to different positions
    44  *          and changing the divider orientation.
    46  *          and changing the divider orientation.
    45  *
    47  *
    46  * @library /sanity/client/lib/jemmy/src
    48  * @library /sanity/client/lib/jemmy/src
    47  * @library /sanity/client/lib/Jemmy2Ext/src
    49  * @library /sanity/client/lib/Extensions/src
    48  * @library /sanity/client/lib/SwingSet3/src
    50  * @library /sanity/client/lib/SwingSet3/src
    49  * @build org.jemmy2ext.JemmyExt
    51  * @build org.jemmy2ext.JemmyExt
    50  * @build com.sun.swingset3.demos.splitpane.SplitPaneDemo
    52  * @build com.sun.swingset3.demos.splitpane.SplitPaneDemo
    51  * @run testng SplitPaneDemoTest
    53  * @run testng SplitPaneDemoTest
    52  */
    54  */
       
    55 @Listeners(GuiTestListener.class)
    53 public class SplitPaneDemoTest {
    56 public class SplitPaneDemoTest {
    54 
    57 
    55     @Test
    58     @Test
    56     public void test() throws Exception {
    59     public void test() throws Exception {
    57         captureDebugInfoOnFail(() -> {
       
    58             new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
       
    59 
    60 
    60             JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
    61         new ClassReference(SplitPaneDemo.class.getCanonicalName()).startApplication();
    61 
    62 
    62             JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
    63         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
    63 
    64 
    64             // Toggle OneTouch Expandable
    65         JSplitPaneOperator splitPane = new JSplitPaneOperator(frame);
    65             checkOneTouch(frame, splitPane, true);
       
    66             checkOneTouch(frame, splitPane, false);
       
    67 
    66 
    68             // Check changing divider size to minimum and maximum values
    67         // Toggle OneTouch Expandable
    69             changeDividerSize(frame, splitPane, 50);
    68         checkOneTouch(frame, splitPane, true);
    70             changeDividerSize(frame, splitPane, 6);
    69         checkOneTouch(frame, splitPane, false);
    71 
    70 
    72             // Check moving the divider
    71         // Check changing divider size to minimum and maximum values
    73             checkDividerMoves(frame, splitPane, false);
    72         changeDividerSize(frame, splitPane, 50);
    74             checkDividerMoves(frame, splitPane, true);
    73         changeDividerSize(frame, splitPane, 6);
    75 
    74 
    76             // Check different minumum Day/Night sizes
    75         // Check moving the divider
    77             changeMinimumSizes(frame, splitPane, 100);
    76         checkDividerMoves(frame, splitPane, false);
    78             changeMinimumSizes(frame, splitPane, 0);
    77         checkDividerMoves(frame, splitPane, true);
    79         });
    78 
       
    79         // Check different minumum Day/Night sizes
       
    80         changeMinimumSizes(frame, splitPane, 100);
       
    81         changeMinimumSizes(frame, splitPane, 0);
    80     }
    82     }
    81 
    83 
    82     // Check for different day and night minimum size
    84     // Check for different day and night minimum size
    83     public void changeMinimumSizes(JFrameOperator frame, JSplitPaneOperator splitPane, int amount) throws Exception {
    85     public void changeMinimumSizes(JFrameOperator frame, JSplitPaneOperator splitPane, int amount) throws Exception {
    84         for (String label : new String[]{FIRST_COMPONENT_MIN_SIZE, SECOND_COMPONENT_MIN_SIZE}) {
    86         for (String label : new String[]{FIRST_COMPONENT_MIN_SIZE, SECOND_COMPONENT_MIN_SIZE}) {