From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- qadevOOo/tests/java/ifc/lang/_ServiceManager.java | 51 ++++++ qadevOOo/tests/java/ifc/lang/_XComponent.java | 168 ++++++++++++++++++ qadevOOo/tests/java/ifc/lang/_XEventListener.java | 53 ++++++ qadevOOo/tests/java/ifc/lang/_XInitialization.java | 102 +++++++++++ qadevOOo/tests/java/ifc/lang/_XLocalizable.java | 63 +++++++ qadevOOo/tests/java/ifc/lang/_XMain.java | 63 +++++++ .../java/ifc/lang/_XMultiComponentFactory.java | 122 +++++++++++++ .../tests/java/ifc/lang/_XMultiServiceFactory.java | 188 +++++++++++++++++++++ .../tests/java/ifc/lang/_XServiceDisplayName.java | 50 ++++++ qadevOOo/tests/java/ifc/lang/_XServiceInfo.java | 88 ++++++++++ .../java/ifc/lang/_XSingleServiceFactory.java | 160 ++++++++++++++++++ qadevOOo/tests/java/ifc/lang/_XTypeProvider.java | 82 +++++++++ 12 files changed, 1190 insertions(+) create mode 100644 qadevOOo/tests/java/ifc/lang/_ServiceManager.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XComponent.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XEventListener.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XInitialization.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XLocalizable.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XMain.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XMultiComponentFactory.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XMultiServiceFactory.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XServiceDisplayName.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XServiceInfo.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XSingleServiceFactory.java create mode 100644 qadevOOo/tests/java/ifc/lang/_XTypeProvider.java (limited to 'qadevOOo/tests/java/ifc/lang') diff --git a/qadevOOo/tests/java/ifc/lang/_ServiceManager.java b/qadevOOo/tests/java/ifc/lang/_ServiceManager.java new file mode 100644 index 000000000..6ccf2b06e --- /dev/null +++ b/qadevOOo/tests/java/ifc/lang/_ServiceManager.java @@ -0,0 +1,51 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.lang; + +import lib.MultiPropertyTest; + +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; +import com.sun.star.uno.XComponentContext; + +public class _ServiceManager extends MultiPropertyTest { + + public void _DefaultContext() { + XComponentContext get = null; + boolean res = false; + try { + get = (XComponentContext)AnyConverter.toObject(new Type(XComponentContext.class), oObj.getPropertyValue("DefaultContext")); + res = get != null; + } catch (com.sun.star.lang.IllegalArgumentException iae) { + log.println("Illegal Argument Exception"); + res = false; + } catch (com.sun.star.beans.UnknownPropertyException upe) { + log.println("Property is optional and not supported"); + res = true; + } catch (com.sun.star.lang.WrappedTargetException wte) { + log.println("Unexpected Exception"); + wte.printStackTrace(log); + res = false; + } + tRes.tested("DefaultContext", res); + + } + +} // EOF _ServiceManager + diff --git a/qadevOOo/tests/java/ifc/lang/_XComponent.java b/qadevOOo/tests/java/ifc/lang/_XComponent.java new file mode 100644 index 000000000..b1c8399f6 --- /dev/null +++ b/qadevOOo/tests/java/ifc/lang/_XComponent.java @@ -0,0 +1,168 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.lang; + +import lib.MultiMethodTest; + +import com.sun.star.frame.XDesktop; +import com.sun.star.lang.EventObject; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XEventListener; + +/** +* Testing com.sun.star.lang.XComponent +* interface methods : +* +* After this interface test object must be recreated.

