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