- rework exclusion patterns to prevent compilation of platform specific
  classes

A classes_spec/org/mozilla/webclient/impl/wrapper_native/GtkBrowserControlCanvas.java
R classes_spec/org/mozilla/webclient/impl/wrapper_native/gtk/GtkBrowserControlCanvas.java

- moved GtkBrowserControlCanvas.java up one level, for access to package
  private classes.

M src_moz/gtk/GtkBrowserControlCanvas.cpp

- package name changes

M test/automated/src/classes/org/mozilla/webclient/CompareFiles.java

- rework this logic to account for files that end in a different number
  of ignorable conditions.

A test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/TestGtkBrowserControlCanvas.java
R test/automated/src/classes/org/mozilla/webclient/impl/wrapper_native/gtk/TestGtkBrowserControlCanvas.java

- moved this test up one level.
This commit is contained in:
edburns%acm.org 2004-04-23 14:52:21 +00:00
Родитель 2dfe7bafd2
Коммит bb14cd7579
5 изменённых файлов: 220 добавлений и 156 удалений

Просмотреть файл

@ -88,13 +88,11 @@
<classpath refid="compile.classpath"/>
<src path="${source.home}"/>
<patternset>
<include name="org/mozilla/webclient/impl/wrapper_native/gtk/*"
if="build.unix.classes"/>
<exclude name="**/Win32*.java" if="build.unix.classes"/>
</patternset>
<patternset>
<include name="org/mozilla/webclient/impl/wrapper_native/Win32*"
if="build.win32.classes"/>
<exclude name="**/Gtk*.java" if="build.win32.classes"/>
</patternset>
<!-- PENDING(edburns): include additional patternsets for ICE,
@ -137,7 +135,7 @@
<target name="compile.unix.canvas.headers" if="build.unix.classes">
<javah destdir="${basedir}/src_moz/gtk"
class="org.mozilla.webclient.impl.wrapper_native.gtk.GtkBrowserControlCanvas">
class="org.mozilla.webclient.impl.wrapper_native.GtkBrowserControlCanvas">
<classpath refid="compile.classpath"/>
</javah>

Просмотреть файл

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
@ -19,7 +18,7 @@
*
* Contributor(s):
*/
package org.mozilla.webclient.impl.wrapper_native.gtk;
package org.mozilla.webclient.impl.wrapper_native;
// GtkBrowserControlCanvas.java
@ -42,7 +41,7 @@ import java.awt.Dimension;
* There is one instance of GtkBrowserControlCanvas per top level awt Frame.
* @version $Id: GtkBrowserControlCanvas.java,v 1.1 2003-09-28 06:29:09 edburns%acm.org Exp $
* @version $Id: GtkBrowserControlCanvas.java,v 1.1 2004-04-23 14:52:20 edburns%acm.org Exp $
*
* @see org.mozilla.webclient.BrowserControlCanvasFactory
*
@ -87,20 +86,41 @@ public class GtkBrowserControlCanvas extends BrowserControlCanvas /* implements
synchronized(getTreeLock()) {
//Use the AWT Native Peer interface to get the handle
//of this Canvas's native peer
canvasWinID = this.getHandleToPeer();
Integer canvasWin = (Integer)
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable() {
public Object run() {
Integer result =
new Integer(GtkBrowserControlCanvas.this.getHandleToPeer());
return result;
}
});
canvasWinID = canvasWin.intValue();
//Set our canvas as a parent of the top-level gtk widget
//which contains Mozilla.
this.reparentWindow(this.gtkWinID, this.canvasWinID);
firstTime = false;
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable() {
public Object run() {
GtkBrowserControlCanvas.this.reparentWindow(GtkBrowserControlCanvas.this.gtkWinID, GtkBrowserControlCanvas.this.canvasWinID);
return null;
}
});
firstTime = false;
}
}
}
public void setBounds(int x, int y, int width, int height) {
super.setBounds(x, y, width, height);
final int finalWidth = width;
final int finalHeight = height;
synchronized(getTreeLock()) {
this.setGTKWindowSize(this.gtkTopWindow, width, height);
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable() {
public Object run() {
GtkBrowserControlCanvas.this.setGTKWindowSize(GtkBrowserControlCanvas.this.gtkTopWindow,
finalWidth, finalHeight);
return null;
}
});
}
}
@ -118,21 +138,42 @@ public class GtkBrowserControlCanvas extends BrowserControlCanvas /* implements
* @returns The native window handle.
*/
protected int getWindow() {
protected int getWindow() {
synchronized(getTreeLock()) {
this.gtkTopWindow = this.createTopLevelWindow();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Integer topWindow = (Integer)
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable() {
public Object run() {
Integer result =
new Integer(GtkBrowserControlCanvas.this.createTopLevelWindow());
return result;
}
});
this.gtkTopWindow = topWindow.intValue();
final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Integer winPtr = (Integer)
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable() {
public Object run() {
Integer result =
new Integer(GtkBrowserControlCanvas.this.createContainerWindow(GtkBrowserControlCanvas.this.gtkTopWindow, screenSize.width, screenSize.height));
return result;
}
});
this.gtkWinPtr = winPtr.intValue();
Integer winId = (Integer)
NativeEventThread.instance.pushBlockingWCRunnable(new WCRunnable() {
public Object run() {
Integer result = new Integer(GtkBrowserControlCanvas.this.getGTKWinID(GtkBrowserControlCanvas.this.gtkWinPtr));
return result;
}
});
this.gtkWinPtr =
this.createContainerWindow(this.gtkTopWindow, screenSize.width,
screenSize.height);
this.gtkWinID = this.getGTKWinID(gtkWinPtr);
}
return this.gtkWinPtr;
this.gtkWinID = winId.intValue();
}
return this.gtkWinPtr;
}
// The test for this class is TestGtkBrowserControlCanvas

