xref: /trunk/test/testuno/source/fvt/uno/sw/paragraph/ParagraphNumberingAndBulletAlignment.java (revision eba4d44a33e5be0b2528d5a9a6f0dcbf65adaa0d)
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.Test;
8*eba4d44aSLiu Zhe import org.openoffice.test.common.FileUtil;
9*eba4d44aSLiu Zhe import org.openoffice.test.common.Testspace;
10*eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp;
11*eba4d44aSLiu Zhe 
12*eba4d44aSLiu Zhe import com.sun.star.style.NumberingType;
13*eba4d44aSLiu Zhe import com.sun.star.text.*;
14*eba4d44aSLiu Zhe import com.sun.star.beans.*;
15*eba4d44aSLiu Zhe import com.sun.star.container.XIndexAccess;
16*eba4d44aSLiu Zhe import com.sun.star.container.XIndexReplace;
17*eba4d44aSLiu Zhe import com.sun.star.frame.XStorable;
18*eba4d44aSLiu Zhe import com.sun.star.lang.XMultiServiceFactory;
19*eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime;
20*eba4d44aSLiu Zhe 
21*eba4d44aSLiu Zhe public class ParagraphNumberingAndBulletAlignment {
22*eba4d44aSLiu Zhe     private static final UnoApp app = new UnoApp();
23*eba4d44aSLiu Zhe     XText xText = null;
24*eba4d44aSLiu Zhe 
25*eba4d44aSLiu Zhe     @Before
26*eba4d44aSLiu Zhe     public void setUp() throws Exception {
27*eba4d44aSLiu Zhe         app.start();
28*eba4d44aSLiu Zhe 
29*eba4d44aSLiu Zhe     }
30*eba4d44aSLiu Zhe 
31*eba4d44aSLiu Zhe     @After
32*eba4d44aSLiu Zhe     public void tearDown() throws Exception {
33*eba4d44aSLiu Zhe         app.close();
34*eba4d44aSLiu Zhe     }
35*eba4d44aSLiu Zhe     /*
36*eba4d44aSLiu Zhe      * test paragraph background color
37*eba4d44aSLiu Zhe      * 1.new a text document
38*eba4d44aSLiu Zhe      * 2.insert some text
39*eba4d44aSLiu Zhe      * 3.set paragraph numbering alignment
40*eba4d44aSLiu Zhe      * 4.save and close the document
41*eba4d44aSLiu Zhe      * 5.reload the saved document and check the paragraph numbering alignment
42*eba4d44aSLiu Zhe      */
43*eba4d44aSLiu Zhe     @Test
44*eba4d44aSLiu Zhe     public void testNumberingBulletAlign_Right() throws Exception {
45*eba4d44aSLiu Zhe 
46*eba4d44aSLiu Zhe         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
47*eba4d44aSLiu Zhe         xText = xTextDocument.getText();
48*eba4d44aSLiu Zhe         xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
49*eba4d44aSLiu Zhe                 "Hello,world!Hello,world!");
50*eba4d44aSLiu Zhe         //create cursor to select paragraph and formating paragraph
51*eba4d44aSLiu Zhe         XTextCursor xTextCursor = xText.createTextCursor();
52*eba4d44aSLiu Zhe         //create paragraph property set
53*eba4d44aSLiu Zhe         XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
54*eba4d44aSLiu Zhe         //create document service factory
55*eba4d44aSLiu Zhe         XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
56*eba4d44aSLiu Zhe         //set numbering character
57*eba4d44aSLiu Zhe         XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
58*eba4d44aSLiu Zhe         PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
59*eba4d44aSLiu Zhe         propsRule[1].Name = "NumberingType";
60*eba4d44aSLiu Zhe         propsRule[1].Value = NumberingType.ARABIC;
61*eba4d44aSLiu Zhe         propsRule[0].Name = "Adjust";
62*eba4d44aSLiu Zhe         propsRule[0].Value = HoriOrientation.RIGHT;
63*eba4d44aSLiu Zhe         XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
64*eba4d44aSLiu Zhe         xReplaceRule.replaceByIndex(0, propsRule);
65*eba4d44aSLiu Zhe         //set paragraph numbering and bullet character
66*eba4d44aSLiu Zhe         xTextProps.setPropertyValue("NumberingRules", xNumRule);
67*eba4d44aSLiu Zhe         //save to odt
68*eba4d44aSLiu Zhe         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
69*eba4d44aSLiu Zhe         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
70*eba4d44aSLiu Zhe         aStoreProperties_odt[0] = new PropertyValue();
71*eba4d44aSLiu Zhe         aStoreProperties_odt[1] = new PropertyValue();
72*eba4d44aSLiu Zhe         aStoreProperties_odt[0].Name = "Override";
73*eba4d44aSLiu Zhe         aStoreProperties_odt[0].Value = true;
74*eba4d44aSLiu Zhe         aStoreProperties_odt[1].Name = "FilterName";
75*eba4d44aSLiu Zhe         aStoreProperties_odt[1].Value = "writer8";
76*eba4d44aSLiu Zhe         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
77*eba4d44aSLiu Zhe         //save to doc
78*eba4d44aSLiu Zhe         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
79*eba4d44aSLiu Zhe         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
80*eba4d44aSLiu Zhe         aStoreProperties_doc[0] = new PropertyValue();
81*eba4d44aSLiu Zhe         aStoreProperties_doc[1] = new PropertyValue();
82*eba4d44aSLiu Zhe         aStoreProperties_doc[0].Name = "Override";
83*eba4d44aSLiu Zhe         aStoreProperties_doc[0].Value = true;
84*eba4d44aSLiu Zhe         aStoreProperties_doc[1].Name = "FilterName";
85*eba4d44aSLiu Zhe         aStoreProperties_doc[1].Value = "MS Word 97";
86*eba4d44aSLiu Zhe         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
87*eba4d44aSLiu Zhe         app.closeDocument(xTextDocument);
88*eba4d44aSLiu Zhe 
89*eba4d44aSLiu Zhe         //reopen the document
90*eba4d44aSLiu Zhe         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
91*eba4d44aSLiu Zhe         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
92*eba4d44aSLiu Zhe         XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
93*eba4d44aSLiu Zhe         XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
94*eba4d44aSLiu Zhe         PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
95*eba4d44aSLiu Zhe         //verify paragraph numbering and bullet alignment
96*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
97*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",HoriOrientation.RIGHT,propsRule_assert_odt[0].Value);
98*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
99*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
100*eba4d44aSLiu Zhe 
101*eba4d44aSLiu Zhe         //reopen the document
102*eba4d44aSLiu Zhe         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
103*eba4d44aSLiu Zhe         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
104*eba4d44aSLiu Zhe         XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
105*eba4d44aSLiu Zhe         PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
106*eba4d44aSLiu Zhe         //verify paragraph numbering and bullet alignment
107*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
108*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",HoriOrientation.RIGHT,propsRule_assert_doc[0].Value);
109*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
110*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
111*eba4d44aSLiu Zhe     }
112*eba4d44aSLiu Zhe     @Test
113*eba4d44aSLiu Zhe     public void testNumberingBulletAlign_Left() throws Exception {
114*eba4d44aSLiu Zhe 
115*eba4d44aSLiu Zhe         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
116*eba4d44aSLiu Zhe         xText = xTextDocument.getText();
117*eba4d44aSLiu Zhe         xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
118*eba4d44aSLiu Zhe                 "Hello,world!Hello,world!");
119*eba4d44aSLiu Zhe         //create cursor to select paragraph and formating paragraph
120*eba4d44aSLiu Zhe         XTextCursor xTextCursor = xText.createTextCursor();
121*eba4d44aSLiu Zhe         //create paragraph property set
122*eba4d44aSLiu Zhe         XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
123*eba4d44aSLiu Zhe         //create document service factory
124*eba4d44aSLiu Zhe         XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
125*eba4d44aSLiu Zhe         //set numbering character
126*eba4d44aSLiu Zhe         XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
127*eba4d44aSLiu Zhe         PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
128*eba4d44aSLiu Zhe         propsRule[1].Name = "NumberingType";
129*eba4d44aSLiu Zhe         propsRule[1].Value = NumberingType.ARABIC;
130*eba4d44aSLiu Zhe         propsRule[0].Name = "Adjust";
131*eba4d44aSLiu Zhe         propsRule[0].Value = HoriOrientation.LEFT;
132*eba4d44aSLiu Zhe         XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
133*eba4d44aSLiu Zhe         xReplaceRule.replaceByIndex(0, propsRule);
134*eba4d44aSLiu Zhe         //set paragraph numbering and bullet character
135*eba4d44aSLiu Zhe         xTextProps.setPropertyValue("NumberingRules", xNumRule);
136*eba4d44aSLiu Zhe         //save to odt
137*eba4d44aSLiu Zhe         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
138*eba4d44aSLiu Zhe         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
139*eba4d44aSLiu Zhe         aStoreProperties_odt[0] = new PropertyValue();
140*eba4d44aSLiu Zhe         aStoreProperties_odt[1] = new PropertyValue();
141*eba4d44aSLiu Zhe         aStoreProperties_odt[0].Name = "Override";
142*eba4d44aSLiu Zhe         aStoreProperties_odt[0].Value = true;
143*eba4d44aSLiu Zhe         aStoreProperties_odt[1].Name = "FilterName";
144*eba4d44aSLiu Zhe         aStoreProperties_odt[1].Value = "writer8";
145*eba4d44aSLiu Zhe         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
146*eba4d44aSLiu Zhe         //save to doc
147*eba4d44aSLiu Zhe         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
148*eba4d44aSLiu Zhe         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
149*eba4d44aSLiu Zhe         aStoreProperties_doc[0] = new PropertyValue();
150*eba4d44aSLiu Zhe         aStoreProperties_doc[1] = new PropertyValue();
151*eba4d44aSLiu Zhe         aStoreProperties_doc[0].Name = "Override";
152*eba4d44aSLiu Zhe         aStoreProperties_doc[0].Value = true;
153*eba4d44aSLiu Zhe         aStoreProperties_doc[1].Name = "FilterName";
154*eba4d44aSLiu Zhe         aStoreProperties_doc[1].Value = "MS Word 97";
155*eba4d44aSLiu Zhe         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
156*eba4d44aSLiu Zhe         app.closeDocument(xTextDocument);
157*eba4d44aSLiu Zhe 
158*eba4d44aSLiu Zhe         //reopen the document
159*eba4d44aSLiu Zhe         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
160*eba4d44aSLiu Zhe         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
161*eba4d44aSLiu Zhe         XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
162*eba4d44aSLiu Zhe         XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
163*eba4d44aSLiu Zhe         PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
164*eba4d44aSLiu Zhe         //verify paragraph numbering and bullet alignment
165*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
166*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",HoriOrientation.LEFT,propsRule_assert_odt[0].Value);
167*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
168*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
169*eba4d44aSLiu Zhe 
170*eba4d44aSLiu Zhe         //reopen the document
171*eba4d44aSLiu Zhe         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
172*eba4d44aSLiu Zhe         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
173*eba4d44aSLiu Zhe         XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
174*eba4d44aSLiu Zhe         PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
175*eba4d44aSLiu Zhe         //verify paragraph numbering and bullet alignment
176*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
177*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",HoriOrientation.LEFT,propsRule_assert_doc[0].Value);
178*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
179*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
180*eba4d44aSLiu Zhe     }
181*eba4d44aSLiu Zhe     @Test
182*eba4d44aSLiu Zhe     public void testNumberingBulletAlign_Center() throws Exception {
183*eba4d44aSLiu Zhe 
184*eba4d44aSLiu Zhe         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
185*eba4d44aSLiu Zhe         xText = xTextDocument.getText();
186*eba4d44aSLiu Zhe         xText.setString("we are Chinese,they are American.\nwe are all living in one earth!\nHello,world!Hello,world!Hello,world!\nHello,world!Hello,world!Hello,world!" +
187*eba4d44aSLiu Zhe                 "Hello,world!Hello,world!");
188*eba4d44aSLiu Zhe         //create cursor to select paragraph and formating paragraph
189*eba4d44aSLiu Zhe         XTextCursor xTextCursor = xText.createTextCursor();
190*eba4d44aSLiu Zhe         //create paragraph property set
191*eba4d44aSLiu Zhe         XPropertySet xTextProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
192*eba4d44aSLiu Zhe         //create document service factory
193*eba4d44aSLiu Zhe         XMultiServiceFactory  xWriterFactory= (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
194*eba4d44aSLiu Zhe         //set numbering character
195*eba4d44aSLiu Zhe         XIndexAccess xNumRule = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,xWriterFactory.createInstance("com.sun.star.text.NumberingRules"));
196*eba4d44aSLiu Zhe         PropertyValue[] propsRule = {new PropertyValue(),new PropertyValue()};
197*eba4d44aSLiu Zhe         propsRule[1].Name = "NumberingType";
198*eba4d44aSLiu Zhe         propsRule[1].Value = NumberingType.ARABIC;
199*eba4d44aSLiu Zhe         propsRule[0].Name = "Adjust";
200*eba4d44aSLiu Zhe         propsRule[0].Value = HoriOrientation.CENTER;
201*eba4d44aSLiu Zhe         XIndexReplace xReplaceRule = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule);
202*eba4d44aSLiu Zhe         xReplaceRule.replaceByIndex(0, propsRule);
203*eba4d44aSLiu Zhe         //set paragraph numbering and bullet character
204*eba4d44aSLiu Zhe         xTextProps.setPropertyValue("NumberingRules", xNumRule);
205*eba4d44aSLiu Zhe         //save to odt
206*eba4d44aSLiu Zhe         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
207*eba4d44aSLiu Zhe         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
208*eba4d44aSLiu Zhe         aStoreProperties_odt[0] = new PropertyValue();
209*eba4d44aSLiu Zhe         aStoreProperties_odt[1] = new PropertyValue();
210*eba4d44aSLiu Zhe         aStoreProperties_odt[0].Name = "Override";
211*eba4d44aSLiu Zhe         aStoreProperties_odt[0].Value = true;
212*eba4d44aSLiu Zhe         aStoreProperties_odt[1].Name = "FilterName";
213*eba4d44aSLiu Zhe         aStoreProperties_odt[1].Value = "writer8";
214*eba4d44aSLiu Zhe         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
215*eba4d44aSLiu Zhe         //save to doc
216*eba4d44aSLiu Zhe         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
217*eba4d44aSLiu Zhe         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
218*eba4d44aSLiu Zhe         aStoreProperties_doc[0] = new PropertyValue();
219*eba4d44aSLiu Zhe         aStoreProperties_doc[1] = new PropertyValue();
220*eba4d44aSLiu Zhe         aStoreProperties_doc[0].Name = "Override";
221*eba4d44aSLiu Zhe         aStoreProperties_doc[0].Value = true;
222*eba4d44aSLiu Zhe         aStoreProperties_doc[1].Name = "FilterName";
223*eba4d44aSLiu Zhe         aStoreProperties_doc[1].Value = "MS Word 97";
224*eba4d44aSLiu Zhe         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
225*eba4d44aSLiu Zhe         app.closeDocument(xTextDocument);
226*eba4d44aSLiu Zhe 
227*eba4d44aSLiu Zhe         //reopen the document
228*eba4d44aSLiu Zhe         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
229*eba4d44aSLiu Zhe         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
230*eba4d44aSLiu Zhe         XIndexAccess xNumRule_assert_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_odt.getPropertyValue("NumberingRules"));
231*eba4d44aSLiu Zhe         XIndexReplace xReplaceRule_assert_odt = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xNumRule_assert_odt);
232*eba4d44aSLiu Zhe         PropertyValue[] propsRule_assert_odt=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xReplaceRule_assert_odt.getByIndex(0));
233*eba4d44aSLiu Zhe         //verify paragraph numbering and bullet alignment
234*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","Adjust",propsRule_assert_odt[0].Name);
235*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",HoriOrientation.CENTER,propsRule_assert_odt[0].Value);
236*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_odt[11].Name);
237*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_odt[11].Value);
238*eba4d44aSLiu Zhe 
239*eba4d44aSLiu Zhe         //reopen the document
240*eba4d44aSLiu Zhe         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
241*eba4d44aSLiu Zhe         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
242*eba4d44aSLiu Zhe         XIndexAccess xNumRule_assert_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xCursorProps_Assert_doc.getPropertyValue("NumberingRules"));
243*eba4d44aSLiu Zhe         PropertyValue[] propsRule_assert_doc=(PropertyValue[]) UnoRuntime.queryInterface(PropertyValue[].class,xNumRule_assert_doc.getByIndex(0));
244*eba4d44aSLiu Zhe         //verify paragraph numbering and bullet alignment
245*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","Adjust",propsRule_assert_doc[0].Name);
246*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",HoriOrientation.CENTER,propsRule_assert_doc[0].Value);
247*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet","NumberingType",propsRule_assert_doc[11].Name);
248*eba4d44aSLiu Zhe         assertEquals("assert numbering and bullet",NumberingType.ARABIC,propsRule_assert_doc[11].Value);
249*eba4d44aSLiu Zhe     }
250*eba4d44aSLiu Zhe }
251