8211322: Reduce the timeout of tooltip in SwingSet2DemoTest
Reviewed-by: serb, shurailine
Contributed-by: gauri.patil@oracle.com
--- a/test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java Tue Feb 26 11:17:12 2019 +0530
+++ b/test/jdk/sanity/client/SwingSet/src/SwingSet2DemoTest.java Tue Feb 26 03:24:34 2019 -0800
@@ -34,6 +34,7 @@
import org.netbeans.jemmy.ClassReference;
import org.netbeans.jemmy.ComponentChooser;
import org.netbeans.jemmy.TimeoutExpiredException;
+import org.netbeans.jemmy.Timeouts;
import org.netbeans.jemmy.operators.ComponentOperator;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JCheckBoxMenuItemOperator;
@@ -67,6 +68,7 @@
private static final String OCEAN_THEME_NAME = "Ocean";
private static final String STEEL_THEME_NAME = "Steel";
private static final int TOOLTIP_DISMISS_DELAY = 60000;
+ private final static long TOOLTIP_TIMEOUT = 5000;
/**
* Testing check box menu item, radio button menu item, nested menus and
@@ -157,6 +159,8 @@
// tooltip is showing for demo toggle button
toolTipMenuItem.push();
toolTipMenuItem.waitSelected(false);
+ // Set tooltip timeout as 5 seconds
+ testComp.getTimeouts().setTimeout("JToolTipOperator.WaitToolTipTimeout", TOOLTIP_TIMEOUT);
boolean isToolTipTimeout = false;
try {
testComp.showToolTip();
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToolTipOperator.java Tue Feb 26 11:17:12 2019 +0530
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToolTipOperator.java Tue Feb 26 03:24:34 2019 -0800
@@ -37,8 +37,11 @@
import org.netbeans.jemmy.ComponentChooser;
import org.netbeans.jemmy.ComponentSearcher;
+import org.netbeans.jemmy.JemmyException;
import org.netbeans.jemmy.TimeoutExpiredException;
+import org.netbeans.jemmy.Timeouts;
import org.netbeans.jemmy.Waitable;
+import org.netbeans.jemmy.Waiter;
/**
* <BR>
@@ -52,6 +55,8 @@
*/
public class JToolTipOperator extends JComponentOperator {
+ private static long WAIT_TOOLTIP_TIMEOUT = 60000;
+
/**
* Identifier for a "tip text" property.
*
@@ -59,6 +64,9 @@
*/
public static final String TIP_TEXT_DPROP = "TipText";
+ static {
+ Timeouts.initDefault("JToolTipOperator.WaitToolTipTimeout", WAIT_TOOLTIP_TIMEOUT);
+ }
/**
* Constructs a JToolTipOperator object, waiting for a shown
* JToolTip.
@@ -286,8 +294,7 @@
*/
public static JToolTip waitJToolTip(ComponentOperator comp,
ComponentChooser chooser) {
- return Operator.getEnvironmentOperator().
- waitState(new Waitable<JToolTip, Void>() {
+ Waitable<JToolTip, Void> waitable = new Waitable<JToolTip, Void>() {
@Override
public JToolTip actionProduced(Void obj) {
return findJToolTip(comp, chooser);
@@ -304,7 +311,19 @@
return "JToolTipOperator.waitJToolTip.Waitable{description = "
+ getDescription() + '}';
}
- });
+ };
+ Waiter<JToolTip, Void> stateWaiter = new Waiter<>(waitable);
+ stateWaiter.setTimeoutsToCloneOf(Operator.getEnvironmentOperator().
+ getTimeouts(), "JToolTipOperator.WaitToolTipTimeout");
+ stateWaiter.setOutput(Operator.getEnvironmentOperator().
+ getOutput().createErrorOutput());
+ try {
+ return stateWaiter.waitAction(null);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw (new JemmyException("Waiting of " + waitable.getDescription()
+ + " state has been interrupted!"));
+ }
}
/**
--- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info Tue Feb 26 11:17:12 2019 +0530
+++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/version_info Tue Feb 26 03:24:34 2019 -0800
@@ -1,6 +1,6 @@
Manifest-version: 1.0
Main-Class: org.netbeans.jemmy.JemmyProperties
Jemmy-MajorVersion: 3.0
-Jemmy-MinorVersion: 6.0
+Jemmy-MinorVersion: 7.0
Jemmy-Build: @BUILD_NUMBER@