|
1
|
|
package abbot.editor.editors;
|
|
2
|
|
|
|
3
|
|
import java.awt.event.*;
|
|
4
|
|
import javax.swing.*;
|
|
5
|
|
import javax.swing.text.*;
|
|
6
|
|
|
|
7
|
|
import junit.extensions.abbot.*;
|
|
8
|
|
import abbot.Log;
|
|
9
|
|
import abbot.script.*;
|
|
10
|
|
import abbot.tester.*;
|
|
11
|
|
import abbot.finder.matchers.*;
|
|
12
|
|
|
|
13
|
|
|
|
14
|
|
|
|
15
|
|
public class ExpressionEditorTest extends ComponentTestFixture {
|
|
16
|
|
|
|
17
|
1
|
public void testExpressionField() throws Exception {
|
|
18
|
1
|
Expression e = new Expression(getResolver(), getName());
|
|
19
|
1
|
String EXPR = "hello = \"world\"";
|
|
20
|
1
|
e.setExpression(EXPR);
|
|
21
|
1
|
ExpressionEditor editor = new ExpressionEditor(e);
|
|
22
|
1
|
showFrame(editor);
|
|
23
|
|
|
|
24
|
1
|
JTextComponent tc = (JTextComponent)getFinder().
|
|
25
|
|
find(editor, new NameMatcher("expression.text"));
|
|
26
|
1
|
assertEquals("Wrong initial text", EXPR, tc.getText());
|
|
27
|
|
|
|
28
|
1
|
String EXPR1 = "empty";
|
|
29
|
1
|
JTextComponentTester tester = new JTextComponentTester();
|
|
30
|
1
|
tester.actionEnterText(tc, EXPR1);
|
|
31
|
1
|
assertEquals("Wrong changed text", EXPR1, e.getExpression());
|
|
32
|
|
}
|
|
33
|
|
|
|
34
|
|
|
|
35
|
1
|
public ExpressionEditorTest(String name) {
|
|
36
|
1
|
super(name);
|
|
37
|
|
}
|
|
38
|
|
|
|
39
|
|
|
|
40
|
0
|
public static void main(String[] args) {
|
|
41
|
0
|
TestHelper.runTests(args, ExpressionEditorTest.class);
|
|
42
|
|
}
|
|
43
|
|
}
|
|
44
|
|
|