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