mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-02 12:10:14 +00:00
8172701: Jemmy: FrameOperator: maximize() and demaximize() is not properly implemented
Reviewed-by: serb, shurailine, mrkam
This commit is contained in:
parent
7f74b3f6bc
commit
b107e7fa38
@ -22,9 +22,7 @@
|
||||
*/
|
||||
package org.netbeans.jemmy.drivers.windows;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
@ -61,16 +59,28 @@ public class DefaultFrameDriver extends LightSupportiveDriver implements FrameDr
|
||||
((FrameOperator) oper).setState(Frame.NORMAL);
|
||||
}
|
||||
|
||||
/** Maximizes the frame.
|
||||
*
|
||||
* @param oper Frame operator.
|
||||
* @throws UnsupportedOperatorException if operator class name is not in
|
||||
* the list of supported classes names
|
||||
*/
|
||||
@Override
|
||||
public void maximize(ComponentOperator oper) {
|
||||
checkSupported(oper);
|
||||
oper.setLocation(0, 0);
|
||||
Dimension ssize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
oper.setSize(ssize.width, ssize.height);
|
||||
((FrameOperator) oper).setExtendedState(Frame.MAXIMIZED_BOTH);
|
||||
}
|
||||
|
||||
/** Demaximizes the frame.
|
||||
*
|
||||
* @param oper Frame operator.
|
||||
* @throws UnsupportedOperatorException if operator class name is not in
|
||||
* the list of supported classes names
|
||||
*/
|
||||
@Override
|
||||
public void demaximize(ComponentOperator oper) {
|
||||
checkSupported(oper);
|
||||
((FrameOperator) oper).setExtendedState(Frame.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ public class FrameOperator extends WindowOperator implements Outputable {
|
||||
output.printGolden("Maximizing frame");
|
||||
driver.maximize(this);
|
||||
if (getVerification()) {
|
||||
waitState(Frame.NORMAL);
|
||||
waitState(Frame.MAXIMIZED_BOTH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ public class FrameOperator extends WindowOperator implements Outputable {
|
||||
waitState(new ComponentChooser() {
|
||||
@Override
|
||||
public boolean checkComponent(Component comp) {
|
||||
return ((Frame) comp).getState() == state;
|
||||
return ((Frame) comp).getExtendedState() == state;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -375,6 +375,19 @@ public class FrameOperator extends WindowOperator implements Outputable {
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps {@code Frame.getExtendedState()} through queue
|
||||
* @return the state of the frame
|
||||
*/
|
||||
public int getExtendedState() {
|
||||
return (runMapping(new MapAction<Integer>("getExtendedState") {
|
||||
@Override
|
||||
public Integer map() {
|
||||
return ((Frame) getSource()).getExtendedState();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps {@code Frame.getTitle()} through queue
|
||||
*/
|
||||
@ -447,6 +460,21 @@ public class FrameOperator extends WindowOperator implements Outputable {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps {@code Frame.setExtendedState(int)} through queue
|
||||
* @param state of the frame
|
||||
*/
|
||||
public void setExtendedState(final int state) {
|
||||
runMapping(new MapAction<Void>("setExtendedState") {
|
||||
@Override
|
||||
public Void map() {
|
||||
((Frame) getSource()).setExtendedState(state);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps {@code Frame.setTitle(String)} through queue
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user