Просмотреть файл

@ -28,7 +28,7 @@
#include <jni.h>
#include <jawt_md.h>
#include <jawt.h>
#include "org_mozilla_webclient_impl_wrapper_0005fnative_gtk_GtkBrowserControlCanvas.h"
#include "org_mozilla_webclient_impl_wrapper_0005fnative_GtkBrowserControlCanvas.h"
#include <X11/Xlib.h>
@ -55,7 +55,7 @@ extern "C" {
* Method: createTopLevelWindow
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_createTopLevelWindow
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_createTopLevelWindow
(JNIEnv * env, jobject obj) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
("GtkBrowserControlCanvas_createTopLevelWindow: entering\n"));
@ -99,7 +99,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBr
* Method: createContainerWindow
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_createContainerWindow
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_createContainerWindow
(JNIEnv * env, jobject obj, jint parent, jint screenWidth, jint screenHeight) {
PR_LOG(prLogModuleInfo, PR_LOG_DEBUG,
@ -136,7 +136,7 @@ int getWinID(GtkWidget * gtkWidgetPtr) {
* Method: getGTKWinID
* Signature: (I)I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_getGTKWinID
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_getGTKWinID
(JNIEnv * env, jobject obj, jint gtkWinPtr) {
GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr;
@ -149,7 +149,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBr
* Method: reparentWindow
* Signature: (II)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_reparentWindow (JNIEnv * env, jobject obj, jint childID, jint parentID) {
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_reparentWindow (JNIEnv * env, jobject obj, jint childID, jint parentID) {
XReparentWindow(GDK_DISPLAY(), childID, parentID, 0, 0);
}
@ -158,7 +158,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBr
* Method: processEvents
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_processEvents
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_processEvents
(JNIEnv * env, jobject obj) {
//printf("process events....\n");
//processEventLoopIntelligently();
@ -169,7 +169,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBr
* Method: setGTKWindowSize
* Signature: (III)V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_setGTKWindowSize
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_setGTKWindowSize
(JNIEnv * env, jobject obj, jint gtkWinPtr, jint width, jint height) {
if (gtkWinPtr != 0) {
GtkWidget * gtkWidgetPtr = (GtkWidget *) gtkWinPtr;
@ -186,7 +186,7 @@ JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBr
* Method: getHandleToPeer
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_getHandleToPeer
JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_getHandleToPeer
(JNIEnv *env, jobject canvas) {
JAWT awt;
JAWT_DrawingSurface* ds;
@ -278,7 +278,7 @@ JNIEXPORT jint JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBr
* Method: loadMainDll
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_gtk_GtkBrowserControlCanvas_loadMainDll
JNIEXPORT void JNICALL Java_org_mozilla_webclient_impl_wrapper_1native_GtkBrowserControlCanvas_loadMainDll
(JNIEnv *, jclass)
{
PR_LOG(prLogModuleInfo, PR_LOG_ERROR,

Просмотреть файл

@ -1,5 +1,5 @@
/*
* $Id: CompareFiles.java,v 1.3 2004-02-26 02:37:00 edburns%acm.org Exp $
* $Id: CompareFiles.java,v 1.4 2004-04-23 14:52:20 edburns%acm.org Exp $
*/
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
@ -59,6 +59,7 @@ public class CompareFiles {
LineNumberReader expectedReader = new LineNumberReader(expectedFileReader);
String actualLine, expectedLine;
boolean swallowedLine = false;
actualLine = actualReader.readLine().trim();
expectedLine = expectedReader.readLine().trim();
@ -79,23 +80,53 @@ public class CompareFiles {
expectedLine = expectedLine.substring(bracketColon + 3);
}
}
if (ignoreWarnings && actualLine.startsWith("WARNING:")) {
swallowedLine = false;
// while the actual lines start with a warning condition
// keep reading them until we get a non-warning line or end
// of stream.
while (null != actualLine && ignoreWarnings &&
(-1 != actualLine.indexOf("WARNING:") ||
-1 != actualLine.indexOf("###!!! ASSERTION:") ||
-1 != actualLine.indexOf("###!!! Break:"))) {
// we're ignoring warnings, no-op
actualLine = actualReader.readLine(); // swallow WARNING
// line
continue;
swallowedLine = true;
}
else if (ignoreWarnings && expectedLine.startsWith("WARNING:")) {
if (null != actualLine && swallowedLine) {
continue;
}
swallowedLine = false;
// while the expected lines start with a warning condition,
// keep reading them until we get a non-warning line or end
// of stream.
while (null != expectedLine && ignoreWarnings &&
(-1 != expectedLine.indexOf("WARNING:") ||
-1 != expectedLine.indexOf("###!!! ASSERTION:") ||
-1 != expectedLine.indexOf("###!!! Break:"))) {
// we're ignoring warnings, no-op
expectedLine = expectedReader.readLine(); // swallow
// WARNING
// line
continue;
// WARNING
// line
swallowedLine = true;
}
else if (!actualLine.equals(expectedLine)) {
if (null != actualLine && swallowedLine) {
continue;
}
if (null == actualLine && null == expectedLine) {
same = true;
continue;
}
// if one of the lines is null, but not the other
if (((null == actualLine) && (null != expectedLine)) ||
((null != actualLine) && (null == expectedLine))) {
same = false;
break;
}
if (!actualLine.equals(expectedLine)) {
if (null != expectedLinesToIgnore) {
// go thru the list of expectedLinesToIgnore and see if
// the current expectedLine matches any of them.
@ -141,12 +172,6 @@ public class CompareFiles {
actualLine = actualReader.readLine();
expectedLine = expectedReader.readLine();
// if one of the lines is null, but not the other
if (((null == actualLine) && (null != expectedLine)) ||
((null != actualLine) && (null == expectedLine))) {
same = false;
break;
}
if (null != actualLine) {
actualLine = actualLine.trim();
}

Просмотреть файл

@ -1,105 +1,105 @@
/*
* $Id: TestGtkBrowserControlCanvas.java,v 1.1 2003-09-28 06:29:21 edburns%acm.org Exp $
*/
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun
* Microsystems, Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.webclient.impl.wrapper_native.gtk;
// TestGtkBrowserControlCanvas.java
import org.mozilla.util.Assert;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.WebclientTestCase;
/**
*
* <B>TestGtkBrowserControlCanvas</B> is a class ...
*
* <B>Lifetime And Scope</B> <P>
*
* @version $Id: TestGtkBrowserControlCanvas.java,v 1.1 2003-09-28 06:29:21 edburns%acm.org Exp $
*
* @see Blah
* @see Bloo
*
*/
public class TestGtkBrowserControlCanvas extends WebclientTestCase
{
//
// Protected Constants
//
public static final int WIDTH = 400;
public static final int HEIGHT = WIDTH;
//
// Class Variables
//
//
// Instance Variables
//
// Attribute Instance Variables
// Relationship Instance Variables
//
// Constructors and Initializers
//
public TestGtkBrowserControlCanvas()
{
super("TestGtkBrowserControlCanvas");
}
public TestGtkBrowserControlCanvas(String name)
{
super(name);
}
//
// Class methods
//
//
// Methods from WebclientTestCase
//
public String getExpectedOutputFilename() { return "TestGtkBrowserControlCanvas_correct"; }
public boolean sendOutputToFile() { return true; }
//
// General Methods
//
public void testLoadMainDll() {
GtkBrowserControlCanvas gtkCanvas = new GtkBrowserControlCanvas();
assertTrue(verifyExpectedOutput());
}
} // end of class TestGtkBrowserControlCanvas
/*
* $Id: TestGtkBrowserControlCanvas.java,v 1.1 2004-04-23 14:52:21 edburns%acm.org Exp $
*/
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun
* Microsystems, Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.webclient.impl.wrapper_native;
// TestGtkBrowserControlCanvas.java
import org.mozilla.util.Assert;
import org.mozilla.util.ParameterCheck;
import org.mozilla.webclient.WebclientTestCase;
/**
*
* <B>TestGtkBrowserControlCanvas</B> is a class ...
*
* <B>Lifetime And Scope</B> <P>
*
* @version $Id: TestGtkBrowserControlCanvas.java,v 1.1 2004-04-23 14:52:21 edburns%acm.org Exp $
*
* @see Blah
* @see Bloo
*
*/
public class TestGtkBrowserControlCanvas extends WebclientTestCase
{
//
// Protected Constants
//
public static final int WIDTH = 400;
public static final int HEIGHT = WIDTH;
//
// Class Variables
//
//
// Instance Variables
//
// Attribute Instance Variables
// Relationship Instance Variables
//
// Constructors and Initializers
//
public TestGtkBrowserControlCanvas()
{
super("TestGtkBrowserControlCanvas");
}
public TestGtkBrowserControlCanvas(String name)
{
super(name);
}
//
// Class methods
//
//
// Methods from WebclientTestCase
//
public String getExpectedOutputFilename() { return "TestGtkBrowserControlCanvas_correct"; }
public boolean sendOutputToFile() { return true; }
//
// General Methods
//
public void testLoadMainDll() {
GtkBrowserControlCanvas gtkCanvas = new GtkBrowserControlCanvas();
assertTrue(verifyExpectedOutput());
}
} // end of class TestGtkBrowserControlCanvas