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