--- testuno/.externalToolBuilders/Classpath Builder.launch (revision 1412762)
+++ testuno/.externalToolBuilders/Classpath Builder.launch (working copy)
@@ -1,22 +1,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- testuno/source/fvt/uno/sw/bookmark/CheckBookmarks.java (revision 1412762)
+++ testuno/source/fvt/uno/sw/bookmark/CheckBookmarks.java (working copy)
@@ -57,7 +57,9 @@
XText xText = document.getText();
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.setString("Contents");
-
+ /**
+ * insert bookmark into document
+ */
for (int i = 0; i < initBookmarkNames.length; i++) {
xTextCursor.gotoEnd(false);
XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xTextCursor);
@@ -77,7 +79,12 @@
public static void tearDownConnection() throws Exception {
app.close();
}
-
+ /**
+ * get bookmark content
+ * @param xBookmarks
+ * @return
+ * @throws Exception
+ */
private static String[] getBookmarkContents(XNameAccess xBookmarks) throws Exception {
String[] bookmarkNames = xBookmarks.getElementNames();
String[] bookmarkContents = new String[bookmarkNames.length];
@@ -89,14 +96,20 @@
return bookmarkContents;
}
-
+ /**
+ * verify inserted bookmark by compare their name and content
+ * @throws Exception
+ */
@Test
public void createBookmark() throws Exception {
XNameAccess xBookmarks = ((XBookmarksSupplier)UnoRuntime.queryInterface(XBookmarksSupplier.class, document)).getBookmarks();
assertArrayEquals("Bookmark name list:", initBookmarkNames, xBookmarks.getElementNames());
assertArrayEquals("Bookmark content list:", initBookmarkContents, getBookmarkContents(xBookmarks));
}
-
+ /**
+ * verify bookmark modify
+ * @throws Exception
+ */
@Test
public void updateBookmarkContent() throws Exception {
String[] expectedBookmarkNames= new String[]{"bookmark1", "bookmark2", "bookmark3"};
@@ -113,7 +126,10 @@
assertArrayEquals("Bookmark name list after updating some content:", expectedBookmarkNames, xBookmarks.getElementNames());
assertArrayEquals("Bookmark content list after updating some content:", expectedBookmarkContents, getBookmarkContents(xBookmarks));
}
-
+ /**
+ * verify bookmark remove
+ * @throws Exception
+ */
@Test
public void removeBookmark() throws Exception {
String[] expectedBookmarkNames= new String[]{"bookmark2", "bookmark3"};
--- testuno/source/fvt/uno/sw/DocumentTest.java (revision 1412762)
+++ testuno/source/fvt/uno/sw/DocumentTest.java (working copy)
@@ -32,6 +32,8 @@
import org.openoffice.test.common.FileUtil;
import org.openoffice.test.uno.UnoApp;
+import testlib.uno.SWUtil;
+
import com.sun.star.text.XTextDocument;
import com.sun.star.text.XTextCursor;
import com.sun.star.text.XText;
@@ -39,10 +41,7 @@
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.*;
import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
import com.sun.star.lang.XComponent;
-import com.sun.star.container.XEnumerationAccess;
-import com.sun.star.container.XEnumeration;
public class DocumentTest {
@@ -51,10 +50,7 @@
File temp = null;
String workingFilePath = "";
String workingTemplatePath = "";
-
- /**
- * @throws java.lang.Exception
- */
+
@Before
public void setUp() throws Exception {
unoApp.start();
@@ -72,71 +68,39 @@
public void tearDown() throws Exception {
unoApp.close();
}
-
- private XComponent newDocumentFromTemplate(String templatePath) throws Exception
- {
- XComponentLoader componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, unoApp.getDesktop());
- PropertyValue[] pros = new PropertyValue[1];
- pros[0] = new PropertyValue();
- pros[0].Name = "AsTemplate";
- pros[0].Value = new Boolean(true);
-
- XComponent component = componentLoader.loadComponentFromURL(FileUtil.getUrl(workingTemplatePath), "_blank", 0,pros);
- return component;
- }
-
-
/**
- * test close document
+ * test new document and close document
* @throws Exception
*/
@Test
- public void testCloseDocument() throws Exception
+ public void testNewAndCloseDocument() throws Exception
{
XComponent component = unoApp.newDocument("swriter");
- unoApp.closeDocument(component);
- XModel xModel = unoApp.getDesktop().getCurrentFrame().getController().getModel();
- Assert.assertTrue("Document has been closed.",xModel==null);
- }
-
- /**
- * test new document
- * @throws Exception
- */
- @Test
- public void testNewDocument() throws Exception
- {
- XComponentLoader componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, unoApp.getDesktop());
- XComponent component = componentLoader.loadComponentFromURL("private:factory/" + "swriter", "_blank", 0, new PropertyValue[0]);
textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
String title = xTitle.getTitle();
Assert.assertEquals("New Document title start with \"Untitled\"",true, title.startsWith("Untitled"));
- unoApp.closeDocument(textDocument);
- }
-
+ unoApp.closeDocument(component);
+ XModel xModel = unoApp.getDesktop().getCurrentFrame().getController().getModel();
+ Assert.assertTrue("Document has been closed.",xModel==null);
+ }
/**
* test new document from template
* @throws Exception
*/
@Test
public void testNewDocumentFromTemplate() throws Exception
- {
- XComponent component = this.newDocumentFromTemplate(workingTemplatePath);
+ {
+ XComponent component = SWUtil.newDocumentFromTemplate(workingTemplatePath,unoApp);
textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
+ XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
XText xText = textDocument.getText();
- XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
- xText = textDocument.getText();
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.gotoEnd(true);
XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
- String paraStyle = (String)xPropertySet.getPropertyValue("ParaStyleName");
-
- Assert.assertEquals("new document from template, heading style in template is remained. ", "Heading 1", paraStyle);
-
+ String paraStyle = (String)xPropertySet.getPropertyValue("ParaStyleName");
+ Assert.assertEquals("new document from template, heading style in template is remained. ", "Heading 1", paraStyle);
Assert.assertEquals("new document from template, title start with \"Untitled\".", true, xTitle.getTitle().startsWith("Untitled"));
-
- unoApp.closeDocument(textDocument);
}
/**
@@ -151,23 +115,17 @@
XText xText = textDocument.getText();
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.gotoEnd(true);
- XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
-
- xPropertySet.setPropertyValue("ParaStyleName", "Heading 1");
-
- XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, component);
- xStorable.store();
- unoApp.closeDocument(textDocument);
-
+ XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ xPropertySet.setPropertyValue("ParaStyleName", "Heading 1");
+ SWUtil.save(textDocument);
+ unoApp.closeDocument(textDocument);
component = unoApp.loadDocument(workingFilePath);
textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
xText = textDocument.getText();
xTextCursor = xText.createTextCursor();
xTextCursor.gotoEnd(true);
- xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
-
+ xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
Assert.assertEquals("Modify plain text to heading 1 style. ", "Heading 1", (String)xPropertySet.getPropertyValue("ParaStyleName"));
- unoApp.closeDocument(textDocument);
}
/**
@@ -186,21 +144,8 @@
xPropertySet.setPropertyValue("ParaStyleName", "Heading 1");
xText.insertString(xTextCursor, "test Save odt as doc.", false);
-
- XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, component);
- PropertyValue[] storeProps = new PropertyValue[2];
-
- storeProps[0] = new PropertyValue();
- storeProps[0].Name = "Overwrite";
- storeProps[0].Value = new Boolean(true);
-
- storeProps[1] = new PropertyValue();
- storeProps[1].Name = "FilterName";
- storeProps[1].Value = "MS Word 97";
-
- xStorable.storeAsURL(FileUtil.getUrl(saveAsFile), storeProps);
+ SWUtil.saveAsDoc(textDocument, FileUtil.getUrl(saveAsFile));
Assert.assertTrue("Save odt document as doc the file exist: " + saveAsFile.getAbsolutePath(), saveAsFile.exists());
- unoApp.closeDocument(textDocument);
}
/**
@@ -232,8 +177,6 @@
xStorable.storeToURL(FileUtil.getUrl(saveAsFile), storeProps);
Assert.assertTrue("Export document as PDF.", saveAsFile.exists());
-
- unoApp.closeDocument(textDocument);
}
/**
@@ -270,19 +213,8 @@
storeProps[2].Value=new Boolean(true);
xStorable.storeToURL(FileUtil.getUrl(saveAsFile), storeProps);
- unoApp.closeDocument(textDocument);
-
- component = this.newDocumentFromTemplate(saveAsFile.getAbsolutePath());
- textDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component);
- XTitle xTitle = (XTitle)UnoRuntime.queryInterface(XTitle.class, textDocument);
- xText = textDocument.getText();
- xTextCursor = xText.createTextCursor();
- xTextCursor.gotoEnd(true);
- xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
- String paraStyle = (String)xPropertySet.getPropertyValue("ParaStyleName");
- Assert.assertEquals("Save document as template, heading style is remained. ", "Heading 1", paraStyle);
- Assert.assertEquals("Save document as template, title start with \"Untitled\".", true, xTitle.getTitle().startsWith("Untitled"));
- unoApp.closeDocument(textDocument);
+ unoApp.closeDocument(textDocument);
+ Assert.assertTrue("Export document as ott.", saveAsFile.exists());
}
}
--- testuno/source/fvt/uno/sw/frame/FrameAnchorType.java (revision 0)
+++ testuno/source/fvt/uno/sw/frame/FrameAnchorType.java (working copy)
@@ -0,0 +1,77 @@
+package fvt.uno.sw.frame;
+
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import testlib.uno.SWUtil;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextFrame;
+import com.sun.star.text.XTextFramesSupplier;
+import com.sun.star.uno.UnoRuntime;
+@RunWith(value = Parameterized.class)
+public class FrameAnchorType {
+ private static final UnoApp app = new UnoApp();
+ private XTextDocument xTextDocument=null;
+ private XMultiServiceFactory xWriterFactory=null;
+ private XText xText=null;
+ private com.sun.star.text.TextContentAnchorType FrameAnchorType;
+ public FrameAnchorType(com.sun.star.text.TextContentAnchorType FrameAnchorType){
+ this.FrameAnchorType=FrameAnchorType;
+ }
+ @Parameters
+ public static Collection