mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[168197] Fix Terminal for CDC-1.1/Foundation-1.1
This commit is contained in:
parent
6bb3eeaebb
commit
1941a62e16
6 changed files with 126 additions and 82 deletions
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#Sun Mar 16 19:48:21 CET 2008
|
||||
#Fri Apr 11 20:49:09 CEST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.4
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
|
|
|
@ -10,7 +10,8 @@ Require-Bundle: org.junit,
|
|||
org.eclipse.swt,
|
||||
org.eclipse.jface,
|
||||
org.eclipse.core.runtime
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.4
|
||||
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
|
||||
J2SE-1.4
|
||||
Export-Package: org.eclipse.tm.internal.terminal.connector;x-internal:=true,
|
||||
org.eclipse.tm.internal.terminal.emulator;x-internal:=true,
|
||||
org.eclipse.tm.internal.terminal.model;x-internal:=true,
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.emulator;
|
||||
|
||||
|
@ -34,7 +35,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
protected String toMultiLineText(ITerminalTextDataReadOnly term) {
|
||||
return TerminalTextTestHelper.toMultiLineText(term);
|
||||
}
|
||||
|
||||
|
||||
protected void fill(ITerminalTextData term, String s) {
|
||||
TerminalTextTestHelper.fill(term,s);
|
||||
}
|
||||
|
@ -50,7 +51,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
* @param actual
|
||||
*/
|
||||
protected void assertEqualsTerm(String expected,String actual) {
|
||||
assertEquals(expected.replaceAll(" ", "."), actual.replaceAll("\000", "."));
|
||||
assertEquals(expected.replace(' ', '.'), actual.replace('\000', '.'));
|
||||
}
|
||||
/**
|
||||
* Used for simple text
|
||||
|
@ -91,7 +92,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
assertEquals(3,vt100.getLines());
|
||||
assertEquals(4,vt100.getColumns());
|
||||
assertEqualsTerm(s,toMultiLineText(term));
|
||||
|
||||
|
||||
vt100.setCursor(0, 2);
|
||||
vt100.setDimensions(2, 4);
|
||||
assertEquals(0, vt100.getCursorLine());
|
||||
|
@ -103,7 +104,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
assertEquals(2, vt100.getCursorColumn());
|
||||
|
||||
assertEqualsTerm(s,toMultiLineText(term));
|
||||
|
||||
|
||||
vt100.setCursor(0, 3);
|
||||
vt100.setDimensions(5, 2);
|
||||
assertEquals(0, vt100.getCursorLine());
|
||||
|
@ -126,7 +127,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
ITerminalTextData term=makeITerminalTextData();
|
||||
IVT100EmulatorBackend vt100=makeBakend(term);
|
||||
vt100.setDimensions(3, 4);
|
||||
String s =
|
||||
String s =
|
||||
"aaaa\n" +
|
||||
"bbbb\n" +
|
||||
"cccc\n" +
|
||||
|
@ -161,7 +162,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"1234\n" +
|
||||
"4 56\n" +
|
||||
"9012",toMultiLineText(term));
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 1);
|
||||
vt100.insertCharacters(2);
|
||||
|
@ -186,7 +187,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
vt100.setCursor(0, 0);
|
||||
vt100.insertCharacters(14);
|
||||
assertEqualsTerm(" ",toMultiLineText(term));
|
||||
|
||||
|
||||
vt100.setDimensions(1, 10);
|
||||
fill(term, "0123456789");
|
||||
vt100.setCursor(0, 3);
|
||||
|
@ -210,7 +211,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
ITerminalTextData term=makeITerminalTextData();
|
||||
IVT100EmulatorBackend vt100=makeBakend(term);
|
||||
vt100.setDimensions(3, 4);
|
||||
String s =
|
||||
String s =
|
||||
"aaaa\n" +
|
||||
"bbbb\n" +
|
||||
"cccc\n" +
|
||||
|
@ -234,7 +235,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
" \n" +
|
||||
" \n" +
|
||||
" ",toMultiLineText(term));
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 0);
|
||||
vt100.eraseToEndOfScreen();
|
||||
|
@ -264,7 +265,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"0123\n" +
|
||||
"4 \n" +
|
||||
" ",toMultiLineText(term));
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 4);
|
||||
assertEquals(1,vt100.getCursorLine());
|
||||
|
@ -282,7 +283,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"456.\n" +
|
||||
" ",toMultiLineText(term));
|
||||
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 5);
|
||||
vt100.eraseToEndOfScreen();
|
||||
|
@ -333,7 +334,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
ITerminalTextData term=makeITerminalTextData();
|
||||
IVT100EmulatorBackend vt100=makeBakend(term);
|
||||
vt100.setDimensions(3, 4);
|
||||
String s =
|
||||
String s =
|
||||
"aaaa\n" +
|
||||
"bbbb\n" +
|
||||
"cccc\n" +
|
||||
|
@ -357,7 +358,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
" 123\n" +
|
||||
"4567\n" +
|
||||
"8901",toMultiLineText(term));
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 0);
|
||||
vt100.eraseToCursor();
|
||||
|
@ -387,7 +388,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
" \n" +
|
||||
" 67\n" +
|
||||
"8901",toMultiLineText(term));
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 4);
|
||||
vt100.eraseToCursor();
|
||||
|
@ -403,7 +404,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
" \n" +
|
||||
"8901",toMultiLineText(term));
|
||||
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 5);
|
||||
vt100.eraseToCursor();
|
||||
|
@ -470,7 +471,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testEraseLine() {
|
||||
String s =
|
||||
String s =
|
||||
"abcde\n" +
|
||||
"fghij\n" +
|
||||
"klmno\n" +
|
||||
|
@ -496,7 +497,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"zABCD\n" +
|
||||
"EFGHI", toMultiLineText(term));
|
||||
|
||||
|
||||
|
||||
vt100.setDimensions(3, 5);
|
||||
fill(term, s);
|
||||
vt100.setCursor(2, 3);
|
||||
|
@ -513,7 +514,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testEraseLineToEnd() {
|
||||
String s =
|
||||
String s =
|
||||
"abcde\n" +
|
||||
"fghij\n" +
|
||||
"klmno\n" +
|
||||
|
@ -553,7 +554,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"zABCD\n" +
|
||||
"EFGHI", toMultiLineText(term));
|
||||
|
||||
|
||||
|
||||
vt100.setDimensions(3, 5);
|
||||
fill(term, s);
|
||||
vt100.setCursor(2, 3);
|
||||
|
@ -569,7 +570,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"EFG ", toMultiLineText(term));
|
||||
vt100.setDimensions(3, 5);
|
||||
fill(term, s);
|
||||
|
||||
|
||||
vt100.setCursor(2, 4);
|
||||
vt100.eraseLineToEnd();
|
||||
assertEquals(2,vt100.getCursorLine());
|
||||
|
@ -597,7 +598,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
}
|
||||
|
||||
public void testEraseLineToCursor() {
|
||||
String s =
|
||||
String s =
|
||||
"abcde\n" +
|
||||
"fghij\n" +
|
||||
"klmno\n" +
|
||||
|
@ -637,7 +638,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"zABCD\n" +
|
||||
"EFGHI", toMultiLineText(term));
|
||||
|
||||
|
||||
|
||||
vt100.setDimensions(3, 5);
|
||||
fill(term, s);
|
||||
vt100.setCursor(2, 3);
|
||||
|
@ -653,7 +654,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
" I", toMultiLineText(term));
|
||||
vt100.setDimensions(3, 5);
|
||||
fill(term, s);
|
||||
|
||||
|
||||
vt100.setCursor(2, 4);
|
||||
vt100.eraseLineToCursor();
|
||||
assertEquals(2,vt100.getCursorLine());
|
||||
|
@ -789,7 +790,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
ITerminalTextData term=makeITerminalTextData();
|
||||
IVT100EmulatorBackend vt100=makeBakend(term);
|
||||
vt100.setDimensions(3, 4);
|
||||
String s =
|
||||
String s =
|
||||
"aaaa\n" +
|
||||
"bbbb\n" +
|
||||
"cccc\n" +
|
||||
|
@ -824,7 +825,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"1234\n" +
|
||||
"467 \n" +
|
||||
"9012",toMultiLineText(term));
|
||||
|
||||
|
||||
fill(term, s);
|
||||
vt100.setCursor(1, 1);
|
||||
vt100.deleteCharacters(2);
|
||||
|
@ -849,7 +850,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
vt100.setCursor(0, 0);
|
||||
vt100.deleteCharacters(14);
|
||||
assertEqualsTerm(" ",toMultiLineText(term));
|
||||
|
||||
|
||||
vt100.setDimensions(1, 10);
|
||||
fill(term, "0123456789");
|
||||
vt100.setCursor(0, 3);
|
||||
|
@ -861,7 +862,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
vt100.setCursor(0, 3);
|
||||
vt100.deleteCharacters(2);
|
||||
assertEqualsTerm("01256789 ",toMultiLineText(term));
|
||||
|
||||
|
||||
vt100.setDimensions(1, 10);
|
||||
fill(term, "0123456789");
|
||||
vt100.setCursor(0, 3);
|
||||
|
@ -1038,7 +1039,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"90a ", toMultiLineText(term));
|
||||
assertEquals(2,vt100.getCursorLine());
|
||||
assertEquals(3,vt100.getCursorColumn());
|
||||
|
||||
|
||||
vt100.appendString("b");
|
||||
assertEqualsTerm(
|
||||
"0123\n" +
|
||||
|
@ -1047,7 +1048,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
" ", toMultiLineText(term));
|
||||
assertEquals(2,vt100.getCursorLine());
|
||||
assertEquals(0,vt100.getCursorColumn());
|
||||
|
||||
|
||||
vt100.appendString("cd");
|
||||
assertEqualsTerm(
|
||||
"0123\n" +
|
||||
|
@ -1056,7 +1057,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"cd ", toMultiLineText(term));
|
||||
assertEquals(2,vt100.getCursorLine());
|
||||
assertEquals(2,vt100.getCursorColumn());
|
||||
|
||||
|
||||
vt100.appendString("efgh");
|
||||
assertEqualsTerm(
|
||||
"0123\n" +
|
||||
|
@ -1066,7 +1067,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
"gh ", toMultiLineText(term));
|
||||
assertEquals(2,vt100.getCursorLine());
|
||||
assertEquals(2,vt100.getCursorColumn());
|
||||
|
||||
|
||||
vt100.appendString("ijklmnopqrstuvwx");
|
||||
assertEqualsTerm(
|
||||
"cdef\n" +
|
||||
|
@ -1140,7 +1141,7 @@ public class VT100EmulatorBackendTest extends TestCase {
|
|||
assertEquals(2,vt100.getCursorLine());
|
||||
assertEquals(3,vt100.getCursorColumn());
|
||||
|
||||
|
||||
|
||||
vt100.processNewline();
|
||||
assertEqualsTerm(
|
||||
"2222\n" +
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.tm.terminal.model.ITerminalTextData;
|
||||
import org.eclipse.tm.terminal.model.LineSegment;
|
||||
import org.eclipse.tm.terminal.model.Style;
|
||||
|
@ -37,7 +40,26 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
}
|
||||
private String stripMultiLine(String s) {
|
||||
StringBuffer b=new StringBuffer();
|
||||
String[] lines=s.split("\n");
|
||||
// String[] lines=s.split("\n");
|
||||
// <J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
ArrayList l = new ArrayList();
|
||||
int j = 0;
|
||||
for (int k = 0; k < s.length(); k++) {
|
||||
if (s.charAt(k) == '\n') {
|
||||
l.add(s.substring(j, k));
|
||||
j = k;
|
||||
}
|
||||
}
|
||||
j = l.size() - 1;
|
||||
while (j >= 0 && "".equals(l.get(j))) {
|
||||
j--;
|
||||
}
|
||||
String[] lines = new String[j + 1];
|
||||
while (j >= 0) {
|
||||
lines[j] = (String) l.get(j);
|
||||
j--;
|
||||
}
|
||||
// </J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
if(i>0)
|
||||
b.append("\n"); //$NON-NLS-1$
|
||||
|
@ -146,46 +168,46 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
ITerminalTextData term=makeITerminalTextData();
|
||||
term.setDimensions(8, 8);
|
||||
LineSegment[] segments;
|
||||
|
||||
|
||||
term.setChars(2, 0,"0123".toCharArray(), s1);
|
||||
term.setChars(2, 4,"abcd".toCharArray(), null);
|
||||
segments=term.getLineSegments(2, 0, term.getWidth());
|
||||
assertEquals(2, segments.length);
|
||||
assertSegment(0, "0123", s1, segments[0]);
|
||||
assertSegment(4, "abcd", null, segments[1]);
|
||||
|
||||
|
||||
|
||||
|
||||
segments=term.getLineSegments(2, 4, term.getWidth()-4);
|
||||
assertEquals(1, segments.length);
|
||||
assertSegment(4, "abcd", null, segments[0]);
|
||||
|
||||
|
||||
segments=term.getLineSegments(2, 3, 2);
|
||||
assertEquals(2, segments.length);
|
||||
assertSegment(3, "3", s1, segments[0]);
|
||||
assertSegment(4, "a", null, segments[1]);
|
||||
|
||||
|
||||
segments=term.getLineSegments(2, 7, 1);
|
||||
assertEquals(1, segments.length);
|
||||
assertSegment(7, "d", null, segments[0]);
|
||||
|
||||
|
||||
segments=term.getLineSegments(2, 0, 1);
|
||||
assertEquals(1, segments.length);
|
||||
assertSegment(0, "0", s1, segments[0]);
|
||||
|
||||
|
||||
// line 1
|
||||
term.setChars(1, 0,"x".toCharArray(), s1);
|
||||
term.setChars(1, 1,"y".toCharArray(), s2);
|
||||
term.setChars(1, 2,"z".toCharArray(), s3);
|
||||
|
||||
|
||||
segments=term.getLineSegments(1, 0, term.getWidth());
|
||||
assertEquals(1, segments.length);
|
||||
assertSegment(0, "\000\000\000\000\000\000\000\000", null, segments[0]);
|
||||
|
||||
|
||||
// line 3
|
||||
segments=term.getLineSegments(3, 0, term.getWidth());
|
||||
assertEquals(1, segments.length);
|
||||
assertSegment(0, "\000\000\000\000\000\000\000\000", null, segments[0]);
|
||||
|
||||
|
||||
}
|
||||
public void testGetChar() {
|
||||
String s="12345\n" +
|
||||
|
@ -228,7 +250,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
assertSame(s, term.getStyle(line, column));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void testSetChar() {
|
||||
ITerminalTextData term=makeITerminalTextData();
|
||||
|
@ -280,7 +302,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
+ "def\n"
|
||||
+ "efg\n"
|
||||
+ "fgh", toMultiLineText(term));
|
||||
|
||||
|
||||
term.setChars(3, 1, new char[]{'1','2'}, null);
|
||||
assertEqualsTerm(
|
||||
"abc\n"
|
||||
|
@ -298,7 +320,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
+ "d12\n"
|
||||
+ "e12\n"
|
||||
+ "fgh", toMultiLineText(term));
|
||||
|
||||
|
||||
}
|
||||
public void testSetCharsLen() {
|
||||
ITerminalTextData term=makeITerminalTextData();
|
||||
|
@ -332,7 +354,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
+ "ABCDEF", toMultiLineText(term));
|
||||
|
||||
|
||||
|
||||
|
||||
fill(term, s);
|
||||
term.setChars(1, 2, chars, 3, 4, null);
|
||||
assertEqualsTerm("ZYXWVU\n"
|
||||
|
@ -356,7 +378,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
termCopy.copyRange(term,0,0,5);
|
||||
assertEqualsSimple(s, toSimple(term));
|
||||
assertEqualsSimple("01234", toSimple(termCopy));
|
||||
|
||||
|
||||
fillSimple(termCopy, sCopy);
|
||||
termCopy.copyRange(term,0,0,2);
|
||||
assertEqualsSimple(s, toSimple(term));
|
||||
|
@ -420,7 +442,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
fill(dest, sCopy);
|
||||
copySelective(dest,term,1,0,new boolean []{true,false,false,true});
|
||||
assertEqualsTerm(s, toMultiLineText(term));
|
||||
assertEqualsTerm(
|
||||
assertEqualsTerm(
|
||||
"222\n" +
|
||||
"bbb\n" +
|
||||
"ccc\n" +
|
||||
|
@ -430,7 +452,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
fill(dest, sCopy);
|
||||
copySelective(dest,term,2,0,new boolean []{true,true});
|
||||
assertEqualsTerm(s, toMultiLineText(term));
|
||||
assertEqualsTerm(
|
||||
assertEqualsTerm(
|
||||
"333\n" +
|
||||
"444\n" +
|
||||
"ccc\n" +
|
||||
|
@ -441,7 +463,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
copySelective(dest,term,0,0,new boolean []{true,true,true,true,true});
|
||||
assertEqualsTerm(s, toMultiLineText(term));
|
||||
assertEqualsTerm(s, toMultiLineText(dest));
|
||||
|
||||
|
||||
fill(dest, sCopy);
|
||||
copySelective(dest,term,0,0,new boolean []{false,false,false,false,false});
|
||||
assertEqualsTerm(s, toMultiLineText(term));
|
||||
|
@ -453,7 +475,7 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
|
|||
ITerminalTextData data=new TerminalTextData();
|
||||
fillSimple(data,"abcd");
|
||||
term.copy(data);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Michael Scharf (Wind River) - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
|
||||
*******************************************************************************/
|
||||
package org.eclipse.tm.internal.terminal.model;
|
||||
|
||||
|
@ -17,8 +18,7 @@ import org.eclipse.tm.terminal.model.StyleColor;
|
|||
|
||||
public class TerminalTextTestHelper {
|
||||
static public String toSimple(ITerminalTextDataReadOnly term) {
|
||||
return toMultiLineText(term).replaceAll("\000", " ").replaceAll("\n", "");
|
||||
|
||||
return toSimple(toMultiLineText(term));
|
||||
}
|
||||
static public String toMultiLineText(ITerminalTextDataReadOnly term) {
|
||||
StringBuffer buff=new StringBuffer();
|
||||
|
@ -33,8 +33,24 @@ public class TerminalTextTestHelper {
|
|||
return buff.toString();
|
||||
}
|
||||
static public String toSimple(String str) {
|
||||
return str.replaceAll("\000", " ").replaceAll("\n", "");
|
||||
|
||||
//return str.replaceAll("\000", " ").replaceAll("\n", "");
|
||||
// <J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
StringBuffer buf = new StringBuffer(str.length());
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
switch (c) {
|
||||
case '\000':
|
||||
buf.append(' ');
|
||||
break;
|
||||
case '\n':
|
||||
break;
|
||||
default:
|
||||
buf.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
// </J2ME CDC-1.1 Foundation-1.1 variant>
|
||||
}
|
||||
/**
|
||||
* @param term
|
||||
|
@ -72,7 +88,7 @@ public class TerminalTextTestHelper {
|
|||
term.setDimensions(height, width);
|
||||
fill(term,0,0,s);
|
||||
}
|
||||
|
||||
|
||||
static public void fill(ITerminalTextData term, int column, int line, String s) {
|
||||
int xx=column;
|
||||
int yy=line;
|
||||
|
|
Loading…
Add table
Reference in a new issue