Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIvan Furnadjiev2011-01-28 10:52:18 +0000
committerIvan Furnadjiev2011-01-28 10:52:18 +0000
commit681dd359a25f5307c368a8e8c88c057e8508ca06 (patch)
treeabaf1ec2da714ce1c208724adcda8a59cfd63a48 /tests
parent29a21c6befc6db2850d5f5b5675538843fd41033 (diff)
downloadorg.eclipse.rap-681dd359a25f5307c368a8e8c88c057e8508ca06.tar.gz
org.eclipse.rap-681dd359a25f5307c368a8e8c88c057e8508ca06.tar.xz
org.eclipse.rap-681dd359a25f5307c368a8e8c88c057e8508ca06.zip
Fixed - bug 333143: Javascript error if set text with special characters to Text component
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333143
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.rap.rwt.q07.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java20
-rw-r--r--tests/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/lifecycle/EncodingUtil_Test.java10
2 files changed, 28 insertions, 2 deletions
diff --git a/tests/org.eclipse.rap.rwt.q07.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java b/tests/org.eclipse.rap.rwt.q07.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
index 1d4a335df4..4873dff775 100644
--- a/tests/org.eclipse.rap.rwt.q07.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
+++ b/tests/org.eclipse.rap.rwt.q07.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH.
+ * Copyright (c) 2002, 2011 Innoopract Informationssysteme GmbH.
* 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
+ * EclipseSource - ongoing development
******************************************************************************/
package org.eclipse.swt.internal.widgets.textkit;
@@ -114,6 +115,23 @@ public class TextLCA_Test extends TestCase {
textLCA.renderChanges( text );
assertEquals( "", Fixture.getAllMarkup() );
}
+
+ public void testRenderText_ZeroChar() throws IOException {
+ Fixture.fakeResponseWriter();
+ Display display = new Display();
+ Shell shell = new Shell( display, SWT.NONE );
+ Text text = new Text( shell, SWT.NONE );
+ shell.open();
+ Fixture.markInitialized( display );
+ Fixture.markInitialized( text );
+ Fixture.clearPreserved();
+ Fixture.preserveWidgets();
+ TextLCA textLCA = new TextLCA();
+ char[] value = new char[] { 'h', 'e', 'l', 0, 'l', 'o' };
+ text.setText( String.valueOf( value ) );
+ textLCA.renderChanges( text );
+ assertTrue( Fixture.getAllMarkup().endsWith( "setValue( \"hel\" );" ) );
+ }
public void testModifyEvent() {
final StringBuffer log = new StringBuffer();
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/lifecycle/EncodingUtil_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/lifecycle/EncodingUtil_Test.java
index 6dcd88d5b9..e9ac3f03b7 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/lifecycle/EncodingUtil_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/lifecycle/EncodingUtil_Test.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 EclipseSource and others.
+ * Copyright (c) 2009, 2011 EclipseSource 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
@@ -147,4 +147,12 @@ public class EncodingUtil_Test extends TestCase {
String result = EncodingUtil.removeNonDisplayableChars( stringToEscape );
assertEquals( expected, result );
}
+
+ public void testTruncateAtZero() {
+ char[] stringToTruncate = new char[] { 'h', 'e', 'l', 0, 'l', 'o' };
+ String expected = "hel";
+ String result
+ = EncodingUtil.truncateAtZero( String.valueOf( stringToTruncate ) );
+ assertEquals( expected, result );
+ }
}

Back to the top