1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 package fvt.uno.sw.puretext; 23 24 import static org.junit.Assert.*; 25 26 import org.junit.After; 27 import org.junit.Before; 28 import org.junit.Ignore; 29 import org.junit.Test; 30 import org.openoffice.test.common.FileUtil; 31 import org.openoffice.test.common.Testspace; 32 import org.openoffice.test.uno.UnoApp; 33 import com.sun.star.text.*; 34 import com.sun.star.beans.*; 35 import com.sun.star.frame.XStorable; 36 import com.sun.star.uno.UnoRuntime; 37 38 39 public class CharacterUnderline { 40 private static final UnoApp app = new UnoApp(); 41 XText xText = null; 42 43 @Before setUp()44 public void setUp() throws Exception { 45 app.start(); 46 47 } 48 49 @After tearDown()50 public void tearDown() throws Exception { 51 app.close(); 52 } 53 @Test@Ignore("Bug #120657 - [testUNO patch]underline color lost and individual words option disable when save to doc") testCharacterUnderlineSetting()54 public void testCharacterUnderlineSetting() throws Exception { 55 XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, app.newDocument("swriter"));// new a text document 56 xText = xTextDocument.getText(); 57 xText.setString("We are Chinese,they are American. We are all living in one earth!" 58 + "and we all love our home very much!!!We are Chinese,they are American. " + 59 "We are all living in one earth!We are Chinese,they are American. " + 60 "We are all living in one earth!We are Chinese,they are American. " + 61 "We are all living in one earth!We are Chinese,they are American. " + 62 "We are all living in one earth!We are Chinese,they are American. " + 63 "We are all living in one earth!We are Chinese,they are American." + 64 " We are all living in one earth!We are Chinese,they are American. " + 65 "We are all living in one earth!We are Chinese,they are American. " + 66 "We are all living in one earth!We are Chinese,they are American. " + 67 "We are all living in one earth!We are Chinese,they are American. " + 68 "We are all living in one earth!We are Chinese,they are American. " + 69 "We are all living in one earth!We are Chinese,they are American. " + 70 "We are all living in one earth!We are Chinese,they are American. " + 71 "We are all living in one earth!We are Chinese,they are American. " + 72 "We are all living in one earth!We are Chinese,they are American. " + 73 "We are all living in one earth!We are Chinese,they are American. " + 74 "We are all living in one earth!We are Chinese,they are American. " + 75 "We are all living in one earth!We are Chinese,they are American. " + 76 "We are all living in one earth!We are all living in one earth!We are Chinese,they are American. " + 77 "We are all living in one earth!We are all living in one earth!We are Chinese,they are American. " + 78 "We are all living in one earth!We are all living in one earth!We are Chinese,they are American. " + 79 "We are all living in one earth!We are all living in one earth!We are Chinese,they are American. " + 80 "We are all living in one earth!We are all living in one earth!We are Chinese,they are American. " + 81 "We are all living in one earth!We are all living in one earth!We are Chinese,they are American. " + 82 "We are all living in one earth!"); 83 // create text cursor for selecting and formatting text 84 XTextCursor xTextCursor = xText.createTextCursor(); 85 XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); 86 xTextCursor.gotoStart(false); 87 xTextCursor.goRight((short) 100, true); 88 xCursorProps.setPropertyValue("CharWordMode", true); 89 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DOUBLE)); 90 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 91 xCursorProps.setPropertyValue("CharUnderlineColor", 0x00FF00FF); 92 xTextCursor.gotoRange(xTextCursor, false); 93 xTextCursor.goRight((short) 100, true); 94 xCursorProps.setPropertyValue("CharWordMode", false); 95 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.WAVE)); 96 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 97 xCursorProps.setPropertyValue("CharUnderlineColor", 0x00FF00FF); 98 xTextCursor.gotoRange(xTextCursor, false); 99 xTextCursor.goRight((short) 100, true); 100 xCursorProps.setPropertyValue("CharWordMode", false); 101 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.SMALLWAVE)); 102 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 103 xCursorProps.setPropertyValue("CharUnderlineColor", 0x00FF00FF); 104 xTextCursor.gotoRange(xTextCursor, false); 105 xTextCursor.goRight((short) 100, true); 106 xCursorProps.setPropertyValue("CharWordMode", true); 107 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.SINGLE)); 108 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 109 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 110 xTextCursor.gotoRange(xTextCursor, false); 111 xTextCursor.goRight((short) 100, true); 112 xCursorProps.setPropertyValue("CharWordMode", true); 113 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.NONE)); 114 xTextCursor.gotoRange(xTextCursor, false); 115 xTextCursor.goRight((short) 100, true); 116 xCursorProps.setPropertyValue("CharWordMode", false); 117 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.LONGDASH)); 118 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 119 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 120 xTextCursor.gotoRange(xTextCursor, false); 121 xTextCursor.goRight((short) 100, true); 122 xCursorProps.setPropertyValue("CharWordMode", false); 123 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DOUBLEWAVE)); 124 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 125 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 126 xTextCursor.gotoRange(xTextCursor, false); 127 xTextCursor.goRight((short) 100, true); 128 xCursorProps.setPropertyValue("CharWordMode", false); 129 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DONTKNOW)); 130 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 131 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 132 xTextCursor.gotoRange(xTextCursor, false); 133 xTextCursor.goRight((short) 100, true); 134 xCursorProps.setPropertyValue("CharWordMode", false); 135 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DOTTED)); 136 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 137 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 138 xTextCursor.gotoRange(xTextCursor, false); 139 xTextCursor.goRight((short) 100, true); 140 xCursorProps.setPropertyValue("CharWordMode", false); 141 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DASHDOTDOT)); 142 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 143 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 144 xTextCursor.gotoRange(xTextCursor, false); 145 xTextCursor.goRight((short) 100, true); 146 xCursorProps.setPropertyValue("CharWordMode", false); 147 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DASHDOT)); 148 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 149 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 150 xTextCursor.gotoRange(xTextCursor, false); 151 xTextCursor.goRight((short) 100, true); 152 xCursorProps.setPropertyValue("CharWordMode", false); 153 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.DASH)); 154 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 155 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 156 xTextCursor.gotoRange(xTextCursor, false); 157 xTextCursor.goRight((short) 100, true); 158 xCursorProps.setPropertyValue("CharWordMode", false); 159 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDWAVE)); 160 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 161 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 162 xTextCursor.gotoRange(xTextCursor, false); 163 xTextCursor.goRight((short) 100, true); 164 xCursorProps.setPropertyValue("CharWordMode", false); 165 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDLONGDASH)); 166 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 167 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 168 xTextCursor.gotoRange(xTextCursor, false); 169 xTextCursor.goRight((short) 100, true); 170 xCursorProps.setPropertyValue("CharWordMode", false); 171 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDOTTED)); 172 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 173 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 174 xTextCursor.gotoRange(xTextCursor, false); 175 xTextCursor.goRight((short) 100, true); 176 xCursorProps.setPropertyValue("CharWordMode", false); 177 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT)); 178 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 179 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 180 xTextCursor.gotoRange(xTextCursor, false); 181 xTextCursor.goRight((short) 100, true); 182 xCursorProps.setPropertyValue("CharWordMode", false); 183 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDASHDOT)); 184 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 185 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 186 xTextCursor.gotoRange(xTextCursor, false); 187 xTextCursor.goRight((short) 100, true); 188 xCursorProps.setPropertyValue("CharWordMode", false); 189 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLDDASH)); 190 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 191 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 192 xTextCursor.gotoRange(xTextCursor, false); 193 xTextCursor.goRight((short) 100, true); 194 xCursorProps.setPropertyValue("CharWordMode", false); 195 xCursorProps.setPropertyValue("CharUnderline", new Short(com.sun.star.awt.FontUnderline.BOLD)); 196 xCursorProps.setPropertyValue("CharUnderlineHasColor", true); 197 xCursorProps.setPropertyValue("CharUnderlineColor", 0x0000FF00); 198 //save to odt 199 XStorable xStorable_odt = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 200 PropertyValue[] aStoreProperties_odt = new PropertyValue[2]; 201 aStoreProperties_odt[0] = new PropertyValue(); 202 aStoreProperties_odt[1] = new PropertyValue(); 203 aStoreProperties_odt[0].Name = "Override"; 204 aStoreProperties_odt[0].Value = true; 205 aStoreProperties_odt[1].Name = "FilterName"; 206 aStoreProperties_odt[1].Value = "StarOffice XML (Writer)"; 207 xStorable_odt.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.odt")), aStoreProperties_odt); 208 //save to doc 209 XStorable xStorable_doc = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument); 210 PropertyValue[] aStoreProperties_doc = new PropertyValue[2]; 211 aStoreProperties_doc[0] = new PropertyValue(); 212 aStoreProperties_doc[1] = new PropertyValue(); 213 aStoreProperties_doc[0].Name = "Override"; 214 aStoreProperties_doc[0].Value = true; 215 aStoreProperties_doc[1].Name = "FilterName"; 216 aStoreProperties_doc[1].Value = "MS Word 97"; 217 xStorable_doc.storeToURL(FileUtil.getUrl(Testspace.getPath("output/test.doc")), aStoreProperties_doc); 218 app.closeDocument(xTextDocument); 219 220 //reopen the document and assert row height setting 221 XTextDocument assertDocument_odt=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.odt"))); 222 XTextCursor xTextCursor_assert_odt = assertDocument_odt.getText().createTextCursor(); 223 XPropertySet xCursorProps_assert_odt = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_odt); 224 225 xTextCursor_assert_odt.gotoStart(false); 226 xTextCursor_assert_odt.goRight((short) 100, true); 227 assertEquals("assert individual word setting",true,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 228 assertEquals("assert underline is double",com.sun.star.awt.FontUnderline.DOUBLE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 229 assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 230 assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 231 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 232 xTextCursor_assert_odt.goRight((short) 100, true); 233 assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 234 assertEquals("assert underline is wave",com.sun.star.awt.FontUnderline.WAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 235 assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 236 assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 237 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 238 xTextCursor_assert_odt.goRight((short) 100, true); 239 assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 240 assertEquals("assert underline is smallwave",com.sun.star.awt.FontUnderline.SMALLWAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 241 assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 242 assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 243 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 244 xTextCursor_assert_odt.goRight((short) 100, true); 245 assertEquals("assert individual word setting",true,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 246 assertEquals("assert underline is single",com.sun.star.awt.FontUnderline.SINGLE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 247 assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 248 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 249 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 250 xTextCursor_assert_odt.goRight((short) 100, true); 251 assertEquals("assert individual word setting",true,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 252 assertEquals("assert underline is without",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 253 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 254 xTextCursor_assert_odt.goRight((short) 100, true); 255 assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 256 assertEquals("assert underline is LONGDASH",com.sun.star.awt.FontUnderline.LONGDASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 257 assertEquals("assert has underline color is true",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 258 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 259 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 260 xTextCursor_assert_odt.goRight((short) 100, true); 261 assertEquals("assert individual word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 262 assertEquals("assert underline is DOUBLEWAVE",com.sun.star.awt.FontUnderline.DOUBLEWAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 263 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 264 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 265 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 266 xTextCursor_assert_odt.goRight((short) 100, true); 267 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 268 assertEquals("assert underline is DONTKNOW",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 269 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 270 xTextCursor_assert_odt.goRight((short) 100, true); 271 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 272 assertEquals("assert underline is DOTTED",com.sun.star.awt.FontUnderline.DOTTED,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 273 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 274 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 275 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 276 xTextCursor_assert_odt.goRight((short) 100, true); 277 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 278 assertEquals("assert underline is DASHDOTDOT",com.sun.star.awt.FontUnderline.DASHDOTDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 279 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 280 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 281 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 282 xTextCursor_assert_odt.goRight((short) 100, true); 283 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 284 assertEquals("assert underline is DASHDOT",com.sun.star.awt.FontUnderline.DASHDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 285 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 286 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 287 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 288 xTextCursor_assert_odt.goRight((short) 100, true); 289 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 290 assertEquals("assert underline is DASH",com.sun.star.awt.FontUnderline.DASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 291 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 292 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 293 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 294 xTextCursor_assert_odt.goRight((short) 100, true); 295 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 296 assertEquals("assert underline is BOLDWAVE",com.sun.star.awt.FontUnderline.BOLDWAVE,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 297 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 298 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 299 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 300 xTextCursor_assert_odt.goRight((short) 100, true); 301 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 302 assertEquals("assert underline is BOLDLONGDASH",com.sun.star.awt.FontUnderline.BOLDLONGDASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 303 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 304 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 305 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 306 xTextCursor_assert_odt.goRight((short) 100, true); 307 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 308 assertEquals("assert underline is BOLDDOTTED",com.sun.star.awt.FontUnderline.BOLDDOTTED,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 309 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 310 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 311 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 312 xTextCursor_assert_odt.goRight((short) 100, true); 313 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 314 assertEquals("assert underline is BOLDDASHDOTDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 315 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 316 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 317 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 318 xTextCursor_assert_odt.goRight((short) 100, true); 319 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 320 assertEquals("assert underline is BOLDDASHDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOT,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 321 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 322 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 323 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 324 xTextCursor_assert_odt.goRight((short) 100, true); 325 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 326 assertEquals("assert underline is BOLDDASH",com.sun.star.awt.FontUnderline.BOLDDASH,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 327 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 328 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 329 xTextCursor_assert_odt.gotoRange(xTextCursor_assert_odt, false); 330 xTextCursor_assert_odt.goRight((short) 100, true); 331 assertEquals("assert individula word setting",false,xCursorProps_assert_odt.getPropertyValue("CharWordMode")); 332 assertEquals("assert underline is bold",com.sun.star.awt.FontUnderline.BOLD,xCursorProps_assert_odt.getPropertyValue("CharUnderline")); 333 assertEquals("assert has underline color",true,xCursorProps_assert_odt.getPropertyValue("CharUnderlineHasColor")); 334 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_odt.getPropertyValue("CharUnderlineColor")); 335 336 //reopen the document and assert row height setting 337 XTextDocument assertDocument_doc=(XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, app.loadDocument(Testspace.getPath("output/test.doc"))); 338 XTextCursor xTextCursor_assert_doc = assertDocument_doc.getText().createTextCursor(); 339 XPropertySet xCursorProps_assert_doc = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor_assert_doc); 340 341 xTextCursor_assert_odt.gotoStart(false); 342 xTextCursor_assert_odt.goRight((short) 100, true); 343 assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 344 assertEquals("assert underline is double",com.sun.star.awt.FontUnderline.DOUBLE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 345 assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 346 assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 347 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 348 xTextCursor_assert_doc.goRight((short) 100, true); 349 assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 350 assertEquals("assert underline is wave",com.sun.star.awt.FontUnderline.WAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 351 assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 352 assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 353 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 354 xTextCursor_assert_doc.goRight((short) 100, true); 355 assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 356 assertEquals("assert underline is smallwave",com.sun.star.awt.FontUnderline.SMALLWAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 357 assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 358 assertEquals("assert underline color",0x00FF00FF,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 359 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 360 xTextCursor_assert_doc.goRight((short) 100, true); 361 assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 362 assertEquals("assert underline is single",com.sun.star.awt.FontUnderline.SINGLE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 363 assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 364 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 365 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 366 xTextCursor_assert_doc.goRight((short) 100, true); 367 assertEquals("assert individual word setting",true,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 368 assertEquals("assert underline is without",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 369 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 370 xTextCursor_assert_doc.goRight((short) 100, true); 371 assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 372 assertEquals("assert underline is LONGDASH",com.sun.star.awt.FontUnderline.LONGDASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 373 assertEquals("assert has underline color is true",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 374 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 375 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 376 xTextCursor_assert_doc.goRight((short) 100, true); 377 assertEquals("assert individual word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 378 assertEquals("assert underline is DOUBLEWAVE",com.sun.star.awt.FontUnderline.DOUBLEWAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 379 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 380 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 381 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 382 xTextCursor_assert_doc.goRight((short) 100, true); 383 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 384 assertEquals("assert underline is DONTKNOW",com.sun.star.awt.FontUnderline.NONE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 385 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 386 xTextCursor_assert_doc.goRight((short) 100, true); 387 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 388 assertEquals("assert underline is DOTTED",com.sun.star.awt.FontUnderline.DOTTED,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 389 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 390 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 391 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 392 xTextCursor_assert_doc.goRight((short) 100, true); 393 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 394 assertEquals("assert underline is DASHDOTDOT",com.sun.star.awt.FontUnderline.DASHDOTDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 395 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 396 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 397 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 398 xTextCursor_assert_doc.goRight((short) 100, true); 399 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 400 assertEquals("assert underline is DASHDOT",com.sun.star.awt.FontUnderline.DASHDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 401 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 402 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 403 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 404 xTextCursor_assert_doc.goRight((short) 100, true); 405 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 406 assertEquals("assert underline is DASH",com.sun.star.awt.FontUnderline.DASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 407 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 408 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 409 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 410 xTextCursor_assert_doc.goRight((short) 100, true); 411 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 412 assertEquals("assert underline is BOLDWAVE",com.sun.star.awt.FontUnderline.BOLDWAVE,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 413 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 414 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 415 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 416 xTextCursor_assert_doc.goRight((short) 100, true); 417 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 418 assertEquals("assert underline is BOLDLONGDASH",com.sun.star.awt.FontUnderline.BOLDLONGDASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 419 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 420 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 421 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 422 xTextCursor_assert_doc.goRight((short) 100, true); 423 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 424 assertEquals("assert underline is BOLDDOTTED",com.sun.star.awt.FontUnderline.BOLDDOTTED,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 425 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 426 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 427 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 428 xTextCursor_assert_doc.goRight((short) 100, true); 429 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 430 assertEquals("assert underline is BOLDDASHDOTDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 431 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 432 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 433 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 434 xTextCursor_assert_doc.goRight((short) 100, true); 435 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 436 assertEquals("assert underline is BOLDDASHDOT",com.sun.star.awt.FontUnderline.BOLDDASHDOT,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 437 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 438 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 439 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 440 xTextCursor_assert_doc.goRight((short) 100, true); 441 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 442 assertEquals("assert underline is BOLDDASH",com.sun.star.awt.FontUnderline.BOLDDASH,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 443 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 444 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 445 xTextCursor_assert_doc.gotoRange(xTextCursor_assert_doc, false); 446 xTextCursor_assert_doc.goRight((short) 100, true); 447 assertEquals("assert individula word setting",false,xCursorProps_assert_doc.getPropertyValue("CharWordMode")); 448 assertEquals("assert underline is bold",com.sun.star.awt.FontUnderline.BOLD,xCursorProps_assert_doc.getPropertyValue("CharUnderline")); 449 assertEquals("assert has underline color",true,xCursorProps_assert_doc.getPropertyValue("CharUnderlineHasColor")); 450 assertEquals("assert underline color",0x0000FF00,xCursorProps_assert_doc.getPropertyValue("CharUnderlineColor")); 451 } 452 } 453