/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
//import static sun.awt.X11.XEmbed.*;
/**
* Test XEmbed server implementation. See file:///home/dom/bugs/4931668/test_plan.html for
* specification and references.
*/
private static final PlatformLogger xembedLog = PlatformLogger.getLogger("sun.awt.X11.xembed.XEmbedServerTester");
boolean focused;
int focusedKind;
boolean reparent;
long parent;
boolean windowActive;
boolean xembedActive;
int mapped;
Rectangle serverBounds[]; // first rectangle is for the server frame, second is for dummy frame, others are for its children
private static final int SERVER_BOUNDS = 0, OTHER_FRAME = 1, SERVER_FOCUS = 2, SERVER_MODAL = 3, MODAL_CLOSE = 4;
focusedKind = -1;
focusedServerComponent = -1;
reparent = false;
windowActive = false;
xembedActive = false;
this.serverBounds = serverBounds;
throw new IllegalArgumentException("There must be at least five areas: server-activation, server-deactivation, server-focus, " +
"server-modal show, modal-close");
}
try {
} catch (Exception e) {
throw new RuntimeException("Can't create robot");
}
initAccel();
}
}
private void dumpReceivedEvents() {
int pos = 0;
}
}
public void test1_1() {
int res = embedCompletely();
requestFocus();
}
public void test1_2() {
int res = embedCompletely();
requestFocus();
}
public void test1_3() {
}
public void test1_4() {
int res = getEventPos();
}
public void test1_5() {
int res = embedCompletely();
}
public void test1_6() {
int res = embedCompletely();
requestFocus();
res = deactivateServer();
checkFocused();
}
public void test1_7() {
int res = embedCompletely();
requestFocus();
focusServer();
}
public void test2_5() {
int res = embedCompletely();
requestFocus();
}
public void test2_6() {
int res = embedCompletely();
requestFocus();
}
public void test3_1() {
reparent = false;
}
public void test3_3() {
reparent = true;
}
public void test3_4() {
my_version = 10;
}
}
public void test3_5() {
// TODO: how can we detect that XEmbed ended? So far we are
// just checking that XEmbed server won't end up with an
// exception, which should end up testing, hopefully.
// Sleep before exiting the tester application
sleep(1000);
}
public void test3_6() {
sleep(1000);
try {
XlibWrapper.XReparentWindow(XToolkit.getDisplay(), window.getWindow(), XToolkit.getDefaultRootWindow(), 0, 0);
} finally {
}
int res = getEventPos();
sleep(1000);
throw new RuntimeException("Focus was been given to the client after XEmbed has ended");
}
}
public void test4_1() {
int res = getEventPos();
sleep(1000);
checkMapped();
}
public void test4_2() {
mapped = 0;
sleep(1000);
int res = getEventPos();
sleep(1000);
checkMapped();
}
public void test4_3() {
int res = getEventPos();
res = getEventPos();
mapped = 0;
sleep(1000);
}
public void test4_4() {
mapped = 0;
sleep(1000);
throw new RuntimeException("Client has been mapped");
}
}
public void test6_1_1() {
focusServer();
int res = pressAccelKey();
}
public void test6_1_2() {
focusServer();
int res = pressAccelKey();
sleep(1000);
throw new RuntimeException("Accelerator has been activated in inactive embedder");
}
}
public void test6_1_3() {
focusServer();
int res = pressAccelKey();
sleep(1000);
throw new RuntimeException("Accelerator has been activated after unregistering");
}
}
public void test6_1_4() {
requestFocus();
int res = pressAccelKey();
sleep(1000);
throw new RuntimeException("Accelerator has been activated in focused client");
}
}
public void test6_2_1() {
grabKey();
focusServer();
int res = pressAccelKey();
}
public void test6_2_2() {
grabKey();
focusServer();
int res = pressAccelKey();
sleep(1000);
throw new RuntimeException("Accelerator has been activated in inactive embedder");
}
}
public void test6_2_3() {
grabKey();
focusServer();
ungrabKey();
int res = pressAccelKey();
sleep(1000);
throw new RuntimeException("Accelerator has been activated after unregistering");
}
}
public void test6_2_4() {
grabKey();
requestFocus();
int res = pressAccelKey();
sleep(1000);
if (pos != -1) {
throw new RuntimeException("Accelerator has been activated in focused client");
}
}
}
public void test7_1() {
int res = showModalDialog();
}
public void test7_2() {
int res = showModalDialog();
res = hideModalDialog();
}
public void test9_1() {
requestFocus();
int res = pressAccelKey();
}
private int embed() {
int res = getEventPos();
try {
new XCreateWindowParams(new Object[] {
if (reparent) {
}
} finally {
}
return res;
}
private void updateEmbedInfo() {
try {
} finally {
}
}
private int getEventPos() {
synchronized(EVENT_LOCK) {
}
}
private int embedCompletely() {
int res = getEventPos();
embed();
return res;
}
private int requestFocus() {
int res = getEventPos();
return res;
}
private int requestFocusNoWait() {
int res = getEventPos();
return res;
}
return res;
}
int res = getEventPos();
return res;
}
loc.y += 5;
return res;
}
private int deactivateServer() {
int res = getEventPos();
return res;
}
private int focusServer() {
int res = getEventPos();
loc.x += 5;
loc.y += 5;
if (weFocused) {
}
return res;
}
private int focusServerNext() {
int res = getEventPos();
return res;
}
private int focusServerPrev() {
int res = getEventPos();
return res;
}
}
}
}
}
}
}
synchronized(EVENT_LOCK) {
// Check for already received events after the request
return;
}
if (eventReceived == event) {
// Already received
return;
}
eventReceived = -1;
eventWaited = event;
try {
} catch (InterruptedException ie) {
}
eventWaited = -1;
throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived));
} else {
}
}
}
/**
* Checks if the <code>event</code> is already in a list at position >= <code>position</code>
*/
if (position == -1) {
return -1;
}
synchronized(EVENT_LOCK) {
return i;
}
}
return -1;
}
}
private void checkFocusedServerNext() {
if (focusedServerComponent != 0) {
throw new RuntimeException("Wrong focused server component, should be 0, but it is " + focusedServerComponent);
}
}
private void checkFocusedServerPrev() {
if (focusedServerComponent != 2) {
throw new RuntimeException("Wrong focused server component, should be 2, but it is " + focusedServerComponent);
}
}
if (!focused) {
throw new RuntimeException("Didn't receive FOCUS_GAINED");
}
if (focusedKind != kind) {
}
}
private void checkNotFocused() {
if (focused) {
throw new RuntimeException("Focused");
}
}
private void checkFocused() {
if (!focused) {
throw new RuntimeException("Not Focused");
}
}
private void checkFocusLost() {
throw new RuntimeException("Didn't receive FOCUS_LOST");
}
}
private void checkWindowActivated() {
if (!windowActive) {
throw new RuntimeException("Window is not active");
}
}
private void checkMapped() {
throw new RuntimeException("Client is not mapped");
}
}
private void checkNotMapped() {
throw new RuntimeException("Client is mapped");
}
}
}
}
if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1)));
xembedActive = true;
break;
windowActive = true;
break;
windowActive = false;
break;
focused = true;
break;
case XEmbedHelper.XEMBED_FOCUS_OUT:
focused = false;
break;
}
synchronized(EVENT_LOCK) {
}
}
}
} else {
synchronized(EVENT_LOCK) {
xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited) + ", but we received " + ev + "(" + XEmbedHelper.msgidToString(eventID) + ")");
if (eventID == eventWaited) {
}
}
}
}
try {
} catch (Exception e) {
}
}
private void registerAccelerator() {
}
private void unregisterAccelerator() {
}
private int pressAccelKey() {
int res = getEventPos();
return res;
}
private void initAccel() {
accel_mods = 0;
}
private void grabKey() {
}
private void ungrabKey() {
}
private int showModalDialog() {
int res = getEventPos();
loc.x += 5;
loc.y += 5;
return res;
}
private int hideModalDialog() {
int res = getEventPos();
// Point loc = serverBounds[MODAL_CLOSE].getLocation();
// loc.x += 5;
// loc.y += 5;
// robot.mouseMove(loc.x, loc.y);
// robot.mousePress(InputEvent.BUTTON1_MASK);
// robot.delay(50);
// robot.mouseRelease(InputEvent.BUTTON1_MASK);
return res;
}
}