You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/08/31 05:11:31 UTC
svn commit: r1379269 [1/2] - in
/incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph:
ParagraphInsertBreak.java ParagraphOutlineAndNumbering.java
ParagraphTabs.java ParagraphTexttoTextAlignment.java
Author: liuzhe
Date: Fri Aug 31 03:11:31 2012
New Revision: 1379269
URL: http://svn.apache.org/viewvc?rev=1379269&view=rev
Log:
#120762 - [testuno]paragraph tabs,text to text alignment,outline&numbering,insert break
Patch By: Du Jing <bj...@gmail.com>
Review By: Liu Zhe <al...@gmail.com>
Added:
incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphInsertBreak.java
incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphOutlineAndNumbering.java
incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphTabs.java
incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphTexttoTextAlignment.java
Added: incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphInsertBreak.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphInsertBreak.java?rev=1379269&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphInsertBreak.java (added)
+++ incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphInsertBreak.java Fri Aug 31 03:11:31 2012
@@ -0,0 +1,734 @@
+package testcase.uno.sw.paragraph;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class ParagraphInsertBreak {
+ private static final UnoApp app = new UnoApp();
+ XText xText = null;
+
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ @Test
+ public void InsertPage_BeforeBreak_NoSplit_KeepTogether() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("ParaSplit",false);
+ xCursorProps.setPropertyValue("ParaKeepTogether",true);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break",false,xCursorProps_Assert_odt.getPropertyValue("ParaSplit"));
+ assertEquals("assert paragraph break",true,xCursorProps_Assert_odt.getPropertyValue("ParaKeepTogether"));
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break",false,xCursorProps_Assert_doc.getPropertyValue("ParaSplit"));
+ assertEquals("assert paragraph break",true,xCursorProps_Assert_doc.getPropertyValue("ParaKeepTogether"));
+ }
+ @Test
+ public void InsertPage_BeforeBreak_Orphan_WindowControl() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("ParaOrphans",(byte)2);
+ xCursorProps.setPropertyValue("ParaWidows",(byte)2);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaOrphans"));
+ assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaWidows"));
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaOrphans"));
+ assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaWidows"));
+ }
+ @Test@Ignore //bug 120719_the page_after break change to page_before break when save to doc.
+ public void InsertPage_AfterBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ }
+ @Test@Ignore //bug 120719_the page_after/column_before break change to page_before break when save to doc.
+ public void InsertColumn_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_BEFORE);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ }
+ @Test@Ignore //bug 120719_the page_after/column_before/column_after break change to page_before break when save to doc.
+ public void InsertColumn_AfterBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_AFTER);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ }
+ @Test@Ignore //bug120721_the endnote page break change to page default break when save to doc.
+ public void InsertPage_Endnote_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Endnote");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+
+ @Test@Ignore //bug120721_the envelope page break change to page default break when save to doc.
+ public void InsertPage_Envelop_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Envelope");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+
+ @Test
+ public void InsertPage_Firstpage_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","First Page");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","First Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","First Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721_the footnote page break change to page default break when save to doc.
+ public void InsertPage_Footnote_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Footnote");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721_the footnote page break change to page default break when save to doc.
+ public void InsertPage_HTML_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","HTML");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","HTML",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","HTML",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721_the index page break change to page default break when save to doc.
+ public void InsertPage_Index_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Index");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Index",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Index",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721_the landscape page break change to page default break when save to doc.
+ public void InsertPage_Landscape_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Landscape");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721_the leftpage break change to page default break when save to doc.
+ public void InsertPage_LeftPage_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Left Page");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+ @Test@Ignore //bug120721_the right page break change to page default break when save to doc.
+ public void InsertPage_RightPage_BeforeBreak() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //set paragraph break type
+ xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
+ xCursorProps.setPropertyValue("PageDescName","Right Page");
+ xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph break
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph background color
+ assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
+ assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
+ assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
+ }
+}
Added: incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphOutlineAndNumbering.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphOutlineAndNumbering.java?rev=1379269&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphOutlineAndNumbering.java (added)
+++ incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphOutlineAndNumbering.java Fri Aug 31 03:11:31 2012
@@ -0,0 +1,160 @@
+package testcase.uno.sw.paragraph;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class ParagraphOutlineAndNumbering {
+ private static final UnoApp app = new UnoApp();
+ XText xText = null;
+
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ //app.close();
+ }
+ /*
+ * test paragraph background color
+ * 1.new a text document
+ * 2.insert some text
+ * 3.set paragraph outline and numbering
+ * 4.save and close the document
+ * 5.reload the saved document and check the paragraph outline and numbering
+ */
+ @Test@Ignore//Bug 120753 - paragraph outline level and numbering style change when save to doc
+ public void testOutlineAndNumbering_NumberStyle() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.\nwe are all living in one earth!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ XTextCursor xTextCursor=xText.createTextCursor();
+ XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ xTextProps.setPropertyValue("OutlineLevel", (short)6);
+ xTextProps.setPropertyValue("NumberingStyleName", "Numbering 2");
+ xTextProps.setPropertyValue("ParaIsNumberingRestart", true);
+ xTextProps.setPropertyValue("NumberingStartValue", (short)7);
+ xTextProps.setPropertyValue("ParaLineNumberCount",true);
+ xTextProps.setPropertyValue("ParaLineNumberStartValue",(long)4);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "writer8";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ //app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph outline and numbering
+ assertEquals("assert paragraph outline and numbering",(short)6,xCursorProps_Assert_odt.getPropertyValue("OutlineLevel"));
+ assertEquals("assert paragraph outline and numbering","Numbering 2",xCursorProps_Assert_odt.getPropertyValue("NumberingStyleName"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_odt.getPropertyValue("ParaIsNumberingRestart"));
+ assertEquals("assert paragraph outline and numbering",(short)7,xCursorProps_Assert_odt.getPropertyValue("NumberingStartValue"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_odt.getPropertyValue("ParaLineNumberCount"));
+ assertEquals("assert paragraph outline and numbering",(long)4,xCursorProps_Assert_odt.getPropertyValue("ParaLineNumberStartValue"));
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph outline and numbering
+ assertEquals("assert paragraph outline and numbering",(short)6,xCursorProps_Assert_doc.getPropertyValue("OutlineLevel"));
+ assertEquals("assert paragraph outline and numbering","Numbering 2",xCursorProps_Assert_doc.getPropertyValue("NumberingStyleName"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_doc.getPropertyValue("ParaIsNumberingRestart"));
+ assertEquals("assert paragraph outline and numbering",(short)7,xCursorProps_Assert_doc.getPropertyValue("NumberingStartValue"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_doc.getPropertyValue("ParaLineNumberCount"));
+ assertEquals("assert paragraph outline and numbering",(long)4,xCursorProps_Assert_doc.getPropertyValue("ParaLineNumberStartValue"));
+
+ }
+ @Test@Ignore//Bug 120753 - paragraph outline level and numbering style change when save to doc
+ public void testOutlineAndNumbering_ListStyle() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.\nwe are all living in one earth!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!Hello,world!" +
+ "Hello,world!Hello,world!");
+ XTextCursor xTextCursor=xText.createTextCursor();
+ XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ xTextProps.setPropertyValue("OutlineLevel", (short)3);
+ xTextProps.setPropertyValue("NumberingStyleName", "List 3");
+ xTextProps.setPropertyValue("ParaIsNumberingRestart", true);
+ xTextProps.setPropertyValue("NumberingStartValue", (short)6);
+ xTextProps.setPropertyValue("ParaLineNumberCount",true);
+ xTextProps.setPropertyValue("ParaLineNumberStartValue",(long)4);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ //app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify paragraph outline and numbering
+ assertEquals("assert paragraph outline and numbering",(short)3,xCursorProps_Assert_odt.getPropertyValue("OutlineLevel"));
+ assertEquals("assert paragraph outline and numbering","List 3",xCursorProps_Assert_odt.getPropertyValue("NumberingStyleName"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_odt.getPropertyValue("ParaIsNumberingRestart"));
+ assertEquals("assert paragraph outline and numbering",(short)6,xCursorProps_Assert_odt.getPropertyValue("NumberingStartValue"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_odt.getPropertyValue("ParaLineNumberCount"));
+ assertEquals("assert paragraph outline and numbering",(long)4,xCursorProps_Assert_odt.getPropertyValue("ParaLineNumberStartValue"));
+
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify paragraph outline and numbering
+ assertEquals("assert paragraph outline and numbering",(short)3,xCursorProps_Assert_doc.getPropertyValue("OutlineLevel"));
+ assertEquals("assert paragraph outline and numbering","List 3",xCursorProps_Assert_doc.getPropertyValue("NumberingStyleName"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_doc.getPropertyValue("ParaIsNumberingRestart"));
+ assertEquals("assert paragraph outline and numbering",(short)6,xCursorProps_Assert_doc.getPropertyValue("NumberingStartValue"));
+ assertEquals("assert paragraph outline and numbering",true,xCursorProps_Assert_doc.getPropertyValue("ParaLineNumberCount"));
+ assertEquals("assert paragraph outline and numbering",(long)4,xCursorProps_Assert_doc.getPropertyValue("ParaLineNumberStartValue"));
+
+ }
+}
Added: incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphTabs.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphTabs.java?rev=1379269&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphTabs.java (added)
+++ incubator/ooo/trunk/test/testuno/source/testcase/uno/sw/paragraph/ParagraphTabs.java Fri Aug 31 03:11:31 2012
@@ -0,0 +1,330 @@
+package testcase.uno.sw.paragraph;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import com.sun.star.style.TabAlign;
+import com.sun.star.style.TabStop;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class ParagraphTabs {
+ private static final UnoApp app = new UnoApp();
+ XText xText = null;
+
+ @Before
+ public void setUp() throws Exception {
+ app.start();
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ app.close();
+ }
+ @Test
+ public void ParagraphTabs_Center() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //paraTabStops.
+ TabStop[] tabStop=new TabStop[1];
+ tabStop[0]=new TabStop();
+ tabStop[0].Position=5001;
+ tabStop[0].Alignment=TabAlign.CENTER;
+ tabStop[0].FillChar='_';
+ //set paragraph tab stops
+ xCursorProps.setPropertyValue("ParaTabStops",tabStop);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "writer8";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
+ TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.CENTER,paraTabs_assert_odt[0].Alignment);
+ assertEquals("assert paragraph tab setting",'_',paraTabs_assert_odt[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.CENTER,paraTabs_assert_doc[0].Alignment);
+ assertEquals("assert paragraph tab setting",'_',paraTabs_assert_doc[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
+ }
+ @Test
+ public void ParagraphTabs_Left() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //paraTabStops.
+ TabStop[] tabStop=new TabStop[1];
+ tabStop[0]=new TabStop();
+ tabStop[0].Position=5001;
+ tabStop[0].Alignment=TabAlign.LEFT;
+ tabStop[0].FillChar='.';
+ //set paragraph tab stops
+ xCursorProps.setPropertyValue("ParaTabStops",tabStop);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "writer8";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
+ TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.LEFT,paraTabs_assert_odt[0].Alignment);
+ assertEquals("assert paragraph tab setting",'.',paraTabs_assert_odt[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.LEFT,paraTabs_assert_doc[0].Alignment);
+ assertEquals("assert paragraph tab setting",'.',paraTabs_assert_doc[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
+ }
+ @Test
+ public void ParagraphTabs_Right() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //paraTabStops.
+ TabStop[] tabStop=new TabStop[1];
+ tabStop[0]=new TabStop();
+ tabStop[0].Position=5001;
+ tabStop[0].Alignment=TabAlign.RIGHT;
+ tabStop[0].FillChar='-';
+ //set paragraph tab stops
+ xCursorProps.setPropertyValue("ParaTabStops",tabStop);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "writer8";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
+ TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.RIGHT,paraTabs_assert_odt[0].Alignment);
+ assertEquals("assert paragraph tab setting",'-',paraTabs_assert_odt[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.RIGHT,paraTabs_assert_doc[0].Alignment);
+ assertEquals("assert paragraph tab setting",'-',paraTabs_assert_doc[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
+ }
+ @Test
+ public void ParagraphTabs_Decimal() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //paraTabStops.
+ TabStop[] tabStop=new TabStop[1];
+ tabStop[0]=new TabStop();
+ tabStop[0].Position=5001;
+ tabStop[0].Alignment=TabAlign.DECIMAL;
+ tabStop[0].DecimalChar='.';
+ tabStop[0].FillChar='-';
+ //set paragraph tab stops
+ xCursorProps.setPropertyValue("ParaTabStops",tabStop);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "writer8";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
+ TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_odt[0].Alignment);
+ assertEquals("assert paragraph tab setting",'-',paraTabs_assert_odt[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
+ assertEquals("assert paragraph tab setting",'.',paraTabs_assert_odt[0].DecimalChar);
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_doc[0].Alignment);
+ assertEquals("assert paragraph tab setting",'-',paraTabs_assert_doc[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
+ assertEquals("assert paragraph tab setting",'.',paraTabs_assert_doc[0].DecimalChar);
+ }
+ @Test@Ignore //bug120748_the tabstops character of paragraph change to default when save to doc.
+ public void ParagraphTabs_Decimal_UserDefineCharacter() throws Exception {
+
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!");
+ // create text cursor for selecting and formatting text
+ XTextCursor xTextCursor = xText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
+ //paraTabStops.
+ TabStop[] tabStop=new TabStop[1];
+ tabStop[0]=new TabStop();
+ tabStop[0].Position=5001;
+ tabStop[0].Alignment=TabAlign.DECIMAL;
+ tabStop[0].DecimalChar='@';
+ tabStop[0].FillChar='%';
+ //set paragraph tab stops
+ xCursorProps.setPropertyValue("ParaTabStops",tabStop);
+ //save to odt
+ XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+ aStoreProperties_odt[0] = new PropertyValue();
+ aStoreProperties_odt[1] = new PropertyValue();
+ aStoreProperties_odt[0].Name = "Override";
+ aStoreProperties_odt[0].Value = true;
+ aStoreProperties_odt[1].Name = "FilterName";
+ aStoreProperties_odt[1].Value = "writer8";
+ xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+ //save to doc
+ XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+ aStoreProperties_doc[0] = new PropertyValue();
+ aStoreProperties_doc[1] = new PropertyValue();
+ aStoreProperties_doc[0].Name = "Override";
+ aStoreProperties_doc[0].Value = true;
+ aStoreProperties_doc[1].Name = "FilterName";
+ aStoreProperties_doc[1].Value = "MS Word 97";
+ xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
+ app.closeDocument(xTextDocument);
+
+ //reopen the document
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ Object paraTabs_obj_odt=xCursorProps_Assert_odt.getPropertyValue("ParaTabStops");
+ TabStop[] paraTabs_assert_odt=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, paraTabs_obj_odt);
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_odt[0].Alignment);
+ assertEquals("assert paragraph tab setting",'%',paraTabs_assert_odt[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_odt[0].Position);
+ assertEquals("assert paragraph tab setting",'@',paraTabs_assert_odt[0].DecimalChar);
+
+ //reopen the document
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ TabStop[] paraTabs_assert_doc=(TabStop[]) UnoRuntime.queryInterface(TabStop[].class, xCursorProps_Assert_doc.getPropertyValue("ParaTabStops"));
+ //verify paragraph tabs
+ assertEquals("assert paragraph tab setting",TabAlign.DECIMAL,paraTabs_assert_doc[0].Alignment);
+ assertEquals("assert paragraph tab setting",'%',paraTabs_assert_doc[0].FillChar);
+ assertEquals("assert paragraph tab setting",5001,paraTabs_assert_doc[0].Position);
+ assertEquals("assert paragraph tab setting",'@',paraTabs_assert_doc[0].DecimalChar);
+ }
+}