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