incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1377551 [3/3] - in /incubator/ooo/trunk/main/test/testuno/source: org/openoffice/test/uno/ testcase/uno/sw/puretext/
Date Mon, 27 Aug 2012 02:24:29 GMT
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterUnderline.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterUnderline.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterUnderline.java
(added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterUnderline.java
Mon Aug 27 02:24:28 2012
@@ -0,0 +1,431 @@
+package testcase.uno.sw.puretext;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+
+public class CharacterUnderline {
+	private static final UnoApp app = new UnoApp();
+	XText xText = null;
+
+	@Before
+	public void setUp() throws Exception {
+		app.start();
+
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		app.close();
+	}
+	@Test@Ignore //bug120657_underline color lost and individual words option disable when save
to doc
+	public void testCharacterUnderlineSetting() throws Exception {
+		XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,
app.newDocument("swriter"));// new a text document
+		xText = xTextDocument.getText();
+		xText.setString("We are Chinese,they are American. We are all living in one earth!"
+				+ "and we all love our home very much!!!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American." +
+				" We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are Chinese,they are American. " +
+				"We are all living in one earth!We are all living in one earth!We are Chinese,they are
American. " +
+				"We are all living in one earth!We are all living in one earth!We are Chinese,they are
American. " +
+				"We are all living in one earth!We are all living in one earth!We are Chinese,they are
American. " +
+				"We are all living in one earth!We are all living in one earth!We are Chinese,they are
American. " +
+				"We are all living in one earth!We are all living in one earth!We are Chinese,they are
American. " +
+				"We are all living in one earth!We are all living in one earth!We are Chinese,they are
American. " +
+				"We are all living in one earth!");
+		// create text cursor for selecting and formatting text
+		XTextCursor xTextCursor = xText.createTextCursor();
+		XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
xTextCursor);
+		xTextCursor.gotoStart(false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", true);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DOUBLE));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x00FF00FF);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.WAVE));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x00FF00FF);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.SMALLWAVE));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x00FF00FF);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", true);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.SINGLE));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", true);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.NONE));
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.LONGDASH));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DOUBLEWAVE));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DONTKNOW));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DOTTED));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DASHDOTDOT));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DASHDOT));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DASH));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDWAVE));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDLONGDASH));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDOTTED));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDASHDOT));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDASH));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		xTextCursor.gotoRange(xTextCursor, false);
+		xTextCursor.goRight((short) 100, true);
+		xCursorProps.setPropertyValue("CharWordMode", false);
+		xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLD));
+		xCursorProps.setPropertyValue("CharUnderlineHasColor", true);
+		xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00);
+		//save to odt 
+		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+		aStoreProperties_odt[0] = new PropertyValue();
+		aStoreProperties_odt[1] = new PropertyValue();
+		aStoreProperties_odt[0].Name = "Override";
+		aStoreProperties_odt[0].Value = true;
+		aStoreProperties_odt[1].Name = "FilterName";
+		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+		//save to doc 
+		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+		aStoreProperties_doc[0] = new PropertyValue();
+		aStoreProperties_doc[1] = new PropertyValue();
+		aStoreProperties_doc[0].Name = "Override";
+		aStoreProperties_doc[0].Value = true;
+		aStoreProperties_doc[1].Name = "FilterName";
+		aStoreProperties_doc[1].Value = "MS Word 97";
+		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);

+		app.closeDocument(xTextDocument);
+
+		//reopen the document and assert row height setting
+		XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,
app.loadDocument(Testspace.getPath("output/test.odt")));
+		XTextCursor xTextCursor_assert_odt = assertDocument_odt.getText().createTextCursor();
+		XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
xTextCursor_assert_odt);
+
+		xTextCursor_assert_odt.gotoStart(false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",true,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is double",com.sun.star.awt.FontUnderline.DOUBLE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is wave",com.sun.star.awt.FontUnderline.WAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is smallwave",com.sun.star.awt.FontUnderline.SMALLWAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",true,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is single",com.sun.star.awt.FontUnderline.SINGLE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",true,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is without",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is LONGDASH",com.sun.star.awt.FontUnderline.LONGDASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DOUBLEWAVE",com.sun.star.awt.FontUnderline.DOUBLEWAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DONTKNOW",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));

+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DOTTED",com.sun.star.awt.FontUnderline.DOTTED,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DASHDOTDOT",com.sun.star.awt.FontUnderline.DASHDOTDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DASHDOT",com.sun.star.awt.FontUnderline.DASHDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DASH",com.sun.star.awt.FontUnderline.DASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDWAVE",com.sun.star.awt.FontUnderline.BOLDWAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
	
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDLONGDASH",com.sun.star.awt.FontUnderline.BOLDLONGDASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDOTTED",com.sun.star.awt.FontUnderline.BOLDDOTTED,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));

