1 19 20 package search_replace; 21 22 import java.awt.event.KeyEvent ; 23 import java.io.File ; 24 import java.io.FileOutputStream ; 25 import java.io.IOException ; 26 import java.io.OutputStream ; 27 import java.io.PrintStream ; 28 import java.util.Hashtable ; 29 import javax.swing.SwingUtilities ; 30 import javax.swing.text.BadLocationException ; 31 import javax.swing.text.Document ; 32 import org.netbeans.jellytools.EditorOperator; 33 import org.netbeans.jellytools.actions.FindAction; 34 import org.netbeans.jellytools.modules.editor.Find; 35 import org.netbeans.jemmy.operators.JEditorPaneOperator; 36 37 42 43 44 public class SearchAndReplaceTest extends lib.EditorTestCase{ 45 46 private PrintStream systemOutPSWrapper = new PrintStream (System.out); 48 private int index = 0; 49 private EditorOperator editor; 50 private JEditorPaneOperator txtOper; 51 private int WAIT_MAX_MILIS_FOR_FIND_OPERATION = 5000; 52 53 public static final int NO_OPERATION = 0x00000000; 54 public static final int MATCH_CASE = 0x00000001; 55 public static final int WHOLE_WORDS = 0x00000002; 56 public static final int REGULAR_EXPRESSIONS = 0x00000004; 57 public static final int HIGHLIGHT_RESULTS = 0x00000008; 58 public static final int WRAP_AROUND = 0x00000010; 59 public static final int SEARCH_SELECTION = 0x00000020; 60 public static final int SEARCH_BACKWARDS = 0x00000040; 61 public static final int INCREMENTAL_SEARCH = 0x00000080; 62 public static final int ALL_UNCHECKED = 0x10000000; 63 public static final int NO_RESET = 0x20000000; 64 public static final int NO_RESET_SEARCH_SELECTION = 0x40000000; 65 66 67 public SearchAndReplaceTest(String testMethodName) { 68 super(testMethodName); 69 } 70 71 private String getIndexAsString(){ 72 String ret = String.valueOf(index); 73 if (ret.length() == 1) ret = "0" + ret; 74 return ret; 75 } 76 77 private String getRefFileName(){ 78 return this.getName()+getIndexAsString()+".ref"; } 80 81 private String getGoldenFileName(){ 82 return this.getName()+getIndexAsString()+".pass"; } 84 85 private String getDiffFileName(){ 86 return this.getName()+getIndexAsString()+".diff"; } 88 89 private Hashtable logStreamTable = null; 91 92 private PrintStream getFileLog(String logName) throws IOException { 93 OutputStream outputStream; 94 FileOutputStream fileOutputStream; 95 96 if ((logStreamTable == null)|(hasTestMethodChanged())) { 97 logStreamTable = new Hashtable (); 99 } else { 101 if (logStreamTable.containsKey(logName)) { 102 return (PrintStream )logStreamTable.get(logName); 104 } 105 } 106 FileOutputStream fileLog = new FileOutputStream (new File (getWorkDir(),logName)); 108 PrintStream printStreamLog = new PrintStream (fileLog,true); 109 logStreamTable.put(logName,printStreamLog); 110 return printStreamLog; 112 } 113 114 private String lastTestMethod=null; 115 116 private boolean hasTestMethodChanged() { 117 if (!this.getName().equals(lastTestMethod)) { 118 lastTestMethod=this.getName(); 119 return true; 120 } else { 121 return false; 122 } 123 } 124 125 public PrintStream getRef() { 126 String refFilename = getRefFileName(); 127 try { 128 return getFileLog(refFilename); 129 } catch (IOException ioe) { 130 fail("Could not open reference file: "+refFilename); 134 return systemOutPSWrapper; 135 } 136 } 137 138 protected void compareToGoldenFile(Document testDoc){ 139 try { 140 ref(testDoc.getText(0, testDoc.getLength())); 141 compareReferenceFiles(getRefFileName(), getGoldenFileName(), getDiffFileName()); 142 index++; 143 } catch (BadLocationException e) { 144 e.printStackTrace(getLog()); 145 fail(); 146 } 147 } 148 149 private void resetFindProperties(Find find, boolean resetSearchSelection){ 150 find.cbMatchCase().setSelected(false); 151 find.cbMatchWholeWordsOnly().setSelected(false); 152 find.cbRegularExpressions().setSelected(false); 153 find.cbHighlightSearch().setSelected(false); 154 find.cbWrapSearch().setSelected(false); 155 if (resetSearchSelection) { 156 find.cbBlockSearch().setSelected(false); 157 } 158 find.cbBackwardSearch().setSelected(false); 159 find.cbIncrementalSearch().setSelected(false); 160 find.cboFindWhat().clearText(); 161 } 162 163 protected Find openFindDialog(String text, int modifiers){ 164 new FindAction().perform(); 165 Find find = new Find(); 166 if (modifiers != 0 && (modifiers & NO_RESET) == 0) { 167 resetFindProperties(find, (modifiers & NO_RESET_SEARCH_SELECTION) == 0); 168 } 169 if ((modifiers & MATCH_CASE) != 0){ 170 find.cbMatchCase().setSelected(true); 171 } 172 if ((modifiers & WHOLE_WORDS) != 0){ 173 find.cbMatchWholeWordsOnly().setSelected(true); 174 } 175 if ((modifiers & REGULAR_EXPRESSIONS) != 0){ 176 find.cbRegularExpressions().setSelected(true); 177 } 178 if ((modifiers & HIGHLIGHT_RESULTS) != 0){ 179 find.cbHighlightSearch().setSelected(true); 180 } 181 if ((modifiers & WRAP_AROUND) != 0){ 182 find.cbWrapSearch().setSelected(true); 183 } 184 if ((modifiers & SEARCH_SELECTION) != 0){ 185 find.cbBlockSearch().setSelected(true); 186 } 187 if ((modifiers & SEARCH_BACKWARDS) != 0){ 188 find.cbBackwardSearch().setSelected(true); 189 } 190 if ((modifiers & INCREMENTAL_SEARCH) != 0){ 191 find.cbIncrementalSearch().setSelected(true); 192 } 193 find.cboFindWhat().clearText(); 194 if (text != null){ 195 find.cboFindWhat().typeText(text); 196 } 197 return find; 198 } 199 200 private ValueResolver getSelectionResolver(final JEditorPaneOperator txtOper, final int startEtalon, final int endEtalon){ 201 202 ValueResolver clipboardValueResolver = new ValueResolver(){ 203 public Object getValue(){ 204 int selectionStart = txtOper.getSelectionStart(); 205 int selectionEnd = txtOper.getSelectionEnd(); 206 if (selectionStart == selectionEnd){ 207 selectionStart = -1; 208 selectionEnd = -1; 209 } 210 if (selectionStart != startEtalon || selectionEnd != endEtalon){ 211 return Boolean.FALSE; 212 } else { 213 return Boolean.TRUE; 214 } 215 } 216 }; 217 218 return clipboardValueResolver; 219 } 220 221 private ValueResolver getIncFindResolver(final JEditorPaneOperator txtOper, final int startEtalon, final int endEtalon){ 222 223 ValueResolver clipboardValueResolver = new ValueResolver(){ 224 public Object getValue(){ 225 org.netbeans.editor.BaseTextUI ui = (org.netbeans.editor.BaseTextUI)txtOper.getUI(); 226 org.netbeans.editor.EditorUI editorUI = ui.getEditorUI(); 227 org.netbeans.editor.DrawLayerFactory.IncSearchLayer incLayer 228 = (org.netbeans.editor.DrawLayerFactory.IncSearchLayer)editorUI.findLayer( 229 org.netbeans.editor.DrawLayerFactory.INC_SEARCH_LAYER_NAME); 230 int selectionStart = -1; 231 int selectionEnd = -1; 232 if (incLayer == null) { 233 return Boolean.FALSE; 234 } else { 235 if (incLayer.isEnabled()) { 236 selectionStart = incLayer.getOffset(); 237 selectionEnd = selectionStart + incLayer.getLength(); 238 } 239 } 240 if (selectionStart == selectionEnd){ 241 selectionStart = -1; 242 selectionEnd = -1; 243 } 244 if (selectionStart != startEtalon || selectionEnd != endEtalon){ 245 return Boolean.FALSE; 246 } else { 247 return Boolean.TRUE; 248 } 249 } 250 }; 251 252 return clipboardValueResolver; 253 } 254 255 256 protected boolean find(String text, int modifiers, int startEtalon, int endEtalon, int setCaretPos){ 257 if (setCaretPos > -1){ 258 txtOper.setCaretPosition(setCaretPos); 259 } 260 Find find = openFindDialog(text, modifiers); 261 find.find(); 262 waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_FIND_OPERATION, getSelectionResolver(txtOper, startEtalon, endEtalon), Boolean.TRUE); 263 int selectionStart = txtOper.getSelectionStart(); 264 int selectionEnd = txtOper.getSelectionEnd(); 265 if (selectionStart == selectionEnd){ 266 selectionEnd = -1; 267 selectionStart = -1; 268 } 269 if (selectionStart != startEtalon || selectionEnd != endEtalon){ 270 log("--------------------------------------------------"); 271 log("Find operation failed. Selected text: "+selectionStart+" - "+selectionEnd+" >>> Expected values: "+startEtalon+" - "+endEtalon); 272 log("find dialog find what combo value:"+find.cboFindWhat().getEditor().getItem()); 273 log("checkboxes:"+ 274 "\n cbBackwardSearch:"+find.cbBackwardSearch().isSelected()+ 275 "\n cbBlockSearch:"+find.cbBlockSearch().isSelected()+ 276 "\n cbHighlightSearch:"+find.cbHighlightSearch().isSelected()+ 277 "\n cbIncrementalSearch:"+find.cbIncrementalSearch().isSelected()+ 278 "\n cbMatchCase:"+find.cbMatchCase().isSelected()+ 279 "\n cbMatchWholeWordsOnly:"+find.cbMatchWholeWordsOnly().isSelected()+ 280 "\n cbRegularExpressions:"+find.cbRegularExpressions().isSelected()+ 281 "\n cbWrapSearch:"+find.cbWrapSearch().isSelected() 282 ); 283 log("--------------------------------------------------"); 284 fail("Find operation failed. Selected text: "+selectionStart+" - "+selectionEnd+" >>> Expected values: "+startEtalon+" - "+endEtalon); find.close(); 286 return false; 287 } 288 find.close(); 289 return true; 290 } 291 292 private void checkIncrementalSearch(Find find, String s, int startEtalon, int endEtalon){ 293 if (true) 295 return; 296 297 find.cboFindWhat().typeText(s); 298 299 waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_FIND_OPERATION, getIncFindResolver(txtOper, startEtalon, endEtalon), Boolean.TRUE); 300 301 int selectionStart = -1; 302 int selectionEnd = -1; 303 304 org.netbeans.editor.BaseTextUI ui = (org.netbeans.editor.BaseTextUI)txtOper.getUI(); 305 org.netbeans.editor.EditorUI editorUI = ui.getEditorUI(); 306 org.netbeans.editor.DrawLayerFactory.IncSearchLayer incLayer 307 = (org.netbeans.editor.DrawLayerFactory.IncSearchLayer)editorUI.findLayer( 308 org.netbeans.editor.DrawLayerFactory.INC_SEARCH_LAYER_NAME); 309 if (incLayer == null) { 310 System.out.println("fail: layer not initialized"); 311 } else { 312 if (incLayer.isEnabled()) { 313 selectionStart = incLayer.getOffset(); 314 selectionEnd = selectionStart + incLayer.getLength(); 315 } 316 } 317 318 if (selectionStart == selectionEnd){ 319 selectionEnd = -1; 320 selectionStart = -1; 321 } 322 if (selectionStart != startEtalon || selectionEnd != endEtalon){ 323 fail("Incremental find operation failed. Selected text: "+selectionStart+" - "+selectionEnd+" >>> Expected values: "+startEtalon+" - "+endEtalon); } 325 } 326 327 private void preselect(JEditorPaneOperator txtOper, int start, int end){ 328 txtOper.setSelectionStart(start); 329 txtOper.setSelectionEnd(end); 330 } 331 332 private void checkSelection(JEditorPaneOperator txtOper, int startEtalon, int endEtalon, String errorMessage){ 333 waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_FIND_OPERATION, getSelectionResolver(txtOper, startEtalon, endEtalon), Boolean.TRUE); 334 int selectionStart = txtOper.getSelectionStart(); 335 int selectionEnd = txtOper.getSelectionEnd(); 336 if (selectionStart == selectionEnd){ 337 selectionStart = -1; 338 selectionEnd = -1; 339 } 340 if (selectionStart != startEtalon || selectionEnd != endEtalon){ 341 fail(errorMessage+" Selected text: "+selectionStart+" - "+selectionEnd+" >>> Expected values: "+startEtalon+" - "+endEtalon); } 343 } 344 345 public void testSearch(){ 346 openDefaultProject(); 347 openDefaultSampleFile(); 348 try { 349 editor = getDefaultSampleEditorOperator(); 350 txtOper = editor.txtEditorPane(); 351 352 find("searchText", ALL_UNCHECKED, 161, 171, 0); 353 find("SeArCHText", MATCH_CASE, 175, 185, 0); 354 find("SeArCHText", WHOLE_WORDS, 275, 285, 206); 355 find("SeArCHText", MATCH_CASE | WHOLE_WORDS, 289, 299, 206); 356 find("SeArCHText", SEARCH_BACKWARDS, 341, 351, 352); 357 find("SeArCHText", SEARCH_BACKWARDS | MATCH_CASE, 289, 299, 352); 358 find("search", SEARCH_BACKWARDS | WHOLE_WORDS, 318, 324, 352); 359 find("search", SEARCH_BACKWARDS | MATCH_CASE | WHOLE_WORDS, 311, 317, 352); 360 find("insert", SEARCH_BACKWARDS | WRAP_AROUND, 86, 92, 86); 361 find("insert", SEARCH_BACKWARDS, -1, -1, 86); 362 363 txtOper.setCaretPosition(328); 365 Find find = openFindDialog(null, INCREMENTAL_SEARCH); 366 checkIncrementalSearch(find, "t", 328, 329); 367 checkIncrementalSearch(find, "e", 330, 332); 368 checkIncrementalSearch(find, "x", 330, 333); 369 checkIncrementalSearch(find, "t", 330, 334); 370 checkIncrementalSearch(find, "x", 429, 434); 371 checkIncrementalSearch(find, "y", -1, -1); find.close(); 373 374 txtOper.setCaretPosition(328); 376 find = openFindDialog(null, INCREMENTAL_SEARCH | MATCH_CASE | SEARCH_BACKWARDS); 377 checkIncrementalSearch(find, "s", 311, 312); 378 checkIncrementalSearch(find, "e", 311, 313); 379 checkIncrementalSearch(find, "a", 311, 314); 380 checkIncrementalSearch(find, "r", 311, 315); 381 checkIncrementalSearch(find, "c", 311, 316); 382 checkIncrementalSearch(find, "h", 311, 317); 383 checkIncrementalSearch(find, "T", 275, 282); 384 checkIncrementalSearch(find, "e", 275, 283); 385 checkIncrementalSearch(find, "x", 275, 284); 386 checkIncrementalSearch(find, "T", -1, -1); 387 find.close(); 388 389 txtOper.setSelectionStart(1); 391 txtOper.setSelectionEnd(100); 392 final Find blockFind = openFindDialog(null, NO_OPERATION); 394 395 waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_FIND_OPERATION, new ValueResolver(){ 397 public Object getValue(){ 398 return Boolean.valueOf(blockFind.cbBlockSearch().isSelected()); 399 } 400 }, Boolean.TRUE); 401 if (!blockFind.cbBlockSearch().isSelected()){ 402 fail("Search Selection checkbox was not checked automaticaly after invoking " + 403 "Find dialog over selected text"); } 405 406 blockFind.close(); 407 412 414 find = openFindDialog(null, ALL_UNCHECKED); find.close(); 417 preselect(txtOper, 46, 132); 418 find("searchText", NO_OPERATION, -1, -1, -1); 420 421 preselect(txtOper, 47, 123); 424 find("public", NO_RESET, 105, 111, -1); 425 426 preselect(txtOper, 161, 544); 427 find("SeArCHText", NO_RESET_SEARCH_SELECTION | MATCH_CASE, 175, 185, -1); 428 preselect(txtOper, 206, 544); 429 find("SeArCHText", NO_RESET_SEARCH_SELECTION | WHOLE_WORDS, 275, 285, -1); 430 preselect(txtOper, 206, 544); 431 find("SeArCHText", NO_RESET_SEARCH_SELECTION | MATCH_CASE | WHOLE_WORDS, 289, 299, -1); 432 preselect(txtOper, 161, 544); 433 find("searchText", NO_RESET_SEARCH_SELECTION | SEARCH_BACKWARDS, 469, 479, -1); 434 preselect(txtOper, 161, 544); 435 find("searchText", NO_RESET_SEARCH_SELECTION | SEARCH_BACKWARDS | MATCH_CASE, 455, 465, -1); 436 preselect(txtOper, 161, 544); 437 find("search", NO_RESET_SEARCH_SELECTION | SEARCH_BACKWARDS | WHOLE_WORDS, 318, 324, -1); 438 preselect(txtOper, 161, 544); 439 find("search", NO_RESET_SEARCH_SELECTION | SEARCH_BACKWARDS | MATCH_CASE | WHOLE_WORDS, 311, 317, -1); 440 441 find = openFindDialog(null, ALL_UNCHECKED); find.close(); 444 preselect(txtOper, 409, 465); 445 find = openFindDialog("searchText", NO_OPERATION); find.find(); 447 checkSelection(txtOper, 410, 420, "Wrap around block testing failed!"); 448 find.find(); 449 checkSelection(txtOper, 423, 433, "Wrap around block testing failed!"); 450 find.find(); 451 checkSelection(txtOper, 455, 465, "Wrap around block testing failed!"); 452 find.find(); 453 checkSelection(txtOper, -1, -1, "Wrap around block testing failed!"); find.cbWrapSearch().setSelected(true); 455 find.find(); 456 checkSelection(txtOper, 410, 420, "Wrap around block testing failed!"); 457 find.close(); 458 459 find = openFindDialog(null, ALL_UNCHECKED); find.close(); 462 preselect(txtOper, 409, 465); 463 find = openFindDialog("searchText", NO_RESET_SEARCH_SELECTION | SEARCH_BACKWARDS); 464 find.find(); 465 checkSelection(txtOper, 455, 465, "Wrap around block testing failed!"); 466 find.find(); 467 checkSelection(txtOper, 423, 433, "Wrap around block testing failed!"); 468 find.find(); 469 checkSelection(txtOper, 410, 420, "Wrap around block testing failed!"); 470 find.find(); 471 checkSelection(txtOper, -1, -1, "Wrap around block testing failed!"); find.cbWrapSearch().setSelected(true); 473 find.find(); 474 checkSelection(txtOper, 455, 465, "Wrap around block testing failed!"); 475 find.close(); 476 477 find = openFindDialog(null, ALL_UNCHECKED); find.close(); 480 preselect(txtOper, 325, 360); 481 find = openFindDialog(null, NO_RESET_SEARCH_SELECTION | INCREMENTAL_SEARCH); 482 checkIncrementalSearch(find, "t", 325, 326); 483 checkIncrementalSearch(find, "e", 325, 327); 484 checkIncrementalSearch(find, "x", 325, 328); 485 checkIncrementalSearch(find, "t", 325, 329); 486 checkIncrementalSearch(find, "x", -1, -1); find.close(); 488 489 find = openFindDialog(null, ALL_UNCHECKED); find.close(); 492 preselect(txtOper, 251 , 350); 493 find = openFindDialog(null, NO_RESET_SEARCH_SELECTION | INCREMENTAL_SEARCH | MATCH_CASE | SEARCH_BACKWARDS); 494 checkIncrementalSearch(find, "T", 347, 348); 495 checkIncrementalSearch(find, "e", 347, 349); 496 checkIncrementalSearch(find, "x", 347, 350); 497 checkIncrementalSearch(find, "t", 295, 299); 498 checkIncrementalSearch(find, "X", -1, -1); find.close(); 500 } finally { 501 closeFileWithDiscard(); 502 } 503 } 504 505 public void testSearch2(){ 506 openDefaultProject(); 507 openDefaultSampleFile(); 508 Find find; 509 try { 510 editor = getDefaultSampleEditorOperator(); 511 txtOper = editor.txtEditorPane(); 512 513 editor.setCaretPosition(16, 9); txtOper.pushKey(KeyEvent.VK_J, KeyEvent.ALT_DOWN_MASK); 517 cutCopyViaStrokes(txtOper, KeyEvent.VK_C, KeyEvent.CTRL_MASK); 518 editor.setCaretPosition(1, 1); 519 find = openFindDialog(null, ALL_UNCHECKED); find.cboFindWhat().requestFocus(); waitForAWTThread(); 522 pasteViaStrokes(find, KeyEvent.VK_V, KeyEvent.CTRL_MASK, null); 523 waitForAWTThread(); 524 find.btFind().requestFocus(); 525 waitForAWTThread(); 526 log("Searching for: "+find.cboFindWhat().getTextField().getText()); 527 find.find(); 528 find.close(); 529 checkSelection(txtOper, 8, 14, "Issue #52115 testing failed on CTRL+V!"); 530 editor.setCaretPosition(327); txtOper.pushKey(KeyEvent.VK_J, KeyEvent.ALT_DOWN_MASK); 533 cutCopyViaStrokes(txtOper, KeyEvent.VK_C, KeyEvent.CTRL_MASK); 534 editor.setCaretPosition(1, 1); 535 find = openFindDialog(null, ALL_UNCHECKED); find.cboFindWhat().requestFocus(); waitForAWTThread(); 538 pasteViaStrokes(find, KeyEvent.VK_INSERT, KeyEvent.SHIFT_DOWN_MASK, null); 539 waitForAWTThread(); 540 find.btFind().requestFocus(); 541 waitForAWTThread(); 542 log("Searching for: "+find.cboFindWhat().getTextField().getText()); 543 find.find(); 544 find.close(); 545 checkSelection(txtOper, 167, 171, "Issue #52115 testing failed on Shift+Insert!"); 546 } finally { 547 closeFileWithDiscard(); 548 } 549 550 } 551 public void waitForAWTThread() { 552 try { 553 SwingUtilities.invokeAndWait(new Runnable () { 554 public void run() { 555 log("Stop waiting"); 556 } 557 }); 558 } catch (Exception e) { 559 } 561 } 562 563 public void testRegExSearch(){ 564 openDefaultProject(); 565 openDefaultSampleFile(); 566 try { 567 editor = getDefaultSampleEditorOperator(); 568 txtOper = editor.txtEditorPane(); 569 570 final Find findRegEx = openFindDialog(null, REGULAR_EXPRESSIONS); 572 waitMaxMilisForValue(WAIT_MAX_MILIS_FOR_FIND_OPERATION, new ValueResolver(){ 573 public Object getValue(){ 574 return Boolean.valueOf( 575 findRegEx.cbMatchWholeWordsOnly().isEnabled() && 576 findRegEx.cbIncrementalSearch().isEnabled()); 577 } 578 }, Boolean.FALSE); 579 if (findRegEx.cbMatchWholeWordsOnly().isEnabled() || findRegEx.cbIncrementalSearch().isEnabled()){ 580 fail("Items disabling failed. \"Whole Words\" and \"Incremental Search\" should be disabled during regEx! " + "(\"Whole Words\" = "+findRegEx.cbMatchWholeWordsOnly().isEnabled()+ ", \"Incremental Search\" = "+findRegEx.cbIncrementalSearch().isEnabled()+")"); } 584 findRegEx.close(); 585 586 587 find("teest", REGULAR_EXPRESSIONS, 309, 314, 0); 588 find("t.*st", REGULAR_EXPRESSIONS, 325, 337, 314); find("t.*st", REGULAR_EXPRESSIONS, 348, 356, 326); find("T.*st", REGULAR_EXPRESSIONS | MATCH_CASE, 348, 356, 309); find("t.*st", REGULAR_EXPRESSIONS | SEARCH_BACKWARDS, 348, 356, 356); 592 find("t.*st", REGULAR_EXPRESSIONS | SEARCH_BACKWARDS | MATCH_CASE, 325, 337, 356); 593 594 String lineStringsExp = "\"[^\"\\r\\n]*\""; 596 editor.setCaretPosition(225); 597 Find find = openFindDialog(lineStringsExp, REGULAR_EXPRESSIONS); 598 find.find(); 599 checkSelection(txtOper, 267, 286, "Line string search failed."); 600 find.find(); 601 checkSelection(txtOper, 417, 430, "Line string search failed."); 602 find.find(); 603 checkSelection(txtOper, -1, -1, "Line string search failed."); 604 find.cbWrapSearch().setSelected(true); 605 find.find(); 606 checkSelection(txtOper, 224, 237, "Line string wrap search failed."); 607 find.close(); 608 609 editor.setCaretPosition(429); 611 find = openFindDialog(lineStringsExp, REGULAR_EXPRESSIONS | SEARCH_BACKWARDS); 612 find.find(); 613 checkSelection(txtOper, 267, 286, "Line string BWD search failed."); 614 find.find(); 615 checkSelection(txtOper, 224, 237, "Line string BWV search failed."); 616 find.find(); 617 checkSelection(txtOper, -1, -1, "Line string BWV search failed."); 618 find.cbWrapSearch().setSelected(true); 619 find.find(); 620 checkSelection(txtOper, 417, 430, "Line string BWV wrap search failed."); 621 find.close(); 622 623 find("\"[^\"]*\"", REGULAR_EXPRESSIONS, 456, 510, 432); 625 626 find = openFindDialog(null, REGULAR_EXPRESSIONS); find.close(); 629 preselect(txtOper, 326, 389); 630 find = openFindDialog("T.*st", NO_OPERATION); find.find(); 632 checkSelection(txtOper, 348, 356, "Wrap around block regEx testing failed!"); 633 find.find(); 634 checkSelection(txtOper, 367, 373, "Wrap around block regEx testing failed!"); 635 find.find(); 636 checkSelection(txtOper, -1, -1, "Wrap around block regEx testing failed!"); find.cbWrapSearch().setSelected(true); 638 find.find(); 639 checkSelection(txtOper, 348, 356, "Wrap around block regEx testing failed!"); 640 find.close(); 641 642 find = openFindDialog(null, REGULAR_EXPRESSIONS | SEARCH_BACKWARDS | MATCH_CASE); find.close(); 645 preselect(txtOper, 252, 369); 646 find = openFindDialog("t.*st", NO_OPERATION); find.find(); 648 checkSelection(txtOper, 325, 337, "Wrap around block BWD regEx testing failed!"); 649 find.find(); 650 checkSelection(txtOper, 309, 314, "Wrap around block BWD regEx testing failed!"); 651 find.find(); 652 checkSelection(txtOper, -1, -1, "Wrap around block BWV regEx testing failed!"); find.cbWrapSearch().setSelected(true); 654 find.find(); 655 checkSelection(txtOper, 325, 337, "Wrap around block BWV regEx testing failed!"); 656 find.close(); 657 658 String lineEndWhitespaces = "[ \\t]+$"; 660 editor.setCaretPosition(1); 661 find = openFindDialog(lineEndWhitespaces, REGULAR_EXPRESSIONS); 662 find.find(); 663 checkSelection(txtOper, 104, 108, "Find end line whitespaces testing failed!"); 664 find.find(); 665 checkSelection(txtOper, 443, 444, "Find end line whitespaces testing failed!"); 666 find.find(); 667 checkSelection(txtOper, 510, 511, "Find end line whitespaces testing failed!"); 668 find.find(); 669 checkSelection(txtOper, 599, 607, "Find end line whitespaces testing failed!"); 670 find.close(); 671 672 673 } finally { 674 closeFileWithDiscard(); 675 } 676 } 677 678 }
| Popular Tags
|