diff options
Diffstat (limited to 'framework/qa/complex/imageManager')
9 files changed, 1005 insertions, 0 deletions
diff --git a/framework/qa/complex/imageManager/CheckImageManager.java b/framework/qa/complex/imageManager/CheckImageManager.java new file mode 100755 index 000000000000..8f283a034e20 --- /dev/null +++ b/framework/qa/complex/imageManager/CheckImageManager.java @@ -0,0 +1,197 @@ +package imageManager; + +import imageManager.interfaces._XComponent; +import imageManager.interfaces._XImageManager; +import imageManager.interfaces._XInitialization; +import imageManager.interfaces._XTypeProvider; +import imageManager.interfaces._XUIConfiguration; +import imageManager.interfaces._XUIConfigurationPersistence; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XIndexAccess; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XTypeProvider; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.ui.XImageManager; +import complexlib.ComplexTestCase; +import com.sun.star.ui.XModuleUIConfigurationManagerSupplier; +import com.sun.star.ui.XUIConfiguration; +import com.sun.star.ui.XUIConfigurationManager; +import com.sun.star.ui.XUIConfigurationPersistence; +import java.io.PrintWriter; +import share.LogWriter; + +/** + * + */ +public class CheckImageManager extends ComplexTestCase { + boolean checkUIConfigManager = false; + XMultiServiceFactory xMSF = null; + + public void before() { + xMSF = (XMultiServiceFactory)param.getMSF(); + } + + public String[] getTestMethodNames() { + return new String[]{"checkImageManagerFromModule"};//, "checkImageManager"}; + } + + public void checkImageManagerFromModule() { + log.println(" **** ImageManager from ModuleUIConfigurationManager *** "); + XUIConfigurationManager xManager = null; + try { + Object o = (XInterface)xMSF.createInstance( + "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); + XModuleUIConfigurationManagerSupplier xMUICMS = + (XModuleUIConfigurationManagerSupplier)UnoRuntime.queryInterface( + XModuleUIConfigurationManagerSupplier.class, o); + xManager = xMUICMS.getUIConfigurationManager( + "com.sun.star.text.TextDocument"); + } + catch(com.sun.star.uno.Exception e) { + e.printStackTrace((PrintWriter)log); + failed("Exception. " + e.getMessage()); + } + XImageManager xImageManager = (XImageManager)UnoRuntime.queryInterface( + XImageManager.class, xManager.getImageManager()); + performChecks(xImageManager, "ModuleUIConfig", xManager); + } + + public void checkImageManager() { + log.println(" **** ImageManager from UIConfigurationManager *** "); + XUIConfigurationManager xManager = null; + try { + xManager = (XUIConfigurationManager)UnoRuntime.queryInterface( + XUIConfigurationManager.class, xMSF.createInstance( + "com.sun.star.comp.framework.UIConfigurationManager")); + } + catch(com.sun.star.uno.Exception e) { + e.printStackTrace((PrintWriter)log); + failed("Exception. " + e.getMessage()); + } + + XImageManager xImageManager = (XImageManager)UnoRuntime.queryInterface( + XImageManager.class, xManager.getImageManager()); + performChecks(xImageManager, "UIConfig", xManager); + } + + private void performChecks(XImageManager xImageManager, String testObjectName, XUIConfigurationManager xManager) { + util.dbg.printInterfaces(xImageManager); + + OXUIConfigurationListenerImpl configListener = new OXUIConfigurationListenerImpl(log, xManager, xMSF); + param.put("XUIConfiguration.XUIConfigurationListenerImpl", configListener); + + XInitialization xInit = (XInitialization)UnoRuntime.queryInterface(XInitialization.class, xImageManager); + _XInitialization _xInit = new _XInitialization(log, param, xInit); + assure(testObjectName + "::XInitialization.initialize", _xInit._initialize(), true); + + // xImageManager is already there, just write a test ;-) + _XImageManager _xImage = new _XImageManager(log, param, xImageManager); + assure(testObjectName + "::XImageManager.getAllImageNames", _xImage._getAllImageNames(), true); + assure(testObjectName + "::XImageManager.getImages", _xImage._getImages(), true); + assure(testObjectName + "::XImageManager.hasImage", _xImage._hasImage(), true); + assure(testObjectName + "::XImageManager.insertImages", _xImage._insertImages(), true); + assure(testObjectName + "::XImageManager.removeImages", _xImage._removeImages(), true); + assure(testObjectName + "::XImageManager.replaceImages", _xImage._replaceImages(), true); + assure(testObjectName + "::XImageManager.reset", _xImage._reset(), true); + + XTypeProvider xType = (XTypeProvider)UnoRuntime.queryInterface(XTypeProvider.class, xImageManager); + _XTypeProvider _xType = new _XTypeProvider(log,param,xType); + assure(testObjectName + "::XTypeProvider.getImplementationId", _xType._getImplementationId(), true); + assure(testObjectName + "::XTypeProvider.getTypes", _xType._getTypes(), true); + + XUIConfiguration xUIConfig = (XUIConfiguration)UnoRuntime.queryInterface(XUIConfiguration.class, xImageManager); + _XUIConfiguration _xUIConfig = new _XUIConfiguration(log, param, xUIConfig); + _xUIConfig.before(); + assure(testObjectName + "::XUIConfig.addConfigurationListener", _xUIConfig._addConfigurationListener(), true); + assure(testObjectName + "::XUIConfig.removeConfigurationListener", _xUIConfig._removeConfigurationListener(), true); + + XUIConfigurationPersistence xUIConfigPersistence = (XUIConfigurationPersistence)UnoRuntime.queryInterface(XUIConfiguration.class, xImageManager); + _XUIConfigurationPersistence _xUIConfigPersistence = new _XUIConfigurationPersistence(log, param, xUIConfigPersistence); + _xUIConfigPersistence.before(); + assure(testObjectName + "::XUIConfigPersistence.isModified", _xUIConfigPersistence._isModified(), true); + assure(testObjectName + "::XUIConfigPersistence.isReadOnly", _xUIConfigPersistence._isReadOnly(), true); + assure(testObjectName + "::XUIConfigPersistence.reload", _xUIConfigPersistence._reload(), true); + assure(testObjectName + "::XUIConfigPersistence.store", _xUIConfigPersistence._store(), true); + assure(testObjectName + "::XUIConfigPersistence.storeToStorage", _xUIConfigPersistence._storeToStorage(), true); + + XComponent xComp = (XComponent)UnoRuntime.queryInterface(XComponent.class, xImageManager); + _XComponent _xComp = new _XComponent(log, param, xComp); + _xComp.before(); + assure(testObjectName + "::XComponent.addEventListener", _xComp._addEventListener(), true); + assure(testObjectName + "::XComponent.removeEventListener", _xComp._removeEventListener(), true); + assure(testObjectName + "::XComponent.dispose", _xComp._dispose(), true); + } + + + class OXUIConfigurationListenerImpl implements _XUIConfiguration.XUIConfigurationListenerImpl { + private boolean triggered = false; + private LogWriter log = null; + private XUIConfigurationManager xUIManager = null; + private XMultiServiceFactory xMSF = null; + + public OXUIConfigurationListenerImpl(LogWriter _log, XUIConfigurationManager xUIManager, XMultiServiceFactory xMSF) { + log = _log; + this.xUIManager = xUIManager; + this.xMSF = xMSF; + } + + public boolean actionWasTriggered() { + return triggered; + } + + public void disposing(com.sun.star.lang.EventObject eventObject) { + triggered = true; + } + + public void elementInserted(com.sun.star.ui.ConfigurationEvent configurationEvent) { + triggered = true; + } + + public void elementRemoved(com.sun.star.ui.ConfigurationEvent configurationEvent) { + triggered = true; + } + + public void elementReplaced(com.sun.star.ui.ConfigurationEvent configurationEvent) { + triggered = true; + } + + public void fireEvent() { + // remove for real action: + triggered = !triggered; +/* try { + XIndexAccess xMenuBarSettings = xUIManager.getSettings( + "private:resource/menubar/menubar", true); + + } + catch(com.sun.star.container.NoSuchElementException e) { + log.println("_XUIConfiguration.XUIConfigurationListenerImpl: Exception."); + e.printStackTrace((java.io.PrintWriter)log); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("_XUIConfiguration.XUIConfigurationListenerImpl: Exception."); + e.printStackTrace((java.io.PrintWriter)log); + } + catch(com.sun.star.lang.IllegalAccessException e) { + log.println("_XUIConfiguration.XUIConfigurationListenerImpl: Exception."); + e.printStackTrace((java.io.PrintWriter)log); + } + catch(com.sun.star.lang.IndexOutOfBoundsException e) { + log.println("_XUIConfiguration.XUIConfigurationListenerImpl: Exception."); + e.printStackTrace((java.io.PrintWriter)log); + } + catch(com.sun.star.lang.WrappedTargetException e) { + log.println("_XUIConfiguration.XUIConfigurationListenerImpl: Exception."); + e.printStackTrace((java.io.PrintWriter)log); + } */ + } + + public void reset() { + // remove comment for real function + //triggered = false; + } + + } +} diff --git a/framework/qa/complex/imageManager/interfaces/_XComponent.java b/framework/qa/complex/imageManager/interfaces/_XComponent.java new file mode 100755 index 000000000000..4e30848b28d2 --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/_XComponent.java @@ -0,0 +1,179 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package imageManager.interfaces; + +import com.sun.star.container.XNameContainer; +import share.LogWriter; + +import com.sun.star.frame.XDesktop; +import com.sun.star.lang.EventObject; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XEventListener; +import lib.TestParameters; + +/** +* Testing <code>com.sun.star.lang.XComponent</code> +* interface methods : +* <ul> +* <li><code> dispose()</code></li> +* <li><code> addEventListener()</code></li> +* <li><code> removeEventListener()</code></li> +* </ul> +* After this interface test object <b>must be recreated</b>. <p> +* Multithreaded test ability <b>not implemented</b> yet. +* @see com.sun.star.lang.XComponent +*/ +public class _XComponent { + + public static XComponent oObj = null; + private XNameContainer xContainer = null; + private XComponent altDispose = null; + TestParameters tEnv = null; + LogWriter log = null; + boolean listenerDisposed[] = new boolean[2]; + String[] Loutput = new String[2]; + + /** + * Listener which added but not removed, and its method must be called + * on <code>dispose</code> call. + */ + public class MyEventListener implements XEventListener { + int number = 0; + String message = null; + public MyEventListener(int number, String message) { + this.message = message; + this.number = number; + } + public void disposing ( EventObject oEvent ) { + Loutput[number] = Thread.currentThread() + " is DISPOSING " + message + this; + listenerDisposed[number] = true; + } + }; + + XEventListener listener1 = new MyEventListener(0, "EV1"); + XEventListener listener2 = new MyEventListener(1, "EV2"); + + public _XComponent(LogWriter log, TestParameters tEnv, XComponent oObj) { + this.log = log; + this.tEnv = tEnv; + this.oObj = oObj; + } + + /** + * For the cfgmgr2.OSetElement tests: dispose the owner element. + */ + public void before() { + // do not dispose this component, but parent instead + altDispose = (XComponent)tEnv.get("XComponent.DisposeThis"); + + } + + /** + * Adds two listeners. <p> + * Has OK status if then the first listener will receive an event + * on <code>dispose</code> method call. + */ + public boolean _addEventListener() { + + listenerDisposed[0] = false; + listenerDisposed[1] = false; + + oObj.addEventListener( listener1 ); + oObj.addEventListener( listener2 ); + + return true; + } // finished _addEventListener() + + /** + * Removes the second of two added listeners. <p> + * Method tests to be completed successfully : + * <ul> + * <li> <code>addEventListener</code> : method must add two listeners. </li> + * </ul> <p> + * Has OK status if no events will be sent to the second listener on + * <code>dispose</code> method call. + */ + public boolean _removeEventListener() { + if (disposed) return false; + // the second listener should not be called + oObj.removeEventListener( listener2 ); + log.println(Thread.currentThread() + " is removing EL " + listener2); + return true; + } // finished _removeEventListener() + + static boolean disposed = false; + + /** + * Disposes the object and then check appropriate listeners were + * called or not. <p> + * Method tests to be completed successfully : + * <ul> + * <li> <code>removeEventListener</code> : method must remove one of two + * listeners. </li> + * </ul> <p> + * Has OK status if liseter removed wasn't called and other listener + * was. + */ + public boolean _dispose() { + disposed = false; + + log.println( "begin dispose" + Thread.currentThread()); + XDesktop oDesk = (XDesktop) tEnv.get("Desktop"); + if (oDesk !=null) { + oDesk.terminate(); + } + else { + if (altDispose == null) + oObj.dispose(); + else + altDispose.dispose(); + } + + try { + Thread.sleep(500) ; + } catch (InterruptedException e) {} + if (Loutput[0]!=null) log.println(Loutput[0]); + if (Loutput[1]!=null) log.println(Loutput[1]); + log.println( "end dispose" + Thread.currentThread()); + disposed = true; + + // check that dispose() works OK. + return listenerDisposed[0] && !listenerDisposed[1]; + + } // finished _dispose() + + /** + * Forces object recreation. + */ + protected void after() { +// disposeEnvironment(); + } + +} // finished class _XComponent + + diff --git a/framework/qa/complex/imageManager/interfaces/_XImageManager.java b/framework/qa/complex/imageManager/interfaces/_XImageManager.java new file mode 100755 index 000000000000..ccba1464c106 --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/_XImageManager.java @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +package imageManager.interfaces; + +import com.sun.star.graphic.XGraphic; +import com.sun.star.ui.ImageType; +import com.sun.star.ui.XImageManager; +import lib.TestParameters; +import share.LogWriter; + +/** + * + */ +public class _XImageManager { + LogWriter log = null; + TestParameters tEnv = null; + String[]imageNames = null; + XGraphic[] xGraphicArray = null; + public XImageManager oObj; + + public _XImageManager(LogWriter log, TestParameters tEnv, XImageManager oObj) { + this.log = log; + this.tEnv = tEnv; + this.oObj = oObj; + } + + public boolean _getAllImageNames() { + short s = ImageType.COLOR_NORMAL + ImageType.SIZE_DEFAULT; + imageNames = oObj.getAllImageNames(s); + for (int i=0; i<(imageNames.length>10?10:imageNames.length); i++) + System.out.println("###### Image: " + imageNames[i]); + return imageNames != null; + } + + public boolean _getImages() { + short s = ImageType.COLOR_NORMAL + ImageType.SIZE_DEFAULT; + try { + xGraphicArray = oObj.getImages(s, imageNames); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + } + return xGraphicArray != null; + } + + public boolean _hasImage() { + boolean result = true; + short s = ImageType.COLOR_NORMAL + ImageType.SIZE_DEFAULT; + try { // check the first image names, 10 at max + for (int i=0; i<(imageNames.length>10?10:imageNames.length); i++) + result &= oObj.hasImage(s, imageNames[i]); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + e.printStackTrace((java.io.PrintWriter)log); + result = false; + } + return result; + } + + public boolean _insertImages() { + try { + oObj.insertImages((short)imageNames.length, imageNames, xGraphicArray); + } + catch(com.sun.star.container.ElementExistException e) { + } + catch(com.sun.star.lang.IllegalArgumentException e) { + } + catch(com.sun.star.lang.IllegalAccessException e) { + } + return true; + } + + public boolean _removeImages() { + try { + oObj.removeImages((short)(imageNames.length-1), imageNames); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + } + catch(com.sun.star.lang.IllegalAccessException e) { + } + return true; + } + + public boolean _replaceImages() { + return true; + } + + public boolean _reset() { + return true; + } +} diff --git a/framework/qa/complex/imageManager/interfaces/_XInitialization.java b/framework/qa/complex/imageManager/interfaces/_XInitialization.java new file mode 100755 index 000000000000..da957331671b --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/_XInitialization.java @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package imageManager.interfaces; + +import share.LogWriter; + + +import com.sun.star.lang.XInitialization; +import lib.TestParameters; + +/** +* Testing <code>com.sun.star.lang.XInitialization</code> +* interface methods. <p> +* This test needs the following object relations : +* <ul> +* <li> <code>'XInitialization.args'</code> (of type <code>Object[]</code>): +* (<b>Optional</b>) : argument for <code>initialize</code> +* method. If ommitet zero length array is used. </li> +* <ul> <p> +* Test is multithread compilant. <p> +* Till the present time there was no need to recreate environment +* after this test completion. +*/ +public class _XInitialization { + + LogWriter log = null; + TestParameters tEnv = null; + public static XInitialization oObj = null; + + public _XInitialization(LogWriter log, TestParameters tEnv, XInitialization oObj) { + this.log = log; + this.tEnv = tEnv; + this.oObj = oObj; + } + + /** + * Test calls the method with 0 length array and checks that + * no exceptions were thrown. <p> + * Has <b> OK </b> status if no exceptions were thrown. <p> + */ + public boolean _initialize() { + boolean result = true ; + + try { + Object[] args = (Object[]) tEnv.get("XInitialization.args"); + if (args==null) { + oObj.initialize(new Object[0]); + } else { + oObj.initialize(args); + } + + } catch (com.sun.star.uno.Exception e) { + log.println("Exception occured while method calling.") ; + e.printStackTrace((java.io.PrintWriter)log) ; + result = false ; + } + + return result ; + } // finished _initialize() + + /** + * Disposes object environment. + */ + public void after() { +// disposeEnvironment() ; + } + +} // finished class _XInitialization + + diff --git a/framework/qa/complex/imageManager/interfaces/_XTypeProvider.java b/framework/qa/complex/imageManager/interfaces/_XTypeProvider.java new file mode 100755 index 000000000000..7ea641ca63d5 --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/_XTypeProvider.java @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package imageManager.interfaces; + +import share.LogWriter; + + +import com.sun.star.lang.XTypeProvider; +import com.sun.star.uno.Type; +import lib.TestParameters; + +/** +* Testing <code>com.sun.star.lang.XTypeProvider</code> +* interface methods : +* <ul> +* <li><code> getTypes()</code></li> +* <li><code> getImplementationId()</code></li> +* </ul> <p> +* Test is <b> NOT </b> multithread compilant. <p> +* @see com.sun.star.lang.XTypeProvider +*/ +public class _XTypeProvider { + + LogWriter log = null; + TestParameters tEnv = null; + public static XTypeProvider oObj = null; + public static Type[] types = null; + + public _XTypeProvider(LogWriter log, TestParameters tEnv, XTypeProvider oObj) { + this.log = log; + this.tEnv = tEnv; + this.oObj = oObj; + } + + /** + * Just calls the method.<p> + * Has <b>OK</b> status if no runtime exceptions occured. + */ + public boolean _getImplementationId() { + boolean result = true; + log.println("testing getImplementationId() ... "); + + log.println("The ImplementationId is "+oObj.getImplementationId()); + result = true; + + return result; + + } // end getImplementationId() + + + /** + * Ņalls the method and checks the return value.<p> + * Has <b>OK</b> status if one of the return value equals to the + * type <code>com.sun.star.lang.XTypeProvider</code>. + */ + public boolean _getTypes() { + boolean result = false; + log.println("getting Types..."); + types = oObj.getTypes(); + for (int i=0;i<types.length;i++) { + int k = i+1; + log.println(k+". Type is "+types[i].toString()); + if (types[i].toString().equals + ("Type[com.sun.star.lang.XTypeProvider]")) { + result = true; + } + } + if (!result) { + log.println("Component must provide Type " + +"<com.sun.star.lang.XTypeProvider>"); + } + + return result; + + } // end getTypes() + +} + diff --git a/framework/qa/complex/imageManager/interfaces/_XUIConfiguration.java b/framework/qa/complex/imageManager/interfaces/_XUIConfiguration.java new file mode 100755 index 000000000000..a1e9e75cabd3 --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/_XUIConfiguration.java @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package imageManager.interfaces; + +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.ui.XModuleUIConfigurationManagerSupplier; +import com.sun.star.ui.XUIConfiguration; +import com.sun.star.ui.XUIConfigurationListener; +import lib.TestParameters; +import share.LogWriter; + + +public class _XUIConfiguration { + + LogWriter log = null; + TestParameters tEnv = null; + public XUIConfiguration oObj; + XUIConfigurationListenerImpl xListener = null; + + public static interface XUIConfigurationListenerImpl + extends XUIConfigurationListener { + public void reset(); + public void fireEvent(); + public boolean actionWasTriggered(); + } + + + public _XUIConfiguration(LogWriter log, TestParameters tEnv, XUIConfiguration oObj) { + this.log = log; + this.tEnv = tEnv; + this.oObj = oObj; + } + + public void before() { + xListener = (XUIConfigurationListenerImpl)tEnv.get( + "XUIConfiguration.XUIConfigurationListenerImpl"); + XUIConfigurationListener l; + } + + public boolean _addConfigurationListener() { + oObj.addConfigurationListener(xListener); + xListener.fireEvent(); + return xListener.actionWasTriggered(); + } + + public boolean _removeConfigurationListener() { + oObj.removeConfigurationListener(xListener); + xListener.reset(); + xListener.fireEvent(); + return !xListener.actionWasTriggered(); + } + + /** + * Dispose because the UIConfigurationManager has to be recreated + */ + public void after() { +// disposeEnvironment(); + } +} diff --git a/framework/qa/complex/imageManager/interfaces/_XUIConfigurationPersistence.java b/framework/qa/complex/imageManager/interfaces/_XUIConfigurationPersistence.java new file mode 100755 index 000000000000..0e029deb4204 --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/_XUIConfigurationPersistence.java @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package imageManager.interfaces; + +import com.sun.star.embed.XStorage; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.ui.XModuleUIConfigurationManagerSupplier; +import com.sun.star.ui.XUIConfigurationPersistence; +import lib.TestParameters; +import share.LogWriter; + + +public class _XUIConfigurationPersistence { + + LogWriter log = null; + TestParameters tEnv = null; + public XUIConfigurationPersistence oObj; + private XStorage xStore = null; + + public _XUIConfigurationPersistence(LogWriter log, TestParameters tEnv, XUIConfigurationPersistence oObj) { + this.log = log; + this.tEnv = tEnv; + this.oObj = oObj; + } + + public void before() { + xStore = (XStorage)tEnv.get("XUIConfigurationStorage.Storage"); + } + + public boolean _reload() { + try { + oObj.reload(); + } + catch(com.sun.star.uno.Exception e) { + e.printStackTrace((java.io.PrintWriter)log); + } + return true; + } + + public boolean _store() { + try { + oObj.store(); + } + catch(com.sun.star.uno.Exception e) { + e.printStackTrace((java.io.PrintWriter)log); + } + return true; + } + + public boolean _storeToStorage() { + boolean result = true; + try { + oObj.storeToStorage(xStore); + } + catch(com.sun.star.uno.Exception e) { + result = false; + e.printStackTrace((java.io.PrintWriter)log); + } + return result; + } + + public boolean _isModified() { + return !oObj.isModified(); + } + + public boolean _isReadOnly() { + return !oObj.isReadOnly(); + } + +} diff --git a/framework/qa/complex/imageManager/interfaces/makefile.mk b/framework/qa/complex/imageManager/interfaces/makefile.mk new file mode 100755 index 000000000000..039eba576069 --- /dev/null +++ b/framework/qa/complex/imageManager/interfaces/makefile.mk @@ -0,0 +1,57 @@ +#************************************************************************* +# +# 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 = ..$/..$/..$/.. +TARGET = ImageManager +PRJNAME = framework +PACKAGE = imageManager$/interfaces + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + + +#----- compile .java files ----------------------------------------- + +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JAVAFILES = _XComponent.java _XUIConfiguration.java _XImageManager.java \ + _XUIConfigurationPersistence.java _XInitialization.java _XTypeProvider.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 + + diff --git a/framework/qa/complex/imageManager/makefile.mk b/framework/qa/complex/imageManager/makefile.mk new file mode 100755 index 000000000000..3b508b718d31 --- /dev/null +++ b/framework/qa/complex/imageManager/makefile.mk @@ -0,0 +1,79 @@ +#************************************************************************* +# +# 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 = ..$/..$/.. +TARGET = ImageManager +PRJNAME = framework +PACKAGE = imageManager + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + + +#----- compile .java files ----------------------------------------- + +JARFILES = mysql.jar mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JAVAFILES = CheckImageManager.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 -------------------------------------- + +# 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 + +# replace $/ with . in package name +CT_PACKAGE = -o $(PACKAGE:s\$/\.\) + +# start the runner application +CT_APP = org.openoffice.Runner + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +RUN: run + +run: + +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).CheckImageManager + + |