Search in sources :

Example 1 with MovementListener

use of org.eclipse.swt.custom.MovementListener in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyledText method test_removeWordMovementListener_invokeActionSelectWordCallsNoMethods.

@Test
public void test_removeWordMovementListener_invokeActionSelectWordCallsNoMethods() {
    MovementListener listener = new RecordingMovementListener();
    listenerCalled = false;
    listener2Called = false;
    text.setText("Word0 Word1 Word2");
    text.addWordMovementListener(listener);
    text.removeWordMovementListener(listener);
    text.invokeAction(ST.SELECT_WORD_NEXT);
    text.invokeAction(ST.SELECT_WORD_PREVIOUS);
    assertFalse("Listener unexpectantly called", listenerCalled);
    assertFalse("Listener unexpectantly called", listener2Called);
}
Also used : MovementListener(org.eclipse.swt.custom.MovementListener) Test(org.junit.Test)

Example 2 with MovementListener

use of org.eclipse.swt.custom.MovementListener in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyledText method test_addWordMovementListener_invokeActionSelectWordPreviousCallsGetPreviousOffset.

@Test
public void test_addWordMovementListener_invokeActionSelectWordPreviousCallsGetPreviousOffset() {
    MovementListener listener = new RecordingMovementListener();
    listenerCalled = false;
    listener2Called = false;
    text.setText("Word0 Word1 Word2");
    text.addWordMovementListener(listener);
    text.invokeAction(ST.SELECT_WORD_PREVIOUS);
    assertTrue("Listener not called", listenerCalled);
    assertFalse("Listener unexpectantly called", listener2Called);
}
Also used : MovementListener(org.eclipse.swt.custom.MovementListener) Test(org.junit.Test)

Example 3 with MovementListener

use of org.eclipse.swt.custom.MovementListener in project eclipse.platform.swt by eclipse.

the class Test_org_eclipse_swt_custom_StyledText method test_addWordMovementListener_invokeActionSelectWordNextCallsGetNextOffset.

@Test
public void test_addWordMovementListener_invokeActionSelectWordNextCallsGetNextOffset() {
    MovementListener listener = new RecordingMovementListener();
    listenerCalled = false;
    listener2Called = false;
    text.setText("Word0 Word1 Word2");
    text.addWordMovementListener(listener);
    text.invokeAction(ST.SELECT_WORD_NEXT);
    assertFalse("Listener unexpectantly called", listenerCalled);
    assertTrue("Listener not called", listener2Called);
}
Also used : MovementListener(org.eclipse.swt.custom.MovementListener) Test(org.junit.Test)

Aggregations

MovementListener (org.eclipse.swt.custom.MovementListener)3 Test (org.junit.Test)3