01: package abbot.editor;
02:
03: import java.awt.*;
04: import javax.swing.ActionMap;
05: import java.io.File;
06:
07: import junit.extensions.abbot.*;
08: import abbot.tester.*;
09:
10: public class ScriptEditorFrameTest extends ComponentTestFixture {
11:
12: private ScriptEditorFrame editor;
13: private String prefsFile = ".test-prefs";
14:
15: public void testTrackMoveAndResize() {
16: showWindow(editor);
17: WindowTester tester = new WindowTester();
18: tester.actionMove(editor, 111, 111);
19: tester.actionResize(editor, 444, 444);
20: Dimension size = editor.getSize();
21: Point where = editor.getLocation();
22: getHierarchy().dispose(editor);
23:
24: ScriptEditorFrame editor2 = createEditor(new Preferences(
25: prefsFile));
26: showWindow(editor2);
27: assertEquals("Location not preserved", where, editor2
28: .getLocation());
29: assertEquals("Size not preserved", size, editor2.getSize());
30: }
31:
32: private ScriptEditorFrame createEditor(Preferences prefs) {
33: return new ScriptEditorFrame(new String[][] {},
34: new ActionMap(), null, getName(), new ScriptTable(),
35: prefs);
36: }
37:
38: protected void setUp() {
39: File file = new File(new File(System.getProperty("user.home")),
40: prefsFile);
41: file.deleteOnExit();
42: editor = createEditor(new Preferences(prefsFile));
43: }
44:
45: /** Construct a test case with the given name. */
46: public ScriptEditorFrameTest(String name) {
47: super (name);
48: }
49:
50: /** Run the default test suite. */
51: public static void main(String[] args) {
52: TestHelper.runTests(args, ScriptEditorFrameTest.class);
53: }
54: }
|