diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-06-14 14:48:44 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-06-14 14:48:44 +0000 |
commit | 27616c7f6ea2ed3ea924d157ef3bf1d9556859df (patch) | |
tree | bc275cbc937c2916d351a934f05e412f7e2405e8 /qadevOOo/tests/java/mod/_fwl | |
parent | 585f37e26201e6cb56fcad82e276d8e45dfdbe0a (diff) |
INTEGRATION: CWS qadev23 (1.3.80); FILE MERGED
2005/05/26 18:31:17 cn 1.3.80.1: #i49934# implement functionality to restore the path settings
Diffstat (limited to 'qadevOOo/tests/java/mod/_fwl')
-rw-r--r-- | qadevOOo/tests/java/mod/_fwl/PathSettings.java | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/qadevOOo/tests/java/mod/_fwl/PathSettings.java b/qadevOOo/tests/java/mod/_fwl/PathSettings.java index 02e49373a97a..c10911599314 100644 --- a/qadevOOo/tests/java/mod/_fwl/PathSettings.java +++ b/qadevOOo/tests/java/mod/_fwl/PathSettings.java @@ -2,9 +2,9 @@ * * $RCSfile: PathSettings.java,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change:$Date: 2003-09-08 11:54:24 $ + * last change:$Date: 2005-06-14 15:48:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,6 +61,14 @@ package mod._fwl; +import com.sun.star.beans.NamedValue; +import com.sun.star.beans.Property; +import com.sun.star.beans.PropertyVetoException; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertySetInfo; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.WrappedTargetException; +import com.sun.star.uno.UnoRuntime; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; @@ -98,6 +106,29 @@ import com.sun.star.uno.XInterface; */ public class PathSettings extends TestCase { + private static NamedValue[] m_Properties; + private static XPropertySet xPS; + + /** + * restores the old values of the path settings + * @param tParam the test parameter + * @param log the log writer + */ + protected void cleanup(TestParameters tParam, PrintWriter log) { + log.println("restore old values of path settings..."); + + for (int i=0; i < m_Properties.length; i++){ + try{ + + xPS.setPropertyValue(m_Properties[i].Name, m_Properties[i].Value); + + } catch (com.sun.star.beans.UnknownPropertyException e){ + } catch (PropertyVetoException e){ + } catch (IllegalArgumentException e){ + } catch (WrappedTargetException e){ + } + } + } /** * Creating a Testenvironment for the interfaces to be tested. * Creates an instance of the service @@ -134,8 +165,31 @@ public class PathSettings extends TestCase { tEnv.addObjRelation("XFastPropertySet.ExcludeProps", exclProps); tEnv.addObjRelation("XMultiPropertySet.ExcludeProps", exclProps); + saveAllPropertyValues(oObj); + return tEnv; } // finish method getTestEnvironment + private void saveAllPropertyValues(XInterface oObj){ + + xPS = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, oObj); + + XPropertySetInfo xPSI = xPS.getPropertySetInfo(); + + Property[] allProperties = xPSI.getProperties(); + m_Properties = new NamedValue[allProperties.length]; + + for (int i=0; i < allProperties.length; i++){ + try{ + m_Properties[i] = new NamedValue(allProperties[i].Name, + xPS.getPropertyValue(allProperties[i].Name)); + + } catch (com.sun.star.beans.UnknownPropertyException e){ + } catch (WrappedTargetException e){ + } + } + } + } |