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 [1/3] - in
/incubator/ooo/trunk/main/test/testuno/source: org/openoffice/test/uno/
testcase/uno/sw/puretext/
Author: liuzhe
Date: Mon Aug 27 02:24:28 2012
New Revision: 1377551
URL: http://svn.apache.org/viewvc?rev=1377551&view=rev
Log:
#120690 - [testuno]puretext general function test script of word processor via UNO API
Patch by: Du Jing <bj...@gmail.com>
Review by: Liu Zhe <al...@gmail.com>
Added:
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBackColor.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBlink.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterChangeCase.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterColor.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterEmphasis.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterFontname.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHidden.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHyperlink.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterLocale.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterOutline.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterPosition.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRelief.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterRotationAndScaleWidth.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterShadow.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSize.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterSpacing.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStrikeThrough.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterStyle.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterUnderline.java
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/Desert.jpg (with props)
incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/InsertCharacterToTable.java
Modified:
incubator/ooo/trunk/main/test/testuno/source/org/openoffice/test/uno/UnoApp.java
Modified: incubator/ooo/trunk/main/test/testuno/source/org/openoffice/test/uno/UnoApp.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/org/openoffice/test/uno/UnoApp.java?rev=1377551&r1=1377550&r2=1377551&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/org/openoffice/test/uno/UnoApp.java (original)
+++ incubator/ooo/trunk/main/test/testuno/source/org/openoffice/test/uno/UnoApp.java Mon Aug 27 02:24:28 2012
@@ -60,7 +60,7 @@ public class UnoApp {
private double reconnectInterval = 2;
- private int reconnectCount = 5;
+ private int reconnectCount = 10;
public UnoApp() {
this.openOffice = OpenOffice.getDefault();
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBackColor.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBackColor.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBackColor.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBackColor.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 com.sun.star.text.*;
+import com.sun.star.beans.*;
+import com.sun.star.frame.XStorable;
+import com.sun.star.uno.UnoRuntime;
+
+public class CharacterBackColor {
+ 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 testCharacterBackColorSetting() 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("CharBackColor", 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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharBackColor"));
+
+ //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",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharBackColor"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBlink.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBlink.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBlink.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterBlink.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 CharacterBlink {
+ 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 hidden
+ * 3.save and reopen the document
+ * 4.check the character color
+ */
+ @Test
+ public void testCharacterBlinkSetting() 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("CharFlash", 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("CharFlash"));
+
+ //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("CharFlash"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterChangeCase.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterChangeCase.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterChangeCase.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterChangeCase.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,268 @@
+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 CharacterChangeCase {
+ 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 testCharacterLowerCaseSetting() 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("CharCaseMap",new Short(com.sun.star.style.CaseMap.LOWERCASE));
+ //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);
+ //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);
+
+ app.closeDocument(xTextDocument);
+
+ //reopen the document and assert case map
+ 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 casemap",com.sun.star.style.CaseMap.LOWERCASE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap"));
+
+ //when save to doc,lower case setting by UNO API lost,change to default.
+ //reopen the document and assert case map
+ 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 casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap"));
+ }
+ @Test
+ public void testCharacterUpperCaseSetting() 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("CharCaseMap",com.sun.star.style.CaseMap.UPPERCASE);
+ //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 casemap",com.sun.star.style.CaseMap.UPPERCASE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap"));
+
+ //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 casemap",com.sun.star.style.CaseMap.UPPERCASE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap"));
+ }
+ @Test
+ public void testCharacterSmallCapsSetting() 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("CharCaseMap",com.sun.star.style.CaseMap.SMALLCAPS);
+ //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 casemap",com.sun.star.style.CaseMap.SMALLCAPS,xCursorProps_assert_odt.getPropertyValue("CharCaseMap"));
+
+ //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 casemap",com.sun.star.style.CaseMap.SMALLCAPS,xCursorProps_assert_doc.getPropertyValue("CharCaseMap"));
+ }
+ @Test
+ public void testCharacterCapitalEveryWordSetting() 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) 110, true);
+ xCursorProps.setPropertyValue("CharCaseMap",new Short(com.sun.star.style.CaseMap.TITLE));
+ //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 casemap",com.sun.star.style.CaseMap.TITLE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap"));
+
+ //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,when save to doc and reopen,the proeprty value change to default,but display is normally
+ assertEquals("assert character casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap"));
+ }
+ @Test
+ public void testCharacterNoCaseSetting() 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) 110, true);
+ xCursorProps.setPropertyValue("CharCaseMap",new Short(com.sun.star.style.CaseMap.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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap"));
+
+ //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 casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterColor.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterColor.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterColor.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterColor.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 CharacterColor {
+ 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 color as green(0x0000FF00)
+ * 3.save and reopen the document
+ * 4.check the character color
+ */
+ @Test
+ public void testCharacterColorSetting() 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("CharColor", 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")));
+ XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor());
+ //verify set property
+ assertEquals("assert character color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharColor"));
+
+ //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",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharColor"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterEmphasis.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterEmphasis.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterEmphasis.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterEmphasis.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,207 @@
+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 CharacterEmphasis {
+ 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_charmode change to disable from enable when save to doc.
+ public void testCharacterEmphasisSetting() 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("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.ACCENT_ABOVE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", false);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.ACCENT_BELOW));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", false);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.CIRCLE_ABOVE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", true);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.CIRCLE_BELOW));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", true);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.DISK_ABOVE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", false);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.DISK_BELOW));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", false);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.DOT_ABOVE));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", false);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.DOT_BELOW));
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharWordMode", false);
+ xCursorProps.setPropertyValue("CharEmphasis", new Short(com.sun.star.text.FontEmphasis.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 character emphasis
+ 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 overline",com.sun.star.text.FontEmphasis.ACCENT_ABOVE,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.ACCENT_BELOW,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.CIRCLE_ABOVE,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.CIRCLE_BELOW,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DISK_ABOVE,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DISK_BELOW,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DOT_ABOVE,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DOT_BELOW,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.NONE,xCursorProps_assert_odt.getPropertyValue("CharEmphasis"));
+
+ //reopen the document and assert character emphasis
+ 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_doc.gotoStart(false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode"));
+ assertEquals("assert overline",com.sun.star.text.FontEmphasis.ACCENT_ABOVE,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.ACCENT_BELOW,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.CIRCLE_ABOVE,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.CIRCLE_BELOW,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DISK_ABOVE,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DISK_BELOW,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DOT_ABOVE,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.DOT_BELOW,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ 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 overline",com.sun.star.text.FontEmphasis.NONE,xCursorProps_assert_doc.getPropertyValue("CharEmphasis"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterFontname.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterFontname.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterFontname.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterFontname.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,268 @@
+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 CharacterFontname {
+ 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 testCharacterFontSetting() 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("CharFontName", "Times New Roman");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Arial Black");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Aharoni");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Agency FB");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Algerian");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Andalus");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Bodoni MT Black");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "BatangChe");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Britannic Bold");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Cooper Black");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "DaunPenh");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Estrangelo Edessa");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Wingdings");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Rage Italic");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Symbol");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Tw Cen MT Condensed Extra Bold");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Vivaldi");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "SimSun");
+ xTextCursor.gotoRange(xTextCursor, false);
+ xTextCursor.goRight((short) 100, true);
+ xCursorProps.setPropertyValue("CharFontName", "Lucida Bright");
+ //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 font style
+ XTextDocument assertDocument=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextCursor xTextCursor_assert = assertDocument.getText().createTextCursor();
+ XPropertySet xCursorProps_assert = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert);
+
+ xTextCursor_assert.gotoStart(false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Times New Roman",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Arial Black",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Aharoni",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Agency FB",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Algerian",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Andalus",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Bodoni MT Black",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("BatangChe",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Britannic Bold",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Cooper Black",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("DaunPenh",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Estrangelo Edessa",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Wingdings",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Rage Italic",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Symbol",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Tw Cen MT Condensed Extra Bold",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Vivaldi",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("SimSun",xCursorProps_assert.getPropertyValue("CharFontName"));
+ xTextCursor_assert.gotoRange(xTextCursor_assert, false);
+ xTextCursor_assert.goRight((short) 100, true);
+ assertEquals("Lucida Bright",xCursorProps_assert.getPropertyValue("CharFontName"));
+
+ //reopen the document and assert font style
+ XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt")));
+ XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor();
+ XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_doc);
+
+ xTextCursor_assert_doc.gotoStart(false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Times New Roman",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Arial Black",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Aharoni",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Agency FB",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Algerian",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Andalus",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Bodoni MT Black",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("BatangChe",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Britannic Bold",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Cooper Black",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("DaunPenh",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Estrangelo Edessa",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Wingdings",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Rage Italic",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Symbol",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Tw Cen MT Condensed Extra Bold",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Vivaldi",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("SimSun",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false);
+ xTextCursor_assert_doc.goRight((short) 100, true);
+ assertEquals("Lucida Bright",xCursorProps_assert_doc.getPropertyValue("CharFontName"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHidden.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHidden.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHidden.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHidden.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 CharacterHidden {
+ 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 hidden
+ * 3.save and reopen the document
+ * 4.check the character color
+ */
+ @Test
+ public void testCharacterHiddenSetting() 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("CharHidden", 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("CharHidden"));
+
+ //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("CharHidden"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHyperlink.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHyperlink.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHyperlink.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterHyperlink.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.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 CharacterHyperlink {
+ 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 //bug120676_the hyperlink name lost and hyperlinktarget change to "_blank" when save to doc
+ public void testCharacterBackHyperlinkSetting() 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("HyperLinkURL", FileUtil.getUrl(Testspace.prepareData("testcase/uno/sw/puretext/Desert.jpg")));
+ xCursorProps.setPropertyValue("HyperLinkTarget","picture");
+ xCursorProps.setPropertyValue("HyperLinkName","testCharacterHyperlink");
+
+ //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 hyperlink URL",FileUtil.getUrl(Testspace.prepareData("testcase/uno/sw/puretext/Desert.jpg")),xCursorProps_assert_odt.getPropertyValue("HyperLinkURL"));
+ assertEquals("assert character hyperlink target name","picture",xCursorProps_assert_odt.getPropertyValue("HyperLinkTarget"));
+ assertEquals("assert character hyperlink name","testCharacterHyperlink",xCursorProps_assert_odt.getPropertyValue("HyperLinkName"));
+
+ //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 hyperlink URL",FileUtil.getUrl(Testspace.prepareData("testcase/uno/sw/puretext/Desert.jpg")),xCursorProps_assert_doc.getPropertyValue("HyperLinkURL"));
+ assertEquals("assert character hyperlink target name","picture",xCursorProps_assert_doc.getPropertyValue("HyperLinkTarget"));
+ assertEquals("assert character hyperlink name","testCharacterHyperlink",xCursorProps_assert_doc.getPropertyValue("HyperLinkName"));
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterLocale.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterLocale.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterLocale.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterLocale.java Mon Aug 27 02:24:28 2012
@@ -0,0 +1,76 @@
+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 CharacterLocale {
+ 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 testCharacterLocaleSetting() throws Exception {
+ XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document
+ //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
+ Object charLocale_obj_odt=xCursorProps_assert_odt.getPropertyValue("CharLocale");
+ com.sun.star.lang.Locale charLocale_odt=(com.sun.star.lang.Locale)UnoRuntime.queryInterface(com.sun.star.lang.Locale.class,charLocale_obj_odt);
+
+ assertEquals("assert character language","en",charLocale_odt.Language);
+ assertEquals("assert character language","US",charLocale_odt.Country);
+
+ //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
+ Object charLocale_obj_doc=xCursorProps_assert_doc.getPropertyValue("CharLocale");
+ com.sun.star.lang.Locale charLocale_doc=(com.sun.star.lang.Locale)UnoRuntime.queryInterface(com.sun.star.lang.Locale.class,charLocale_obj_doc);
+
+ assertEquals("assert character language","en",charLocale_doc.Language);
+ assertEquals("assert character language","US",charLocale_doc.Country);
+ }
+}
Added: incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterOutline.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterOutline.java?rev=1377551&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterOutline.java (added)
+++ incubator/ooo/trunk/main/test/testuno/source/testcase/uno/sw/puretext/CharacterOutline.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 CharacterOutline {
+ 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 outline
+ * 3.save and reopen the document
+ * 4.check the character outline effect
+ */
+ @Test
+ public void testCharacterOutlineSetting() 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("CharContoured", 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("CharContoured"));
+
+ //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("CharContoured"));
+ }
+}