summaryrefslogtreecommitdiff
path: root/bean
diff options
context:
space:
mode:
Diffstat (limited to 'bean')
-rw-r--r--bean/com/sun/star/comp/beans/LocalOfficeConnection.java13
-rw-r--r--bean/com/sun/star/comp/beans/OOoBean.java11
-rw-r--r--bean/prj/build.lst4
-rw-r--r--bean/qa/complex/bean/OOoBeanTest.java (renamed from bean/qa/complex/OOoBeanTest.java)253
-rw-r--r--bean/qa/complex/bean/ScreenComparer.java (renamed from bean/qa/complex/ScreenComparer.java)28
-rw-r--r--bean/qa/complex/bean/WriterFrame.java (renamed from bean/qa/complex/WriterFrame.java)71
-rw-r--r--bean/qa/complex/bean/makefile.mk138
-rw-r--r--bean/qa/complex/makefile.mk95
8 files changed, 388 insertions, 225 deletions
diff --git a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
index 8467f1b75812..cc7545ad3e22 100644
--- a/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
+++ b/bean/com/sun/star/comp/beans/LocalOfficeConnection.java
@@ -153,7 +153,18 @@ public class LocalOfficeConnection
{}
}
- /**
+ /**
+ * protected Constructor
+ * Initialise a LocalOfficeConnection with an already running office.
+ * This C'Tor is only used in complex tests at the moment.
+ * @param xContext
+ */
+ protected LocalOfficeConnection(com.sun.star.uno.XComponentContext xContext)
+ {
+ this.mContext = xContext;
+ }
+
+ /**
* Sets a connection URL.
* This implementation accepts a UNO URL with following format:<br />
* <pre>
diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java
index b10becb3ce9a..44871d2a2675 100644
--- a/bean/com/sun/star/comp/beans/OOoBean.java
+++ b/bean/com/sun/star/comp/beans/OOoBean.java
@@ -601,8 +601,15 @@ public class OOoBean
xURLTransformer = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(
com.sun.star.util.XURLTransformer.class,
xServiceFactory.createInstance( "com.sun.star.util.URLTransformer") );
- xDispatcher = (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface(
- com.sun.star.frame.XDispatchProvider.class, aFrame );
+
+ try
+ {
+ xDispatcher = UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class, aFrame);
+ }
+ catch (Exception e)
+ {
+ /*ignore!*/
+ }
// get XComponentLoader from frame
com.sun.star.frame.XComponentLoader xLoader = (com.sun.star.frame.XComponentLoader)
diff --git a/bean/prj/build.lst b/bean/prj/build.lst
index 3767e8fff387..91d443344555 100644
--- a/bean/prj/build.lst
+++ b/bean/prj/build.lst
@@ -4,3 +4,7 @@ ob bean\com\sun\star\beans nmake - all ob_legacybeanjava ob_beanjava NULL
ob bean\native\win32 nmake - n ob_beanwin32 NULL
ob bean\native\unix nmake - u ob_beanunix NULL
ob bean\util nmake - all ob_util ob_beanjava ob_legacybeanjava ob_beanwin32.n ob_beanunix.u NULL
+
+# complex tests compileable but fail at runtime
+# ob bean\qa\complex\bean nmake - all ob_qa_complex ob_util NULL
+
diff --git a/bean/qa/complex/OOoBeanTest.java b/bean/qa/complex/bean/OOoBeanTest.java
index 2d038e8b37af..69c63e11a91a 100644
--- a/bean/qa/complex/OOoBeanTest.java
+++ b/bean/qa/complex/bean/OOoBeanTest.java
@@ -24,86 +24,90 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex;
-
-
-import complexlib.ComplexTestCase;
-import java.io.*;
-import java.awt.Rectangle;
-import java.awt.Insets;
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.image.BufferedImage;
-import java.awt.image.PixelGrabber;
-import java.awt.GridBagLayout;
-import java.awt.GridBagConstraints;
+package complex.bean;
+
+
+// import complexlib.ComplexTestCase;
+import com.sun.star.lang.XMultiServiceFactory;
import java.awt.event.*;
-import java.awt.Frame;
-import java.awt.Toolkit;
-import java.awt.Robot;
import java.awt.event.KeyEvent;
-import java.awt.Button;
-import javax.imageio.ImageIO;
-import javax.imageio.stream.FileImageOutputStream;
import com.sun.star.comp.beans.OOoBean;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.text.XTextDocument;
import java.awt.*;
-public class OOoBeanTest extends ComplexTestCase
-{
+// import org.junit.After;
+import org.junit.AfterClass;
+// import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
- public String[] getTestMethodNames()
+class PrivateLocalOfficeConnection extends com.sun.star.comp.beans.LocalOfficeConnection
+{
+ public PrivateLocalOfficeConnection(com.sun.star.uno.XComponentContext xContext)
{
- // TODO think about trigger of sub-tests from outside
- return new String[]
- {
- "test1",
- "test2",
- "test3",
- "test4",
- "test5",
- "test6",
- "test6a",
- "test7",
- "test8"
- };
+ super(xContext);
}
+}
+
+public class OOoBeanTest
+{
+
+// public String[] getTestMethodNames()
+// {
+// // TODO think about trigger of sub-tests from outside
+// return new String[]
+// {
+// "test1",
+// "test2",
+// "test3",
+// "test4",
+// "test5",
+// "test6",
+// "test6a",
+// "test7",
+// "test8"
+// };
+// }
/** For X-Windows we need to prolong the time between painting windows. Because
it takes longer than on Windows.
*/
- int getSleepTime(int time)
+ private int getSleepTime(int time)
{
int ret = time;
if (isWindows() == false)
+ {
return time * 5;
+ }
return time;
}
/** If it cannot be determined if we run on Windows then we assume
that we do not.
*/
- boolean isWindows()
+ private boolean isWindows()
{
boolean ret = false;
String os = System.getProperty("os.name");
if (os != null)
{
os = os.trim();
- if (os.indexOf("Win") == 0)
+ if (os.toLowerCase().indexOf("win") == 0)
+ {
ret = true;
+ }
}
return ret;
}
- public String getText(OOoBean bean) throws Exception
+ private String getText(OOoBean bean) throws Exception
{
com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)bean.getDocument();
com.sun.star.text.XTextDocument myDoc =
- (XTextDocument) UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class,
- model);
+ UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model);
com.sun.star.text.XText xText = myDoc.getText();
return xText.getString();
}
@@ -112,34 +116,40 @@ public class OOoBeanTest extends ComplexTestCase
* 2.Add OOoBean (no document loaded yet)
* 3.Show frame
* 4.Load document
+ * @throws Exception
*/
- public void test1() throws Exception
+ @Test public void test1() throws Exception
{
WriterFrame f = null;
try
{
- f = new WriterFrame(100 ,100, 500 ,400, false);
+ f = new WriterFrame(100 ,100, 500 ,400, false, connection.getComponentContext());
f.setText("OOoBean test.");
Thread.sleep(1000);
}
finally
{
if (f != null)
+ {
f.dispose();
+ }
}
}
/** Sizing, painting
+ * @throws Exception
*/
- public void test2() throws Exception
+ @Test public void test2() throws Exception
{
WriterFrame f = null;
ScreenComparer capturer = null;
try
{
- f = new WriterFrame(100, 100, 500,500, false);
+ f = new WriterFrame(100, 100, 500,500, false, connection.getComponentContext());
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Client are of Java frame does not match the UNO window.", true);
+ {
+ fail("Sizing error: Client are of Java frame does not match the UNO window.");
+ }
capturer = new ScreenComparer(100, 100, 500, 500);
//Minimize Window and back
@@ -153,15 +163,19 @@ public class OOoBeanTest extends ComplexTestCase
f.setExtendedState(Frame.ICONIFIED);
Thread.sleep(getSleepTime(200));
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Frame was iconified.", true);
+ {
+ fail("Sizing error: Frame was iconified.");
+ }
f.setExtendedState(Frame.NORMAL);
Thread.sleep(getSleepTime(200));
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Frame size set back to normal after it was iconified.", true);
+ {
+ fail("Sizing error: Frame size set back to normal after it was iconified.");
+ }
capturer.grabTwo(f.getClientArea());
if (capturer.compare() == false)
{
- failed("Painting error: Minimize (iconify) frame and back to normal size.", true);
+ fail("Painting error: Minimize (iconify) frame and back to normal size.");
capturer.writeImages();
}
}
@@ -174,15 +188,19 @@ public class OOoBeanTest extends ComplexTestCase
f.setExtendedState(Frame.MAXIMIZED_BOTH);
Thread.sleep(getSleepTime(200));
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Frame maximized.", true);
+ {
+ fail("Sizing error: Frame maximized.");
+ }
f.setExtendedState(Frame.NORMAL);
Thread.sleep(getSleepTime(200));
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Frame set from maximized to normal.", true);
+ {
+ fail("Sizing error: Frame set from maximized to normal.");
+ }
capturer.grabTwo(f.getClientArea());
if (capturer.compare() == false)
{
- failed("Painting error: Maximize frame and back to normal size", true);
+ fail("Painting error: Maximize frame and back to normal size");
capturer.writeImages();
}
}
@@ -194,12 +212,14 @@ public class OOoBeanTest extends ComplexTestCase
f.setBounds(0, 0, oldPosition.width, oldPosition.height);
Thread.sleep(getSleepTime(200));
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Frame moved.", true);
+ {
+ fail("Sizing error: Frame moved.");
+ }
capturer.grabTwo(f.getClientArea());
if (capturer.compare() == false)
{
- failed("Painting error: Move frame to a different position.", true);
+ fail("Painting error: Move frame to a different position.");
capturer.writeImages();
}
@@ -217,7 +237,7 @@ public class OOoBeanTest extends ComplexTestCase
capturer.grabTwo(f.getClientArea());
if (capturer.compare() == false)
{
- failed("Painting error: Move frame to a different position.", true);
+ fail("Painting error: Move frame to a different position.");
capturer.writeImages();
}
curY+= 50;
@@ -242,12 +262,14 @@ public class OOoBeanTest extends ComplexTestCase
f.toFront();
Thread.sleep(getSleepTime(200));
if (f.checkUnoFramePosition() == false)
- failed("Sizing error: Frame moved from back to front.", true);
+ {
+ fail("Sizing error: Frame moved from back to front.");
+ }
capturer.grabTwo(f.getClientArea());
if (capturer.compare() == false)
{
- failed("Painting error: Move frame to back and to front.", true);
+ fail("Painting error: Move frame to back and to front.");
capturer.writeImages();
}
}
@@ -257,7 +279,9 @@ public class OOoBeanTest extends ComplexTestCase
finally
{
if (f != null)
+ {
f.dispose();
+ }
}
}
@@ -267,33 +291,39 @@ public class OOoBeanTest extends ComplexTestCase
3. Create Frame (do not show yet)
4. Add OOoBean to Frame
5. Show Frame
- */
- public void test3() throws Exception
+ * @throws Exception
+ */
+ @Test public void test3() throws Exception
{
WriterFrame f = null;
try
{
- f = new WriterFrame(100, 100, 500, 300, true);
+ f = new WriterFrame(100, 100, 500, 300, true, connection.getComponentContext());
if (f.checkUnoFramePosition() == false)
- failed("Sizing error.", true);
+ {
+ fail("Sizing error.");
+ }
}
finally
{
if (f != null)
+ {
f.dispose();
+ }
}
}
/** Test repeated OOoBean.aquireSystemWindow and OOoBean.releaseSystemWindow
* calls.
+ * @throws Exception
*/
- public void test4() throws Exception
+ @Test public void test4() throws Exception
{
WriterFrame f = null;
try
{
- f = new WriterFrame(100, 100, 500, 300, false);
+ f = new WriterFrame(100, 100, 500, 300, false, connection.getComponentContext());
OOoBean b = f.getBean();
for (int i = 0; i < 100; i++)
{
@@ -301,26 +331,33 @@ public class OOoBeanTest extends ComplexTestCase
b.aquireSystemWindow();
}
if (f.checkUnoFramePosition() == false)
- failed("Sizing error.", true);
+ {
+ fail("Sizing error.");
+ }
}
finally
{
if (f != null)
+ {
f.dispose();
+ }
if (isWindows() == false)
+ {
Thread.sleep(10000);
+ }
}
}
/** Adding and removing the bean to a Java frame multiple times.
* Test painting and sizing.
+ * @throws Exception
*/
- public void test5() throws Exception
+ @Test public void test5() throws Exception
{
WriterFrame f = null;
try
{
- f = new WriterFrame(100, 100, 500, 400, false);
+ f = new WriterFrame(100, 100, 500, 400, false, connection.getComponentContext());
f.goToStart();
f.pageDown();
Thread.sleep(1000);
@@ -340,21 +377,27 @@ public class OOoBeanTest extends ComplexTestCase
if (capturer.compare() == false)
{
- failed("Painting error: adding and removing OOoBean " +
- "repeatedly to java.lang.Frame.", true);
+ fail("Painting error: adding and removing OOoBean " +
+ "repeatedly to java.lang.Frame.");
capturer.writeImages();
}
if (f.checkUnoFramePosition() == false)
- failed("Sizing error.", true);
+ {
+ fail("Sizing error.");
+ }
}
finally
{
if (f != null)
+ {
f.dispose();
+ }
if (isWindows() == false)
+ {
Thread.sleep(10000);
+ }
}
}
@@ -363,12 +406,13 @@ public class OOoBeanTest extends ComplexTestCase
* it should still be possible to enter text in the window. This does not
* work all the time on Windows. This is probably a timing problem. When using
* Thread.sleep (position #1) then it should work.
+ * @throws Exception
*/
- public void test6() throws Exception
+ @Test public void test6() throws Exception
{
for (int j = 0; j < 10; j++)
{
- final OOoBean bean = new OOoBean();
+ final OOoBean bean = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext()));
java.awt.Frame frame = null;
bean.setOOoCallTimeOut(10000);
try {
@@ -395,7 +439,9 @@ public class OOoBeanTest extends ComplexTestCase
}
if (isWindows() == false)
+ {
Thread.sleep(5000);
+ }
Robot roby = new Robot();
roby.keyPress(KeyEvent.VK_H);
@@ -405,10 +451,10 @@ public class OOoBeanTest extends ComplexTestCase
String s = getText(bean);
if ( ! s.equals(buf.toString()))
{
- failed("Focus error: After removing and adding the bean, the" +
+ fail("Focus error: After removing and adding the bean, the" +
"office window does not receive keyboard input.\n" +
"Try typing in the window, you've got 30s!!! This " +
- "test may not work with Linux/Solaris", true);
+ "test may not work with Linux/Solaris");
Thread.sleep(30000);
break;
}
@@ -428,12 +474,13 @@ public class OOoBeanTest extends ComplexTestCase
* different. The bean is added and removed from withing the event dispatch
* thread. Using Thread.sleep at various points (#1, #2, #3) seems to workaround
* the problem.
+ * @throws Exception
*/
- public void test6a() throws Exception
+ @Test public void test6a() throws Exception
{
for (int j = 0; j < 50; j++)
{
- final OOoBean bean = new OOoBean();
+ final OOoBean bean = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext()));
final java.awt.Frame frame = new Frame("Openoffice.org");
bean.setOOoCallTimeOut(10000);
@@ -486,7 +533,9 @@ public class OOoBeanTest extends ComplexTestCase
}
if (isWindows() == false)
+ {
Thread.sleep(5000);
+ }
Robot roby = new Robot();
roby.mouseMove(300, 200);
@@ -521,10 +570,10 @@ public class OOoBeanTest extends ComplexTestCase
if ( ! sH.equals(s2))
{
- failed("Focus error: After removing and adding the bean, the" +
+ fail("Focus error: After removing and adding the bean, the" +
"office window does not receive keyboard input.\n" +
"Try typing in the window, you've got 30s!!! This " +
- "test may not work with Linux/Solaris", true);
+ "test may not work with Linux/Solaris");
System.out.println("j: " + j + " i: " + i);
Thread.sleep(30000);
break;
@@ -543,13 +592,14 @@ public class OOoBeanTest extends ComplexTestCase
}
/** Repeatedly loading a document in one and the same OOoBean instance.
+ * @throws Exception
*/
- public void test7() throws Exception
+ @Test public void test7() throws Exception
{
WriterFrame f = null;
try
{
- f = new WriterFrame(100 ,100, 500 ,400, false);
+ f = new WriterFrame(100 ,100, 500 ,400, false, connection.getComponentContext());
String text = "OOoBean test.";
for (int i = 0; i < 10; i++)
@@ -561,28 +611,34 @@ public class OOoBeanTest extends ComplexTestCase
f.validate();
if (text.equals(f.getText()) == false)
- failed("Repeated loading of a document failed.");
+ {
+ fail("Repeated loading of a document failed.");
+ }
Thread.sleep(1000);
}
}
finally
{
if (f != null)
+ {
f.dispose();
+ }
}
}
/** Using multiple instances of OOoBean at the same time
+ * @throws Exception
*/
- public void test8() throws Exception
+
+ @Test public void test8() throws Exception
{
- OOoBean bean1 = new OOoBean();
+ OOoBean bean1 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext()));
BeanPanel bp1 = new BeanPanel(bean1);
- OOoBean bean2 = new OOoBean();
+ OOoBean bean2 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext()));
BeanPanel bp2 = new BeanPanel(bean2);
- OOoBean bean3 = new OOoBean();
+ OOoBean bean3 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext()));
BeanPanel bp3 = new BeanPanel(bean3);
- OOoBean bean4 = new OOoBean();
+ OOoBean bean4 = new OOoBean(new PrivateLocalOfficeConnection(connection.getComponentContext()));
BeanPanel bp4 = new BeanPanel(bean4);
try
@@ -651,6 +707,31 @@ public class OOoBeanTest extends ComplexTestCase
}
}
+
+
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+ // setup and close connections
+ @BeforeClass public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
+
}
diff --git a/bean/qa/complex/ScreenComparer.java b/bean/qa/complex/bean/ScreenComparer.java
index a2547a763c58..9bb0a41f40d8 100644
--- a/bean/qa/complex/ScreenComparer.java
+++ b/bean/qa/complex/bean/ScreenComparer.java
@@ -24,19 +24,19 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex;
+package complex.bean;
-import complexlib.ComplexTestCase;
+// import complexlib.ComplexTestCase;
import java.io.File;
import java.awt.Rectangle;
-import java.awt.BorderLayout;
+// import java.awt.BorderLayout;
import java.awt.image.BufferedImage;
import java.awt.image.PixelGrabber;
-import java.awt.event.*;
-import java.awt.Frame;
+// import java.awt.event.*;
+// import java.awt.Frame;
import javax.imageio.ImageIO;
-import javax.imageio.stream.FileImageOutputStream;
+// import javax.imageio.stream.FileImageOutputStream;
@@ -104,7 +104,9 @@ class ScreenComparer
public boolean compare() throws Exception
{
if (m_img1 == null || m_img2 == null)
+ {
throw new Exception("Only one image captured!");
+ }
boolean ret = true;
int w1 = m_img1.getWidth();
int h1 = m_img1.getHeight();
@@ -127,19 +129,31 @@ class ScreenComparer
int pixel2 = 0;
//get the pixel for m_img1
if (x < w1 && y < h1)
+ {
pixel1 = m_img1.getRGB(x, y);
+ }
else
+ {
bOutOfRange = true;
+ }
if (x < w2 && y < h2)
+ {
pixel2 = m_img2.getRGB(x, y);
+ }
else
+ {
bOutOfRange = true;
+ }
if (bOutOfRange || pixel1 != pixel2)
+ {
m_imgDiff.setRGB(x, y, m_diffColor);
+ }
else
+ {
m_imgDiff.setRGB(x, y, pixel1);
+ }
}
}
@@ -165,7 +179,9 @@ class ScreenComparer
for (index = 0; index < lenAr; index++)
{
if (pixels1[index] != pixels2[index])
+ {
break;
+ }
}
//If the images are different, then create the diff image
diff --git a/bean/qa/complex/WriterFrame.java b/bean/qa/complex/bean/WriterFrame.java
index b2aff726ad05..b4611fb30b1a 100644
--- a/bean/qa/complex/WriterFrame.java
+++ b/bean/qa/complex/bean/WriterFrame.java
@@ -24,67 +24,71 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex;
+package complex.bean;
-import complexlib.ComplexTestCase;
+// import com.sun.star.comp.beans.LocalOfficeConnection;
+import com.sun.star.uno.XComponentContext;
import java.awt.Rectangle;
import java.awt.Insets;
import java.awt.BorderLayout;
-import java.awt.event.*;
-import java.awt.Frame;
-import java.awt.Dimension;
import com.sun.star.comp.beans.OOoBean;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.text.XTextDocument;
+
class WriterFrame extends java.awt.Frame
{
com.sun.star.comp.beans.OOoBean m_bean;
- String m_sDocURL = "private:factory/swriter";
+ final static String m_sDocURL = "private:factory/swriter";
/**
@param loadBeforeVisible
the OOoBean is added to the frame before it is displayable. Then the Java Frame does
not have a native window peer yet.
*/
- public WriterFrame(int x, int y, int width, int height, boolean loadBeforeVisible) throws Exception
+ public WriterFrame(int x, int y, int width, int height, boolean loadBeforeVisible, XComponentContext _xConn) throws Exception
{
- if (loadBeforeVisible == false)
+ try
{
- m_bean = new com.sun.star.comp.beans.OOoBean();
- add(m_bean, BorderLayout.CENTER);
- pack();
- setBounds(x, y, width, height);
- setVisible(true);
- m_bean.loadFromURL(m_sDocURL, null);
- validate();
+ if (loadBeforeVisible == false)
+ {
+ m_bean = new com.sun.star.comp.beans.OOoBean(new PrivateLocalOfficeConnection(_xConn));
+ add(m_bean, BorderLayout.CENTER);
+ pack();
+ setBounds(x, y, width, height);
+ setVisible(true);
+ m_bean.loadFromURL(m_sDocURL, null);
+ validate();
+ }
+ else
+ {
+ m_bean = new com.sun.star.comp.beans.OOoBean(new PrivateLocalOfficeConnection(_xConn));
+ m_bean.loadFromURL(m_sDocURL, null);
+ add(m_bean, BorderLayout.CENTER);
+ pack();
+ setBounds(x, y, width, height);
+ setVisible(true);
+ m_bean.aquireSystemWindow();
+ }
}
- else
+ catch (Exception e)
{
- m_bean = new com.sun.star.comp.beans.OOoBean();
- m_bean.loadFromURL(m_sDocURL, null);
- add(m_bean, BorderLayout.CENTER);
- pack();
- setBounds(x, y, width, height);
- setVisible(true);
- m_bean.aquireSystemWindow();
+ System.out.println("Exception caught: " + e.getMessage());
}
}
public WriterFrame() throws Exception
{
- this(0, 0, 800, 400, false);
+ this(0, 0, 800, 400, false, null);
}
public void setText(String s) throws Exception
{
com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument();
com.sun.star.text.XTextDocument myDoc =
- (XTextDocument) UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class,
- model);
+ UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model);
com.sun.star.text.XText xText = myDoc.getText();
com.sun.star.text.XTextCursor xTCursor = xText.createTextCursor();
//inserting some Text
@@ -95,12 +99,12 @@ class WriterFrame extends java.awt.Frame
{
com.sun.star.frame.XModel model = (com.sun.star.frame.XModel)m_bean.getDocument();
com.sun.star.text.XTextDocument myDoc =
- (XTextDocument) UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class,
- model);
+ UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, model);
com.sun.star.text.XText xText = myDoc.getText();
return xText.getString();
}
+ @Override
public void dispose() {
m_bean.stopOOoConnection();
setVisible(false);
@@ -121,8 +125,7 @@ class WriterFrame extends java.awt.Frame
com.sun.star.frame.XController xController = xModel.getCurrentController();
com.sun.star.text.XTextViewCursorSupplier xVCSupplier =
- (com.sun.star.text.XTextViewCursorSupplier) UnoRuntime.queryInterface (
- com.sun.star.text.XTextViewCursorSupplier.class, xController );
+ UnoRuntime.queryInterface(com.sun.star.text.XTextViewCursorSupplier.class, xController);
com.sun.star.text.XTextViewCursor xTViewCursor = xVCSupplier.getViewCursor ( );
xTViewCursor.gotoStart(false);
@@ -135,12 +138,10 @@ class WriterFrame extends java.awt.Frame
com.sun.star.frame.XController xController = xModel.getCurrentController();
com.sun.star.text.XTextViewCursorSupplier xVCSupplier =
- (com.sun.star.text.XTextViewCursorSupplier) UnoRuntime.queryInterface (
- com.sun.star.text.XTextViewCursorSupplier.class, xController );
+ UnoRuntime.queryInterface(com.sun.star.text.XTextViewCursorSupplier.class, xController);
com.sun.star.text.XTextViewCursor xTViewCursor = xVCSupplier.getViewCursor ( );
com.sun.star.view.XScreenCursor xScreenCursor =
- (com.sun.star.view.XScreenCursor) UnoRuntime.queryInterface (
- com.sun.star.view.XScreenCursor.class, xTViewCursor );
+ UnoRuntime.queryInterface(com.sun.star.view.XScreenCursor.class, xTViewCursor);
xScreenCursor.screenDown();
}
diff --git a/bean/qa/complex/bean/makefile.mk b/bean/qa/complex/bean/makefile.mk
new file mode 100644
index 000000000000..257dd6df46ca
--- /dev/null
+++ b/bean/qa/complex/bean/makefile.mk
@@ -0,0 +1,138 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+ @echo "OOO_SUBSEQUENT_TESTS not set, do nothing."
+.ELSE
+
+PRJ = ../../..
+PRJNAME = bean
+TARGET = qa_complex_bean
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = complex/bean
+
+# here store only Files which contain a @Test
+JAVATESTFILES = \
+ OOoBeanTest.java
+
+# put here all other files
+JAVAFILES = $(JAVATESTFILES) \
+ ScreenComparer.java \
+ WriterFrame.java
+
+JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar officebean.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+
+# subdirectories
+# SUBDIRS = helper
+
+# Sample how to debug
+# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
+
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
+
+#
+#
+#
+#
+# PRJ := ..$/..
+# PRJNAME := bean
+# TARGET := test_bean
+# PACKAGE = complex
+#
+# .INCLUDE: settings.mk
+#
+# #----- compile .java files -----------------------------------------
+#
+# JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+# JAVAFILES = OOoBeanTest.java ScreenComparer.java WriterFrame.java
+# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+#
+# #----- make a jar from compiled files ------------------------------
+#
+# MAXLINELENGTH = 100000
+#
+# JARCLASSDIRS = $(PACKAGE)
+# JARTARGET = $(TARGET).jar
+# JARCOMPRESS = TRUE
+#
+# # --- Parameters for the test --------------------------------------
+#
+# # test base is java complex
+# CT_TESTBASE = -TestBase java_complex
+#
+# # test looks something like the.full.package.TestName
+# CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+#
+# # start the runner application
+# CT_APP = org.openoffice.Runner
+#
+# CT_NOOFFICE = -NoOffice
+#
+#
+# OFFICE_CLASSPATH_TMP:=$(foreach,i,$(JARFILES) $(office)$/program$/classes$/$(i)$(PATH_SEPERATOR))
+#
+# OFFICE_CLASSPATH=$(OFFICE_CLASSPATH_TMP:t"")$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSDIR)
+#
+# OOOBEAN_OPTIONS=-Dcom.sun.star.officebean.Options=-norestore -DOOoBean.Images=$(MISC)
+#
+#
+# .INCLUDE: target.mk
+#
+# ALLTAR : RUNINSTRUCTIONS
+#
+# # --- Targets ------------------------------------------------------
+#
+# #The OOoBean uses the classpath to find the office installation.
+# #Therefore we must use the jar files from the office.
+# RUN:
+# java -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST)
+# run: RUN
+#
+# rund:
+# java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8100 -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST)
+#
+#
+#
+# RUNINSTRUCTIONS :
+# @echo .
+# @echo ########################### N O T E ######################################
+# @echo .
+# @echo "To run the test you have to provide the office location."
+# @echo Example:
+# @echo dmake run office="d:/myOffice"
+# @echo .
+#
diff --git a/bean/qa/complex/makefile.mk b/bean/qa/complex/makefile.mk
deleted file mode 100644
index e7b88ce3400c..000000000000
--- a/bean/qa/complex/makefile.mk
+++ /dev/null
@@ -1,95 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org 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 Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ := ..$/..
-PRJNAME := bean
-TARGET := test_bean
-PACKAGE = complex
-
-.INCLUDE: settings.mk
-
-#----- compile .java files -----------------------------------------
-
-JARFILES = officebean.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
-JAVAFILES = OOoBeanTest.java ScreenComparer.java WriterFrame.java
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-#----- make a jar from compiled files ------------------------------
-
-MAXLINELENGTH = 100000
-
-JARCLASSDIRS = $(PACKAGE)
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-
-# --- Parameters for the test --------------------------------------
-
-# test base is java complex
-CT_TESTBASE = -TestBase java_complex
-
-# test looks something like the.full.package.TestName
-CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
-
-# start the runner application
-CT_APP = org.openoffice.Runner
-
-CT_NOOFFICE = -NoOffice
-
-
-OFFICE_CLASSPATH_TMP:=$(foreach,i,$(JARFILES) $(office)$/program$/classes$/$(i)$(PATH_SEPERATOR))
-
-OFFICE_CLASSPATH=$(OFFICE_CLASSPATH_TMP:t"")$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSDIR)
-
-OOOBEAN_OPTIONS=-Dcom.sun.star.officebean.Options=-norestore -DOOoBean.Images=$(MISC)
-
-
-.INCLUDE: target.mk
-
-ALLTAR : RUNINSTRUCTIONS
-
-# --- Targets ------------------------------------------------------
-
-#The OOoBean uses the classpath to find the office installation.
-#Therefore we must use the jar files from the office.
-RUN:
- java -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST)
-run: RUN
-
-rund:
- java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8100 -cp $(OFFICE_CLASSPATH) $(OOOBEAN_OPTIONS) $(CT_APP) $(CT_NOOFFICE) $(CT_TESTBASE) $(CT_TEST)
-
-
-
-RUNINSTRUCTIONS :
- @echo .
- @echo ########################### N O T E ######################################
- @echo .
- @echo "To run the test you have to provide the office location."
- @echo Example:
- @echo dmake run office="d:/myOffice"
- @echo .
-