1*eba4d44aSLiu Zhe package fvt.uno.sw.paragraph; 29f0ca99bSLiu Zhe 39f0ca99bSLiu Zhe import static org.junit.Assert.*; 49f0ca99bSLiu Zhe 59f0ca99bSLiu Zhe import org.junit.After; 69f0ca99bSLiu Zhe import org.junit.Before; 79f0ca99bSLiu Zhe import org.junit.Test; 89f0ca99bSLiu Zhe import org.openoffice.test.common.FileUtil; 99f0ca99bSLiu Zhe import org.openoffice.test.common.Testspace; 109f0ca99bSLiu Zhe import org.openoffice.test.uno.UnoApp; 119f0ca99bSLiu Zhe import com.sun.star.text.*; 129f0ca99bSLiu Zhe import com.sun.star.beans.*; 139f0ca99bSLiu Zhe import com.sun.star.frame.XStorable; 149f0ca99bSLiu Zhe import com.sun.star.uno.UnoRuntime; 159f0ca99bSLiu Zhe 169f0ca99bSLiu Zhe public class ParagraphTexttoTextAlignment { 179f0ca99bSLiu Zhe private static final UnoApp app = new UnoApp(); 189f0ca99bSLiu Zhe XText xText = null; 199f0ca99bSLiu Zhe 209f0ca99bSLiu Zhe @Before 219f0ca99bSLiu Zhe public void setUp() throws Exception { 229f0ca99bSLiu Zhe app.start(); 239f0ca99bSLiu Zhe 249f0ca99bSLiu Zhe } 259f0ca99bSLiu Zhe 269f0ca99bSLiu Zhe @After 279f0ca99bSLiu Zhe public void tearDown() throws Exception { 289f0ca99bSLiu Zhe app.close(); 299f0ca99bSLiu Zhe } 309f0ca99bSLiu Zhe /* 319f0ca99bSLiu Zhe * test paragraph background color 329f0ca99bSLiu Zhe * 1.new a text document 339f0ca99bSLiu Zhe * 2.insert some text 349f0ca99bSLiu Zhe * 3.set paragraph text to text alignment 359f0ca99bSLiu Zhe * 4.save and close the document 369f0ca99bSLiu Zhe * 5.reload the saved document and check the paragraph text to text alignment 379f0ca99bSLiu Zhe */ 389f0ca99bSLiu Zhe @Test 399f0ca99bSLiu Zhe public void testTexttoTextAlignment_Baseline() throws Exception { 409f0ca99bSLiu Zhe 419f0ca99bSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 429f0ca99bSLiu Zhe xText = xTextDocument.getText(); 439f0ca99bSLiu Zhe 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!" + 449f0ca99bSLiu Zhe "Hello,world!Hello,world!"); 459f0ca99bSLiu Zhe // create text cursor for selecting and formatting text 469f0ca99bSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 479f0ca99bSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 489f0ca99bSLiu Zhe xCursorProps.setPropertyValue("ParaVertAlignment",ParagraphVertAlign.BASELINE); 499f0ca99bSLiu Zhe //save to odt 509f0ca99bSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 519f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 529f0ca99bSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 539f0ca99bSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 549f0ca99bSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 559f0ca99bSLiu Zhe aStoreProperties_odt[0].Value = true; 569f0ca99bSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 579f0ca99bSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 589f0ca99bSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 599f0ca99bSLiu Zhe //save to doc 609f0ca99bSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 619f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 629f0ca99bSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 639f0ca99bSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 649f0ca99bSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 659f0ca99bSLiu Zhe aStoreProperties_doc[0].Value = true; 669f0ca99bSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 679f0ca99bSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 689f0ca99bSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 699f0ca99bSLiu Zhe app.closeDocument(xTextDocument); 709f0ca99bSLiu Zhe 719f0ca99bSLiu Zhe //reopen the document 729f0ca99bSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 739f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 749f0ca99bSLiu Zhe //verify paragraph text to text alignment 759f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.BASELINE,xCursorProps_Assert_odt.getPropertyValue("ParaVertAlignment")); 769f0ca99bSLiu Zhe 779f0ca99bSLiu Zhe //reopen the document 789f0ca99bSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 799f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 809f0ca99bSLiu Zhe //verify paragraph text to text alignment 819f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.BASELINE,xCursorProps_Assert_doc.getPropertyValue("ParaVertAlignment")); 829f0ca99bSLiu Zhe } 839f0ca99bSLiu Zhe @Test 849f0ca99bSLiu Zhe public void testTexttoTextAlignment_Bottom() throws Exception { 859f0ca99bSLiu Zhe 869f0ca99bSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 879f0ca99bSLiu Zhe xText = xTextDocument.getText(); 889f0ca99bSLiu Zhe 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!" + 899f0ca99bSLiu Zhe "Hello,world!Hello,world!"); 909f0ca99bSLiu Zhe // create text cursor for selecting and formatting text 919f0ca99bSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 929f0ca99bSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 939f0ca99bSLiu Zhe xCursorProps.setPropertyValue("ParaVertAlignment",ParagraphVertAlign.BOTTOM); 949f0ca99bSLiu Zhe //save to odt 959f0ca99bSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 969f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 979f0ca99bSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 989f0ca99bSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 999f0ca99bSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 1009f0ca99bSLiu Zhe aStoreProperties_odt[0].Value = true; 1019f0ca99bSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 1029f0ca99bSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 1039f0ca99bSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 1049f0ca99bSLiu Zhe //save to doc 1059f0ca99bSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 1069f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 1079f0ca99bSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 1089f0ca99bSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 1099f0ca99bSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 1109f0ca99bSLiu Zhe aStoreProperties_doc[0].Value = true; 1119f0ca99bSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 1129f0ca99bSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 1139f0ca99bSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 1149f0ca99bSLiu Zhe app.closeDocument(xTextDocument); 1159f0ca99bSLiu Zhe 1169f0ca99bSLiu Zhe //reopen the document 1179f0ca99bSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 1189f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 1199f0ca99bSLiu Zhe //verify paragraph text to text alignment 1209f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.BOTTOM,xCursorProps_Assert_odt.getPropertyValue("ParaVertAlignment")); 1219f0ca99bSLiu Zhe 1229f0ca99bSLiu Zhe //reopen the document 1239f0ca99bSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 1249f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 1259f0ca99bSLiu Zhe //verify paragraph text to text alignment 1269f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.BOTTOM,xCursorProps_Assert_doc.getPropertyValue("ParaVertAlignment")); 1279f0ca99bSLiu Zhe } 1289f0ca99bSLiu Zhe @Test 1299f0ca99bSLiu Zhe public void testTexttoTextAlignment_Center() throws Exception { 1309f0ca99bSLiu Zhe 1319f0ca99bSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 1329f0ca99bSLiu Zhe xText = xTextDocument.getText(); 1339f0ca99bSLiu Zhe 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!" + 1349f0ca99bSLiu Zhe "Hello,world!Hello,world!"); 1359f0ca99bSLiu Zhe // create text cursor for selecting and formatting text 1369f0ca99bSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 1379f0ca99bSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 1389f0ca99bSLiu Zhe xCursorProps.setPropertyValue("ParaVertAlignment",ParagraphVertAlign.CENTER); 1399f0ca99bSLiu Zhe //save to odt 1409f0ca99bSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 1419f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 1429f0ca99bSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 1439f0ca99bSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 1449f0ca99bSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 1459f0ca99bSLiu Zhe aStoreProperties_odt[0].Value = true; 1469f0ca99bSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 1479f0ca99bSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 1489f0ca99bSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 1499f0ca99bSLiu Zhe //save to doc 1509f0ca99bSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 1519f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 1529f0ca99bSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 1539f0ca99bSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 1549f0ca99bSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 1559f0ca99bSLiu Zhe aStoreProperties_doc[0].Value = true; 1569f0ca99bSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 1579f0ca99bSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 1589f0ca99bSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 1599f0ca99bSLiu Zhe app.closeDocument(xTextDocument); 1609f0ca99bSLiu Zhe 1619f0ca99bSLiu Zhe //reopen the document 1629f0ca99bSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 1639f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 1649f0ca99bSLiu Zhe //verify paragraph text to text alignment 1659f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.CENTER,xCursorProps_Assert_odt.getPropertyValue("ParaVertAlignment")); 1669f0ca99bSLiu Zhe 1679f0ca99bSLiu Zhe //reopen the document 1689f0ca99bSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 1699f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 1709f0ca99bSLiu Zhe //verify paragraph text to text alignment 1719f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.CENTER,xCursorProps_Assert_doc.getPropertyValue("ParaVertAlignment")); 1729f0ca99bSLiu Zhe } 1739f0ca99bSLiu Zhe @Test 1749f0ca99bSLiu Zhe public void testTexttoTextAlignment_Top() throws Exception { 1759f0ca99bSLiu Zhe 1769f0ca99bSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 1779f0ca99bSLiu Zhe xText = xTextDocument.getText(); 1789f0ca99bSLiu Zhe 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!" + 1799f0ca99bSLiu Zhe "Hello,world!Hello,world!"); 1809f0ca99bSLiu Zhe // create text cursor for selecting and formatting text 1819f0ca99bSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 1829f0ca99bSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 1839f0ca99bSLiu Zhe xCursorProps.setPropertyValue("ParaVertAlignment",ParagraphVertAlign.TOP); 1849f0ca99bSLiu Zhe //save to odt 1859f0ca99bSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 1869f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 1879f0ca99bSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 1889f0ca99bSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 1899f0ca99bSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 1909f0ca99bSLiu Zhe aStoreProperties_odt[0].Value = true; 1919f0ca99bSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 1929f0ca99bSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 1939f0ca99bSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 1949f0ca99bSLiu Zhe //save to doc 1959f0ca99bSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 1969f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 1979f0ca99bSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 1989f0ca99bSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 1999f0ca99bSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 2009f0ca99bSLiu Zhe aStoreProperties_doc[0].Value = true; 2019f0ca99bSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 2029f0ca99bSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 2039f0ca99bSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 2049f0ca99bSLiu Zhe app.closeDocument(xTextDocument); 2059f0ca99bSLiu Zhe 2069f0ca99bSLiu Zhe //reopen the document 2079f0ca99bSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 2089f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 2099f0ca99bSLiu Zhe //verify paragraph text to text alignment 2109f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.TOP,xCursorProps_Assert_odt.getPropertyValue("ParaVertAlignment")); 2119f0ca99bSLiu Zhe 2129f0ca99bSLiu Zhe //reopen the document 2139f0ca99bSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 2149f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 2159f0ca99bSLiu Zhe //verify paragraph text to text alignment 2169f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.TOP,xCursorProps_Assert_doc.getPropertyValue("ParaVertAlignment")); 2179f0ca99bSLiu Zhe } 2189f0ca99bSLiu Zhe @Test 2199f0ca99bSLiu Zhe public void testTexttoTextAlignment_Automatic() throws Exception { 2209f0ca99bSLiu Zhe 2219f0ca99bSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 2229f0ca99bSLiu Zhe xText = xTextDocument.getText(); 2239f0ca99bSLiu Zhe 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!" + 2249f0ca99bSLiu Zhe "Hello,world!Hello,world!"); 2259f0ca99bSLiu Zhe // create text cursor for selecting and formatting text 2269f0ca99bSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 2279f0ca99bSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 2289f0ca99bSLiu Zhe xCursorProps.setPropertyValue("ParaVertAlignment",ParagraphVertAlign.AUTOMATIC); 2299f0ca99bSLiu Zhe //save to odt 2309f0ca99bSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 2319f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 2329f0ca99bSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 2339f0ca99bSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 2349f0ca99bSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 2359f0ca99bSLiu Zhe aStoreProperties_odt[0].Value = true; 2369f0ca99bSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 2379f0ca99bSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 2389f0ca99bSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 2399f0ca99bSLiu Zhe //save to doc 2409f0ca99bSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 2419f0ca99bSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 2429f0ca99bSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 2439f0ca99bSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 2449f0ca99bSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 2459f0ca99bSLiu Zhe aStoreProperties_doc[0].Value = true; 2469f0ca99bSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 2479f0ca99bSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 2489f0ca99bSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 2499f0ca99bSLiu Zhe app.closeDocument(xTextDocument); 2509f0ca99bSLiu Zhe 2519f0ca99bSLiu Zhe //reopen the document 2529f0ca99bSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 2539f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 2549f0ca99bSLiu Zhe //verify paragraph text to text alignment 2559f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.AUTOMATIC,xCursorProps_Assert_odt.getPropertyValue("ParaVertAlignment")); 2569f0ca99bSLiu Zhe 2579f0ca99bSLiu Zhe //reopen the document 2589f0ca99bSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 2599f0ca99bSLiu Zhe XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 2609f0ca99bSLiu Zhe //verify paragraph text to text alignment 2619f0ca99bSLiu Zhe assertEquals("assert paragraph text to text alignment",ParagraphVertAlign.AUTOMATIC,xCursorProps_Assert_doc.getPropertyValue("ParaVertAlignment")); 2629f0ca99bSLiu Zhe } 2639f0ca99bSLiu Zhe } 264