changeset 50682:c4789b6dbbb9

8202064: Jemmy JInternalFrameOperator: Add wait for close(), activate(), resize() and move() operations Reviewed-by: serb Contributed-by: abdul.kolarkunnu@oracle.com
author psadhukhan
date Mon, 07 May 2018 16:51:08 +0530
parents a9398d77ea79
children 6064cd8725fa
files test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info
diffstat 2 files changed, 73 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java	Sat May 05 12:17:43 2018 -0700
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java	Mon May 07 16:51:08 2018 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 
 import java.awt.Component;
 import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Point;
 import java.awt.Rectangle;
 import java.beans.PropertyVetoException;
 import java.util.Hashtable;
@@ -505,6 +507,9 @@
                 + " position");
         checkIconified(false);
         wDriver.move(this, x, y);
+        if (getVerification()) {
+            waitComponentLocation(new Point(x, y));
+        }
     }
 
     /**
@@ -526,6 +531,9 @@
                 + " size");
         checkIconified(false);
         wDriver.resize(this, width, height);
+        if (getVerification()) {
+            waitComponentSize(new Dimension(width, height));
+        }
     }
 
     /**
@@ -536,6 +544,9 @@
     public void activate() {
         checkIconified(false);
         wDriver.activate(this);
+        if (getVerification()) {
+            waitActivate(true);
+        }
     }
 
     /**
@@ -544,6 +555,9 @@
     public void close() {
         checkIconified(false);
         wDriver.requestClose(this);
+        if (getVerification()) {
+            waitClosed();
+        }
     }
 
     /**
@@ -654,18 +668,18 @@
     /**
      * Waits for the frame to be iconified or deiconified.
      *
-     * @param icon whether the frame needs to be iconified.
+     * @param isIconified whether the frame needs to be iconified or deiconified.
      */
-    public void waitIcon(final boolean icon) {
-        waitState(new ComponentChooser() {
+    public void waitIcon(final boolean isIconified) {
+        waitStateOnQueue(new ComponentChooser() {
             @Override
             public boolean checkComponent(Component comp) {
-                return ((JInternalFrame) comp).isIcon() == icon;
+                return isIcon() == isIconified;
             }
 
             @Override
             public String getDescription() {
-                return "Iconified JInternalFrame";
+                return "Internal Frame is " + (isIconified ? "iconified" : "deiconified");
             }
 
             @Override
@@ -676,20 +690,66 @@
     }
 
     /**
-     * Waits for the frame to be maximized or demaximized.
+     * Waits for the frame to be activated or deactivated.
      *
-     * @param maximum whether the frame needs to be maximized.
+     * @param isActivate whether the frame needs to be activated or deactivated.
      */
-    public void waitMaximum(final boolean maximum) {
-        waitState(new ComponentChooser() {
+    public void waitActivate(final boolean isActivate) {
+        waitStateOnQueue(new ComponentChooser() {
             @Override
             public boolean checkComponent(Component comp) {
-                return ((JInternalFrame) comp).isMaximum() == maximum;
+                return isSelected() == isActivate;
             }
 
             @Override
             public String getDescription() {
-                return "Maximizied JInternalFrame";
+                return "Internal Frame is " + (isActivate ? "activated" : "deactivated");
+            }
+
+            @Override
+            public String toString() {
+                return "JInternalFrameOperator.waitActivate.ComponentChooser{description = " + getDescription() + '}';
+            }
+        });
+    }
+
+    /**
+     * Waits for the frame to be closed.
+     */
+    public void waitClosed() {
+        waitStateOnQueue(new ComponentChooser() {
+            @Override
+            public boolean checkComponent(Component comp) {
+                return isClosed();
+            }
+
+            @Override
+            public String getDescription() {
+                return "Internal Frame is closed";
+            }
+
+            @Override
+            public String toString() {
+                return "JInternalFrameOperator.waitClosed.ComponentChooser{description = " + getDescription() + '}';
+            }
+        });
+    }
+
+    /**
+     * Waits for the frame to be maximized or demaximized.
+     *
+     * @param isMaximum whether the frame needs to be maximized or demaximized.
+     */
+    public void waitMaximum(final boolean isMaximum) {
+        waitStateOnQueue(new ComponentChooser() {
+            @Override
+            public boolean checkComponent(Component comp) {
+                return isMaximum() == isMaximum;
+            }
+
+            @Override
+            public String getDescription() {
+                return "Internal Frame is " + (isMaximum ? "maximizied" : "demaximizied");
             }
 
             @Override
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info	Sat May 05 12:17:43 2018 -0700
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info	Mon May 07 16:51:08 2018 +0530
@@ -1,6 +1,6 @@
 Manifest-version: 1.0
 Main-Class: org.netbeans.jemmy.JemmyProperties
 Jemmy-MajorVersion: 3.0
-Jemmy-MinorVersion: 0.0
+Jemmy-MinorVersion: 1.0
 Jemmy-Build: @BUILD_NUMBER@