summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
diff options
context:
space:
mode:
authorStephan Wunderlich <sw@openoffice.org>2003-02-03 11:08:21 +0000
committerStephan Wunderlich <sw@openoffice.org>2003-02-03 11:08:21 +0000
commit5be1adc9927f32e42568679bd0da558c9698ca40 (patch)
tree9c1efe1fefe48afde2cdc5f1ae12dc5b3781304d /qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
parent5f06943052604bb76d7f56e9a4e245793c399c81 (diff)
CHG: using AnyConverter instead of simple cast
Diffstat (limited to 'qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java')
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java27
1 files changed, 19 insertions, 8 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
index 6193ec7c4cc7..b2163898c1ba 100644
--- a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
+++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ScHeaderFieldsObj.java,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change:$Date: 2003-01-27 18:16:29 $
+ * last change:$Date: 2003-02-03 12:08:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,6 +83,9 @@ import lib.TestEnvironment;
import lib.TestParameters;
import util.SOfficeFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+
/**
* Test for object which is represented by collection of
* text fields conained in the text of a page header. <p>
@@ -149,8 +152,7 @@ public class ScHeaderFieldsObj extends TestCase {
* @see com.sun.star.text.XText
* @see com.sun.star.text.XTextContent
*/
- public TestEnvironment createTestEnvironment(
- TestParameters tParam, PrintWriter log) throws StatusException {
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
XInterface oObj = null;
XPropertySet PropSet;
@@ -166,14 +168,19 @@ public class ScHeaderFieldsObj extends TestCase {
XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
try{
- PageStyles = (XNameAccess)StyleFamNames.getByName("PageStyles");
- StdStyle = (XStyle)PageStyles.getByName("Default");
+ PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),PageStyles.getByName("Default"));
} catch(com.sun.star.lang.WrappedTargetException e){
e.printStackTrace(log);
throw new StatusException("Couldn't get by name", e);
} catch(com.sun.star.container.NoSuchElementException e){
e.printStackTrace(log);
throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
}
//get the property-set
@@ -185,14 +192,18 @@ public class ScHeaderFieldsObj extends TestCase {
// first we write what we are intend to do to log file
log.println( "creating a test environment" );
try {
- RPHC = (XHeaderFooterContent)
- PropSet.getPropertyValue("RightPageHeaderContent");
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't get HeaderContent", e);
} catch (com.sun.star.beans.UnknownPropertyException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't get HeaderContent", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
}
XText left = RPHC.getLeftText();