1*07d7dbdcSHerbert Dürr /**************************************************************
2*07d7dbdcSHerbert Dürr  *
3*07d7dbdcSHerbert Dürr  * Licensed to the Apache Software Foundation (ASF) under one
4*07d7dbdcSHerbert Dürr  * or more contributor license agreements.  See the NOTICE file
5*07d7dbdcSHerbert Dürr  * distributed with this work for additional information
6*07d7dbdcSHerbert Dürr  * regarding copyright ownership.  The ASF licenses this file
7*07d7dbdcSHerbert Dürr  * to you under the Apache License, Version 2.0 (the
8*07d7dbdcSHerbert Dürr  * "License"); you may not use this file except in compliance
9*07d7dbdcSHerbert Dürr  * with the License.  You may obtain a copy of the License at
10*07d7dbdcSHerbert Dürr  *
11*07d7dbdcSHerbert Dürr  *   http://www.apache.org/licenses/LICENSE-2.0
12*07d7dbdcSHerbert Dürr  *
13*07d7dbdcSHerbert Dürr  * Unless required by applicable law or agreed to in writing,
14*07d7dbdcSHerbert Dürr  * software distributed under the License is distributed on an
15*07d7dbdcSHerbert Dürr  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*07d7dbdcSHerbert Dürr  * KIND, either express or implied.  See the License for the
17*07d7dbdcSHerbert Dürr  * specific language governing permissions and limitations
18*07d7dbdcSHerbert Dürr  * under the License.
19*07d7dbdcSHerbert Dürr  *
20*07d7dbdcSHerbert Dürr  *************************************************************/
21*07d7dbdcSHerbert Dürr 
22eba4d44aSLiu Zhe package fvt.uno.sw.paragraph;
2387127aedSLiu Zhe 
2487127aedSLiu Zhe import static org.junit.Assert.*;
2587127aedSLiu Zhe 
2687127aedSLiu Zhe import org.junit.After;
2787127aedSLiu Zhe import org.junit.Before;
2887127aedSLiu Zhe import org.junit.Ignore;
2987127aedSLiu Zhe import org.junit.Test;
3087127aedSLiu Zhe import org.openoffice.test.common.FileUtil;
3187127aedSLiu Zhe import org.openoffice.test.common.Testspace;
3287127aedSLiu Zhe import org.openoffice.test.uno.UnoApp;
3387127aedSLiu Zhe import com.sun.star.text.*;
3487127aedSLiu Zhe import com.sun.star.beans.*;
3587127aedSLiu Zhe import com.sun.star.frame.XStorable;
3687127aedSLiu Zhe import com.sun.star.uno.UnoRuntime;
3787127aedSLiu Zhe 
3887127aedSLiu Zhe public class ParagraphBackGraphic {
3987127aedSLiu Zhe 	private static final UnoApp app = new UnoApp();
4087127aedSLiu Zhe 	XText xText = null;
4187127aedSLiu Zhe 
4287127aedSLiu Zhe 	@Before
4387127aedSLiu Zhe 	public void setUp() throws Exception {
4487127aedSLiu Zhe 		app.start();
4587127aedSLiu Zhe 
4687127aedSLiu Zhe 	}
4787127aedSLiu Zhe 
4887127aedSLiu Zhe 	@After
4987127aedSLiu Zhe 	public void tearDown() throws Exception {
5087127aedSLiu Zhe 		app.close();
5187127aedSLiu Zhe 	}
5287127aedSLiu Zhe 	/*
5387127aedSLiu Zhe 	 * test paragraph background graphic
5487127aedSLiu Zhe 	 * 1.new a text document
5587127aedSLiu Zhe 	 * 2.insert some text
5687127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is left bottom
5787127aedSLiu Zhe 	 * 4.save and close the document
5887127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
5987127aedSLiu Zhe 	 */
60af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
6187127aedSLiu Zhe 	public void testParagraphBackGraphic_LeftBottom() throws Exception {
6287127aedSLiu Zhe 
6387127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
6487127aedSLiu Zhe 		xText = xTextDocument.getText();
6587127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
6687127aedSLiu Zhe 				"Hello,world!Hello,world!");
6787127aedSLiu Zhe 		// create text cursor for selecting and formatting text
6887127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
6987127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
7087127aedSLiu Zhe 		//set paragraph background color
716b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
7287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
7387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.LEFT_BOTTOM);
7487127aedSLiu Zhe 		//save to odt
7587127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
7687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
7787127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
7887127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
7987127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
8087127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
8187127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
8287127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
8387127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
8487127aedSLiu Zhe 		//save to doc
8587127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
8687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
8787127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
8887127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
8987127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
9087127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
9187127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
9287127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
9387127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
9487127aedSLiu Zhe 		app.closeDocument(xTextDocument);
9587127aedSLiu Zhe 
9687127aedSLiu Zhe 		//reopen the document
9787127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
9887127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
9987127aedSLiu Zhe 		//verify paragraph background graphic
10087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.LEFT_BOTTOM,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
10187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
1026b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
10387127aedSLiu Zhe 
10487127aedSLiu Zhe 		//reopen the document
10587127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
10687127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
10787127aedSLiu Zhe 		//verify paragraph background graphic
10887127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.LEFT_BOTTOM,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
10987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
1106b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
11187127aedSLiu Zhe 	}
11287127aedSLiu Zhe 	/*
11387127aedSLiu Zhe 	 * test paragraph background graphic
11487127aedSLiu Zhe 	 * 1.new a text document
11587127aedSLiu Zhe 	 * 2.insert some text
11687127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is left middle
11787127aedSLiu Zhe 	 * 4.save and close the document
11887127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
11987127aedSLiu Zhe 	 */
120af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
12187127aedSLiu Zhe 	public void testParagraphBackGraphic_LeftMiddle() throws Exception {
12287127aedSLiu Zhe 
12387127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
12487127aedSLiu Zhe 		xText = xTextDocument.getText();
12587127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
12687127aedSLiu Zhe 				"Hello,world!Hello,world!");
12787127aedSLiu Zhe 		// create text cursor for selecting and formatting text
12887127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
12987127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
13087127aedSLiu Zhe 		//set paragraph background color
1316b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
13287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
13387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.LEFT_MIDDLE);
13487127aedSLiu Zhe 		//save to odt
13587127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
13687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
13787127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
13887127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
13987127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
14087127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
14187127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
14287127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
14387127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
14487127aedSLiu Zhe 		//save to doc
14587127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
14687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
14787127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
14887127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
14987127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
15087127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
15187127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
15287127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
15387127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
15487127aedSLiu Zhe 		app.closeDocument(xTextDocument);
15587127aedSLiu Zhe 
15687127aedSLiu Zhe 		//reopen the document
15787127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
15887127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
15987127aedSLiu Zhe 		//verify paragraph background graphic
16087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.LEFT_MIDDLE,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
16187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
1626b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
16387127aedSLiu Zhe 
16487127aedSLiu Zhe 		//reopen the document
16587127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
16687127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
16787127aedSLiu Zhe 		//verify paragraph background graphic
16887127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.LEFT_MIDDLE,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
16987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
1706b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
17187127aedSLiu Zhe 	}
17287127aedSLiu Zhe 	/*
17387127aedSLiu Zhe 	 * test paragraph background graphic
17487127aedSLiu Zhe 	 * 1.new a text document
17587127aedSLiu Zhe 	 * 2.insert some text
17687127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is left top
17787127aedSLiu Zhe 	 * 4.save and close the document
17887127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
17987127aedSLiu Zhe 	 */
180af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
18187127aedSLiu Zhe 	public void testParagraphBackGraphic_LeftTop() throws Exception {
18287127aedSLiu Zhe 
18387127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
18487127aedSLiu Zhe 		xText = xTextDocument.getText();
18587127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
18687127aedSLiu Zhe 				"Hello,world!Hello,world!");
18787127aedSLiu Zhe 		// create text cursor for selecting and formatting text
18887127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
18987127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
19087127aedSLiu Zhe 		//set paragraph background color
1916b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
19287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
19387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.LEFT_TOP);
19487127aedSLiu Zhe 		//save to odt
19587127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
19687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
19787127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
19887127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
19987127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
20087127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
20187127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
20287127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
20387127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
20487127aedSLiu Zhe 		//save to doc
20587127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
20687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
20787127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
20887127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
20987127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
21087127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
21187127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
21287127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
21387127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
21487127aedSLiu Zhe 		app.closeDocument(xTextDocument);
21587127aedSLiu Zhe 
21687127aedSLiu Zhe 		//reopen the document
21787127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
21887127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
21987127aedSLiu Zhe 		//verify paragraph background graphic
22087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.LEFT_TOP,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
22187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
2226b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
22387127aedSLiu Zhe 
22487127aedSLiu Zhe 		//reopen the document
22587127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
22687127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
22787127aedSLiu Zhe 		//verify paragraph background graphic
22887127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.LEFT_TOP,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
22987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
2306b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
23187127aedSLiu Zhe 	}
23287127aedSLiu Zhe 	/*
23387127aedSLiu Zhe 	 * test paragraph background graphic
23487127aedSLiu Zhe 	 * 1.new a text document
23587127aedSLiu Zhe 	 * 2.insert some text
23687127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is middle bottom
23787127aedSLiu Zhe 	 * 4.save and close the document
23887127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
23987127aedSLiu Zhe 	 */
240af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
24187127aedSLiu Zhe 	public void testParagraphBackGraphic_MiddleBottom() throws Exception {
24287127aedSLiu Zhe 
24387127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
24487127aedSLiu Zhe 		xText = xTextDocument.getText();
24587127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
24687127aedSLiu Zhe 				"Hello,world!Hello,world!");
24787127aedSLiu Zhe 		// create text cursor for selecting and formatting text
24887127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
24987127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
25087127aedSLiu Zhe 		//set paragraph background color
2516b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
25287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
25387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.MIDDLE_BOTTOM);
25487127aedSLiu Zhe 		//save to odt
25587127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
25687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
25787127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
25887127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
25987127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
26087127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
26187127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
26287127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
26387127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
26487127aedSLiu Zhe 		//save to doc
26587127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
26687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
26787127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
26887127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
26987127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
27087127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
27187127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
27287127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
27387127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
27487127aedSLiu Zhe 		app.closeDocument(xTextDocument);
27587127aedSLiu Zhe 
27687127aedSLiu Zhe 		//reopen the document
27787127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
27887127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
27987127aedSLiu Zhe 		//verify paragraph background graphic
28087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.MIDDLE_BOTTOM,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
28187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
2826b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
28387127aedSLiu Zhe 
28487127aedSLiu Zhe 		//reopen the document
28587127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
28687127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
28787127aedSLiu Zhe 		//verify paragraph background graphic
28887127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.MIDDLE_BOTTOM,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
28987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
2906b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
29187127aedSLiu Zhe 	}
29287127aedSLiu Zhe 	/*
29387127aedSLiu Zhe 	 * test paragraph background graphic
29487127aedSLiu Zhe 	 * 1.new a text document
29587127aedSLiu Zhe 	 * 2.insert some text
29687127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is middle middle
29787127aedSLiu Zhe 	 * 4.save and close the document
29887127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
29987127aedSLiu Zhe 	 */
300af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
30187127aedSLiu Zhe 	public void testParagraphBackGraphic_MiddleMiddle() throws Exception {
30287127aedSLiu Zhe 
30387127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
30487127aedSLiu Zhe 		xText = xTextDocument.getText();
30587127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
30687127aedSLiu Zhe 				"Hello,world!Hello,world!");
30787127aedSLiu Zhe 		// create text cursor for selecting and formatting text
30887127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
30987127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
31087127aedSLiu Zhe 		//set paragraph background color
3116b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
31287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
31387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.MIDDLE_MIDDLE);
31487127aedSLiu Zhe 		//save to odt
31587127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
31687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
31787127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
31887127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
31987127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
32087127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
32187127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
32287127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
32387127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
32487127aedSLiu Zhe 		//save to doc
32587127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
32687127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
32787127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
32887127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
32987127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
33087127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
33187127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
33287127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
33387127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
33487127aedSLiu Zhe 		app.closeDocument(xTextDocument);
33587127aedSLiu Zhe 
33687127aedSLiu Zhe 		//reopen the document
33787127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
33887127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
33987127aedSLiu Zhe 		//verify paragraph background graphic
34087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.MIDDLE_MIDDLE,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
34187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
3426b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
34387127aedSLiu Zhe 
34487127aedSLiu Zhe 		//reopen the document
34587127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
34687127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
34787127aedSLiu Zhe 		//verify paragraph background graphic
34887127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.MIDDLE_MIDDLE,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
34987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
3506b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
35187127aedSLiu Zhe 	}
35287127aedSLiu Zhe 	/*
35387127aedSLiu Zhe 	 * test paragraph background graphic
35487127aedSLiu Zhe 	 * 1.new a text document
35587127aedSLiu Zhe 	 * 2.insert some text
35687127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is middle top
35787127aedSLiu Zhe 	 * 4.save and close the document
35887127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
35987127aedSLiu Zhe 	 */
360af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
36187127aedSLiu Zhe 	public void testParagraphBackGraphic_MiddleTop() throws Exception {
36287127aedSLiu Zhe 
36387127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
36487127aedSLiu Zhe 		xText = xTextDocument.getText();
36587127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
36687127aedSLiu Zhe 				"Hello,world!Hello,world!");
36787127aedSLiu Zhe 		// create text cursor for selecting and formatting text
36887127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
36987127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
37087127aedSLiu Zhe 		//set paragraph background color
3716b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
37287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
37387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.MIDDLE_TOP);
37487127aedSLiu Zhe 		//save and reload text document
37587127aedSLiu Zhe 		//save to odt
37687127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
37787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
37887127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
37987127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
38087127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
38187127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
38287127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
38387127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
38487127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
38587127aedSLiu Zhe 		//save to doc
38687127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
38787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
38887127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
38987127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
39087127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
39187127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
39287127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
39387127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
39487127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
39587127aedSLiu Zhe 		app.closeDocument(xTextDocument);
39687127aedSLiu Zhe 
39787127aedSLiu Zhe 		//reopen the document
39887127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
39987127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
40087127aedSLiu Zhe 		//verify paragraph background graphic
40187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.MIDDLE_TOP,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
40287127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
4036b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
40487127aedSLiu Zhe 
40587127aedSLiu Zhe 		//reopen the document
40687127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
40787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
40887127aedSLiu Zhe 		//verify paragraph background graphic
40987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.MIDDLE_TOP,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
41087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
4116b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
41287127aedSLiu Zhe 	}
41387127aedSLiu Zhe 	/*
41487127aedSLiu Zhe 	 * test paragraph background graphic
41587127aedSLiu Zhe 	 * 1.new a text document
41687127aedSLiu Zhe 	 * 2.insert some text
41787127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is right bottom
41887127aedSLiu Zhe 	 * 4.save and close the document
41987127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
42087127aedSLiu Zhe 	 */
421af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
42287127aedSLiu Zhe 	public void testParagraphBackGraphic_RightBottom() throws Exception {
42387127aedSLiu Zhe 
42487127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
42587127aedSLiu Zhe 		xText = xTextDocument.getText();
42687127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
42787127aedSLiu Zhe 				"Hello,world!Hello,world!");
42887127aedSLiu Zhe 		// create text cursor for selecting and formatting text
42987127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
43087127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
43187127aedSLiu Zhe 		//set paragraph background color
4326b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
43387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
43487127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.RIGHT_BOTTOM);
43587127aedSLiu Zhe 		//save to odt
43687127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
43787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
43887127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
43987127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
44087127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
44187127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
44287127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
44387127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
44487127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
44587127aedSLiu Zhe 		//save to doc
44687127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
44787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
44887127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
44987127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
45087127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
45187127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
45287127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
45387127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
45487127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
45587127aedSLiu Zhe 		app.closeDocument(xTextDocument);
45687127aedSLiu Zhe 
45787127aedSLiu Zhe 		//reopen the document
45887127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
45987127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
46087127aedSLiu Zhe 		//verify paragraph background graphic
46187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.RIGHT_BOTTOM,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
46287127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
4636b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
46487127aedSLiu Zhe 
46587127aedSLiu Zhe 		//reopen the document
46687127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
46787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
46887127aedSLiu Zhe 		//verify paragraph background graphic
46987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.RIGHT_BOTTOM,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
47087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
4716b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
47287127aedSLiu Zhe 	}
47387127aedSLiu Zhe 	/*
47487127aedSLiu Zhe 	 * test paragraph background graphic
47587127aedSLiu Zhe 	 * 1.new a text document
47687127aedSLiu Zhe 	 * 2.insert some text
47787127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is right middle
47887127aedSLiu Zhe 	 * 4.save and close the document
47987127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
48087127aedSLiu Zhe 	 */
481af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
48287127aedSLiu Zhe 	public void testParagraphBackGraphic_RightMiddle() throws Exception {
48387127aedSLiu Zhe 
48487127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
48587127aedSLiu Zhe 		xText = xTextDocument.getText();
48687127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
48787127aedSLiu Zhe 				"Hello,world!Hello,world!");
48887127aedSLiu Zhe 		// create text cursor for selecting and formatting text
48987127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
49087127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
49187127aedSLiu Zhe 		//set paragraph background color
4926b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
49387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
49487127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.RIGHT_MIDDLE);
49587127aedSLiu Zhe 		//save to odt
49687127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
49787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
49887127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
49987127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
50087127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
50187127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
50287127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
50387127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
50487127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
50587127aedSLiu Zhe 		//save to doc
50687127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
50787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
50887127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
50987127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
51087127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
51187127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
51287127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
51387127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
51487127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
51587127aedSLiu Zhe 		app.closeDocument(xTextDocument);
51687127aedSLiu Zhe 
51787127aedSLiu Zhe 		//reopen the document
51887127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
51987127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
52087127aedSLiu Zhe 		//verify paragraph background graphic
52187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.RIGHT_MIDDLE,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
52287127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
5236b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
52487127aedSLiu Zhe 
52587127aedSLiu Zhe 		//reopen the document
52687127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
52787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
52887127aedSLiu Zhe 		//verify paragraph background graphic
52987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.RIGHT_MIDDLE,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
53087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
5316b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
53287127aedSLiu Zhe 	}
53387127aedSLiu Zhe 	/*
53487127aedSLiu Zhe 	 * test paragraph background graphic
53587127aedSLiu Zhe 	 * 1.new a text document
53687127aedSLiu Zhe 	 * 2.insert some text
53787127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is right top
53887127aedSLiu Zhe 	 * 4.save and close the document
53987127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
54087127aedSLiu Zhe 	 */
541af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
54287127aedSLiu Zhe 	public void testParagraphBackGraphic_RightTop() throws Exception {
54387127aedSLiu Zhe 
54487127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
54587127aedSLiu Zhe 		xText = xTextDocument.getText();
54687127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
54787127aedSLiu Zhe 				"Hello,world!Hello,world!");
54887127aedSLiu Zhe 		// create text cursor for selecting and formatting text
54987127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
55087127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
55187127aedSLiu Zhe 		//set paragraph background color
5526b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
55387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
55487127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.RIGHT_TOP);
55587127aedSLiu Zhe 		//save to odt
55687127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
55787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
55887127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
55987127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
56087127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
56187127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
56287127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
56387127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
56487127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
56587127aedSLiu Zhe 		//save to doc
56687127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
56787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
56887127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
56987127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
57087127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
57187127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
57287127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
57387127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
57487127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
57587127aedSLiu Zhe 		app.closeDocument(xTextDocument);
57687127aedSLiu Zhe 
57787127aedSLiu Zhe 		//reopen the document
57887127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
57987127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
58087127aedSLiu Zhe 		//verify paragraph background graphic
58187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.RIGHT_TOP,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
58287127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
5836b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
58487127aedSLiu Zhe 
58587127aedSLiu Zhe 		//reopen the document
58687127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
58787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
58887127aedSLiu Zhe 		//verify paragraph background graphic
58987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.RIGHT_TOP,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
59087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
5916b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
59287127aedSLiu Zhe 	}
59387127aedSLiu Zhe 	/*
59487127aedSLiu Zhe 	 * test paragraph background graphic
59587127aedSLiu Zhe 	 * 1.new a text document
59687127aedSLiu Zhe 	 * 2.insert some text
59787127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is area
59887127aedSLiu Zhe 	 * 4.save and close the document
59987127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
60087127aedSLiu Zhe 	 */
601af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
60287127aedSLiu Zhe 	public void testParagraphBackGraphic_Area() throws Exception {
60387127aedSLiu Zhe 
60487127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
60587127aedSLiu Zhe 		xText = xTextDocument.getText();
60687127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
60787127aedSLiu Zhe 				"Hello,world!Hello,world!");
60887127aedSLiu Zhe 		// create text cursor for selecting and formatting text
60987127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
61087127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
61187127aedSLiu Zhe 		//set paragraph background color
6126b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
61387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
61487127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.AREA);
61587127aedSLiu Zhe 		//save to odt
61687127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
61787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
61887127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
61987127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
62087127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
62187127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
62287127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
62387127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
62487127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
62587127aedSLiu Zhe 		//save to doc
62687127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
62787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
62887127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
62987127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
63087127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
63187127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
63287127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
63387127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
63487127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
63587127aedSLiu Zhe 		app.closeDocument(xTextDocument);
63687127aedSLiu Zhe 
63787127aedSLiu Zhe 		//reopen the document
63887127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
63987127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
64087127aedSLiu Zhe 		//verify paragraph background graphic
64187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.AREA,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
64287127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
6436b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
64487127aedSLiu Zhe 
64587127aedSLiu Zhe 		//reopen the document
64687127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
64787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
64887127aedSLiu Zhe 		//verify paragraph background graphic
64987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.AREA,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
65087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
6516b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
65287127aedSLiu Zhe 	}
65387127aedSLiu Zhe 	/*
65487127aedSLiu Zhe 	 * test paragraph background graphic
65587127aedSLiu Zhe 	 * 1.new a text document
65687127aedSLiu Zhe 	 * 2.insert some text
65787127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is titled
65887127aedSLiu Zhe 	 * 4.save and close the document
65987127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
66087127aedSLiu Zhe 	 */
661af986861SLiu Zhe 	@Test@Ignore("Bug #120638 - [testUNO patch]graphic background lost when save to doc")
66287127aedSLiu Zhe 	public void testParagraphBackGraphic_Titled() throws Exception {
66387127aedSLiu Zhe 
66487127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
66587127aedSLiu Zhe 		xText = xTextDocument.getText();
66687127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
66787127aedSLiu Zhe 				"Hello,world!Hello,world!");
66887127aedSLiu Zhe 		// create text cursor for selecting and formatting text
66987127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
67087127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
67187127aedSLiu Zhe 		//set paragraph background color
6726b55ece7SLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicURL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")));
67387127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicFilter","draw_jpg_Export");
67487127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.TILED);
67587127aedSLiu Zhe 		//save to odt
67687127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
67787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
67887127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
67987127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
68087127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
68187127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
68287127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
68387127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
68487127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
68587127aedSLiu Zhe 		//save to doc
68687127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
68787127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
68887127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
68987127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
69087127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
69187127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
69287127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
69387127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
69487127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
69587127aedSLiu Zhe 		app.closeDocument(xTextDocument);
69687127aedSLiu Zhe 
69787127aedSLiu Zhe 		//reopen the document
69887127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
69987127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
70087127aedSLiu Zhe 		//verify paragraph background graphic
70187127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.TILED,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
70287127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicFilter"));
7036b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/sw/paragraphtable/Desert.jpg")),xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicURL"));
70487127aedSLiu Zhe 
70587127aedSLiu Zhe 		//reopen the document
70687127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
70787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
70887127aedSLiu Zhe 		//verify paragraph background graphic
70987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.TILED,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
71087127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic fileter","draw_jpg_Export",xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicFilter"));
7116b55ece7SLiu Zhe 		assertEquals("verify paragraph backgraphic URL",FileUtil.getUrl(Testspace.prepareData("uno/Desert.jpg")),xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicURL"));
71287127aedSLiu Zhe 	}
71387127aedSLiu Zhe 	/*
71487127aedSLiu Zhe 	 * test paragraph background graphic
71587127aedSLiu Zhe 	 * 1.new a text document
71687127aedSLiu Zhe 	 * 2.insert some text
71787127aedSLiu Zhe 	 * 3.set paragraph background with graphic and graphic location is none
71887127aedSLiu Zhe 	 * 4.save and close the document
71987127aedSLiu Zhe 	 * 5.reload the saved document and check the paragraph background graphic
72087127aedSLiu Zhe 	 */
72187127aedSLiu Zhe 	@Test
72287127aedSLiu Zhe 	public void testParagraphBackGraphic_Nonne() throws Exception {
72387127aedSLiu Zhe 
72487127aedSLiu Zhe 		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
72587127aedSLiu Zhe 		xText = xTextDocument.getText();
72687127aedSLiu Zhe 		xText.setString("we are Chinese,they are American.we are all living in one earth!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!Hello,world!" +
72787127aedSLiu Zhe 				"Hello,world!Hello,world!");
72887127aedSLiu Zhe 		// create text cursor for selecting and formatting text
72987127aedSLiu Zhe 		XTextCursor xTextCursor = xText.createTextCursor();
73087127aedSLiu Zhe 		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor);
73187127aedSLiu Zhe 		//set paragraph background color
73287127aedSLiu Zhe 		xCursorProps.setPropertyValue("ParaBackGraphicLocation",com.sun.star.style.GraphicLocation.NONE);
73387127aedSLiu Zhe 		//save to odt
73487127aedSLiu Zhe 		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
73587127aedSLiu Zhe 		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
73687127aedSLiu Zhe 		aStoreProperties_odt[0] = new PropertyValue();
73787127aedSLiu Zhe 		aStoreProperties_odt[1] = new PropertyValue();
73887127aedSLiu Zhe 		aStoreProperties_odt[0].Name = "Override";
73987127aedSLiu Zhe 		aStoreProperties_odt[0].Value = true;
74087127aedSLiu Zhe 		aStoreProperties_odt[1].Name = "FilterName";
74187127aedSLiu Zhe 		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
74287127aedSLiu Zhe 		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
74387127aedSLiu Zhe 		//save to doc
74487127aedSLiu Zhe 		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
74587127aedSLiu Zhe 		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
74687127aedSLiu Zhe 		aStoreProperties_doc[0] = new PropertyValue();
74787127aedSLiu Zhe 		aStoreProperties_doc[1] = new PropertyValue();
74887127aedSLiu Zhe 		aStoreProperties_doc[0].Name = "Override";
74987127aedSLiu Zhe 		aStoreProperties_doc[0].Value = true;
75087127aedSLiu Zhe 		aStoreProperties_doc[1].Name = "FilterName";
75187127aedSLiu Zhe 		aStoreProperties_doc[1].Value = "MS Word 97";
75287127aedSLiu Zhe 		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);
75387127aedSLiu Zhe 		app.closeDocument(xTextDocument);
75487127aedSLiu Zhe 
75587127aedSLiu Zhe 		//reopen the document
75687127aedSLiu Zhe 		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
75787127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
75887127aedSLiu Zhe 		//verify paragraph background graphic
75987127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.NONE,xCursorProps_Assert_odt.getPropertyValue("ParaBackGraphicLocation"));
76087127aedSLiu Zhe 
76187127aedSLiu Zhe 		//reopen the document
76287127aedSLiu Zhe 		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
76387127aedSLiu Zhe 		XPropertySet xCursorProps_Assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
76487127aedSLiu Zhe 		//verify paragraph background graphic
76587127aedSLiu Zhe 		assertEquals("verify paragraph backgraphic location",com.sun.star.style.GraphicLocation.NONE,xCursorProps_Assert_doc.getPropertyValue("ParaBackGraphicLocation"));
76687127aedSLiu Zhe 
76787127aedSLiu Zhe 	}
76887127aedSLiu Zhe }
769