xref: /trunk/test/testuno/source/fvt/uno/sw/paragraph/ParagraphInsertBreak.java (revision a7b613a6af1cb6c17f72fb50272cb23f0021e01b)
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 com.sun.star.text.*;
13 import com.sun.star.beans.*;
14 import com.sun.star.frame.XStorable;
15 import com.sun.star.uno.UnoRuntime;
16 
17 public class ParagraphInsertBreak {
18     private static final UnoApp app = new UnoApp();
19     XText xText = null;
20 
21     @Before
22     public void setUp() throws Exception {
23         app.start();
24 
25     }
26 
27     @After
28     public void tearDown() throws Exception {
29         app.close();
30     }
31     @Test
32     public void InsertPage_BeforeBreak_NoSplit_KeepTogether() throws Exception {
33 
34         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
35         xText = xTextDocument.getText();
36         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!" +
37                 "Hello,world!Hello,world!");
38         // create text cursor for selecting and formatting text
39         XTextCursor xTextCursor = xText.createTextCursor();
40         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
41         //set paragraph break type
42         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
43         xCursorProps.setPropertyValue("ParaSplit",false);
44         xCursorProps.setPropertyValue("ParaKeepTogether",true);
45         //save to odt
46         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
47         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
48         aStoreProperties_odt[0] = new PropertyValue();
49         aStoreProperties_odt[1] = new PropertyValue();
50         aStoreProperties_odt[0].Name = "Override";
51         aStoreProperties_odt[0].Value = true;
52         aStoreProperties_odt[1].Name = "FilterName";
53         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
54         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
55         //save to doc
56         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
57         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
58         aStoreProperties_doc[0] = new PropertyValue();
59         aStoreProperties_doc[1] = new PropertyValue();
60         aStoreProperties_doc[0].Name = "Override";
61         aStoreProperties_doc[0].Value = true;
62         aStoreProperties_doc[1].Name = "FilterName";
63         aStoreProperties_doc[1].Value = "MS Word 97";
64         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
65         app.closeDocument(xTextDocument);
66 
67         //reopen the document
68         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
69         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
70         //verify paragraph break
71         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
72         assertEquals("assert paragraph break",false,xCursorProps_Assert_odt.getPropertyValue("ParaSplit"));
73         assertEquals("assert paragraph break",true,xCursorProps_Assert_odt.getPropertyValue("ParaKeepTogether"));
74 
75         //reopen the document
76         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
77         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
78         //verify paragraph background color
79         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
80         assertEquals("assert paragraph break",false,xCursorProps_Assert_doc.getPropertyValue("ParaSplit"));
81         assertEquals("assert paragraph break",true,xCursorProps_Assert_doc.getPropertyValue("ParaKeepTogether"));
82     }
83     @Test
84     public void InsertPage_BeforeBreak_Orphan_WindowControl() throws Exception {
85 
86         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
87         xText = xTextDocument.getText();
88         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!" +
89                 "Hello,world!Hello,world!");
90         // create text cursor for selecting and formatting text
91         XTextCursor xTextCursor = xText.createTextCursor();
92         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
93         //set paragraph break type
94         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
95         xCursorProps.setPropertyValue("ParaOrphans",(byte)2);
96         xCursorProps.setPropertyValue("ParaWidows",(byte)2);
97         //save to odt
98         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
99         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
100         aStoreProperties_odt[0] = new PropertyValue();
101         aStoreProperties_odt[1] = new PropertyValue();
102         aStoreProperties_odt[0].Name = "Override";
103         aStoreProperties_odt[0].Value = true;
104         aStoreProperties_odt[1].Name = "FilterName";
105         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
106         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
107         //save to doc
108         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
109         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
110         aStoreProperties_doc[0] = new PropertyValue();
111         aStoreProperties_doc[1] = new PropertyValue();
112         aStoreProperties_doc[0].Name = "Override";
113         aStoreProperties_doc[0].Value = true;
114         aStoreProperties_doc[1].Name = "FilterName";
115         aStoreProperties_doc[1].Value = "MS Word 97";
116         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
117         app.closeDocument(xTextDocument);
118 
119         //reopen the document
120         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
121         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
122         //verify paragraph break
123         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
124         assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaOrphans"));
125         assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaWidows"));
126 
127         //reopen the document
128         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
129         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
130         //verify paragraph background color
131         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
132         assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaOrphans"));
133         assertEquals("assert paragraph break",(byte)2,xCursorProps_Assert_odt.getPropertyValue("ParaWidows"));
134     }
135     @Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
136     public void InsertPage_AfterBreak() throws Exception {
137 
138         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
139         xText = xTextDocument.getText();
140         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!" +
141                 "Hello,world!Hello,world!");
142         // create text cursor for selecting and formatting text
143         XTextCursor xTextCursor = xText.createTextCursor();
144         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
145         //set paragraph break type
146         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_AFTER);
147         //save to odt
148         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
149         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
150         aStoreProperties_odt[0] = new PropertyValue();
151         aStoreProperties_odt[1] = new PropertyValue();
152         aStoreProperties_odt[0].Name = "Override";
153         aStoreProperties_odt[0].Value = true;
154         aStoreProperties_odt[1].Name = "FilterName";
155         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
156         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
157         //save to doc
158         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
159         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
160         aStoreProperties_doc[0] = new PropertyValue();
161         aStoreProperties_doc[1] = new PropertyValue();
162         aStoreProperties_doc[0].Name = "Override";
163         aStoreProperties_doc[0].Value = true;
164         aStoreProperties_doc[1].Name = "FilterName";
165         aStoreProperties_doc[1].Value = "MS Word 97";
166         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
167         app.closeDocument(xTextDocument);
168 
169         //reopen the document
170         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
171         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
172         //verify paragraph break
173         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
174 
175         //reopen the document
176         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
177         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
178         //verify paragraph break
179         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
180     }
181     @Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
182     public void InsertColumn_BeforeBreak() throws Exception {
183 
184         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
185         xText = xTextDocument.getText();
186         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!" +
187                 "Hello,world!Hello,world!");
188         // create text cursor for selecting and formatting text
189         XTextCursor xTextCursor = xText.createTextCursor();
190         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
191         //set paragraph break type
192         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_BEFORE);
193         //save to odt
194         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
195         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
196         aStoreProperties_odt[0] = new PropertyValue();
197         aStoreProperties_odt[1] = new PropertyValue();
198         aStoreProperties_odt[0].Name = "Override";
199         aStoreProperties_odt[0].Value = true;
200         aStoreProperties_odt[1].Name = "FilterName";
201         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
202         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
203         //save to doc
204         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
205         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
206         aStoreProperties_doc[0] = new PropertyValue();
207         aStoreProperties_doc[1] = new PropertyValue();
208         aStoreProperties_doc[0].Name = "Override";
209         aStoreProperties_doc[0].Value = true;
210         aStoreProperties_doc[1].Name = "FilterName";
211         aStoreProperties_doc[1].Value = "MS Word 97";
212         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
213         app.closeDocument(xTextDocument);
214 
215         //reopen the document
216         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
217         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
218         //verify paragraph break
219         assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
220 
221         //reopen the document
222         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
223         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
224         //verify paragraph break
225         assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
226     }
227     @Test@Ignore("Bug #120719 - [testUNO patch]the page_after break change to page_before break when save to doc.")
228     public void InsertColumn_AfterBreak() throws Exception {
229 
230         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
231         xText = xTextDocument.getText();
232         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!" +
233                 "Hello,world!Hello,world!");
234         // create text cursor for selecting and formatting text
235         XTextCursor xTextCursor = xText.createTextCursor();
236         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
237         //set paragraph break type
238         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.COLUMN_AFTER);
239         //save to odt
240         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
241         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
242         aStoreProperties_odt[0] = new PropertyValue();
243         aStoreProperties_odt[1] = new PropertyValue();
244         aStoreProperties_odt[0].Name = "Override";
245         aStoreProperties_odt[0].Value = true;
246         aStoreProperties_odt[1].Name = "FilterName";
247         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
248         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
249         //save to doc
250         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
251         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
252         aStoreProperties_doc[0] = new PropertyValue();
253         aStoreProperties_doc[1] = new PropertyValue();
254         aStoreProperties_doc[0].Name = "Override";
255         aStoreProperties_doc[0].Value = true;
256         aStoreProperties_doc[1].Name = "FilterName";
257         aStoreProperties_doc[1].Value = "MS Word 97";
258         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
259         app.closeDocument(xTextDocument);
260 
261         //reopen the document
262         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
263         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
264         //verify paragraph break
265         assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
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         //verify paragraph break
271         assertEquals("assert paragraph break",com.sun.star.style.BreakType.COLUMN_AFTER,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
272     }
273     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
274     public void InsertPage_Endnote_BeforeBreak() throws Exception {
275 
276         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
277         xText = xTextDocument.getText();
278         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!" +
279                 "Hello,world!Hello,world!");
280         // create text cursor for selecting and formatting text
281         XTextCursor xTextCursor = xText.createTextCursor();
282         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
283         //set paragraph break type
284         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
285         xCursorProps.setPropertyValue("PageDescName","Endnote");
286         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
287         //save to odt
288         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
289         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
290         aStoreProperties_odt[0] = new PropertyValue();
291         aStoreProperties_odt[1] = new PropertyValue();
292         aStoreProperties_odt[0].Name = "Override";
293         aStoreProperties_odt[0].Value = true;
294         aStoreProperties_odt[1].Name = "FilterName";
295         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
296         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
297         //save to doc
298         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
299         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
300         aStoreProperties_doc[0] = new PropertyValue();
301         aStoreProperties_doc[1] = new PropertyValue();
302         aStoreProperties_doc[0].Name = "Override";
303         aStoreProperties_doc[0].Value = true;
304         aStoreProperties_doc[1].Name = "FilterName";
305         aStoreProperties_doc[1].Value = "MS Word 97";
306         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
307         app.closeDocument(xTextDocument);
308 
309         //reopen the document
310         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
311         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
312         //verify paragraph break
313         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
314         assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
315         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
316         //reopen the document
317         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
318         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
319         //verify paragraph background color
320         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
321         assertEquals("assert paragraph break","Endnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
322         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
323     }
324 
325     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
326     public void InsertPage_Envelop_BeforeBreak() throws Exception {
327 
328         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
329         xText = xTextDocument.getText();
330         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!" +
331                 "Hello,world!Hello,world!");
332         // create text cursor for selecting and formatting text
333         XTextCursor xTextCursor = xText.createTextCursor();
334         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
335         //set paragraph break type
336         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
337         xCursorProps.setPropertyValue("PageDescName","Envelope");
338         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
339         //save to odt
340         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
341         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
342         aStoreProperties_odt[0] = new PropertyValue();
343         aStoreProperties_odt[1] = new PropertyValue();
344         aStoreProperties_odt[0].Name = "Override";
345         aStoreProperties_odt[0].Value = true;
346         aStoreProperties_odt[1].Name = "FilterName";
347         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
348         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
349         //save to doc
350         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
351         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
352         aStoreProperties_doc[0] = new PropertyValue();
353         aStoreProperties_doc[1] = new PropertyValue();
354         aStoreProperties_doc[0].Name = "Override";
355         aStoreProperties_doc[0].Value = true;
356         aStoreProperties_doc[1].Name = "FilterName";
357         aStoreProperties_doc[1].Value = "MS Word 97";
358         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
359         app.closeDocument(xTextDocument);
360 
361         //reopen the document
362         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
363         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
364         //verify paragraph break
365         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
366         assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
367         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
368         //reopen the document
369         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
370         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
371         //verify paragraph background color
372         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
373         assertEquals("assert paragraph break","Envelope",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
374         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
375     }
376 
377     @Test
378     public void InsertPage_Firstpage_BeforeBreak() throws Exception {
379 
380         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
381         xText = xTextDocument.getText();
382         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!" +
383                 "Hello,world!Hello,world!");
384         // create text cursor for selecting and formatting text
385         XTextCursor xTextCursor = xText.createTextCursor();
386         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
387         //set paragraph break type
388         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
389         xCursorProps.setPropertyValue("PageDescName","First Page");
390         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
391         //save to odt
392         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
393         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
394         aStoreProperties_odt[0] = new PropertyValue();
395         aStoreProperties_odt[1] = new PropertyValue();
396         aStoreProperties_odt[0].Name = "Override";
397         aStoreProperties_odt[0].Value = true;
398         aStoreProperties_odt[1].Name = "FilterName";
399         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
400         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
401         //save to doc
402         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
403         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
404         aStoreProperties_doc[0] = new PropertyValue();
405         aStoreProperties_doc[1] = new PropertyValue();
406         aStoreProperties_doc[0].Name = "Override";
407         aStoreProperties_doc[0].Value = true;
408         aStoreProperties_doc[1].Name = "FilterName";
409         aStoreProperties_doc[1].Value = "MS Word 97";
410         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
411         app.closeDocument(xTextDocument);
412 
413         //reopen the document
414         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
415         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
416         //verify paragraph break
417         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
418         assertEquals("assert paragraph break","First Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
419         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
420         //reopen the document
421         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
422         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
423         //verify paragraph background color
424         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
425         assertEquals("assert paragraph break","First Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
426         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
427     }
428     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
429     public void InsertPage_Footnote_BeforeBreak() throws Exception {
430 
431         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
432         xText = xTextDocument.getText();
433         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!" +
434                 "Hello,world!Hello,world!");
435         // create text cursor for selecting and formatting text
436         XTextCursor xTextCursor = xText.createTextCursor();
437         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
438         //set paragraph break type
439         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
440         xCursorProps.setPropertyValue("PageDescName","Footnote");
441         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
442         //save to odt
443         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
444         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
445         aStoreProperties_odt[0] = new PropertyValue();
446         aStoreProperties_odt[1] = new PropertyValue();
447         aStoreProperties_odt[0].Name = "Override";
448         aStoreProperties_odt[0].Value = true;
449         aStoreProperties_odt[1].Name = "FilterName";
450         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
451         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
452         //save to doc
453         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
454         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
455         aStoreProperties_doc[0] = new PropertyValue();
456         aStoreProperties_doc[1] = new PropertyValue();
457         aStoreProperties_doc[0].Name = "Override";
458         aStoreProperties_doc[0].Value = true;
459         aStoreProperties_doc[1].Name = "FilterName";
460         aStoreProperties_doc[1].Value = "MS Word 97";
461         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
462         app.closeDocument(xTextDocument);
463 
464         //reopen the document
465         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
466         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
467         //verify paragraph break
468         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
469         assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
470         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
471         //reopen the document
472         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
473         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
474         //verify paragraph background color
475         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
476         assertEquals("assert paragraph break","Footnote",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
477         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
478     }
479     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
480     public void InsertPage_HTML_BeforeBreak() throws Exception {
481 
482         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
483         xText = xTextDocument.getText();
484         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!" +
485                 "Hello,world!Hello,world!");
486         // create text cursor for selecting and formatting text
487         XTextCursor xTextCursor = xText.createTextCursor();
488         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
489         //set paragraph break type
490         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
491         xCursorProps.setPropertyValue("PageDescName","HTML");
492         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
493         //save to odt
494         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
495         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
496         aStoreProperties_odt[0] = new PropertyValue();
497         aStoreProperties_odt[1] = new PropertyValue();
498         aStoreProperties_odt[0].Name = "Override";
499         aStoreProperties_odt[0].Value = true;
500         aStoreProperties_odt[1].Name = "FilterName";
501         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
502         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
503         //save to doc
504         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
505         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
506         aStoreProperties_doc[0] = new PropertyValue();
507         aStoreProperties_doc[1] = new PropertyValue();
508         aStoreProperties_doc[0].Name = "Override";
509         aStoreProperties_doc[0].Value = true;
510         aStoreProperties_doc[1].Name = "FilterName";
511         aStoreProperties_doc[1].Value = "MS Word 97";
512         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
513         app.closeDocument(xTextDocument);
514 
515         //reopen the document
516         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
517         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
518         //verify paragraph break
519         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
520         assertEquals("assert paragraph break","HTML",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
521         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
522         //reopen the document
523         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
524         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
525         //verify paragraph background color
526         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
527         assertEquals("assert paragraph break","HTML",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
528         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
529     }
530     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
531     public void InsertPage_Index_BeforeBreak() throws Exception {
532 
533         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
534         xText = xTextDocument.getText();
535         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!" +
536                 "Hello,world!Hello,world!");
537         // create text cursor for selecting and formatting text
538         XTextCursor xTextCursor = xText.createTextCursor();
539         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
540         //set paragraph break type
541         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
542         xCursorProps.setPropertyValue("PageDescName","Index");
543         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
544         //save to odt
545         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
546         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
547         aStoreProperties_odt[0] = new PropertyValue();
548         aStoreProperties_odt[1] = new PropertyValue();
549         aStoreProperties_odt[0].Name = "Override";
550         aStoreProperties_odt[0].Value = true;
551         aStoreProperties_odt[1].Name = "FilterName";
552         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
553         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
554         //save to doc
555         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
556         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
557         aStoreProperties_doc[0] = new PropertyValue();
558         aStoreProperties_doc[1] = new PropertyValue();
559         aStoreProperties_doc[0].Name = "Override";
560         aStoreProperties_doc[0].Value = true;
561         aStoreProperties_doc[1].Name = "FilterName";
562         aStoreProperties_doc[1].Value = "MS Word 97";
563         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
564         app.closeDocument(xTextDocument);
565 
566         //reopen the document
567         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
568         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
569         //verify paragraph break
570         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
571         assertEquals("assert paragraph break","Index",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
572         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
573         //reopen the document
574         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
575         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
576         //verify paragraph background color
577         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
578         assertEquals("assert paragraph break","Index",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
579         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
580     }
581     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
582     public void InsertPage_Landscape_BeforeBreak() throws Exception {
583 
584         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
585         xText = xTextDocument.getText();
586         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!" +
587                 "Hello,world!Hello,world!");
588         // create text cursor for selecting and formatting text
589         XTextCursor xTextCursor = xText.createTextCursor();
590         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
591         //set paragraph break type
592         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
593         xCursorProps.setPropertyValue("PageDescName","Landscape");
594         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
595         //save to odt
596         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
597         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
598         aStoreProperties_odt[0] = new PropertyValue();
599         aStoreProperties_odt[1] = new PropertyValue();
600         aStoreProperties_odt[0].Name = "Override";
601         aStoreProperties_odt[0].Value = true;
602         aStoreProperties_odt[1].Name = "FilterName";
603         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
604         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
605         //save to doc
606         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
607         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
608         aStoreProperties_doc[0] = new PropertyValue();
609         aStoreProperties_doc[1] = new PropertyValue();
610         aStoreProperties_doc[0].Name = "Override";
611         aStoreProperties_doc[0].Value = true;
612         aStoreProperties_doc[1].Name = "FilterName";
613         aStoreProperties_doc[1].Value = "MS Word 97";
614         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
615         app.closeDocument(xTextDocument);
616 
617         //reopen the document
618         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
619         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
620         //verify paragraph break
621         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
622         assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
623         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
624         //reopen the document
625         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
626         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
627         //verify paragraph background color
628         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
629         assertEquals("assert paragraph break","Landscape",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
630         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
631     }
632     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
633     public void InsertPage_LeftPage_BeforeBreak() throws Exception {
634 
635         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
636         xText = xTextDocument.getText();
637         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!" +
638                 "Hello,world!Hello,world!");
639         // create text cursor for selecting and formatting text
640         XTextCursor xTextCursor = xText.createTextCursor();
641         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
642         //set paragraph break type
643         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
644         xCursorProps.setPropertyValue("PageDescName","Left Page");
645         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
646         //save to odt
647         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
648         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
649         aStoreProperties_odt[0] = new PropertyValue();
650         aStoreProperties_odt[1] = new PropertyValue();
651         aStoreProperties_odt[0].Name = "Override";
652         aStoreProperties_odt[0].Value = true;
653         aStoreProperties_odt[1].Name = "FilterName";
654         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
655         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
656         //save to doc
657         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
658         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
659         aStoreProperties_doc[0] = new PropertyValue();
660         aStoreProperties_doc[1] = new PropertyValue();
661         aStoreProperties_doc[0].Name = "Override";
662         aStoreProperties_doc[0].Value = true;
663         aStoreProperties_doc[1].Name = "FilterName";
664         aStoreProperties_doc[1].Value = "MS Word 97";
665         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
666         app.closeDocument(xTextDocument);
667 
668         //reopen the document
669         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
670         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
671         //verify paragraph break
672         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
673         assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
674         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
675         //reopen the document
676         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
677         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
678         //verify paragraph background color
679         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
680         assertEquals("assert paragraph break","Left Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
681         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
682     }
683     @Test@Ignore("Bug #120721 - [testUNO patch]the endnote page break change to page default break when save to doc.")
684     public void InsertPage_RightPage_BeforeBreak() throws Exception {
685 
686         XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
687         xText = xTextDocument.getText();
688         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!" +
689                 "Hello,world!Hello,world!");
690         // create text cursor for selecting and formatting text
691         XTextCursor xTextCursor = xText.createTextCursor();
692         XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
693         //set paragraph break type
694         xCursorProps.setPropertyValue("BreakType",com.sun.star.style.BreakType.PAGE_BEFORE);
695         xCursorProps.setPropertyValue("PageDescName","Right Page");
696         xCursorProps.setPropertyValue("PageNumberOffset",(short)3);
697         //save to odt
698         XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
699         PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
700         aStoreProperties_odt[0] = new PropertyValue();
701         aStoreProperties_odt[1] = new PropertyValue();
702         aStoreProperties_odt[0].Name = "Override";
703         aStoreProperties_odt[0].Value = true;
704         aStoreProperties_odt[1].Name = "FilterName";
705         aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
706         xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
707         //save to doc
708         XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
709         PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
710         aStoreProperties_doc[0] = new PropertyValue();
711         aStoreProperties_doc[1] = new PropertyValue();
712         aStoreProperties_doc[0].Name = "Override";
713         aStoreProperties_doc[0].Value = true;
714         aStoreProperties_doc[1].Name = "FilterName";
715         aStoreProperties_doc[1].Value = "MS Word 97";
716         xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
717         app.closeDocument(xTextDocument);
718 
719         //reopen the document
720         XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
721         XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
722         //verify paragraph break
723         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_odt.getPropertyValue("BreakType"));
724         assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_odt.getPropertyValue("PageDescName"));
725         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_odt.getPropertyValue("PageNumberOffset"));
726         //reopen the document
727         XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
728         XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
729         //verify paragraph background color
730         assertEquals("assert paragraph break",com.sun.star.style.BreakType.PAGE_BEFORE,xCursorProps_Assert_doc.getPropertyValue("BreakType"));
731         assertEquals("assert paragraph break","Right Page",xCursorProps_Assert_doc.getPropertyValue("PageDescName"));
732         assertEquals("assert paragraph break",(short)3,xCursorProps_Assert_doc.getPropertyValue("PageNumberOffset"));
733     }
734 }
735