1*eba4d44aSLiu Zhe package fvt.uno.sw.paragraph; 2*eba4d44aSLiu Zhe 3*eba4d44aSLiu Zhe import static org.junit.Assert.*; 4*eba4d44aSLiu Zhe 5*eba4d44aSLiu Zhe import org.junit.After; 6*eba4d44aSLiu Zhe import org.junit.Before; 7*eba4d44aSLiu Zhe import org.junit.Ignore; 8*eba4d44aSLiu Zhe import org.junit.Test; 9*eba4d44aSLiu Zhe import org.openoffice.test.common.FileUtil; 10*eba4d44aSLiu Zhe import org.openoffice.test.common.Testspace; 11*eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp; 12*eba4d44aSLiu Zhe import com.sun.star.text.*; 13*eba4d44aSLiu Zhe import com.sun.star.beans.*; 14*eba4d44aSLiu Zhe import com.sun.star.frame.XStorable; 15*eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime; 16*eba4d44aSLiu Zhe 17*eba4d44aSLiu Zhe public class ParagraphAlignment { 18*eba4d44aSLiu Zhe private static final UnoApp app = new UnoApp(); 19*eba4d44aSLiu Zhe XText xText = null; 20*eba4d44aSLiu Zhe 21*eba4d44aSLiu Zhe @Before 22*eba4d44aSLiu Zhe public void setUp() throws Exception { 23*eba4d44aSLiu Zhe app.start(); 24*eba4d44aSLiu Zhe 25*eba4d44aSLiu Zhe } 26*eba4d44aSLiu Zhe 27*eba4d44aSLiu Zhe @After 28*eba4d44aSLiu Zhe public void tearDown() throws Exception { 29*eba4d44aSLiu Zhe app.close(); 30*eba4d44aSLiu Zhe } 31*eba4d44aSLiu Zhe /* 32*eba4d44aSLiu Zhe * test paragraph alignment is justified 33*eba4d44aSLiu Zhe * 1.new a text document 34*eba4d44aSLiu Zhe * 2.insert some text 35*eba4d44aSLiu Zhe * 3.set paragraph alignment is justified,and last line align to left,check expand single word 36*eba4d44aSLiu Zhe * 4.save and close the document 37*eba4d44aSLiu Zhe * 5.reload the saved document and check the paragraph alignment 38*eba4d44aSLiu Zhe */ 39*eba4d44aSLiu Zhe @Test@Ignore("Bug #120636 - [testUNO patch]the expand single word option disable when save to doc") 40*eba4d44aSLiu Zhe public void testParagraphAlignmentJustified() throws Exception { 41*eba4d44aSLiu Zhe 42*eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 43*eba4d44aSLiu Zhe xText = xTextDocument.getText(); 44*eba4d44aSLiu 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!" + 45*eba4d44aSLiu Zhe "Hello,world!Hello,world!"); 46*eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 47*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 48*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 49*eba4d44aSLiu Zhe //apply paragraph alignment as justified and last line alignment 50*eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 51*eba4d44aSLiu Zhe xTextCursor.goRight((short)180 , true); 52*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("ParaAdjust",com.sun.star.style.ParagraphAdjust.BLOCK); 53*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("ParaLastLineAdjust", com.sun.star.style.ParagraphAdjust.LEFT); 54*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("ParaExpandSingleWord", true); 55*eba4d44aSLiu Zhe //save to odt 56*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 57*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 58*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 59*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 60*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 61*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 62*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 63*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 64*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 65*eba4d44aSLiu Zhe //save to doc 66*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 67*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 68*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 69*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 70*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 71*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 72*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 73*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 74*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 75*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 76*eba4d44aSLiu Zhe 77*eba4d44aSLiu Zhe //reopen the document and assert table margin to page setting 78*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 79*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_odt = assertDocument_odt.getText().createTextCursor(); 80*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_odt); 81*eba4d44aSLiu Zhe //verify paragraph alignment property 82*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is justified",(short)2,xCursorProps_assert_odt.getPropertyValue("ParaAdjust")); 83*eba4d44aSLiu Zhe assertEquals("assert first paragraph last line alignment is left",(short)0, xCursorProps_assert_odt.getPropertyValue("ParaLastLineAdjust")); 84*eba4d44aSLiu Zhe assertEquals("assert expand single word is true",true,xCursorProps_assert_odt.getPropertyValue("ParaExpandSingleWord")); 85*eba4d44aSLiu Zhe 86*eba4d44aSLiu Zhe //reopen the document and assert table margin to page setting 87*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 88*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor(); 89*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_doc); 90*eba4d44aSLiu Zhe //verify paragraph alignment property 91*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is justified",(short)2,xCursorProps_assert_doc.getPropertyValue("ParaAdjust")); 92*eba4d44aSLiu Zhe assertEquals("assert first paragraph last line alignment is left",(short)0, xCursorProps_assert_doc.getPropertyValue("ParaLastLineAdjust")); 93*eba4d44aSLiu Zhe assertEquals("assert expand single word is true",true,xCursorProps_assert_doc.getPropertyValue("ParaExpandSingleWord")); 94*eba4d44aSLiu Zhe 95*eba4d44aSLiu Zhe } 96*eba4d44aSLiu Zhe /* 97*eba4d44aSLiu Zhe * test paragraph alignment is left 98*eba4d44aSLiu Zhe * 1.new a text document 99*eba4d44aSLiu Zhe * 2.insert some text 100*eba4d44aSLiu Zhe * 3.set paragraph alignment is left 101*eba4d44aSLiu Zhe * 4.save and close the document 102*eba4d44aSLiu Zhe * 5.reload the saved document and check the paragraph alignment 103*eba4d44aSLiu Zhe */ 104*eba4d44aSLiu Zhe @Test 105*eba4d44aSLiu Zhe public void testParagraphAlignmentLeft() throws Exception { 106*eba4d44aSLiu Zhe 107*eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 108*eba4d44aSLiu Zhe xText = xTextDocument.getText(); 109*eba4d44aSLiu 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!" + 110*eba4d44aSLiu Zhe "Hello,world!Hello,world!"); 111*eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 112*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 113*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 114*eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 115*eba4d44aSLiu Zhe xTextCursor.goRight((short)180 , true); 116*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("ParaAdjust",com.sun.star.style.ParagraphAdjust.LEFT); 117*eba4d44aSLiu Zhe //save to odt 118*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 119*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 120*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 121*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 122*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 123*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 124*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 125*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 126*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 127*eba4d44aSLiu Zhe //save to doc 128*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 129*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 130*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 131*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 132*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 133*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 134*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 135*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 136*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 137*eba4d44aSLiu Zhe 138*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 139*eba4d44aSLiu Zhe 140*eba4d44aSLiu Zhe //reopen the odt document and assert paragraph alignment 141*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 142*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_odt = assertDocument_odt.getText().createTextCursor(); 143*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_odt); 144*eba4d44aSLiu Zhe //verify paragraph alignment property 145*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is left",(short)0,xCursorProps_assert_odt.getPropertyValue("ParaAdjust")); 146*eba4d44aSLiu Zhe //reopen the doc document and assert paragraph alignment 147*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 148*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor(); 149*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_doc); 150*eba4d44aSLiu Zhe //verify paragraph alignment property 151*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is left",(short)0,xCursorProps_assert_doc.getPropertyValue("ParaAdjust")); 152*eba4d44aSLiu Zhe 153*eba4d44aSLiu Zhe 154*eba4d44aSLiu Zhe } 155*eba4d44aSLiu Zhe /* 156*eba4d44aSLiu Zhe * test paragraph alignment is justified 157*eba4d44aSLiu Zhe * 1.new a text document 158*eba4d44aSLiu Zhe * 2.insert some text 159*eba4d44aSLiu Zhe * 3.set paragraph alignment is right 160*eba4d44aSLiu Zhe * 4.save and close the document 161*eba4d44aSLiu Zhe * 5.reload the saved document and check the paragraph alignment 162*eba4d44aSLiu Zhe */ 163*eba4d44aSLiu Zhe @Test 164*eba4d44aSLiu Zhe public void testParagraphAlignmentRight() throws Exception { 165*eba4d44aSLiu Zhe 166*eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 167*eba4d44aSLiu Zhe xText = xTextDocument.getText(); 168*eba4d44aSLiu 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!" + 169*eba4d44aSLiu Zhe "Hello,world!Hello,world!"); 170*eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 171*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 172*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 173*eba4d44aSLiu Zhe //apply paragraph alignment as justified and last line alignment 174*eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 175*eba4d44aSLiu Zhe xTextCursor.goRight((short)180 , true); 176*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("ParaAdjust",com.sun.star.style.ParagraphAdjust.RIGHT); 177*eba4d44aSLiu Zhe //save to odt 178*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 179*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 180*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 181*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 182*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 183*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 184*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 185*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 186*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 187*eba4d44aSLiu Zhe //save to doc 188*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 189*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 190*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 191*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 192*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 193*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 194*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 195*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 196*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 197*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 198*eba4d44aSLiu Zhe 199*eba4d44aSLiu Zhe //reopen the document and assert paragraph alignment 200*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 201*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_odt = assertDocument_odt.getText().createTextCursor(); 202*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_odt); 203*eba4d44aSLiu Zhe //verify paragraph alignment property 204*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is right",(short)1,xCursorProps_assert_odt.getPropertyValue("ParaAdjust")); 205*eba4d44aSLiu Zhe //reopen the document and assert paragraph alignment 206*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 207*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor(); 208*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_doc); 209*eba4d44aSLiu Zhe //verify paragraph alignment property 210*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is right",(short)1,xCursorProps_assert_doc.getPropertyValue("ParaAdjust")); 211*eba4d44aSLiu Zhe } 212*eba4d44aSLiu Zhe /* 213*eba4d44aSLiu Zhe * test paragraph alignment is justified 214*eba4d44aSLiu Zhe * 1.new a text document 215*eba4d44aSLiu Zhe * 2.insert some text 216*eba4d44aSLiu Zhe * 3.set paragraph alignment is center 217*eba4d44aSLiu Zhe * 4.save and close the document 218*eba4d44aSLiu Zhe * 5.reload the saved document and check the paragraph alignment 219*eba4d44aSLiu Zhe */ 220*eba4d44aSLiu Zhe @Test 221*eba4d44aSLiu Zhe public void testParagraphAlignmentCenter() throws Exception { 222*eba4d44aSLiu Zhe 223*eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 224*eba4d44aSLiu Zhe xText = xTextDocument.getText(); 225*eba4d44aSLiu 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!" + 226*eba4d44aSLiu Zhe "Hello,world!Hello,world!"); 227*eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 228*eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 229*eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 230*eba4d44aSLiu Zhe //apply paragraph alignment as justified and last line alignment 231*eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 232*eba4d44aSLiu Zhe xTextCursor.goRight((short)180 , true); 233*eba4d44aSLiu Zhe xCursorProps.setPropertyValue("ParaAdjust",com.sun.star.style.ParagraphAdjust.CENTER); 234*eba4d44aSLiu Zhe //save to odt 235*eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 236*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 237*eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 238*eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 239*eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 240*eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 241*eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 242*eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 243*eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 244*eba4d44aSLiu Zhe //save to doc 245*eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 246*eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 247*eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 248*eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 249*eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 250*eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 251*eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 252*eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 253*eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 254*eba4d44aSLiu Zhe 255*eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 256*eba4d44aSLiu Zhe 257*eba4d44aSLiu Zhe //reopen the document and assert paragraph alignment 258*eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 259*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_odt = assertDocument_odt.getText().createTextCursor(); 260*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_odt); 261*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is center",(short)3,xCursorProps_assert_odt.getPropertyValue("ParaAdjust")); 262*eba4d44aSLiu Zhe //reopen the document and assert paragraph alignment 263*eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 264*eba4d44aSLiu Zhe XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor(); 265*eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_doc); 266*eba4d44aSLiu Zhe assertEquals("assert first paragraph alignment is center",(short)3,xCursorProps_assert_doc.getPropertyValue("ParaAdjust")); 267*eba4d44aSLiu Zhe } 268*eba4d44aSLiu Zhe } 269