8258645: Bring Jemmy 1.3.11 to JDK test base
Reviewed-by: serb
This commit is contained in:
parent
7f92d187b1
commit
6a78b2a2b2
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -30,6 +29,10 @@ import java.util.function.Predicate;
|
|||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import static org.testng.AssertJUnit.*;
|
import static org.testng.AssertJUnit.*;
|
||||||
|
|
||||||
|
import org.netbeans.jemmy.drivers.DriverManager;
|
||||||
|
import org.netbeans.jemmy.drivers.scrolling.KeyboardJSliderScrollDriver;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.netbeans.jemmy.ClassReference;
|
import org.netbeans.jemmy.ClassReference;
|
||||||
import org.netbeans.jemmy.ComponentChooser;
|
import org.netbeans.jemmy.ComponentChooser;
|
||||||
@ -68,6 +71,11 @@ public class SliderDemoTest {
|
|||||||
private static final int VERTICAL_MINOR_TICKS_SLIDER_MINIMUM = 0;
|
private static final int VERTICAL_MINOR_TICKS_SLIDER_MINIMUM = 0;
|
||||||
private static final int VERTICAL_MINOR_TICKS_SLIDER_MAXIMUM = 100;
|
private static final int VERTICAL_MINOR_TICKS_SLIDER_MAXIMUM = 100;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public void useKeyboardSliderDriver() {
|
||||||
|
DriverManager.setScrollDriver(new KeyboardJSliderScrollDriver());
|
||||||
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
@Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
|
||||||
public void test(String lookAndFeel) throws Exception {
|
public void test(String lookAndFeel) throws Exception {
|
||||||
UIManager.setLookAndFeel(lookAndFeel);
|
UIManager.setLookAndFeel(lookAndFeel);
|
||||||
@ -139,70 +147,81 @@ public class SliderDemoTest {
|
|||||||
|
|
||||||
private void checkMaximum(JSliderOperator jso, int maxValue) {
|
private void checkMaximum(JSliderOperator jso, int maxValue) {
|
||||||
jso.scrollToMaximum();
|
jso.scrollToMaximum();
|
||||||
waitSliderValue(jso, jSlider -> jSlider.getValue() == maxValue);
|
waitSliderValue(jso, jSlider -> jSlider.getValue() == maxValue,
|
||||||
|
"value == " + maxValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkMinimum(JSliderOperator jso, int minValue) {
|
private void checkMinimum(JSliderOperator jso, int minValue) {
|
||||||
jso.scrollToMinimum();
|
jso.scrollToMinimum();
|
||||||
waitSliderValue(jso, jSlider -> jSlider.getValue() == minValue);
|
waitSliderValue(jso, jSlider -> jSlider.getValue() == minValue,
|
||||||
|
"value == " + minValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkKeyboard(JSliderOperator jso) {
|
private void checkKeyboard(JSliderOperator jso) {
|
||||||
boolean isMotif = LookAndFeel.isMotif();
|
boolean isMotif = LookAndFeel.isMotif();
|
||||||
checkKeyPress(jso, KeyEvent.VK_HOME,
|
checkKeyPress(jso, KeyEvent.VK_HOME,
|
||||||
jSlider -> jSlider.getValue() == jso.getMinimum());
|
jSlider -> jSlider.getValue() == jso.getMinimum(),
|
||||||
|
"value == " + jso.getMinimum());
|
||||||
|
|
||||||
{
|
{
|
||||||
int expectedValue = jso.getValue() + 1;
|
int expectedValue = jso.getValue() + 1;
|
||||||
checkKeyPress(jso, KeyEvent.VK_UP,
|
checkKeyPress(jso, KeyEvent.VK_UP,
|
||||||
jSlider -> jSlider.getValue() >= expectedValue);
|
jSlider -> jSlider.getValue() >= expectedValue,
|
||||||
|
"value >= " + expectedValue);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
int expectedValue = jso.getValue() + 1;
|
int expectedValue = jso.getValue() + 1;
|
||||||
checkKeyPress(jso, KeyEvent.VK_RIGHT,
|
checkKeyPress(jso, KeyEvent.VK_RIGHT,
|
||||||
jSlider -> jSlider.getValue() >= expectedValue);
|
jSlider -> jSlider.getValue() >= expectedValue,
|
||||||
|
"value >= " + expectedValue);
|
||||||
}
|
}
|
||||||
if (!isMotif) {
|
if (!isMotif) {
|
||||||
int expectedValue = jso.getValue() + 11;
|
int expectedValue = jso.getValue() + 11;
|
||||||
checkKeyPress(jso, KeyEvent.VK_PAGE_UP,
|
checkKeyPress(jso, KeyEvent.VK_PAGE_UP,
|
||||||
jSlider -> jSlider.getValue() >= expectedValue);
|
jSlider -> jSlider.getValue() >= expectedValue,
|
||||||
|
"value >= " + expectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkKeyPress(jso, KeyEvent.VK_END,
|
checkKeyPress(jso, KeyEvent.VK_END,
|
||||||
jSlider -> jSlider.getValue() == jso.getMaximum());
|
jSlider -> jSlider.getValue() == jso.getMaximum(),
|
||||||
|
"value == " + jso.getMaximum());
|
||||||
|
|
||||||
{
|
{
|
||||||
int expectedValue = jso.getValue() - 1;
|
int expectedValue = jso.getValue() - 1;
|
||||||
checkKeyPress(jso, KeyEvent.VK_DOWN,
|
checkKeyPress(jso, KeyEvent.VK_DOWN,
|
||||||
jSlider -> jSlider.getValue() <= expectedValue);
|
jSlider -> jSlider.getValue() <= expectedValue,
|
||||||
|
"value <= " + expectedValue);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
int expectedValue = jso.getValue() - 1;
|
int expectedValue = jso.getValue() - 1;
|
||||||
checkKeyPress(jso, KeyEvent.VK_LEFT,
|
checkKeyPress(jso, KeyEvent.VK_LEFT,
|
||||||
jSlider -> jSlider.getValue() <= expectedValue);
|
jSlider -> jSlider.getValue() <= expectedValue,
|
||||||
|
"value <= " + expectedValue);
|
||||||
}
|
}
|
||||||
if (!isMotif) {
|
if (!isMotif) {
|
||||||
int expectedValue = jso.getValue() - 11;
|
int expectedValue = jso.getValue() - 11;
|
||||||
checkKeyPress(jso, KeyEvent.VK_PAGE_DOWN,
|
checkKeyPress(jso, KeyEvent.VK_PAGE_DOWN,
|
||||||
jSlider -> jSlider.getValue() <= expectedValue);
|
jSlider -> jSlider.getValue() <= expectedValue,
|
||||||
|
"value <= " + expectedValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkKeyPress(JSliderOperator jso, int keyCode,
|
private void checkKeyPress(JSliderOperator jso, int keyCode,
|
||||||
Predicate<JSliderOperator> predicate) {
|
Predicate<JSliderOperator> predicate,
|
||||||
|
String description) {
|
||||||
jso.pushKey(keyCode);
|
jso.pushKey(keyCode);
|
||||||
waitSliderValue(jso, predicate);
|
waitSliderValue(jso, predicate, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitSliderValue(JSliderOperator jso,
|
private void waitSliderValue(JSliderOperator jso,
|
||||||
Predicate<JSliderOperator> predicate) {
|
Predicate<JSliderOperator> predicate, String description) {
|
||||||
jso.waitState(new ComponentChooser() {
|
jso.waitState(new ComponentChooser() {
|
||||||
public boolean checkComponent(Component comp) {
|
public boolean checkComponent(Component comp) {
|
||||||
return predicate.test(jso);
|
return predicate.test(jso);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "Wait till Slider attains the specified state.";
|
return description;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -211,14 +230,16 @@ public class SliderDemoTest {
|
|||||||
jso.setValue(jso.getMinimum());
|
jso.setValue(jso.getMinimum());
|
||||||
int finalValue = jso.getValue() + value;
|
int finalValue = jso.getValue() + value;
|
||||||
jso.scrollToValue(finalValue);
|
jso.scrollToValue(finalValue);
|
||||||
waitSliderValue(jso, jSlider -> jSlider.getValue() == finalValue);
|
waitSliderValue(jso, jSlider -> jSlider.getValue() == finalValue,
|
||||||
|
"value == " + finalValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSnapToTick(JSliderOperator jso, int expectedLower,
|
private void checkSnapToTick(JSliderOperator jso, int expectedLower,
|
||||||
int expectedHigher) {
|
int expectedHigher) {
|
||||||
jso.pressMouse(jso.getCenterXForClick(), jso.getCenterYForClick());
|
jso.pressMouse(jso.getCenterXForClick(), jso.getCenterYForClick());
|
||||||
waitSliderValue(jso, jSlider -> jSlider.getValue() == expectedLower
|
waitSliderValue(jso, jSlider -> jSlider.getValue() == expectedLower
|
||||||
|| jSlider.getValue() == expectedHigher);
|
|| jSlider.getValue() == expectedHigher,
|
||||||
|
"value is either" + expectedLower + " or " + expectedHigher);
|
||||||
jso.releaseMouse();
|
jso.releaseMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,13 +251,15 @@ public class SliderDemoTest {
|
|||||||
jso.setValue((jso.getMaximum() + jso.getMinimum()) / 2);
|
jso.setValue((jso.getMaximum() + jso.getMinimum()) / 2);
|
||||||
jso.pressMouse(jso.getCenterXForClick(), jso.getCenterYForClick());
|
jso.pressMouse(jso.getCenterXForClick(), jso.getCenterYForClick());
|
||||||
jso.dragMouse(jso.getWidth() + 10, jso.getHeight());
|
jso.dragMouse(jso.getWidth() + 10, jso.getHeight());
|
||||||
waitSliderValue(jso, jSlider -> jSlider.getValue() == jSlider.getMaximum());
|
waitSliderValue(jso, jSlider -> jSlider.getValue() == jSlider.getMaximum(),
|
||||||
|
"value == " + jso.getMaximum());
|
||||||
jso.releaseMouse();
|
jso.releaseMouse();
|
||||||
|
|
||||||
// Check mouse click by clicking on the center of the track 2 times
|
// Check mouse click by clicking on the center of the track 2 times
|
||||||
// and waiting till the slider value has changed from its previous
|
// and waiting till the slider value has changed from its previous
|
||||||
// value as a result of the clicks.
|
// value as a result of the clicks.
|
||||||
jso.clickMouse(jso.getCenterXForClick(), jso.getCenterYForClick(), 2);
|
jso.clickMouse(jso.getCenterXForClick(), jso.getCenterYForClick(), 2);
|
||||||
waitSliderValue(jso, jSlider -> jSlider.getValue() != jSlider.getMaximum());
|
waitSliderValue(jso, jSlider -> jSlider.getValue() != jSlider.getMaximum(),
|
||||||
|
"value != " + jso.getMaximum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.netbeans.jemmy.drivers;
|
package org.netbeans.jemmy.drivers;
|
||||||
|
|
||||||
import javax.swing.UIManager;
|
|
||||||
|
|
||||||
import org.netbeans.jemmy.ClassReference;
|
import org.netbeans.jemmy.ClassReference;
|
||||||
import org.netbeans.jemmy.JemmyException;
|
import org.netbeans.jemmy.JemmyException;
|
||||||
import org.netbeans.jemmy.JemmyProperties;
|
import org.netbeans.jemmy.JemmyProperties;
|
||||||
@ -41,7 +39,7 @@ import org.netbeans.jemmy.drivers.lists.ListKeyboardDriver;
|
|||||||
import org.netbeans.jemmy.drivers.menus.DefaultJMenuDriver;
|
import org.netbeans.jemmy.drivers.menus.DefaultJMenuDriver;
|
||||||
import org.netbeans.jemmy.drivers.menus.QueueJMenuDriver;
|
import org.netbeans.jemmy.drivers.menus.QueueJMenuDriver;
|
||||||
import org.netbeans.jemmy.drivers.scrolling.JScrollBarDriver;
|
import org.netbeans.jemmy.drivers.scrolling.JScrollBarDriver;
|
||||||
import org.netbeans.jemmy.drivers.scrolling.KeyboardJSliderScrollDriver;
|
import org.netbeans.jemmy.drivers.scrolling.JSliderDriver;
|
||||||
import org.netbeans.jemmy.drivers.scrolling.JSplitPaneDriver;
|
import org.netbeans.jemmy.drivers.scrolling.JSplitPaneDriver;
|
||||||
import org.netbeans.jemmy.drivers.scrolling.ScrollPaneDriver;
|
import org.netbeans.jemmy.drivers.scrolling.ScrollPaneDriver;
|
||||||
import org.netbeans.jemmy.drivers.scrolling.ScrollbarDriver;
|
import org.netbeans.jemmy.drivers.scrolling.ScrollbarDriver;
|
||||||
@ -110,7 +108,7 @@ public class DefaultDriverInstaller extends ArrayDriverInstaller {
|
|||||||
new ScrollPaneDriver(),
|
new ScrollPaneDriver(),
|
||||||
new JScrollBarDriver(),
|
new JScrollBarDriver(),
|
||||||
new JSplitPaneDriver(),
|
new JSplitPaneDriver(),
|
||||||
new KeyboardJSliderScrollDriver(),
|
new JSliderDriver(),
|
||||||
createSpinnerDriver(),
|
createSpinnerDriver(),
|
||||||
new ButtonMouseDriver(),
|
new ButtonMouseDriver(),
|
||||||
new JTabMouseDriver(),
|
new JTabMouseDriver(),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -78,6 +78,8 @@ import org.netbeans.jemmy.drivers.FocusDriver;
|
|||||||
import org.netbeans.jemmy.drivers.KeyDriver;
|
import org.netbeans.jemmy.drivers.KeyDriver;
|
||||||
import org.netbeans.jemmy.drivers.MouseDriver;
|
import org.netbeans.jemmy.drivers.MouseDriver;
|
||||||
|
|
||||||
|
import javax.accessibility.AccessibleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Root class for all component operators.
|
* Root class for all component operators.
|
||||||
*
|
*
|
||||||
@ -122,6 +124,20 @@ public class ComponentOperator extends Operator
|
|||||||
*/
|
*/
|
||||||
public static final String NAME_DPROP = "Name:";
|
public static final String NAME_DPROP = "Name:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for a name property.
|
||||||
|
*
|
||||||
|
* @see #getDump
|
||||||
|
*/
|
||||||
|
public static final String ACCESSIBLE_NAME_DPROP = "Accessible name:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for a name property.
|
||||||
|
*
|
||||||
|
* @see #getDump
|
||||||
|
*/
|
||||||
|
public static final String ACCESSIBLE_DESCRIPTION_DPROP = "Accessible description:";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifier for a visible property.
|
* Identifier for a visible property.
|
||||||
*
|
*
|
||||||
@ -1222,7 +1238,7 @@ public class ComponentOperator extends Operator
|
|||||||
/**
|
/**
|
||||||
* Wait till the component reaches exact location on screen.
|
* Wait till the component reaches exact location on screen.
|
||||||
*
|
*
|
||||||
* @param exactLocation exact expected screen location.
|
* @param exactlocation exact expected screen location.
|
||||||
*/
|
*/
|
||||||
public void waitComponentLocationOnScreen(Point exactlocation) {
|
public void waitComponentLocationOnScreen(Point exactlocation) {
|
||||||
waitComponentLocationOnScreen(exactlocation, exactlocation);
|
waitComponentLocationOnScreen(exactlocation, exactlocation);
|
||||||
@ -1270,6 +1286,15 @@ public class ComponentOperator extends Operator
|
|||||||
if (getSource().getName() != null) {
|
if (getSource().getName() != null) {
|
||||||
result.put(NAME_DPROP, getSource().getName());
|
result.put(NAME_DPROP, getSource().getName());
|
||||||
}
|
}
|
||||||
|
AccessibleContext context = source.getAccessibleContext();
|
||||||
|
if(context != null) {
|
||||||
|
if(context.getAccessibleName() != null) {
|
||||||
|
result.put(ACCESSIBLE_NAME_DPROP, context.getAccessibleName());
|
||||||
|
}
|
||||||
|
if(context.getAccessibleDescription() != null) {
|
||||||
|
result.put(ACCESSIBLE_DESCRIPTION_DPROP, context.getAccessibleDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
result.put(IS_VISIBLE_DPROP, getSource().isVisible() ? "true" : "false");
|
result.put(IS_VISIBLE_DPROP, getSource().isVisible() ? "true" : "false");
|
||||||
result.put(IS_SHOWING_DPROP, getSource().isShowing() ? "true" : "false");
|
result.put(IS_SHOWING_DPROP, getSource().isShowing() ? "true" : "false");
|
||||||
result.put(X_DPROP, Integer.toString(getSource().getX()));
|
result.put(X_DPROP, Integer.toString(getSource().getX()));
|
||||||
|
@ -43,6 +43,7 @@ import javax.swing.JTable;
|
|||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.JToggleButton;
|
import javax.swing.JToggleButton;
|
||||||
import javax.swing.ListModel;
|
import javax.swing.ListModel;
|
||||||
|
import javax.swing.UIManager;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import javax.swing.filechooser.FileSystemView;
|
import javax.swing.filechooser.FileSystemView;
|
||||||
import javax.swing.filechooser.FileView;
|
import javax.swing.filechooser.FileView;
|
||||||
@ -341,18 +342,18 @@ public class JFileChooserOperator extends JComponentOperator
|
|||||||
* @return a component being used to display directory content.
|
* @return a component being used to display directory content.
|
||||||
*/
|
*/
|
||||||
public Component getFileList() {
|
public Component getFileList() {
|
||||||
int index = 0;
|
final String fileListName;
|
||||||
// In GTK and Motif L&F, there are two JLists, one is to list folders
|
|
||||||
// and second one one is to list files
|
|
||||||
if (LookAndFeel.isMotif() || LookAndFeel.isGTK()) {
|
if (LookAndFeel.isMotif() || LookAndFeel.isGTK()) {
|
||||||
index =1;
|
fileListName = UIManager.getString("FileChooser.filesLabelText", getLocale());
|
||||||
|
} else {
|
||||||
|
fileListName = UIManager.getString("FileChooser.filesListAccessibleName", getLocale());
|
||||||
}
|
}
|
||||||
return innerSearcher.
|
return innerSearcher.
|
||||||
findComponent(new ComponentChooser() {
|
findComponent(new ComponentChooser() {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkComponent(Component comp) {
|
public boolean checkComponent(Component comp) {
|
||||||
return (comp != null
|
return ((comp instanceof JList && fileListName.equals(comp.getAccessibleContext().getAccessibleName()))
|
||||||
&& (comp instanceof JList || comp instanceof JTable));
|
|| comp instanceof JTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -364,7 +365,7 @@ public class JFileChooserOperator extends JComponentOperator
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "JFileChooserOperator.getFileList.ComponentChooser{description = " + getDescription() + '}';
|
return "JFileChooserOperator.getFileList.ComponentChooser{description = " + getDescription() + '}';
|
||||||
}
|
}
|
||||||
}, index);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -828,10 +828,8 @@ public class JTextComponentOperator extends JComponentOperator
|
|||||||
public Hashtable<String, Object> getDump() {
|
public Hashtable<String, Object> getDump() {
|
||||||
Hashtable<String, Object> result = super.getDump();
|
Hashtable<String, Object> result = super.getDump();
|
||||||
result.put(TEXT_DPROP, ((JTextComponent) getSource()).getText());
|
result.put(TEXT_DPROP, ((JTextComponent) getSource()).getText());
|
||||||
if (((JTextComponent) getSource()).getSelectedText() != null
|
String selected = ((JTextComponent) getSource()).getSelectedText();
|
||||||
&& !((JTextComponent) getSource()).getSelectedText().equals("")) {
|
result.put(SELECTED_TEXT_DPROP, (selected != null) ? selected : "");
|
||||||
result.put(SELECTED_TEXT_DPROP, ((JTextComponent) getSource()).getSelectedText());
|
|
||||||
}
|
|
||||||
result.put(IS_EDITABLE_DPROP, ((JTextComponent) getSource()).isEditable() ? "true" : "false");
|
result.put(IS_EDITABLE_DPROP, ((JTextComponent) getSource()).isEditable() ? "true" : "false");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -320,9 +320,8 @@ public class JToolTipOperator extends JComponentOperator {
|
|||||||
try {
|
try {
|
||||||
return stateWaiter.waitAction(null);
|
return stateWaiter.waitAction(null);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
throw new JemmyException("Waiting of " + waitable.getDescription()
|
||||||
throw (new JemmyException("Waiting of " + waitable.getDescription()
|
+ " state has been interrupted!");
|
||||||
+ " state has been interrupted!"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,10 +720,9 @@ public abstract class Operator
|
|||||||
try {
|
try {
|
||||||
return stateWaiter.waitAction(null);
|
return stateWaiter.waitAction(null);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
throw new JemmyException(
|
||||||
throw (new JemmyException(
|
|
||||||
"Waiting of \"" + waitable.getDescription()
|
"Waiting of \"" + waitable.getDescription()
|
||||||
+ "\" state has been interrupted!"));
|
+ "\" state has been interrupted!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,14 +734,22 @@ public abstract class Operator
|
|||||||
* defined by {@code "ComponentOperator.WaitStateTimeout"}
|
* defined by {@code "ComponentOperator.WaitStateTimeout"}
|
||||||
*/
|
*/
|
||||||
public void waitStateOnQueue(final ComponentChooser state) {
|
public void waitStateOnQueue(final ComponentChooser state) {
|
||||||
waitState((comp) -> {
|
waitState(new ComponentChooser() {
|
||||||
return (boolean) (queueTool.invokeSmoothly(
|
@Override
|
||||||
new QueueTool.QueueAction<Object>("checkComponent") {
|
public boolean checkComponent(Component comp) {
|
||||||
@Override
|
return (boolean) (queueTool.invokeSmoothly(
|
||||||
public final Object launch() throws Exception {
|
new QueueTool.QueueAction<Object>("checkComponent") {
|
||||||
return state.checkComponent(comp);
|
@Override
|
||||||
}
|
public final Object launch() throws Exception {
|
||||||
}));
|
return state.checkComponent(comp);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return state.getDescription();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -58,6 +58,13 @@ public class TextComponentOperator extends ComponentOperator
|
|||||||
*/
|
*/
|
||||||
public static final String TEXT_DPROP = "Text";
|
public static final String TEXT_DPROP = "Text";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for a "selected text" property.
|
||||||
|
*
|
||||||
|
* @see #getDump
|
||||||
|
*/
|
||||||
|
public static final String SELECTED_TEXT_DPROP = "Selected text";
|
||||||
|
|
||||||
private final static long PUSH_KEY_TIMEOUT = 0;
|
private final static long PUSH_KEY_TIMEOUT = 0;
|
||||||
private final static long BETWEEN_KEYS_TIMEOUT = 0;
|
private final static long BETWEEN_KEYS_TIMEOUT = 0;
|
||||||
private final static long CHANGE_CARET_POSITION_TIMEOUT = 60000;
|
private final static long CHANGE_CARET_POSITION_TIMEOUT = 60000;
|
||||||
@ -505,6 +512,8 @@ public class TextComponentOperator extends ComponentOperator
|
|||||||
public Hashtable<String, Object> getDump() {
|
public Hashtable<String, Object> getDump() {
|
||||||
Hashtable<String, Object> result = super.getDump();
|
Hashtable<String, Object> result = super.getDump();
|
||||||
result.put(TEXT_DPROP, ((TextComponent) getSource()).getText());
|
result.put(TEXT_DPROP, ((TextComponent) getSource()).getText());
|
||||||
|
String selected = ((TextComponent) getSource()).getSelectedText();
|
||||||
|
result.put(SELECTED_TEXT_DPROP, (selected != null) ? selected : "");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Manifest-version: 1.0
|
Manifest-version: 1.0
|
||||||
Main-Class: org.netbeans.jemmy.JemmyProperties
|
Main-Class: org.netbeans.jemmy.JemmyProperties
|
||||||
Jemmy-MajorVersion: 3.0
|
Jemmy-MajorVersion: 3.0
|
||||||
Jemmy-MinorVersion: 8.0
|
Jemmy-MinorVersion: 11.0
|
||||||
Jemmy-Build: @BUILD_NUMBER@
|
Jemmy-Build: @BUILD_NUMBER@
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user