+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDASHDOTDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
	
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDASHDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
	
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDASH",com.sun.star.awt.FontUnderline.BOLDDASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is bold",com.sun.star.awt.FontUnderline.BOLD,xCursorProps_assert_odt.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor"));
+		
+		//reopen the document and assert row height setting
+		XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,
app.loadDocument(Testspace.getPath("output/test.doc")));
+		XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor();
+		XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
xTextCursor_assert_doc);
+
+		xTextCursor_assert_odt.gotoStart(false);
+		xTextCursor_assert_odt.goRight((short) 100, true);
+		assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is double",com.sun.star.awt.FontUnderline.DOUBLE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is wave",com.sun.star.awt.FontUnderline.WAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is smallwave",com.sun.star.awt.FontUnderline.SMALLWAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is single",com.sun.star.awt.FontUnderline.SINGLE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is without",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is LONGDASH",com.sun.star.awt.FontUnderline.LONGDASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DOUBLEWAVE",com.sun.star.awt.FontUnderline.DOUBLEWAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DONTKNOW",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));

+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DOTTED",com.sun.star.awt.FontUnderline.DOTTED,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DASHDOTDOT",com.sun.star.awt.FontUnderline.DASHDOTDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DASHDOT",com.sun.star.awt.FontUnderline.DASHDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is DASH",com.sun.star.awt.FontUnderline.DASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDWAVE",com.sun.star.awt.FontUnderline.BOLDWAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
	
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDLONGDASH",com.sun.star.awt.FontUnderline.BOLDLONGDASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDOTTED",com.sun.star.awt.FontUnderline.BOLDDOTTED,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));

+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDASHDOTDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
	
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDASHDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
	
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is BOLDDASH",com.sun.star.awt.FontUnderline.BOLDDASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+		xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+		xTextCursor_assert_doc.goRight((short) 100, true);
+		assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+		assertEquals("assert underline is bold",com.sun.star.awt.FontUnderline.BOLD,xCursorProps_assert_doc.getPropertyValue("CharUnderline"));
+		assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor"));
+		assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor"));
+	}
+}

Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/Desert.jpg
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/Desert.jpg?rev=1377551&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/Desert.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/InsertCharacterToTable.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/InsertCharacterToTable.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/InsertCharacterToTable.java
(added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/InsertCharacterToTable.java
Mon Aug 27 02:24:28 2012
@@ -0,0 +1,111 @@
+package testcase.uno.sw.puretext;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XStorable;
+
+public class InsertCharacterToTable {
+
+	private static final UnoApp app = new UnoApp();
+	private XTextDocument xTextDocument = null;
+	private XMultiServiceFactory xWriterFactory = null;
+	private XText xText = null;
+
+	@Before
+	public void setUp() throws Exception {
+		app.start();
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		app.close();
+	}
+
+	@Test
+	public void testCreateTable() throws Exception {
+		xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));
+		xText = xTextDocument.getText();
+		XTextCursor xTextCursor = xText.createTextCursor();
+		// get internal service factory of the document
+		xWriterFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
xTextDocument);
+		// Create a new table from the document's factory
+		XTextTable xTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class,xWriterFactory.createInstance("com.sun.star.text.TextTable"));
+		xTable.initialize(4, 4);
+		xText.insertTextContent(xTextCursor, xTable, false);
+        //insert text in to table cell
+		insertIntoCell( "A1","test", xTable );	
+		insertIntoCell( "C4","123", xTable );
+		insertIntoCell( "D2","fsdf132134", xTable );
+		insertIntoCell( "B3","*^$%^$^$", xTable );
+
+		//save to odt 
+		XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+		PropertyValue[] aStoreProperties_odt = new PropertyValue[2];
+		aStoreProperties_odt[0] = new PropertyValue();
+		aStoreProperties_odt[1] = new PropertyValue();
+		aStoreProperties_odt[0].Name = "Override";
+		aStoreProperties_odt[0].Value = true;
+		aStoreProperties_odt[1].Name = "FilterName";
+		aStoreProperties_odt[1].Value = "StarOffice XML (Writer)";
+		xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt);
+		//save to doc 
+		XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+		PropertyValue[] aStoreProperties_doc = new PropertyValue[2];
+		aStoreProperties_doc[0] = new PropertyValue();
+		aStoreProperties_doc[1] = new PropertyValue();
+		aStoreProperties_doc[0].Name = "Override";
+		aStoreProperties_doc[0].Value = true;
+		aStoreProperties_doc[1].Name = "FilterName";
+		aStoreProperties_doc[1].Value = "MS Word 97";
+		xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc);

