@@ -49,18 +49,18 @@ protected final void initializeTextViewerWithFindReplaceUI(String content) {
4949 initializeFindReplaceUIForTextViewer ();
5050 }
5151
52- private void openTextViewer (String content ) {
52+ protected void openTextViewer (String content ) {
5353 fTextViewer = new TextViewer (PlatformUI .getWorkbench ().getActiveWorkbenchWindow ().getShell (), SWT .BORDER | SWT .V_SCROLL | SWT .H_SCROLL );
5454 fTextViewer .setDocument (new Document (content ));
5555 fTextViewer .getControl ().setFocus ();
5656 }
5757
58- private void initializeFindReplaceUIForTextViewer () {
58+ protected void initializeFindReplaceUIForTextViewer () {
5959 dialog = openUIFromTextViewer (fTextViewer );
6060 dialog .assertInitialConfiguration ();
6161 }
6262
63- private void reopenFindReplaceUIForTextViewer () {
63+ protected void reopenFindReplaceUIForTextViewer () {
6464 dialog .close ();
6565 dialog = openUIFromTextViewer (fTextViewer );
6666 }
@@ -189,45 +189,31 @@ public void testChangeInputForIncrementalSearch() {
189189 @ Test
190190 public void testFindWithWholeWordEnabledWithMultipleWords () {
191191 initializeTextViewerWithFindReplaceUI ("two words two" );
192- dialog .setFindText ( "two" );
192+ dialog .select ( SearchOptions . INCREMENTAL );
193193 dialog .select (SearchOptions .WHOLE_WORD );
194194 dialog .select (SearchOptions .WRAP );
195+ dialog .setFindText ("two" );
195196 IFindReplaceTarget target = dialog .getTarget ();
196197 assertEquals (0 , (target .getSelection ()).x );
197- assertEquals (0 , (target .getSelection ()).y );
198+ assertEquals (3 , (target .getSelection ()).y );
198199
199200 dialog .setFindText ("two wo" );
200201 dialog .assertDisabled (SearchOptions .WHOLE_WORD );
201202 dialog .assertSelected (SearchOptions .WHOLE_WORD );
202203
203204 dialog .simulateEnterInFindInputField (false );
204205 assertThat (target .getSelectionText (), is (dialog .getFindText ()));
205- assertEquals (0 , (target .getSelection ()).x );
206- assertEquals (dialog .getFindText ().length (), (target .getSelection ()).y );
207- }
208-
209- @ Test
210- public void testReplaceAndFindAfterInitializingFindWithSelectedString () {
211- openTextViewer ("text text text" );
212- fTextViewer .setSelectedRange (0 , 4 );
213- initializeFindReplaceUIForTextViewer ();
214206
215- IFindReplaceTarget target = dialog .getTarget ();
216207 assertEquals (0 , (target .getSelection ()).x );
217- assertEquals (4 , (target .getSelection ()).y );
218-
219- dialog .performReplaceAndFind ();
220-
221- assertEquals (" text text" , fTextViewer .getDocument ().get ());
222- assertEquals (1 , (target .getSelection ()).x );
223- assertEquals (4 , (target .getSelection ()).y );
208+ assertEquals (dialog .getFindText ().length (), (target .getSelection ()).y );
224209 }
225210
226211 @ Test
227212 public void testRegExSearch () {
228213 initializeTextViewerWithFindReplaceUI ("abc" );
229214 dialog .select (SearchOptions .REGEX );
230215 dialog .setFindText ("(a|bc)" );
216+
231217 IFindReplaceTarget target = dialog .getTarget ();
232218 dialog .simulateEnterInFindInputField (false );
233219 assertEquals (0 , (target .getSelection ()).x );
@@ -304,41 +290,6 @@ public void testActivateDialogWithSelectionActive() {
304290 assertThat (fTextViewer .getDocument ().get (), is ("text" + System .lineSeparator () + System .lineSeparator ()));
305291 }
306292
307- @ Test
308- public void testIncrementalSearchOnlyEnabledWhenAllowed () {
309- initializeTextViewerWithFindReplaceUI ("text text text" );
310-
311- dialog .select (SearchOptions .INCREMENTAL );
312- dialog .select (SearchOptions .REGEX );
313-
314- dialog .assertSelected (SearchOptions .INCREMENTAL );
315- dialog .assertDisabled (SearchOptions .INCREMENTAL );
316- }
317-
318- /*
319- * Test for https://github.com/eclipse-platform/eclipse.platform.ui/pull/1805#pullrequestreview-1993772378
320- */
321- @ Test
322- public void testIncrementalSearchOptionRecoveredCorrectly () {
323- initializeTextViewerWithFindReplaceUI ("text text text" );
324-
325- dialog .select (SearchOptions .INCREMENTAL );
326- dialog .assertSelected (SearchOptions .INCREMENTAL );
327- dialog .assertEnabled (SearchOptions .INCREMENTAL );
328-
329- reopenFindReplaceUIForTextViewer ();
330- dialog .assertSelected (SearchOptions .INCREMENTAL );
331- dialog .assertEnabled (SearchOptions .INCREMENTAL );
332-
333- dialog .select (SearchOptions .REGEX );
334- dialog .assertSelected (SearchOptions .INCREMENTAL );
335- dialog .assertDisabled (SearchOptions .INCREMENTAL );
336-
337- reopenFindReplaceUIForTextViewer ();
338- dialog .assertSelected (SearchOptions .INCREMENTAL );
339- dialog .assertDisabled (SearchOptions .INCREMENTAL );
340- }
341-
342293 protected AccessType getDialog () {
343294 return dialog ;
344295 }
0 commit comments