mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-test] Avoid private fields and reuse parent robot() and target()
This commit is contained in:
+2
-6
@@ -24,21 +24,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.awt.*;
|
||||
|
||||
public class ComponentWithBrowseButtonFixture extends JComponentFixture<ComponentWithBrowseButtonFixture, ComponentWithBrowseButton> {
|
||||
private final ComponentWithBrowseButton myComponentWithBrowseButton;
|
||||
@NotNull private final Robot myRobot;
|
||||
|
||||
public ComponentWithBrowseButtonFixture(ComponentWithBrowseButton componentWithBrowseButton, @NotNull Robot robot) {
|
||||
super(ComponentWithBrowseButtonFixture.class, robot, componentWithBrowseButton);
|
||||
myComponentWithBrowseButton = componentWithBrowseButton;
|
||||
myRobot = robot;
|
||||
}
|
||||
|
||||
public void clickButton() {
|
||||
FixedSizeButton button = myComponentWithBrowseButton.getButton();
|
||||
FixedSizeButton button = target().getButton();
|
||||
Point locationOnScreen = button.getLocationOnScreen();
|
||||
Rectangle bounds = button.getBounds();
|
||||
final Point point =
|
||||
new Point(locationOnScreen.x + bounds.x + bounds.width / 2, locationOnScreen.y + bounds.y + bounds.height / 2);
|
||||
myRobot.click(point, MouseButton.LEFT_BUTTON, 1);
|
||||
robot().click(point, MouseButton.LEFT_BUTTON, 1);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -29,21 +29,17 @@ import java.util.Collection;
|
||||
|
||||
public class JDialogFixture extends ComponentFixture<JDialogFixture, JDialog> implements ContainerFixture<JDialog> {
|
||||
|
||||
private final Robot myRobot;
|
||||
private final JDialog myDialog;
|
||||
|
||||
public JDialogFixture(@NotNull Robot robot, JDialog jDialog) {
|
||||
super(JDialogFixture.class, robot, jDialog);
|
||||
myRobot = robot;
|
||||
myDialog = jDialog;
|
||||
}
|
||||
|
||||
public void waitTillGone() {
|
||||
GenericTypeMatcher<JDialog> matcher = getMatcher(myDialog.getTitle());
|
||||
GenericTypeMatcher<JDialog> matcher = getMatcher(target().getTitle());
|
||||
Pause.pause(new Condition("Wait till dialog gone") {
|
||||
@Override
|
||||
public boolean test() {
|
||||
return myRobot.finder().findAll(matcher).isEmpty();
|
||||
return robot().finder().findAll(matcher).isEmpty();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user