01: package abbot.editor.editors;
02:
03: import javax.swing.text.*;
04:
05: import junit.extensions.abbot.*;
06: import abbot.script.*;
07: import abbot.tester.*;
08: import abbot.finder.matchers.*;
09:
10: /** Verify ExpressionEditor operation. */
11:
12: public class ExpressionEditorTest extends ResolverFixture {
13:
14: public void testExpressionField() throws Exception {
15: Expression e = new Expression(getResolver(), getName());
16: String EXPR = "hello = \"world\"";
17: e.setExpression(EXPR);
18: ExpressionEditor editor = new ExpressionEditor(e);
19: showFrame(editor);
20:
21: JTextComponent tc = (JTextComponent) getFinder().find(editor,
22: new NameMatcher("expression.text"));
23: assertEquals("Wrong initial text", EXPR, tc.getText());
24:
25: String EXPR1 = "empty";
26: JTextComponentTester tester = new JTextComponentTester();
27: tester.actionEnterText(tc, EXPR1);
28: assertEquals("Wrong changed text", EXPR1, e.getExpression());
29: }
30:
31: /** Construct a test case with the given name. */
32: public ExpressionEditorTest(String name) {
33: super (name);
34: }
35:
36: /** Run the default test suite. */
37: public static void main(String[] args) {
38: TestHelper.runTests(args, ExpressionEditorTest.class);
39: }
40: }
|