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