Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java2
-rw-r--r--tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java20
2 files changed, 19 insertions, 3 deletions
diff --git a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
index 5306b545e4..b996624543 100644
--- a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
+++ b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
@@ -132,7 +132,7 @@ final class TextLCAUtil {
adapter.preserve( PROP_TEXT, txt );
if( selection != null ) {
text.setSelection( selection );
- adapter.preserve( PROP_SELECTION, selection );
+ adapter.preserve( PROP_SELECTION, text.getSelection() );
}
}
} );
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
index 3da12f4711..8348920d7d 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2013 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2002, 2014 Innoopract Informationssysteme GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
+
import org.eclipse.rap.json.JsonArray;
import org.eclipse.rap.json.JsonObject;
import org.eclipse.rap.json.JsonValue;
@@ -130,7 +131,7 @@ public class TextLCA_Test {
assertEquals( new Point( 1, 2 ), text.getSelection() );
}
-
+
@Test
public void testModifyEvent() {
ModifyListener listener = mock( ModifyListener.class );
@@ -222,6 +223,21 @@ public class TextLCA_Test {
}
@Test
+ public void testSelectionWithVerifyListener_adjustedValueIsNotRenderedBack() {
+ Fixture.markInitialized( display );
+ Fixture.markInitialized( text );
+ text.addVerifyListener( mock( VerifyListener.class ) );
+ Fixture.fakeSetProperty( getId( text ), "text", "abc" );
+ Fixture.fakeSetProperty( getId( text ), "selectionStart", 10 );
+ Fixture.fakeSetProperty( getId( text ), "selectionLength", 0 );
+
+ Fixture.executeLifeCycleFromServerThread();
+
+ Message message = Fixture.getProtocolMessage();
+ assertNull( message.findSetOperation( text, "selection" ) );
+ }
+
+ @Test
public void testPreserveText() {
Fixture.markInitialized( display );
Fixture.markInitialized( text );

Back to the top