+* Multithreaded test ability not implemented yet. +* @see com.sun.star.lang.XComponent +*/ +public class _XComponent extends MultiMethodTest { + + public static XComponent oObj = null; + private XComponent altDispose = null; + + boolean listenerDisposed[] = new boolean[2]; + String[] Loutput = new String[2]; + + /** + * Listener which added but not removed, and its method must be called + * on dispose call. + */ + public class MyEventListener implements XEventListener { + public void disposing ( EventObject oEvent ) { + Loutput[0] = Thread.currentThread() + " is DISPOSING EV1" + this; + listenerDisposed[0] = true; + } + } + + /** + * Listener which added and then removed, and its method must not + * be called on dispose call. + */ + public class MyEventListener2 implements XEventListener { + public void disposing ( EventObject oEvent ) { + Loutput[0] = Thread.currentThread() + " is DISPOSING EV2" + this; + listenerDisposed[1] = true; + } + } + + XEventListener listener1 = new MyEventListener(); + XEventListener listener2 = new MyEventListener2(); + + /** + * For the (no longer existing) cfgmgr2.OSetElement tests: dispose the owner + * element. TODO: Is this needed for anything else, too, or should it be + * removed? + */ + @Override + protected void before() { + // do not dispose this component, but parent instead + altDispose = (XComponent)tEnv.getObjRelation("XComponent.DisposeThis"); + + } + + /** + * Adds two listeners.

+ * Has OK status if then the first listener will receive an event + * on dispose method call. + */ + public void _addEventListener() { + + listenerDisposed[0] = false; + listenerDisposed[1] = false; + + oObj.addEventListener( listener1 ); + oObj.addEventListener( listener2 ); + } // finished _addEventListener() + + /** + * Removes the second of two added listeners.

+ * Method tests to be completed successfully : + *

+ * Has OK status if no events will be sent to the second listener on + * dispose method call. + */ + public void _removeEventListener() { + executeMethod("addEventListener()"); + if (disposed) return; + // the second listener should not be called + oObj.removeEventListener( listener2 ); + log.println(Thread.currentThread() + " is removing EL " + listener2); + } // finished _removeEventListener() + + boolean disposed = false; + + /** + * Disposes the object and then check appropriate listeners were + * called or not.

+ * Method tests to be completed successfully : + *

+ * Has OK status if liseter removed wasn't called and other listener + * was. + */ + public void _dispose() { + disposed = false; + executeMethod("removeEventListener()"); + + log.println( "begin dispose in thread " + Thread.currentThread()); + XDesktop oDesk = (XDesktop) tEnv.getObjRelation("Desktop"); + if (oDesk !=null) { + oDesk.terminate(); + } + else { + if (altDispose == null) + oObj.dispose(); + else + altDispose.dispose(); + } + + util.utils.shortWait(); + 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. + tRes.tested("addEventListener()", listenerDisposed[0]); + tRes.tested("removeEventListener()", !listenerDisposed[1]); + tRes.tested("dispose()", listenerDisposed[0] && !listenerDisposed[1]); + + } // finished _dispose() + + /** + * Forces object recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} // finished class _XComponent + + diff --git a/qadevOOo/tests/java/ifc/lang/_XEventListener.java b/qadevOOo/tests/java/ifc/lang/_XEventListener.java new file mode 100644 index 000000000..2401e7d24 --- /dev/null +++ b/qadevOOo/tests/java/ifc/lang/_XEventListener.java @@ -0,0 +1,53 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.lang; + +import lib.MultiMethodTest; + +import com.sun.star.lang.XEventListener; + +/** +* Testing com.sun.star.lang.XEventListener +* interface methods : +*

+* Tests nothing, all methods has OK status. +* @see com.sun.star.lang.XEventListener +*/ +public class _XEventListener extends MultiMethodTest { + + public XEventListener oObj = null; + + /** + * Nothing to test. Always has OK status. + */ + public void _disposing() { + log.println("The method 'disposing'"); + log.println("gets called when the broadcaster is about to be"+ + " disposed.") ; + log.println("All listeners and all other objects which reference "+ + "the broadcaster should release the references."); + log.println("So there is nothing to test here"); + tRes.tested("disposing()",true); + + } + +} //EOF of XEventListener + diff --git a/qadevOOo/tests/java/ifc/lang/_XInitialization.java b/qadevOOo/tests/java/ifc/lang/_XInitialization.java new file mode 100644 index 000000000..5566aef0c --- /dev/null +++ b/qadevOOo/tests/java/ifc/lang/_XInitialization.java @@ -0,0 +1,102 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.lang; + +import lib.MultiMethodTest; + +import com.sun.star.lang.XInitialization; + +/** +* Testing com.sun.star.lang.XInitialization +* interface methods.

+* This test needs the following object relations : +*