xref: /trunk/test/testuno/source/fvt/uno/sw/paragraph/ParagraphLineSpacing.java (revision eba4d44a33e5be0b2528d5a9a6f0dcbf65adaa0d)
1 package fvt.uno.sw.paragraph;
2 
3 import static org.junit.Assert.*;
4 
5 import org.junit.After;
6 import org.junit.Before;
7 import org.junit.Ignore;
8 import org.junit.Test;
9 import org.openoffice.test.common.FileUtil;
10 import org.openoffice.test.common.Testspace;
11 import org.openoffice.test.uno.UnoApp;
12 //import org.openoffice.test.vcl.Tester.*;
13 import com.sun.star.text.*;
14 import com.sun.star.beans.*;
15 import com.sun.star.frame.XStorable;
16 import com.sun.star.uno.UnoRuntime;
17 import com.sun.star.style.*;
18 
19 public class ParagraphLineSpacing {
20     private static final UnoApp app = new UnoApp();
21     XText xText = null;
22 
23     @Before
24     public void setUp() throws Exception {
25         app.start();
26 
27     }
28 
29     @After
30     public void tearDown() throws Exception {
31         app.close();
32     }
33     /*
34      * test paragraph line spacing is fix
35      * 1.new a text document
36      * 2.insert some text
37      * 3.set paragraph line spacing is fix
38      * 4.save and close the document
39      * 5.reload the saved document and check the paragraph line spacing
40      */
41     @Test
42     public void testParagraphLineSpacingFix() throws Exception {
43 
44         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
45         xText = xTextDocument.getText();
46         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!" +
47                 "Hello,world!Hello,world!");
48         // create text cursor for selecting and formatting text
49         XTextCursor xTextCursor = xText.createTextCursor();
50         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
51         //set paragraph line spacing
52         LineSpacing lineSpacing = new LineSpacing();
53         lineSpacing.Mode = LineSpacingMode.FIX;
54         lineSpacing.Height = 5000;
55         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
56         //save to odt
57         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
58         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
59         aStoreProperties_odt[0] = new PropertyValue();
60         aStoreProperties_odt[1] = new PropertyValue();
61         aStoreProperties_odt[0].Name = "Override";
62         aStoreProperties_odt[0].Value = true;
63         aStoreProperties_odt[1].Name = "FilterName";
64         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
65         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
66         //save to doc
67         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
68         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
69         aStoreProperties_doc[0] = new PropertyValue();
70         aStoreProperties_doc[1] = new PropertyValue();
71         aStoreProperties_doc[0].Name = "Override";
72         aStoreProperties_doc[0].Value = true;
73         aStoreProperties_doc[1].Name = "FilterName";
74         aStoreProperties_doc[1].Value = "MS Word 97";
75         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
76         app.closeDocument(xTextDocument);
77 
78         //reopen the document and assert paragraph line spacing
79         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
80         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
81         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
82         assertEquals("assert first paragraph line spacing is fix",LineSpacingMode.FIX,paraLineSpacing_assert_odt.Mode);
83         assertEquals("assert first paragraph line spacing is fix",5001,paraLineSpacing_assert_odt.Height);
84 
85         //reopen the document and assert paragraph line spacing
86         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
87         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
88         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
89         assertEquals("assert first paragraph line spacing is fix",LineSpacingMode.FIX,paraLineSpacing_assert_doc.Mode);
90         assertEquals("assert first paragraph line spacing is fix",5001,paraLineSpacing_assert_doc.Height);
91     }
92     /*
93      * test paragraph line spacing is leading
94      * 1.new a text document
95      * 2.insert some text
96      * 3.set paragraph line spacing is leading
97      * 4.save and close the document
98      * 5.reload the saved document and check the paragraph line spacing
99      */
100     @Test@Ignore("Bug #120647 - [testUNO patch]line spacing leading setting change to at least when save to doc")
101     public void testParagraphLineSpacingLeading() throws Exception {
102 
103         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
104         xText = xTextDocument.getText();
105         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!" +
106                 "Hello,world!Hello,world!");
107         // create text cursor for selecting and formatting text
108         XTextCursor xTextCursor = xText.createTextCursor();
109         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
110         //set paragraph line spacing
111         LineSpacing lineSpacing = new LineSpacing();
112         lineSpacing.Mode = LineSpacingMode.LEADING;
113         lineSpacing.Height = 5000;
114         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
115         //save to odt
116         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
117         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
118         aStoreProperties_odt[0] = new PropertyValue();
119         aStoreProperties_odt[1] = new PropertyValue();
120         aStoreProperties_odt[0].Name = "Override";
121         aStoreProperties_odt[0].Value = true;
122         aStoreProperties_odt[1].Name = "FilterName";
123         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
124         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
125         //save to doc
126         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
127         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
128         aStoreProperties_doc[0] = new PropertyValue();
129         aStoreProperties_doc[1] = new PropertyValue();
130         aStoreProperties_doc[0].Name = "Override";
131         aStoreProperties_doc[0].Value = true;
132         aStoreProperties_doc[1].Name = "FilterName";
133         aStoreProperties_doc[1].Value = "MS Word 97";
134         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
135         app.closeDocument(xTextDocument);
136 
137         //reopen the document
138         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
139         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
140         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
141         //verify paragraph line spacing property
142         assertEquals("assert first paragraph line spacing is fix",LineSpacingMode.LEADING,paraLineSpacing_assert_odt.Mode);
143         assertEquals("assert first paragraph line spacing is fix",5001,paraLineSpacing_assert_odt.Height);
144 
145         //reopen the document
146         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
147         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
148         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
149         //verify paragraph line spacing property
150         assertEquals("assert first paragraph line spacing is fix",LineSpacingMode.LEADING,paraLineSpacing_assert_doc.Mode);
151         assertEquals("assert first paragraph line spacing is fix",5001,paraLineSpacing_assert_doc.Height);
152     }
153     /*
154      * test paragraph line spacing is minimum
155      * 1.new a text document
156      * 2.insert some text
157      * 3.set paragraph line spacing is minimum
158      * 4.save and close the document
159      * 5.reload the saved document and check the paragraph line spacing
160      */
161     @Test
162     public void testParagraphLineSpacingMinimum() throws Exception {
163 
164         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
165         xText = xTextDocument.getText();
166         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!" +
167                 "Hello,world!Hello,world!");
168         // create text cursor for selecting and formatting text
169         XTextCursor xTextCursor = xText.createTextCursor();
170         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
171         //set paragraph line spacing
172         LineSpacing lineSpacing = new LineSpacing();
173         lineSpacing.Mode = LineSpacingMode.MINIMUM;
174         lineSpacing.Height = 5000;
175         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
176         //save to odt
177         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
178         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
179         aStoreProperties_odt[0] = new PropertyValue();
180         aStoreProperties_odt[1] = new PropertyValue();
181         aStoreProperties_odt[0].Name = "Override";
182         aStoreProperties_odt[0].Value = true;
183         aStoreProperties_odt[1].Name = "FilterName";
184         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
185         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
186         //save to doc
187         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
188         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
189         aStoreProperties_doc[0] = new PropertyValue();
190         aStoreProperties_doc[1] = new PropertyValue();
191         aStoreProperties_doc[0].Name = "Override";
192         aStoreProperties_doc[0].Value = true;
193         aStoreProperties_doc[1].Name = "FilterName";
194         aStoreProperties_doc[1].Value = "MS Word 97";
195         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
196         app.closeDocument(xTextDocument);
197 
198         //reopen the document
199         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
200         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
201         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
202         //verify paragraph line spacing property
203         assertEquals("assert first paragraph line spacing is fix",LineSpacingMode.MINIMUM,paraLineSpacing_assert_odt.Mode);
204         assertEquals("assert first paragraph line spacing is fix",5001,paraLineSpacing_assert_odt.Height);
205 
206         //reopen the document
207         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
208         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
209         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
210         //verify paragraph line spacing property
211         assertEquals("assert first paragraph line spacing is fix",LineSpacingMode.MINIMUM,paraLineSpacing_assert_doc.Mode);
212         assertEquals("assert first paragraph line spacing is fix",5001,paraLineSpacing_assert_doc.Height);
213     }
214     /*
215      * test paragraph line spacing is prop
216      * 1.new a text document
217      * 2.insert some text
218      * 3.set paragraph alignment is prop
219      * 4.save and close the document
220      * 5.reload the saved document and check the paragraph line spacing
221      */
222     @Test
223     public void testParagraphLineSpacingProp() throws Exception {
224 
225         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
226         xText = xTextDocument.getText();
227         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!" +
228                 "Hello,world!Hello,world!");
229         // create text cursor for selecting and formatting text
230         XTextCursor xTextCursor = xText.createTextCursor();
231         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
232         //set paragraph line spacing
233         LineSpacing lineSpacing = new LineSpacing();
234         lineSpacing.Mode = LineSpacingMode.PROP;
235         lineSpacing.Height = 150;
236         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
237         //save to odt
238         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
239         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
240         aStoreProperties_odt[0] = new PropertyValue();
241         aStoreProperties_odt[1] = new PropertyValue();
242         aStoreProperties_odt[0].Name = "Override";
243         aStoreProperties_odt[0].Value = true;
244         aStoreProperties_odt[1].Name = "FilterName";
245         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
246         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
247         //save to doc
248         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
249         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
250         aStoreProperties_doc[0] = new PropertyValue();
251         aStoreProperties_doc[1] = new PropertyValue();
252         aStoreProperties_doc[0].Name = "Override";
253         aStoreProperties_doc[0].Value = true;
254         aStoreProperties_doc[1].Name = "FilterName";
255         aStoreProperties_doc[1].Value = "MS Word 97";
256         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
257         app.closeDocument(xTextDocument);
258 
259         //reopen the document
260         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
261         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
262         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
263         //verify paragraph line spacing property
264         assertEquals("assert line spacing is prop",LineSpacingMode.PROP,paraLineSpacing_assert_odt.Mode);
265         assertEquals("assert line spacing height is 150",150,paraLineSpacing_assert_odt.Height);
266 
267         //reopen the document
268         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
269         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
270         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
271         //verify paragraph line spacing property
272         assertEquals("assert line spacing is prop",LineSpacingMode.PROP,paraLineSpacing_assert_doc.Mode);
273         assertEquals("assert line spacing height is 150",150,paraLineSpacing_assert_doc.Height);
274     }
275     /*
276      * test paragraph line spacing is single
277      * 1.new a text document
278      * 2.insert some text
279      * 3.set paragraph line spacing is single
280      * 4.save and close the document
281      * 5.reload the saved document and check the paragraph line spacing
282      */
283     @Test@Ignore("Bug #120649 - [testUNO patch]single line spacing change to at least of 0.07 when save to doc")
284     public void testParagraphLineSpacingSingle() throws Exception {
285 
286         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
287         xText = xTextDocument.getText();
288         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!" +
289                 "Hello,world!Hello,world!");
290         // create text cursor for selecting and formatting text
291         XTextCursor xTextCursor = xText.createTextCursor();
292         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
293         //set paragraph line spacing
294         LineSpacing lineSpacing = new LineSpacing();
295         lineSpacing.Height = 100;
296         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
297         //save to odt
298         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
299         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
300         aStoreProperties_odt[0] = new PropertyValue();
301         aStoreProperties_odt[1] = new PropertyValue();
302         aStoreProperties_odt[0].Name = "Override";
303         aStoreProperties_odt[0].Value = true;
304         aStoreProperties_odt[1].Name = "FilterName";
305         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
306         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
307         //save to doc
308         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
309         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
310         aStoreProperties_doc[0] = new PropertyValue();
311         aStoreProperties_doc[1] = new PropertyValue();
312         aStoreProperties_doc[0].Name = "Override";
313         aStoreProperties_doc[0].Value = true;
314         aStoreProperties_doc[1].Name = "FilterName";
315         aStoreProperties_doc[1].Value = "MS Word 97";
316         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
317         app.closeDocument(xTextDocument);
318 
319         //reopen the document
320         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
321         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
322         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
323         //verify paragraph line spacing property
324         assertEquals("assert first paragraph line spacing is single",100,paraLineSpacing_assert_odt.Height);
325 
326         //reopen the document
327         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
328         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
329         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
330         //verify paragraph line spacing property
331         assertEquals("assert first paragraph line spacing is single",100,paraLineSpacing_assert_doc.Height);
332     }
333     /*
334      * test paragraph line spacing is double
335      * 1.new a text document
336      * 2.insert some text
337      * 3.set paragraph line spacing is double
338      * 4.save and close the document
339      * 5.reload the saved document and check the paragraph line spacing
340      */
341     @Test
342     public void testParagraphLineSpacingDouble() throws Exception {
343 
344         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
345         xText = xTextDocument.getText();
346         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!" +
347                 "Hello,world!Hello,world!");
348         // create text cursor for selecting and formatting text
349         XTextCursor xTextCursor = xText.createTextCursor();
350         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
351         //set paragraph line spacing
352         LineSpacing lineSpacing = new LineSpacing();
353         lineSpacing.Height = 200;
354         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
355         //save to odt
356         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
357         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
358         aStoreProperties_odt[0] = new PropertyValue();
359         aStoreProperties_odt[1] = new PropertyValue();
360         aStoreProperties_odt[0].Name = "Override";
361         aStoreProperties_odt[0].Value = true;
362         aStoreProperties_odt[1].Name = "FilterName";
363         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
364         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
365         //save to doc
366         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
367         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
368         aStoreProperties_doc[0] = new PropertyValue();
369         aStoreProperties_doc[1] = new PropertyValue();
370         aStoreProperties_doc[0].Name = "Override";
371         aStoreProperties_doc[0].Value = true;
372         aStoreProperties_doc[1].Name = "FilterName";
373         aStoreProperties_doc[1].Value = "MS Word 97";
374         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
375         app.closeDocument(xTextDocument);
376 
377         //reopen the document and assert line spacing
378         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
379         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
380         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
381         //verify paragraph line spacing property
382         assertEquals("assert first paragraph line spacing is single",200,paraLineSpacing_assert_odt.Height);
383 
384         //reopen the document and assert line spacing
385         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
386         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
387         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
388         //verify paragraph line spacing property
389         assertEquals("assert first paragraph line spacing is single",200,paraLineSpacing_assert_doc.Height);
390     }
391     /*
392      * test paragraph line spacing is 1.5line
393      * 1.new a text document
394      * 2.insert some text
395      * 3.set paragraph line spacing is 1.5line
396      * 4.save and close the document
397      * 5.reload the saved document and check the paragraph line spacing
398      */
399     @Test
400     public void testParagraphLineSpacingUserDefine() throws Exception {
401 
402         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
403         xText = xTextDocument.getText();
404         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!" +
405                 "Hello,world!Hello,world!");
406         // create text cursor for selecting and formatting text
407         XTextCursor xTextCursor = xText.createTextCursor();
408         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
409         //set paragraph line spacing
410         LineSpacing lineSpacing = new LineSpacing();
411         lineSpacing.Height = 150;
412         xCursorProps.setPropertyValue("ParaLineSpacing",lineSpacing);
413         //save to odt
414         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
415         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
416         aStoreProperties_odt[0] = new PropertyValue();
417         aStoreProperties_odt[1] = new PropertyValue();
418         aStoreProperties_odt[0].Name = "Override";
419         aStoreProperties_odt[0].Value = true;
420         aStoreProperties_odt[1].Name = "FilterName";
421         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
422         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
423         //save to doc
424         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
425         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
426         aStoreProperties_doc[0] = new PropertyValue();
427         aStoreProperties_doc[1] = new PropertyValue();
428         aStoreProperties_doc[0].Name = "Override";
429         aStoreProperties_doc[0].Value = true;
430         aStoreProperties_doc[1].Name = "FilterName";
431         aStoreProperties_doc[1].Value = "MS Word 97";
432         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
433         app.closeDocument(xTextDocument);
434 
435         //reopen the document
436         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
437         XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_odt.getText().createTextCursor());
438         LineSpacing paraLineSpacing_assert_odt=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_odt.getPropertyValue("ParaLineSpacing"));
439         //verify paragraph line spacing property
440         assertEquals("assert first paragraph line spacing is single",150,paraLineSpacing_assert_odt.Height);
441 
442         //reopen the document
443         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
444         XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,assertDocument_doc.getText().createTextCursor());
445         LineSpacing paraLineSpacing_assert_doc=(LineSpacing) UnoRuntime.queryInterface(LineSpacing.class, xCursorProps_assert_doc.getPropertyValue("ParaLineSpacing"));
446         //verify paragraph line spacing property
447         assertEquals("assert first paragraph line spacing is single",150,paraLineSpacing_assert_doc.Height);
448     }
449 }
450