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