summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMajouane BENJELLOUL <majouane.benjelloul@inria.fr>2007-07-17 15:08:49 +0000
committerMajouane BENJELLOUL <majouane.benjelloul@inria.fr>2007-07-17 15:08:49 +0000
commit2bef4d71c88cddc4de2da9808bfd9f1c00a904e4 (patch)
tree6b6a1b939aaf94069f1bb92d057b75026498b5b1 /tests
parent87ffa5b3ceef9c6752d52960768bea91e44d457a (diff)
downloadscilab-2bef4d71c88cddc4de2da9808bfd9f1c00a904e4.zip
scilab-2bef4d71c88cddc4de2da9808bfd9f1c00a904e4.tar.gz
Updated Test for current java GUI
Diffstat (limited to 'tests')
-rw-r--r--tests/GUI/addmember/AddMemberTest.java6
-rw-r--r--tests/GUI/overview/ScilabConsoleTest.java2
-rw-r--r--tests/GUI/window/WindowTest1.java26
-rw-r--r--tests/GUI/window/WindowTest2.java173
-rw-r--r--tests/GUI/window/size/SizeTest.java11
5 files changed, 196 insertions, 22 deletions
diff --git a/tests/GUI/addmember/AddMemberTest.java b/tests/GUI/addmember/AddMemberTest.java
index 961d3af..0b28183 100644
--- a/tests/GUI/addmember/AddMemberTest.java
+++ b/tests/GUI/addmember/AddMemberTest.java
@@ -50,7 +50,7 @@ public class AddMemberTest {
50 50
51 // Try to add a Frame in a Tab 51 // Try to add a Frame in a Tab
52 assertTrue("_MUST_ be able to add a Frame in a Tab", tab.addMember(frame) != -1); 52 assertTrue("_MUST_ be able to add a Frame in a Tab", tab.addMember(frame) != -1);
53 assertTrue("_MUST_ be able to add a Frame in a Tab (Through the Bridge)", ScilabBridge.addMember(tab, frame) != -1); 53 assertTrue("_MUST_ be able to add a Frame in a Tab (Through the Bridge)", ScilabBridge.addMember(tab.getAsSimpleTab(), frame.getAsSimpleFrame()) != -1);
54 System.out.println(STOP_BANNER); 54 System.out.println(STOP_BANNER);
55 } 55 }
56 56
@@ -69,7 +69,7 @@ public class AddMemberTest {
69 69
70 // Try to add a Console in a Frame 70 // Try to add a Console in a Frame
71 assertTrue("_MUST_NOT_ be able to add a Console in a Frame", frame.addMember(console) == -1); 71 assertTrue("_MUST_NOT_ be able to add a Console in a Frame", frame.addMember(console) == -1);
72 assertTrue("_MUST_ be able to add a Console in a Frame (Through the Bridge)", ScilabBridge.addMember(frame, console) != -1); 72 assertTrue("_MUST_ be able to add a Console in a Frame (Through the Bridge)", ScilabBridge.addMember(frame.getAsSimpleFrame(), console.getAsSimpleConsole()) != -1);
73 System.out.println(STOP_BANNER); 73 System.out.println(STOP_BANNER);
74 } 74 }
75 75
@@ -88,7 +88,7 @@ public class AddMemberTest {
88 88
89 // Try to add a Console in a Tab 89 // Try to add a Console in a Tab
90 assertTrue("_MUST_ be able to add a Console in a Tab", tab.addMember(console) != -1); 90 assertTrue("_MUST_ be able to add a Console in a Tab", tab.addMember(console) != -1);
91 assertTrue("_MUST_ be able to add a Console in a Tab(Through the Bridge)", ScilabBridge.addMember(tab, console) != -1); 91 assertTrue("_MUST_ be able to add a Console in a Tab(Through the Bridge)", ScilabBridge.addMember(tab.getAsSimpleTab(), console.getAsSimpleConsole()) != -1);
92 System.out.println(STOP_BANNER); 92 System.out.println(STOP_BANNER);
93 } 93 }
94 94
diff --git a/tests/GUI/overview/ScilabConsoleTest.java b/tests/GUI/overview/ScilabConsoleTest.java
index 499ce12..5c4f0b2 100644
--- a/tests/GUI/overview/ScilabConsoleTest.java
+++ b/tests/GUI/overview/ScilabConsoleTest.java
@@ -10,7 +10,7 @@ import javax.swing.UIManager;
10 10
11import org.flexdock.docking.DockingManager; 11import org.flexdock.docking.DockingManager;
12import org.flexdock.util.SwingUtility; 12import org.flexdock.util.SwingUtility;
13import org.scilab.modules.gui.bridge.SwingScilabConsole; 13import org.scilab.modules.gui.bridge.console.SwingScilabConsole;
14import org.scilab.modules.gui.console.Console; 14import org.scilab.modules.gui.console.Console;
15import org.scilab.modules.gui.console.ScilabConsole; 15import org.scilab.modules.gui.console.ScilabConsole;
16import org.scilab.modules.gui.frame.Frame; 16import org.scilab.modules.gui.frame.Frame;
diff --git a/tests/GUI/window/WindowTest1.java b/tests/GUI/window/WindowTest1.java
index bfc3618..386d62a 100644
--- a/tests/GUI/window/WindowTest1.java
+++ b/tests/GUI/window/WindowTest1.java
@@ -2,21 +2,14 @@
2 2
3package window; 3package window;
4 4
5import java.awt.BorderLayout;
6import java.awt.Color;
7import java.awt.EventQueue; 5import java.awt.EventQueue;
8import java.awt.event.*; 6import java.awt.event.*;
9 7
10import javax.swing.UIManager; 8import javax.swing.UIManager;
11import javax.swing.border.LineBorder; 9
12 10
13import org.flexdock.util.SwingUtility; 11import org.flexdock.util.SwingUtility;
14import org.flexdock.docking.DockingManager; 12import org.flexdock.docking.DockingManager;
15import org.scilab.modules.gui.canvas.Canvas;
16import org.scilab.modules.gui.canvas.ScilabCanvas;
17import org.scilab.modules.gui.dockable.Dockable;
18import org.scilab.modules.gui.frame.Frame;
19import org.scilab.modules.gui.frame.ScilabFrame;
20import org.scilab.modules.gui.menuitem.MenuItem; 13import org.scilab.modules.gui.menuitem.MenuItem;
21import org.scilab.modules.gui.menu.Menu; 14import org.scilab.modules.gui.menu.Menu;
22import org.scilab.modules.gui.menubar.MenuBar; 15import org.scilab.modules.gui.menubar.MenuBar;
@@ -31,7 +24,6 @@ import org.scilab.modules.gui.textbox.ScilabTextBox;
31import org.scilab.modules.gui.textbox.TextBox; 24import org.scilab.modules.gui.textbox.TextBox;
32import org.scilab.modules.gui.toolbar.ScilabToolBar; 25import org.scilab.modules.gui.toolbar.ScilabToolBar;
33import org.scilab.modules.gui.toolbar.ToolBar; 26import org.scilab.modules.gui.toolbar.ToolBar;
34import org.scilab.modules.gui.utils.Size;
35import org.scilab.modules.gui.window.ScilabWindow; 27import org.scilab.modules.gui.window.ScilabWindow;
36import org.scilab.modules.gui.window.Window; 28import org.scilab.modules.gui.window.Window;
37 29
@@ -125,6 +117,22 @@ public class WindowTest1 {
125 mainView.addInfoBar(infoBar); 117 mainView.addInfoBar(infoBar);
126 System.out.println("mainView.infoBar Added : result = " + mainView.getInfoBar()); 118 System.out.println("mainView.infoBar Added : result = " + mainView.getInfoBar());
127 119
120 // adding Main tab to a window
121 Tab mainTab = ScilabTab.createTab("Main");
122
123 mainView.addTab(mainTab);
124
125// adding Help tab to a window
126 Tab helpTab = ScilabTab.createTab("Help");
127
128 mainView.addTab(helpTab);
129
130// adding Graph tab to a window
131 Tab graphTab = ScilabTab.createTab("Graph");
132
133 mainView.addTab(graphTab);
134
135 // draw
128 mainView.draw(); 136 mainView.draw();
129 137
130 mainView.getInfoBar().setText("Loaded WindowTest1"); 138 mainView.getInfoBar().setText("Loaded WindowTest1");
diff --git a/tests/GUI/window/WindowTest2.java b/tests/GUI/window/WindowTest2.java
new file mode 100644
index 0000000..d135809
--- /dev/null
+++ b/tests/GUI/window/WindowTest2.java
@@ -0,0 +1,173 @@
1/* Copyright INRIA 2007 */
2
3package window;
4
5import java.awt.EventQueue;
6import java.awt.event.*;
7
8import javax.swing.UIManager;
9
10import org.flexdock.util.SwingUtility;
11import org.flexdock.docking.DockingManager;
12import org.scilab.modules.gui.canvas.Canvas;
13import org.scilab.modules.gui.canvas.ScilabCanvas;
14import org.scilab.modules.gui.console.Console;
15import org.scilab.modules.gui.console.ScilabConsole;
16import org.scilab.modules.gui.frame.Frame;
17import org.scilab.modules.gui.frame.ScilabFrame;
18import org.scilab.modules.gui.menuitem.MenuItem;
19import org.scilab.modules.gui.menu.Menu;
20import org.scilab.modules.gui.menubar.MenuBar;
21import org.scilab.modules.gui.menuitem.ScilabMenuItem;
22import org.scilab.modules.gui.menu.ScilabMenu;
23import org.scilab.modules.gui.menubar.ScilabMenuBar;
24import org.scilab.modules.gui.pushbutton.PushButton;
25import org.scilab.modules.gui.pushbutton.ScilabPushButton;
26import org.scilab.modules.gui.tab.ScilabTab;
27import org.scilab.modules.gui.tab.Tab;
28import org.scilab.modules.gui.textbox.ScilabTextBox;
29import org.scilab.modules.gui.textbox.TextBox;
30import org.scilab.modules.gui.toolbar.ScilabToolBar;
31import org.scilab.modules.gui.toolbar.ToolBar;
32import org.scilab.modules.gui.utils.Position;
33import org.scilab.modules.gui.utils.Size;
34import org.scilab.modules.gui.window.ScilabWindow;
35import org.scilab.modules.gui.window.Window;
36
37/**
38 * Basic test
39 * @author Marouane BEN JELLOUL
40 */
41public class WindowTest2 {
42
43 /**
44 * Constructor
45 */
46 protected WindowTest2() {
47 throw new UnsupportedOperationException(); /* Prevents calls from subclass */
48 }
49
50 /**
51 * Launch main WindowTest1
52 * @param args not used
53 */
54 public static void main(String[] args) {
55 SwingUtility.setPlaf(UIManager.getSystemLookAndFeelClassName());
56
57 DockingManager.setFloatingEnabled(true);
58
59 EventQueue.invokeLater(new Runnable() {
60 public void run() {
61 createAndShowGui();
62 }
63 });
64 }
65
66 /**
67 * Creates and show WindowTest2
68 */
69 private static void createAndShowGui() {
70 System.out.println("-*- Starting Program WindowTest2 -*-");
71
72 Window mainView = ScilabWindow.createWindow();
73 mainView.setTitle("WindowTest2");
74
75 // menuBar
76 MenuBar menuBar = ScilabMenuBar.createMenuBar();
77
78 // menu File
79 Menu menu = ScilabMenu.createMenu();
80 menu.setText("File");
81 menu.setMnemonic(KeyEvent.VK_F);
82 MenuItem menuItem = ScilabMenuItem.createMenuItem();
83 menuItem.setText("New Scilab");
84 menuItem.setMnemonic(KeyEvent.VK_N);
85 menu.add(menuItem);
86 menu.addSeparator();
87 menuItem = ScilabMenuItem.createMenuItem();
88 menuItem.setText("Exec ...");
89 menuItem.setMnemonic(KeyEvent.VK_E);
90 menu.add(menuItem);
91 menuBar.add(menu);
92
93 // menu Edit
94 menu = ScilabMenu.createMenu();
95 menu.setText("Edit");
96 menu.setMnemonic(KeyEvent.VK_E);
97 menuItem = ScilabMenuItem.createMenuItem();
98 menuItem.setText("Select All");
99 menuItem.setMnemonic(KeyEvent.VK_S);
100 menu.add(menuItem);
101 menuBar.add(menu);
102
103 //System.out.println("mainView.menuBar is null : result = " + mainView.getMenuBar());
104 mainView.addMenuBar(menuBar);
105 //System.out.println("mainView.menuBar Added : result = " + mainView.getMenuBar());
106
107 // toolBar
108 ToolBar toolBar = ScilabToolBar.createToolBar();
109 PushButton pushButton = ScilabPushButton.createPushButton();
110 pushButton.setText("PB One");
111 toolBar.add(pushButton);
112 pushButton = ScilabPushButton.createPushButton();
113 pushButton.setText("PB Two");
114 toolBar.add(pushButton);
115
116 //System.out.println("mainView.toolBar is null : result = " + mainView.getToolBar());
117 mainView.addToolBar(toolBar);
118 //System.out.println("mainView.toolBar Added : result = " + mainView.getToolBar());
119
120// infoBar
121 TextBox infoBar = ScilabTextBox.createTextBox();
122
123 System.out.println("mainView.infoBar is null : result = " + mainView.getInfoBar());
124 mainView.addInfoBar(infoBar);
125 System.out.println("mainView.infoBar Added : result = " + mainView.getInfoBar());
126
127// adding Main tab to a window
128 Tab mainTab = ScilabTab.createTab("Main");
129
130 mainView.addTab(mainTab);
131
132// adding Help tab to a window
133 Tab helpTab = ScilabTab.createTab("Help");
134
135 mainView.addTab(helpTab);
136
137// adding Console tab to a window
138 Tab consoleTab = ScilabTab.createTab("Console");
139// Console console = ScilabConsole.createConsole();
140// consoleTab.addMember(console);
141 mainView.addTab(consoleTab);
142
143// adding Canvas tab to a window
144 Tab canvasTab = ScilabTab.createTab("Canvas");
145 Canvas canvas = ScilabCanvas.createCanvas();
146 canvasTab.addMember(canvas);
147 mainView.addTab(canvasTab);
148
149// creating Test tab
150 Tab testTab = ScilabTab.createTab("Test");
151
152// adding a frame to the testTab
153 Frame frame1 = ScilabFrame.createFrame();
154
155 // pushButton on frame
156 PushButton pushButton1 = ScilabPushButton.createPushButton();
157 pushButton1.setText("push Button in a Frame");
158 pushButton1.setPosition(new Position(0,0));
159 pushButton1.setDims(new Size(200,20));
160 frame1.addMember(pushButton1);
161
162 testTab.addMember(frame1);
163
164// adding Test tab to a window
165 mainView.addTab(testTab);
166 // draw
167 mainView.draw();
168
169 mainView.getInfoBar().setText("Loaded WindowTest2");
170 System.out.println("-*- Last Line Program WindowTest2 -*-");
171 }
172
173}
diff --git a/tests/GUI/window/size/SizeTest.java b/tests/GUI/window/size/SizeTest.java
index 4797a92..ce3bc90 100644
--- a/tests/GUI/window/size/SizeTest.java
+++ b/tests/GUI/window/size/SizeTest.java
@@ -16,19 +16,12 @@ import org.scilab.modules.gui.window.Window;
16 */ 16 */
17public class SizeTest { 17public class SizeTest {
18 18
19 private static final int DEFAULTWIDTH = 100; 19 private static final int DEFAULTWIDTH = 400;
20 private static final int DEFAULTHEIGHT = 100; 20 private static final int DEFAULTHEIGHT = 500;
21 private static final int NEWWIDTH = 500; 21 private static final int NEWWIDTH = 500;
22 private static final int NEWHEIGHT = 800; 22 private static final int NEWHEIGHT = 800;
23 23
24 /** 24 /**
25 * Constructor for class SizeTest
26 */
27 public SizeTest() {
28 throw new UnsupportedOperationException(); /* Prevents calls from subclass */
29 };
30
31 /**
32 * Default window size test 25 * Default window size test
33 */ 26 */
34 @Test 27 @Test