You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/08/27 04:24:29 UTC
svn commit: r1377551 [2/3] - in
/incubator/ooo/trunk/main/test/testuno/source: org/openoffice/test/uno/
testcase/uno/sw/puretext/
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterPosition.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterPosition.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterPosition.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterPosition.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,179 @@
+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 CharacterPosition {
+ 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
+ public void testCharacterSuperscriptSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharEscapement", (short)29);
+ xCursorProps.setPropertyValue("CharEscapementHeight", (byte)50);
+ //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 character position setting
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character position",(short)29,xCursorProps_assert_odt.getPropertyValue("CharEscapement"));
+ assertEquals("assert character position",(byte)50,xCursorProps_assert_odt.getPropertyValue("CharEscapementHeight"));
+
+ //reopen the document and assert character position setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character position",(short)29,xCursorProps_assert_doc.getPropertyValue("CharEscapement"));
+ assertEquals("assert character position",(byte)50,xCursorProps_assert_odt.getPropertyValue("CharEscapementHeight"));
+ }
+ @Test@Ignore //bug120674_the lower and relative font size value of subscript change when save to doc.
+ public void testCharacterSubscriptSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharEscapement", (short)-29);
+ xCursorProps.setPropertyValue("CharEscapementHeight", (byte)50);
+ //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 character position setting
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character position",(short)-29,xCursorProps_assert_odt.getPropertyValue("CharEscapement"));
+ assertEquals("assert character position",(byte)50,xCursorProps_assert_odt.getPropertyValue("CharEscapementHeight"));
+
+ //reopen the document and assert character position setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character position",(short)-29,xCursorProps_assert_doc.getPropertyValue("CharEscapement"));
+ assertEquals("assert character position",(byte)50,xCursorProps_assert_odt.getPropertyValue("CharEscapementHeight"));
+ }
+ @Test
+ public void testCharacterDefaultPositionSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharEscapement", (short)0);
+ xCursorProps.setPropertyValue("CharEscapementHeight", (byte)100);
+ //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 character position setting
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character position",(short)0,xCursorProps_assert_odt.getPropertyValue("CharEscapement"));
+ assertEquals("assert character position",(byte)100,xCursorProps_assert_odt.getPropertyValue("CharEscapementHeight"));
+
+ //reopen the document and assert character position setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character position",(short)0,xCursorProps_assert_doc.getPropertyValue("CharEscapement"));
+ assertEquals("assert character position",(byte)100,xCursorProps_assert_odt.getPropertyValue("CharEscapementHeight"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRelief.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRelief.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRelief.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRelief.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,104 @@
+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 org.openoffice.test.vcl.Tester.*;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterRelief {
+ 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
+ public void testCharacterReliefSetting() 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!"
+ + "and we all love our home very much!!!we are Chinese,they are American.We are all living in one earth!"
+ + "and we all love our home very much!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharRelief", new Short(com.sun.star.text.FontRelief.EMBOSSED));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 102, true);
+ xCursorProps.setPropertyValue("CharRelief", new Short(com.sun.star.text.FontRelief.ENGRAVED));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 102, true);
+ xCursorProps.setPropertyValue("CharRelief", new Short(com.sun.star.text.FontRelief.NONE));
+ //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);
+ //verify set property
+ xTextCursor_assert_odt.gotoStart(false);
+ xTextCursor_assert_odt.goRight((short) 102, true);
+ assertEquals("assert character relief",com.sun.star.text.FontRelief.EMBOSSED,xCursorProps_assert_odt.getPropertyValue("CharRelief"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 102, true);
+ assertEquals("assert character relief",com.sun.star.text.FontRelief.ENGRAVED,xCursorProps_assert_odt.getPropertyValue("CharRelief"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 102, true);
+ assertEquals("assert character relief",com.sun.star.text.FontRelief.NONE,xCursorProps_assert_odt.getPropertyValue("CharRelief"));
+
+ //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);
+ //verify set property
+ xTextCursor_assert_doc.gotoStart(false);
+ xTextCursor_assert_doc.goRight((short) 102, true);
+ assertEquals("assert character relief",com.sun.star.text.FontRelief.EMBOSSED,xCursorProps_assert_doc.getPropertyValue("CharRelief"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 102, true);
+ assertEquals("assert character relief",com.sun.star.text.FontRelief.ENGRAVED,xCursorProps_assert_doc.getPropertyValue("CharRelief"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 102, true);
+ assertEquals("assert character relief",com.sun.star.text.FontRelief.NONE,xCursorProps_assert_doc.getPropertyValue("CharRelief"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRotationAndScaleWidth.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRotationAndScaleWidth.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRotationAndScaleWidth.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRotationAndScaleWidth.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,184 @@
+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 org.openoffice.test.vcl.Tester.*;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterRotationAndScaleWidth {
+ 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
+ public void testCharacterRotationZeroSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharRotation", (short)0);
+ xCursorProps.setPropertyValue("CharScaleWidth", (short)150);
+ //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 character rotation and scale width
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character rotation ",(short)0,xCursorProps_assert_odt.getPropertyValue("CharRotation"));
+ assertEquals("assert character rotation ",(short)150,xCursorProps_assert_odt.getPropertyValue("CharScaleWidth"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character rotation ",(short)0,xCursorProps_assert_doc.getPropertyValue("CharRotation"));
+ assertEquals("assert character rotation ",(short)150,xCursorProps_assert_doc.getPropertyValue("CharScaleWidth"));
+ }
+ @Test
+ public void testCharacterRotationNinetySetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharRotation", (short)900);
+ xCursorProps.setPropertyValue("CharScaleWidth", (short)200);
+ xCursorProps.setPropertyValue("CharRotationIsFitToLine", true);
+ //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 character rotation and scale width
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character rotation ",(short)900,xCursorProps_assert_odt.getPropertyValue("CharRotation"));
+ assertEquals("assert character rotation ",(short)200,xCursorProps_assert_odt.getPropertyValue("CharScaleWidth"));
+ assertEquals("assert character rotation ",true,xCursorProps_assert_odt.getPropertyValue("CharRotationIsFitToLine"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character rotation ",(short)900,xCursorProps_assert_doc.getPropertyValue("CharRotation"));
+ assertEquals("assert character rotation ",(short)200,xCursorProps_assert_doc.getPropertyValue("CharScaleWidth"));
+ assertEquals("assert character rotation ",true,xCursorProps_assert_odt.getPropertyValue("CharRotationIsFitToLine"));
+ }
+ //test character rotation 270 degree
+ @Test@Ignore //bug 120673_character rotation degree change to 90 from 270 when save to doc
+ public void testCharacterRotationDefineSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharRotation", (short)2700);
+ xCursorProps.setPropertyValue("CharScaleWidth", (short)300);
+ //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 character rotation and scale width
+ XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character rotation ",(short)2700,xCursorProps_assert_odt.getPropertyValue("CharRotation"));
+ assertEquals("assert character rotation ",(short)300,xCursorProps_assert_odt.getPropertyValue("CharScaleWidth"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character rotation ",(short)2700,xCursorProps_assert_doc.getPropertyValue("CharRotation"));
+ assertEquals("assert character rotation ",(short)300,xCursorProps_assert_doc.getPropertyValue("CharScaleWidth"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterShadow.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterShadow.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterShadow.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterShadow.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,85 @@
+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 org.openoffice.test.vcl.Tester.*;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterShadow {
+ 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 character color
+ * 1.new a text document and insert some character
+ * 2.set character shadow
+ * 3.save and reopen the document
+ * 4.check the character color
+ */
+ @Test
+ public void testCharacterShadowSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharShadowed", true);
+ //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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character shadow",true,xCursorProps_assert_odt.getPropertyValue("CharShadowed"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character shadow",true,xCursorProps_assert_doc.getPropertyValue("CharShadowed"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSize.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSize.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSize.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSize.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,77 @@
+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 org.openoffice.test.vcl.Tester.*;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterSize {
+ 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
+ public void testCharacterSizeSetting() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharHeight", 20);
+ //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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character size",(float)20.0,xCursorProps_assert_odt.getPropertyValue("CharHeight"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character size",(float)20.0,xCursorProps_assert_doc.getPropertyValue("CharHeight"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSpacing.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSpacing.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSpacing.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSpacing.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,169 @@
+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.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterSpacing {
+ 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
+ public void testCharacterSpacing_Default() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharAutoKerning", true);
+ //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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",true,xCursorProps_assert_odt.getPropertyValue("CharAutoKerning"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",true,xCursorProps_assert_doc.getPropertyValue("CharAutoKerning"));
+ }
+ @Test
+ public void testCharacterSpacing_Expand() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharKerning", (short)101);
+ //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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",(short)101,xCursorProps_assert_odt.getPropertyValue("CharKerning"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",(short)101,xCursorProps_assert_doc.getPropertyValue("CharKerning"));
+ }
+ @Test
+ public void testCharacterSpacing_Condens() 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!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharKerning", (short)-101);
+ //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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",(short)-101,xCursorProps_assert_odt.getPropertyValue("CharKerning"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",(short)-101,xCursorProps_assert_doc.getPropertyValue("CharKerning"));
+}
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStrikeThrough.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStrikeThrough.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStrikeThrough.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStrikeThrough.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,145 @@
+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 CharacterStrikeThrough {
+ 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 //bug 120656_bold,"/","X" strike through change to single when save to doc
+ public void testCharacterStrikeThroughSetting() 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!"
+ + "and we all love our home very much!!!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!"
+ + "and we all love our home very much!!!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!"
+ + "and we all love our home very much!!!we are Chinese,they are American.We are all living in one earth!"
+ + "and we all love our home very much!!!");
+ // 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("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.BOLD));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.DONTKNOW));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.DOUBLE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.NONE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.SINGLE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.SLASH));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharStrikeout", new Short(com.sun.star.awt.FontStrikeout.X));
+ //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);
+ //verify set property
+ xTextCursor_assert_odt.gotoStart(false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is bold",com.sun.star.awt.FontStrikeout.BOLD,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is don'tknow",com.sun.star.awt.FontStrikeout.NONE,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is double",com.sun.star.awt.FontStrikeout.DOUBLE,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is without",com.sun.star.awt.FontStrikeout.NONE,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is single",com.sun.star.awt.FontStrikeout.SINGLE,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is with /",com.sun.star.awt.FontStrikeout.SLASH,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_odt.goRight((short) 100, true);
+ assertEquals("assert strikethrough is with X",com.sun.star.awt.FontStrikeout.X,xCursorProps_assert_odt.getPropertyValue("CharStrikeout"));
+
+ //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);
+ //verify set property
+ xTextCursor_assert_doc.gotoStart(false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is bold",com.sun.star.awt.FontStrikeout.BOLD,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is don'tknow",com.sun.star.awt.FontStrikeout.NONE,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is double",com.sun.star.awt.FontStrikeout.DOUBLE,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is without",com.sun.star.awt.FontStrikeout.NONE,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is single",com.sun.star.awt.FontStrikeout.SINGLE,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is with /",com.sun.star.awt.FontStrikeout.SLASH,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_odt, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert strikethrough is with X",com.sun.star.awt.FontStrikeout.X,xCursorProps_assert_doc.getPropertyValue("CharStrikeout"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStyle.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStyle.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStyle.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStyle.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,81 @@
+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 org.openoffice.test.vcl.Tester.*;
+import com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterStyle {
+ 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
+ public void testCharacterStyleSetting() throws Exception {
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ xText = xTextDocument.getText();
+ // simply set whole text as one string
+ xText.setString("we are Chinese,they are American.We are all living in one earth!"
+ + "and we all love our home very much!!!");
+ // 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) 102, true);
+ xCursorProps.setPropertyValue("CharPosture",com.sun.star.awt.FontSlant.ITALIC);
+ xCursorProps.setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD));
+ //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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals(com.sun.star.awt.FontSlant.ITALIC,xCursorProps_assert_odt.getPropertyValue("CharPosture"));
+ assertEquals(com.sun.star.awt.FontWeight.BOLD,xCursorProps_assert_odt.getPropertyValue("CharWeight"));
+
+ //reopen the document and assert row height setting
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc")));
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor());
+ //verify set property
+ assertEquals(com.sun.star.awt.FontSlant.ITALIC,xCursorProps_assert_doc.getPropertyValue("CharPosture"));
+ assertEquals(com.sun.star.awt.FontWeight.BOLD,xCursorProps_assert_doc.getPropertyValue("CharWeight"));
+ }
+}