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