1*07d7dbdcSHerbert Dürr /************************************************************** 2*07d7dbdcSHerbert Dürr * 3*07d7dbdcSHerbert Dürr * Licensed to the Apache Software Foundation (ASF) under one 4*07d7dbdcSHerbert Dürr * or more contributor license agreements. See the NOTICE file 5*07d7dbdcSHerbert Dürr * distributed with this work for additional information 6*07d7dbdcSHerbert Dürr * regarding copyright ownership. The ASF licenses this file 7*07d7dbdcSHerbert Dürr * to you under the Apache License, Version 2.0 (the 8*07d7dbdcSHerbert Dürr * "License"); you may not use this file except in compliance 9*07d7dbdcSHerbert Dürr * with the License. You may obtain a copy of the License at 10*07d7dbdcSHerbert Dürr * 11*07d7dbdcSHerbert Dürr * http://www.apache.org/licenses/LICENSE-2.0 12*07d7dbdcSHerbert Dürr * 13*07d7dbdcSHerbert Dürr * Unless required by applicable law or agreed to in writing, 14*07d7dbdcSHerbert Dürr * software distributed under the License is distributed on an 15*07d7dbdcSHerbert Dürr * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*07d7dbdcSHerbert Dürr * KIND, either express or implied. See the License for the 17*07d7dbdcSHerbert Dürr * specific language governing permissions and limitations 18*07d7dbdcSHerbert Dürr * under the License. 19*07d7dbdcSHerbert Dürr * 20*07d7dbdcSHerbert Dürr *************************************************************/ 21*07d7dbdcSHerbert Dürr 22eba4d44aSLiu Zhe package fvt.uno.sw.puretext; 23eba4d44aSLiu Zhe 24eba4d44aSLiu Zhe import static org.junit.Assert.*; 25eba4d44aSLiu Zhe 26eba4d44aSLiu Zhe import org.junit.After; 27eba4d44aSLiu Zhe import org.junit.Before; 28eba4d44aSLiu Zhe import org.junit.Test; 29eba4d44aSLiu Zhe import org.openoffice.test.common.FileUtil; 30eba4d44aSLiu Zhe import org.openoffice.test.common.Testspace; 31eba4d44aSLiu Zhe import org.openoffice.test.uno.UnoApp; 32eba4d44aSLiu Zhe //import org.openoffice.test.vcl.Tester.*; 33eba4d44aSLiu Zhe import com.sun.star.text.*; 34eba4d44aSLiu Zhe import com.sun.star.beans.*; 35eba4d44aSLiu Zhe import com.sun.star.frame.XStorable; 36eba4d44aSLiu Zhe import com.sun.star.uno.UnoRuntime; 37eba4d44aSLiu Zhe 38eba4d44aSLiu Zhe public class CharacterChangeCase { 39eba4d44aSLiu Zhe private static final UnoApp app = new UnoApp(); 40eba4d44aSLiu Zhe XText xText = null; 41eba4d44aSLiu Zhe 42eba4d44aSLiu Zhe @Before setUp()43eba4d44aSLiu Zhe public void setUp() throws Exception { 44eba4d44aSLiu Zhe app.start(); 45eba4d44aSLiu Zhe 46eba4d44aSLiu Zhe } 47eba4d44aSLiu Zhe 48eba4d44aSLiu Zhe @After tearDown()49eba4d44aSLiu Zhe public void tearDown() throws Exception { 50eba4d44aSLiu Zhe app.close(); 51eba4d44aSLiu Zhe } 52eba4d44aSLiu Zhe @Test testCharacterLowerCaseSetting()53eba4d44aSLiu Zhe public void testCharacterLowerCaseSetting() throws Exception { 54eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 55eba4d44aSLiu Zhe xText = xTextDocument.getText(); 56eba4d44aSLiu Zhe // simply set whole text as one string 57eba4d44aSLiu Zhe xText.setString("We are Chinese they are American We are all living in one earth " 58eba4d44aSLiu Zhe + "And we all love our home very much!!!"); 59eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 60eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 61eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 62eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 63eba4d44aSLiu Zhe xTextCursor.goRight((short) 102, true); 64eba4d44aSLiu Zhe xCursorProps.setPropertyValue("CharCaseMap",new Short(com.sun.star.style.CaseMap.LOWERCASE)); 65eba4d44aSLiu Zhe //save to doc 66eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 67eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 68eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 69eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 70eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 71eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 72eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 73eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 74eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 75eba4d44aSLiu Zhe //save to odt 76eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 77eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 78eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 79eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 80eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 81eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 82eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 83eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 84eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 85eba4d44aSLiu Zhe 86eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 87eba4d44aSLiu Zhe 88eba4d44aSLiu Zhe //reopen the document and assert case map 89eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 90eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 91eba4d44aSLiu Zhe //verify set property 92eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.LOWERCASE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap")); 93eba4d44aSLiu Zhe 94eba4d44aSLiu Zhe //when save to doc,lower case setting by UNO API lost,change to default. 95eba4d44aSLiu Zhe //reopen the document and assert case map 96eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 97eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 98eba4d44aSLiu Zhe //verify set property 99eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap")); 100eba4d44aSLiu Zhe } 101eba4d44aSLiu Zhe @Test testCharacterUpperCaseSetting()102eba4d44aSLiu Zhe public void testCharacterUpperCaseSetting() throws Exception { 103eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 104eba4d44aSLiu Zhe xText = xTextDocument.getText(); 105eba4d44aSLiu Zhe // simply set whole text as one string 106eba4d44aSLiu Zhe xText.setString("we are Chinese,they are American.We are all living in one earth!" 107eba4d44aSLiu Zhe + "and we all love our home very much!!!"); 108eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 109eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 110eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 111eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 112eba4d44aSLiu Zhe xTextCursor.goRight((short) 102, true); 113eba4d44aSLiu Zhe xCursorProps.setPropertyValue("CharCaseMap",com.sun.star.style.CaseMap.UPPERCASE); 114eba4d44aSLiu Zhe //save to odt 115eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 116eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 117eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 118eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 119eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 120eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 121eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 122eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 123eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 124eba4d44aSLiu Zhe //save to doc 125eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 126eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 127eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 128eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 129eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 130eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 131eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 132eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 133eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 134eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 135eba4d44aSLiu Zhe 136eba4d44aSLiu Zhe //reopen the document and assert row height setting 137eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 138eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 139eba4d44aSLiu Zhe //verify set property 140eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.UPPERCASE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap")); 141eba4d44aSLiu Zhe 142eba4d44aSLiu Zhe //reopen the document and assert row height setting 143eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 144eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 145eba4d44aSLiu Zhe //verify set property 146eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.UPPERCASE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap")); 147eba4d44aSLiu Zhe } 148eba4d44aSLiu Zhe @Test testCharacterSmallCapsSetting()149eba4d44aSLiu Zhe public void testCharacterSmallCapsSetting() throws Exception { 150eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 151eba4d44aSLiu Zhe xText = xTextDocument.getText(); 152eba4d44aSLiu Zhe // simply set whole text as one string 153eba4d44aSLiu Zhe xText.setString("we are Chinese,they are American.We are all living in one earth!" 154eba4d44aSLiu Zhe + "and we all love our home very much!!!"); 155eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 156eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 157eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 158eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 159eba4d44aSLiu Zhe xTextCursor.goRight((short) 102, true); 160eba4d44aSLiu Zhe xCursorProps.setPropertyValue("CharCaseMap",com.sun.star.style.CaseMap.SMALLCAPS); 161eba4d44aSLiu Zhe //save to odt 162eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 163eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 164eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 165eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 166eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 167eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 168eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 169eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 170eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 171eba4d44aSLiu Zhe //save to doc 172eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 173eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 174eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 175eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 176eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 177eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 178eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 179eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 180eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 181eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 182eba4d44aSLiu Zhe 183eba4d44aSLiu Zhe //reopen the document and assert row height setting 184eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 185eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 186eba4d44aSLiu Zhe //verify set property 187eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.SMALLCAPS,xCursorProps_assert_odt.getPropertyValue("CharCaseMap")); 188eba4d44aSLiu Zhe 189eba4d44aSLiu Zhe //reopen the document and assert row height setting 190eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 191eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 192eba4d44aSLiu Zhe //verify set property 193eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.SMALLCAPS,xCursorProps_assert_doc.getPropertyValue("CharCaseMap")); 194eba4d44aSLiu Zhe } 195eba4d44aSLiu Zhe @Test testCharacterCapitalEveryWordSetting()196eba4d44aSLiu Zhe public void testCharacterCapitalEveryWordSetting() throws Exception { 197eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 198eba4d44aSLiu Zhe xText = xTextDocument.getText(); 199eba4d44aSLiu Zhe // simply set whole text as one string 200eba4d44aSLiu Zhe xText.setString("we are Chinese they are American we are all living in one earth " 201eba4d44aSLiu Zhe + "and we all love our home very much!!!"); 202eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 203eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 204eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 205eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 206eba4d44aSLiu Zhe xTextCursor.goRight((short) 110, true); 207eba4d44aSLiu Zhe xCursorProps.setPropertyValue("CharCaseMap",new Short(com.sun.star.style.CaseMap.TITLE)); 208eba4d44aSLiu Zhe //save to odt 209eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 210eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 211eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 212eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 213eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 214eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 215eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 216eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 217eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 218eba4d44aSLiu Zhe //save to doc 219eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 220eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 221eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 222eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 223eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 224eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 225eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 226eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 227eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 228eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 229eba4d44aSLiu Zhe 230eba4d44aSLiu Zhe //reopen the document and assert row height setting 231eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 232eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 233eba4d44aSLiu Zhe //verify set property 234eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.TITLE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap")); 235eba4d44aSLiu Zhe 236eba4d44aSLiu Zhe //reopen the document and assert row height setting 237eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 238eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 239eba4d44aSLiu Zhe //verify set property,when save to doc and reopen,the proeprty value change to default,but display is normally 240eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap")); 241eba4d44aSLiu Zhe } 242eba4d44aSLiu Zhe @Test testCharacterNoCaseSetting()243eba4d44aSLiu Zhe public void testCharacterNoCaseSetting() throws Exception { 244eba4d44aSLiu Zhe XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 245eba4d44aSLiu Zhe xText = xTextDocument.getText(); 246eba4d44aSLiu Zhe // simply set whole text as one string 247eba4d44aSLiu Zhe xText.setString("we are Chinese they are American we are all living in one earth " 248eba4d44aSLiu Zhe + "and we all love our home very much!!!"); 249eba4d44aSLiu Zhe // create text cursor for selecting and formatting text 250eba4d44aSLiu Zhe XTextCursor xTextCursor = xText.createTextCursor(); 251eba4d44aSLiu Zhe XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 252eba4d44aSLiu Zhe xTextCursor.gotoStart(false); 253eba4d44aSLiu Zhe xTextCursor.goRight((short) 110, true); 254eba4d44aSLiu Zhe xCursorProps.setPropertyValue("CharCaseMap",new Short(com.sun.star.style.CaseMap.NONE)); 255eba4d44aSLiu Zhe //save to odt 256eba4d44aSLiu Zhe XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 257eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 258eba4d44aSLiu Zhe aStoreProperties_odt[0] = new PropertyValue(); 259eba4d44aSLiu Zhe aStoreProperties_odt[1] = new PropertyValue(); 260eba4d44aSLiu Zhe aStoreProperties_odt[0].Name = "Override"; 261eba4d44aSLiu Zhe aStoreProperties_odt[0].Value = true; 262eba4d44aSLiu Zhe aStoreProperties_odt[1].Name = "FilterName"; 263eba4d44aSLiu Zhe aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 264eba4d44aSLiu Zhe xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 265eba4d44aSLiu Zhe //save to doc 266eba4d44aSLiu Zhe XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 267eba4d44aSLiu Zhe PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 268eba4d44aSLiu Zhe aStoreProperties_doc[0] = new PropertyValue(); 269eba4d44aSLiu Zhe aStoreProperties_doc[1] = new PropertyValue(); 270eba4d44aSLiu Zhe aStoreProperties_doc[0].Name = "Override"; 271eba4d44aSLiu Zhe aStoreProperties_doc[0].Value = true; 272eba4d44aSLiu Zhe aStoreProperties_doc[1].Name = "FilterName"; 273eba4d44aSLiu Zhe aStoreProperties_doc[1].Value = "MS Word 97"; 274eba4d44aSLiu Zhe xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 275eba4d44aSLiu Zhe app.closeDocument(xTextDocument); 276eba4d44aSLiu Zhe 277eba4d44aSLiu Zhe //reopen the document and assert row height setting 278eba4d44aSLiu Zhe XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 279eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_odt.getText().createTextCursor()); 280eba4d44aSLiu Zhe //verify set property 281eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_odt.getPropertyValue("CharCaseMap")); 282eba4d44aSLiu Zhe 283eba4d44aSLiu Zhe //reopen the document and assert row height setting 284eba4d44aSLiu Zhe XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 285eba4d44aSLiu Zhe XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, assertDocument_doc.getText().createTextCursor()); 286eba4d44aSLiu Zhe //verify set property 287eba4d44aSLiu Zhe assertEquals("assert character casemap",com.sun.star.style.CaseMap.NONE,xCursorProps_assert_doc.getPropertyValue("CharCaseMap")); 288eba4d44aSLiu Zhe } 289eba4d44aSLiu Zhe } 290