diff options
-rw-r--r-- | bean/com/sun/star/comp/beans/LocalOfficeConnection.java | 13 | ||||
-rw-r--r-- | bean/com/sun/star/comp/beans/OOoBean.java | 11 | ||||
-rw-r--r-- | bean/prj/build.lst | 4 | ||||
-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.mk | 134 | ||||
-rw-r--r-- | bean/qa/complex/makefile.mk | 95 | ||||
-rw-r--r-- | extensions/prj/build.lst | 3 | ||||
-rw-r--r-- | extensions/qa/complex/extensions/OfficeResourceLoader.java | 84 | ||||
-rw-r--r-- | extensions/qa/complex/extensions/makefile.mk | 59 | ||||
-rw-r--r-- | forms/prj/build.lst | 1 | ||||
-rwxr-xr-x | forms/qa/complex/forms/CheckOGroupBoxModel.java | 203 | ||||
-rwxr-xr-x | forms/qa/complex/forms/makefile.mk | 115 | ||||
-rw-r--r-- | forms/qa/unoapi/forms.sce | 2 | ||||
-rw-r--r-- | forms/qa/unoapi/knownissues.xcl | 6 |
16 files changed, 699 insertions, 383 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..9a21e52ac916 --- /dev/null +++ b/bean/qa/complex/bean/makefile.mk @@ -0,0 +1,134 @@ +#************************************************************************* +# +# 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: +.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) + +# 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 . - diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst index 1489e2a4e0e4..e6a4e02a8096 100644 --- a/extensions/prj/build.lst +++ b/extensions/prj/build.lst @@ -34,3 +34,6 @@ ex extensions\source\update\feed nmake - all ex_updchkfeed ex ex extensions\source\update\check nmake - all ex_updchk ex_inc NULL ex extensions\source\update\ui nmake - all ex_updchkui ex_inc NULL ex extensions\util nmake - all ex_util ex_preload ex_abpilot ex_dbpilots ex_logging ex_ldap ex_propctrlr ex_bib ex_plutil ex_oooimprovecore NULL + +# Fails at the moment +# ex extensions\qa\complex\extensions nmake - all ex_complex ex_util NULL diff --git a/extensions/qa/complex/extensions/OfficeResourceLoader.java b/extensions/qa/complex/extensions/OfficeResourceLoader.java index d0b2f1db2db8..f28d04d3d438 100644 --- a/extensions/qa/complex/extensions/OfficeResourceLoader.java +++ b/extensions/qa/complex/extensions/OfficeResourceLoader.java @@ -26,6 +26,7 @@ ************************************************************************/ package complex.extensions; +import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.resource.XResourceBundle; @@ -34,7 +35,15 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.Locale; -public class OfficeResourceLoader extends complexlib.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 class OfficeResourceLoader { XResourceBundleLoader m_loader; XResourceBundle m_bundle; @@ -45,37 +54,36 @@ public class OfficeResourceLoader extends complexlib.ComplexTestCase } /* ------------------------------------------------------------------ */ - public String[] getTestMethodNames() - { - return new String[] { - "checkSimpleStringAccess", - "checkLocales" - }; - } +// public String[] getTestMethodNames() +// { +// return new String[] { +// "checkSimpleStringAccess", +// "checkLocales" +// }; +// } /* ------------------------------------------------------------------ */ - public String getTestObjectName() - { - return "Extensions - OfficeResourceLoader"; - } +// public String getTestObjectName() +// { +// return "Extensions - OfficeResourceLoader"; +// } /* ------------------------------------------------------------------ */ - public void before() throws com.sun.star.uno.Exception, java.lang.Exception + @Before public void before() throws com.sun.star.uno.Exception, java.lang.Exception { - XPropertySet orb = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, param.getMSF() ); - XComponentContext context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class, - orb.getPropertyValue( "DefaultContext" ) ); + XPropertySet orb = UnoRuntime.queryInterface(XPropertySet.class, getMSF()); + XComponentContext context = UnoRuntime.queryInterface(XComponentContext.class, orb.getPropertyValue("DefaultContext")); m_loader = com.sun.star.resource.OfficeResourceLoader.get( context ); } /* ------------------------------------------------------------------ */ - public void after() throws com.sun.star.uno.Exception, java.lang.Exception + @After public void after() throws com.sun.star.uno.Exception, java.lang.Exception { } /* ------------------------------------------------------------------ */ - public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception + @Test public void checkSimpleStringAccess() throws com.sun.star.uno.Exception, java.lang.Exception { // default bundle (UI locale) m_bundle = m_loader.loadBundle_Default( "orl" ); @@ -88,34 +96,62 @@ public class OfficeResourceLoader extends complexlib.ComplexTestCase && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ) - assure( "invalid 'en-US' string", testString.equals( "Dummy String" ) ); + { + assertTrue( "invalid 'en-US' string", testString.equals( "Dummy String" ) ); + } if ( resourceLocale.Language.equals( "de" ) && resourceLocale.Country.equals( "" ) && resourceLocale.Variant.equals( "" ) ) - assure( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) ); + { + assertTrue( "invalid 'de' string", testString.equals( "Attrappen-Zeichenkette" ) ); + } if ( resourceLocale.Language.equals( "" ) && resourceLocale.Country.equals( "" ) && resourceLocale.Variant.equals( "" ) ) - assure( "invalid unlocalized string", testString.equals( "unlocalized string" ) ); + { + assertTrue( "invalid unlocalized string", testString.equals( "unlocalized string" ) ); + } } /* ------------------------------------------------------------------ */ - public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception + @Test public void checkLocales() throws com.sun.star.uno.Exception, java.lang.Exception { // en-US bundle (should always be built and thus present and thus found) m_bundle = m_loader.loadBundle( "orl", new Locale( "en", "US", "" ) ); Locale resourceLocale = m_bundle.getLocale(); - assure( "'en-US' could not be loaded", + assertTrue( "'en-US' could not be loaded", resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); // some (invalid) locale which is usually no built, and should thus fallback to en-US m_bundle = m_loader.loadBundle( "orl", new Locale( "inv", "al", "id" ) ); resourceLocale = m_bundle.getLocale(); - assure( "non-existing locale request does not fallback to en-US", + assertTrue( "non-existing locale request does not fallback to en-US", resourceLocale.Language.equals( "en" ) && resourceLocale.Country.equals( "US" ) && resourceLocale.Variant.equals( "" ) ); } + + + 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/extensions/qa/complex/extensions/makefile.mk b/extensions/qa/complex/extensions/makefile.mk index 96c2afb40bf3..281960b32da9 100644 --- a/extensions/qa/complex/extensions/makefile.mk +++ b/extensions/qa/complex/extensions/makefile.mk @@ -25,12 +25,26 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = ExtensionsComplexTests +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + +PRJ = ../../.. PRJNAME = extensions -PACKAGE = complex$/$(PRJNAME) +TARGET = qa_complex_extensions + +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/extensions +JAVATESTFILES = \ + OfficeResourceLoader.java + +JAVAFILES = $(JAVATESTFILES) + +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar ConnectivityTools.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END + -RES_TARGET = orl .IF "$(GUI)"=="WNT" command_seperator=&& @@ -38,11 +52,11 @@ command_seperator=&& command_seperator=; .ENDIF -# --- Settings ----------------------------------------------------- -.INCLUDE : settings.mk +.INCLUDE: settings.mk #----- resource files for the OfficeResourceLoader test ------------ +RES_TARGET = orl SRS1NAME=$(RES_TARGET)_A_ SRC1FILES= \ @@ -66,36 +80,19 @@ RES2FILELIST=\ RESLIB2NAME=$(RES_TARGET)_B_ RESLIB2SRSFILES=$(RES2FILELIST) +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -#----- compile .java files ----------------------------------------- -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar ConnectivityTools.jar -JAVAFILES = $(shell @$(FIND) .$/*.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 - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk +#----- resource files for the OfficeResourceLoader test ------------ -RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar$(PATH_SEPERATOR)$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/ConnectivityTools.jar -RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex -run:copy_resources - +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce extensions_all.sce +ALLTAR : copy_resources javatest -run_%:copy_resources - +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//) +copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN) + $(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo + $(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo -copy_resources: $(RESLIB1TARGETN) $(RESLIB2TARGETN) - @$(foreach,i,$(RESLIB1TARGETN) $(COPY) $i $(i:s/de/invalid/:s/_A_//) $(command_seperator)) echo. - @$(foreach,i,$(RESLIB2TARGETN) $(COPY) $i $(i:s/en-US/invalid/:s/_B_//) $(command_seperator)) echo. +.END diff --git a/forms/prj/build.lst b/forms/prj/build.lst index cc71868b734d..2d7c5f49c7e5 100644 --- a/forms/prj/build.lst +++ b/forms/prj/build.lst @@ -16,3 +16,4 @@ fm forms\source\runtime nmake - all frm_runtime NULL fm forms\util nmake - all fm_util fm_component fm_solar_component fm_solar_control fm_helper fm_misc fm_resource fm_richtext frm_runtime fm_xforms NULL fm forms\qa nmake - all fm_qa NULL fm forms\qa\unoapi nmake - all fm_qa_unoapi NULL +fm forms\qa\complex\forms nmake - all fm_qa_complex NULL diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java index 8a2ae5c7f0e4..490a2ae695c5 100755 --- a/forms/qa/complex/forms/CheckOGroupBoxModel.java +++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java @@ -24,7 +24,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package complex.forms; import com.sun.star.beans.Property; @@ -37,88 +36,127 @@ import com.sun.star.drawing.XControlShape; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; -import java.io.PrintWriter; +// import complexlib.ComplexTestCase; +import com.sun.star.util.CloseVetoException; +import com.sun.star.util.XCloseable; import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; import util.FormTools; import util.SOfficeFactory; import util.ValueChanger; +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 class CheckOGroupBoxModel extends ComplexTestCase { - - private XMultiPropertySet xPropSet = null; - - public String[] getTestMethodNames() { - return new String[] {"setPropertyValues"}; - } - - public void before() { - XComponent xDrawDoc = null; - SOfficeFactory SOF = SOfficeFactory.getFactory(((XMultiServiceFactory) param.getMSF())); - - try { - log.println("creating a draw document"); - xDrawDoc = SOF.createDrawDoc(null); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace((PrintWriter)log); - failed("Couldn't create document."); +public class CheckOGroupBoxModel +{ + + private XMultiPropertySet m_xPropSet; + private XComponent m_xDrawDoc; + +// public String[] getTestMethodNames() { +// return new String[] {"setPropertyValues"}; +// } + @Before public void before() + { + // XComponent xDrawDoc = null; + SOfficeFactory SOF = SOfficeFactory.getFactory(getMSF()); + + try + { + System.out.println("creating a draw document"); + m_xDrawDoc = SOF.createDrawDoc(null); + } + catch (com.sun.star.uno.Exception e) + { + fail("Couldn't create document."); } String objName = "GroupBox"; - XControlShape shape = FormTools.insertControlShape(xDrawDoc, 5000, 7000, 2000, 2000, objName); - xPropSet = (XMultiPropertySet)UnoRuntime.queryInterface(XMultiPropertySet.class, shape.getControl()); + XControlShape shape = FormTools.insertControlShape(m_xDrawDoc, 5000, 7000, 2000, 2000, objName); + m_xPropSet = UnoRuntime.queryInterface(XMultiPropertySet.class, shape.getControl()); } - - public void setPropertyValues() { + @After public void after() + { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, m_xDrawDoc); + if (xClose != null) + { + try + { + xClose.close(true); + } + catch (CloseVetoException ex) + { + fail("Can't close document. Exception caught: " + ex.getMessage()); + /* ignore! */ + } + } + } + @Test public void setPropertyValues() + { String[] boundPropsToTest = getBoundPropsToTest(); MyChangeListener ml = new MyChangeListener(); - xPropSet.addPropertiesChangeListener(boundPropsToTest, ml); + m_xPropSet.addPropertiesChangeListener(boundPropsToTest, ml); - Object[] gValues = xPropSet.getPropertyValues(boundPropsToTest); + Object[] gValues = m_xPropSet.getPropertyValues(boundPropsToTest); Object[] newValue = new Object[gValues.length]; - log.println("Trying to change all properties."); - for (int i=0; i<boundPropsToTest.length; i++) { + System.out.println("Trying to change all properties."); + for (int i = 0; i < boundPropsToTest.length; i++) + { newValue[i] = ValueChanger.changePValue(gValues[i]); } - try { - xPropSet.setPropertyValues(boundPropsToTest, newValue); - } catch (com.sun.star.beans.PropertyVetoException e) { - e.printStackTrace((PrintWriter)log); - failed("Exception occured while trying to change the properties."); - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace((PrintWriter)log); - failed("Exception occured while trying to change the properties."); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace((PrintWriter)log); - failed("Exception occured while trying to change the properties."); + try + { + m_xPropSet.setPropertyValues(boundPropsToTest, newValue); + } + catch (com.sun.star.beans.PropertyVetoException e) + { + fail("Exception occured while trying to change the properties."); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + fail("Exception occured while trying to change the properties."); + } + catch (com.sun.star.lang.WrappedTargetException e) + { + fail("Exception occured while trying to change the properties."); } // end of try-catch - assure("Listener was not called.", ml.wasListenerCalled()); - xPropSet.removePropertiesChangeListener(ml); + assertTrue("Listener was not called.", ml.wasListenerCalled()); + m_xPropSet.removePropertiesChangeListener(ml); } - private String[] getBoundPropsToTest() { - Property[] properties = xPropSet.getPropertySetInfo().getProperties(); + private String[] getBoundPropsToTest() + { + Property[] properties = m_xPropSet.getPropertySetInfo().getProperties(); String[] testPropsNames = null; - Vector tNames = new Vector(); + Vector<String> tNames = new Vector<String>(); - for (int i = 0; i < properties.length; i++) { + for (int i = 0; i < properties.length; i++) + { Property property = properties[i]; String name = property.Name; - boolean isWritable = ((property.Attributes & - PropertyAttribute.READONLY) == 0); - boolean isNotNull = ((property.Attributes & - PropertyAttribute.MAYBEVOID) == 0); - boolean isBound = ((property.Attributes & - PropertyAttribute.BOUND) != 0); - - if ( isWritable && isNotNull && isBound) { + boolean isWritable = ((property.Attributes + & PropertyAttribute.READONLY) == 0); + boolean isNotNull = ((property.Attributes + & PropertyAttribute.MAYBEVOID) == 0); + boolean isBound = ((property.Attributes + & PropertyAttribute.BOUND) != 0); + + if (isWritable && isNotNull && isBound) + { tNames.add(name); } @@ -126,22 +164,59 @@ public class CheckOGroupBoxModel extends ComplexTestCase { //get a array of bound properties testPropsNames = new String[tNames.size()]; - testPropsNames = (String[])tNames.toArray(testPropsNames); + testPropsNames = tNames.toArray(testPropsNames); return testPropsNames; } /** - * Listener implementation which sets a flag when - * listener was called. - */ - public class MyChangeListener implements XPropertiesChangeListener { + * Listener implementation which sets a flag when + * listener was called. + */ + public class MyChangeListener implements XPropertiesChangeListener + { + boolean propertiesChanged = false; - public void propertiesChange(PropertyChangeEvent[] e) { - propertiesChanged = true; + + public void propertiesChange(PropertyChangeEvent[] e) + { + propertiesChanged = true; + } + + public void disposing(EventObject obj) + { + } + + public boolean wasListenerCalled() + { + return propertiesChanged; + } + + public void reset() + { + propertiesChanged = false; } - public void disposing (EventObject obj) {} - public boolean wasListenerCalled() { return propertiesChanged; } - public void reset() { propertiesChanged = false; } }; + 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/forms/qa/complex/forms/makefile.mk b/forms/qa/complex/forms/makefile.mk index 6caf244cddc1..c5895b708fb1 100755 --- a/forms/qa/complex/forms/makefile.mk +++ b/forms/qa/complex/forms/makefile.mk @@ -25,54 +25,93 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = CheckOGroupBoxModel -PRJNAME = $(TARGET) -PACKAGE = complex$/forms - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar -JAVAFILES = CheckOGroupBoxModel.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +PRJ = ../../.. +PRJNAME = forms +TARGET = qa_complex_forms -#----- make a jar from compiled files ------------------------------ +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/forms -MAXLINELENGTH = 100000 +# here store only Files which contain a @Test +JAVATESTFILES = \ + CheckOGroupBoxModel.java -JARCLASSDIRS = $(PACKAGE) +# put here all other files +JAVAFILES = $(JAVATESTFILES) -# --- Parameters for the test -------------------------------------- -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# test base is java complex -CT_TESTBASE = -TestBase java_complex +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -# build up package name with "." instead of $/ -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +.END -# start the runner application -CT_APP = org.openoffice.Runner +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk -# --- Targets ------------------------------------------------------ +ALLTAR : javatest -.IF "$(depend)" == "" -run : ALLTAR -.ELSE -run : ALLDEP -.ENDIF +.END -.INCLUDE : target.mk -run: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).$(JAVAFILES:b) +# +# +# +# PRJ = ..$/..$/.. +# TARGET = CheckOGroupBoxModel +# PRJNAME = $(TARGET) +# PACKAGE = complex$/forms +# +# # --- Settings ----------------------------------------------------- +# .INCLUDE: settings.mk +# +# +# #----- compile .java files ----------------------------------------- +# +# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar +# JAVAFILES = CheckOGroupBoxModel.java +# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +# +# #----- make a jar from compiled files ------------------------------ +# +# MAXLINELENGTH = 100000 +# +# JARCLASSDIRS = $(PACKAGE) +# +# # --- Parameters for the test -------------------------------------- +# +# # start an office if the parameter is set for the makefile +# .IF "$(OFFICE)" == "" +# CT_APPEXECCOMMAND = +# .ELSE +# CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" +# .ENDIF +# +# # test base is java complex +# CT_TESTBASE = -TestBase java_complex +# +# # build up package name with "." instead of $/ +# CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +# +# # start the runner application +# CT_APP = org.openoffice.Runner +# +# # --- Targets ------------------------------------------------------ +# +# .IF "$(depend)" == "" +# run : ALLTAR +# .ELSE +# run : ALLDEP +# .ENDIF +# +# .INCLUDE : target.mk +# +# run: +# +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).$(JAVAFILES:b) diff --git a/forms/qa/unoapi/forms.sce b/forms/qa/unoapi/forms.sce index 073472f03126..8ac840e7ca1e 100644 --- a/forms/qa/unoapi/forms.sce +++ b/forms/qa/unoapi/forms.sce @@ -24,7 +24,7 @@ -o forms.OImageButtonModel -o forms.OImageControlControl -o forms.OImageControlModel --o forms.OListBoxControl +#i114669 -o forms.OListBoxControl -o forms.OListBoxModel -o forms.ONavigationBarControl -o forms.ONavigationBarModel diff --git a/forms/qa/unoapi/knownissues.xcl b/forms/qa/unoapi/knownissues.xcl index 2e10a269c681..eb8efe91b4f0 100644 --- a/forms/qa/unoapi/knownissues.xcl +++ b/forms/qa/unoapi/knownissues.xcl @@ -125,5 +125,11 @@ forms.OFileControlModel::com::sun::star::form::FormControlModel forms.OImageControlModel::com::sun::star::beans::XMultiPropertySet forms.OImageControlModel::com::sun::star::beans::XPropertySet +### i113201 ### +forms.OEditModel::com::sun::star::form::validation::XValidatableFormComponent + +### i114209 ### +forms.OGridControlModel::com::sun::star::view::XSelectionSupplier + ### i111333 ### forms.OImageControlControl::com::sun::star::awt::XControl |