+		app.closeDocument(xTextDocument);
+
+		// reopen the document and assert create table successfully
+		XTextDocument assertDocument_odt = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,app.loadDocument(Testspace.getPath("output/test.odt")));
+		XTextTablesSupplier xTablesSupplier_odt = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class,
assertDocument_odt);
+		XIndexAccess xIndexedTables_odt = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,
xTablesSupplier_odt.getTextTables());
+		Object xTable_obj_odt = xIndexedTables_odt.getByIndex(0);
+		XTextTable xTable_Assert_odt = (XTextTable) UnoRuntime.queryInterface(XTextTable.class,
xTable_obj_odt);
+		assertEquals("assert table cell text","test",getFromCell("A1", xTable_Assert_odt));
+		assertEquals("assert table cell text","*^$%^$^$",getFromCell("B3", xTable_Assert_odt));
+		assertEquals("assert table cell text","123",getFromCell("C4", xTable_Assert_odt));
+		assertEquals("assert table cell text","fsdf132134",getFromCell("D2", xTable_Assert_odt));
+		
+		// reopen the document and assert create table successfully
+		XTextDocument assertDocument_doc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,app.loadDocument(Testspace.getPath("output/test.doc")));
+		XTextTablesSupplier xTablesSupplier_doc = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class,
assertDocument_doc);
+		XIndexAccess xIndexedTables_doc = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,
xTablesSupplier_doc.getTextTables());
+		Object xTable_obj_doc = xIndexedTables_doc.getByIndex(0);
+		XTextTable xTable_Assert_doc = (XTextTable) UnoRuntime.queryInterface(XTextTable.class,
xTable_obj_doc);
+		assertEquals("assert table cell text","test",getFromCell("A1", xTable_Assert_doc));
+		assertEquals("assert table cell text","*^$%^$^$",getFromCell("B3", xTable_Assert_doc));
+		assertEquals("assert table cell text","123",getFromCell("C4", xTable_Assert_doc));
+		assertEquals("assert table cell text","fsdf132134",getFromCell("D2", xTable_Assert_doc));
+	}
+	// This method is inserts string sText in table cell by sCellName.
+	public static void insertIntoCell(String sCellName, String sText, XTextTable xTable) {
+		// Access the XText interface of the cell referred to by sCellName
+		XText xCellText = (XText) UnoRuntime.queryInterface(XText.class, xTable.getCellByName(sCellName));
+		// Set the text in the cell to sText
+		xCellText.setString(sText);
+	}
+	// This method is get string sText in table cell by sCellName.
+	public static String getFromCell(String sCellName, XTextTable xTable) {
+		// Access the XText interface of the cell referred to by sCellName
+		XText xCellText = (XText) UnoRuntime.queryInterface(XText.class, xTable.getCellByName(sCellName));
+		// Set the text in the cell to sText
+		return xCellText.getString();
+	}	
+}
\ No newline at end of file



Mime
View raw message