diff options
author | Stephan Wunderlich <sw@openoffice.org> | 2003-02-06 09:55:02 +0000 |
---|---|---|
committer | Stephan Wunderlich <sw@openoffice.org> | 2003-02-06 09:55:02 +0000 |
commit | a7a6fffdf4a74ed94e93e39b47029b3ebbf0fbb9 (patch) | |
tree | 5d03e608813b85831552fe5696c26297416151a3 | |
parent | 8405be3130680a504273131703886598fd4339a5 (diff) |
CHG: using AnyConverter instead of simple cast
-rw-r--r-- | qadevOOo/tests/java/mod/_svx/SvxDrawPage.java | 20 | ||||
-rw-r--r-- | qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java | 16 |
2 files changed, 25 insertions, 11 deletions
diff --git a/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java b/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java index ab4997c1ec30..f0e825e45f77 100644 --- a/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java +++ b/qadevOOo/tests/java/mod/_svx/SvxDrawPage.java @@ -2,9 +2,9 @@ * * $RCSfile: SvxDrawPage.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 18:18:10 $ + * last change:$Date: 2003-02-06 10:50:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,6 +80,9 @@ import util.InstCreator; import util.SOfficeFactory; import util.ShapeDsc; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + /** * Test for object which is represented by service * <code>com.sun.star.drawing.DrawPage</code>. <p> @@ -151,7 +154,7 @@ public class SvxDrawPage extends TestCase { */ protected void cleanup( TestParameters tParam, PrintWriter log ) { log.println( " disposing xSheetDoc " ); - //xDoc.dispose(); + ((XComponent) UnoRuntime.queryInterface(XComponent.class,xDoc)).dispose(); } @@ -173,9 +176,7 @@ public class SvxDrawPage extends TestCase { * <code>com.sun.star.drawing.Line</code> service </li> * </ul> */ - public TestEnvironment createTestEnvironment( TestParameters tParam, - PrintWriter log ) - throws StatusException { + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { XInterface oObj = null; XShape oShape = null ; @@ -193,7 +194,8 @@ public class SvxDrawPage extends TestCase { oDP = (XDrawPages) oDPS.getDrawPages(); oDP.insertNewByIndex(1); oDP.insertNewByIndex(2); - oObj = (XDrawPage) oDP.getByIndex(0); + oObj = (XDrawPage) AnyConverter.toObject( + new Type(XDrawPage.class),oDP.getByIndex(0)); SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF()); @@ -210,6 +212,10 @@ public class SvxDrawPage extends TestCase { log.println("Couldn't create insance"); e.printStackTrace(log); throw new StatusException("Can't create enviroment", e) ; + } catch (com.sun.star.lang.IllegalArgumentException e) { + log.println("Couldn't create insance"); + e.printStackTrace(log); + throw new StatusException("Can't create enviroment", e) ; } // create test environment here diff --git a/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java b/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java index 34e9154af09b..708835183299 100644 --- a/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java +++ b/qadevOOo/tests/java/mod/_sw/SwAccessibleFooterView.java @@ -2,9 +2,9 @@ * * $RCSfile: SwAccessibleFooterView.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Date: 2003-01-27 18:18:45 $ + * last change: $Date: 2003-02-06 10:55:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,6 +83,9 @@ import util.AccessibilityTools; import util.WriterTools; import util.utils; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + /** * Test of accessible object for a footer of a text document.<p> * Object implements the following interfaces : @@ -122,14 +125,19 @@ public class SwAccessibleFooterView extends TestCase { // obtains style 'Standard' from style family 'PageStyles' try { - PageStyles = (XNameAccess) StyleFamNames.getByName("PageStyles"); - StdStyle = (XStyle) PageStyles.getByName("Standard"); + PageStyles = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles")); + StdStyle = (XStyle) AnyConverter.toObject( + new Type(XStyle.class),PageStyles.getByName("Standard")); } catch ( com.sun.star.lang.WrappedTargetException e ) { e.printStackTrace(log); throw new StatusException("Error getting style by name!", e); } catch ( com.sun.star.container.NoSuchElementException e ) { e.printStackTrace(log); throw new StatusException("Error, no such style name! ", e); + } catch ( com.sun.star.lang.IllegalArgumentException e ) { + e.printStackTrace(log); + throw new StatusException("Error getting style by name!", e); } final XPropertySet PropSet = (XPropertySet) |