diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-09-14 19:10:10 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-09-14 22:01:55 +0200 |
commit | c3da81104bf6b82a3688c82ed341666c8f5eeec0 (patch) | |
tree | cc70d6921f5e069e5831fdc61f575ee41a1b9132 | |
parent | 2171077c0c3c43a61546ab2c0ae68ba63c5112f7 (diff) |
sfx2: DocumentInfo test should use a private temp dir
At least it failed on me once trying to store to its temp file, maybe
the predictable file name was the problem...
Change-Id: I78918ada1615c8337e4c8692d34aa285010bc820
-rw-r--r-- | sfx2/qa/complex/sfx2/DocumentInfo.java | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/sfx2/qa/complex/sfx2/DocumentInfo.java b/sfx2/qa/complex/sfx2/DocumentInfo.java index 4822153ffcf3..1532a3cc14c4 100644 --- a/sfx2/qa/complex/sfx2/DocumentInfo.java +++ b/sfx2/qa/complex/sfx2/DocumentInfo.java @@ -51,7 +51,7 @@ public class DocumentInfo XTextDocument xTextDoc = null; XTextDocument xTextDocSecond = null; - @Test public void checkDocInfo() + @Test public void checkDocInfo() throws Exception { m_xMSF = getMSF(); @@ -59,8 +59,7 @@ public class DocumentInfo assertNotNull("## Couldn't get MultiServiceFactory make sure your Office is started", m_xMSF); - // TODO: need other temp directory! - String tempdir = System.getProperty("java.io.tmpdir"); + String tempdir = util.utils.getOfficeTemp/*Dir*/(m_xMSF); String fs = System.getProperty("file.separator"); if (!tempdir.endsWith(fs)) @@ -127,16 +126,9 @@ public class DocumentInfo System.out.println("Storing the document"); - try - { - XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc); - store.storeToURL(sTempDocument, new PropertyValue[] {}); - DesktopTools.closeDoc(xTextDoc); - } - catch (Exception e) - { - fail("Couldn't store document"); - } + XStorable store = UnoRuntime.queryInterface(XStorable.class, xTextDoc); + store.storeToURL(sTempDocument, new PropertyValue[] {}); + DesktopTools.closeDoc(xTextDoc); System.out.println("...done"); } @@ -146,16 +138,9 @@ public class DocumentInfo { System.out.println("loading the document"); - try - { - XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop")); - XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {}); - xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp); - } - catch (Exception e) - { - fail("Couldn't load document"); - } + XComponentLoader xCL = UnoRuntime.queryInterface(XComponentLoader.class, m_xMSF.createInstance("com.sun.star.frame.Desktop")); + XComponent xComp = xCL.loadComponentFromURL(sTempDocument, "_blank", 0, new PropertyValue[] {}); + xTextDocSecond = UnoRuntime.queryInterface(XTextDocument.class, xComp); System.out.println("...done"); |