Added
Link Here
|
1 |
/* |
2 |
* Sun Public License Notice |
3 |
* |
4 |
* The contents of this file are subject to the Sun Public License |
5 |
* Version 1.0 (the "License"). You may not use this file except in |
6 |
* compliance with the License. A copy of the License is available at |
7 |
* http://www.sun.com/ |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
13 |
|
14 |
package org.netbeans.swing.tabcontrol.plaf; |
15 |
|
16 |
import java.awt.BorderLayout; |
17 |
import java.util.ArrayList; |
18 |
import java.util.Arrays; |
19 |
import java.util.HashSet; |
20 |
import java.util.Set; |
21 |
import javax.swing.JFrame; |
22 |
import javax.swing.JLabel; |
23 |
import javax.swing.SwingUtilities; |
24 |
import junit.framework.*; |
25 |
import org.netbeans.swing.tabcontrol.DefaultTabDataModel; |
26 |
import org.netbeans.swing.tabcontrol.TabData; |
27 |
import org.netbeans.swing.tabcontrol.TabDataModel; |
28 |
import org.netbeans.swing.tabcontrol.TabDisplayer; |
29 |
import org.netbeans.swing.tabcontrol.TabbedContainer; |
30 |
|
31 |
/** |
32 |
* TabState stores a list of tabs which are blinking for attention. |
33 |
* They are stored by index. This test ensures that when tabs are added |
34 |
* or removed from the model, that the indices are updated correctly. |
35 |
* <p> |
36 |
* This test also exercises the data model heavily. |
37 |
* |
38 |
* @author Tim Boudreau |
39 |
*/ |
40 |
public class AttentionAndModelChangesTest extends TestCase { |
41 |
|
42 |
public AttentionAndModelChangesTest(java.lang.String testName) { |
43 |
super(testName); |
44 |
} |
45 |
|
46 |
public static Test suite() { |
47 |
TestSuite suite = new TestSuite(AttentionAndModelChangesTest.class); |
48 |
return suite; |
49 |
} |
50 |
|
51 |
TabDataModel mdl = null; |
52 |
TabData[] origData = null; |
53 |
TabState state = null; |
54 |
TabDisplayer displayer = null; |
55 |
TabbedContainer tab = null; |
56 |
public void setUp() { |
57 |
origData = new TabData[13]; |
58 |
for (int i=0; i < origData.length; i++) { |
59 |
origData[i] = new TabData(new JLabel("TD " + i), null, "TD " + i, "tip"); |
60 |
} |
61 |
|
62 |
mdl = new DefaultTabDataModel(origData); |
63 |
|
64 |
tab = new TabbedContainer(mdl, TabbedContainer.TYPE_EDITOR); |
65 |
tab.setActive(true); |
66 |
JFrame jf = new JFrame(); |
67 |
jf.getContentPane().setLayout (new BorderLayout()); |
68 |
jf.getContentPane().add (tab, BorderLayout.CENTER); |
69 |
jf.setBounds (20, 20, 400, 200); |
70 |
jf.show(); |
71 |
jf.toFront(); |
72 |
while (!jf.isShowing()) { |
73 |
try { |
74 |
Thread.currentThread().sleep(50); |
75 |
} catch (InterruptedException e) { |
76 |
fail (e.toString()); |
77 |
} |
78 |
} |
79 |
displayer = ((DefaultTabbedContainerUI) tab.getUI()).getTabDisplayer(); |
80 |
BasicTabDisplayerUI ui = (BasicTabDisplayerUI) displayer.getUI(); |
81 |
state = ui.getTabState(); |
82 |
} |
83 |
|
84 |
private void requestAttention (final int i) throws Exception { |
85 |
SwingUtilities.invokeAndWait (new Runnable() { |
86 |
public void run() { |
87 |
tab.requestAttention(i); |
88 |
} |
89 |
}); |
90 |
} |
91 |
|
92 |
private void assertAtt (final int[] i) throws Exception { |
93 |
Arrays.sort (i); |
94 |
int[] att = state.getAlarmTabs(); |
95 |
assertTrue ("Expected attention tabs to be " |
96 |
+ a2s(i) + " but they are " + a2s(att), |
97 |
Arrays.equals(i, att)); |
98 |
} |
99 |
|
100 |
private void assertNotAtt (final int[] i) throws Exception { |
101 |
SwingUtilities.invokeAndWait (new Runnable() { |
102 |
public void run() { |
103 |
Arrays.sort (i); |
104 |
int[] att = state.getAlarmTabs(); |
105 |
assertFalse ("Expected attention tabs NOT to be " |
106 |
+ a2s(i) + " but they are " + a2s(att), |
107 |
Arrays.equals(i, att)); |
108 |
} |
109 |
}); |
110 |
} |
111 |
|
112 |
private static String a2s (int[] ints) { |
113 |
if (ints == null) { |
114 |
return "null"; |
115 |
} |
116 |
if (ints.length == 0) { |
117 |
return "[]"; |
118 |
} |
119 |
StringBuffer sb = new StringBuffer(); |
120 |
for (int i=0; i < ints.length; i++) { |
121 |
sb.append (ints[i]); |
122 |
if (i != ints.length -1) { |
123 |
sb.append(','); |
124 |
} |
125 |
} |
126 |
return sb.toString(); |
127 |
} |
128 |
|
129 |
public void testRequestAttention () throws Exception { |
130 |
System.out.println("testRequestAttention"); |
131 |
requestAttention (3); |
132 |
requestAttention (5); |
133 |
assertAtt(new int[] {3, 5}); |
134 |
} |
135 |
|
136 |
public void testRemoveSingleInBetween() throws Exception { |
137 |
System.out.println("testRemoveSingleInBetween"); |
138 |
requestAttention(3); |
139 |
requestAttention(5); |
140 |
mdl.removeTab(4); |
141 |
assertAtt(new int[] {3, 4}); |
142 |
} |
143 |
|
144 |
public void testRemoveSingleBefore() throws Exception { |
145 |
System.out.println("testRemoveSingleBefore"); |
146 |
requestAttention(3); |
147 |
requestAttention(5); |
148 |
mdl.removeTab(2); |
149 |
assertAtt(new int[] {2, 4}); |
150 |
} |
151 |
|
152 |
|
153 |
public void testRemoveSingleAfter() throws Exception { |
154 |
System.out.println("testRemoveSingleAfter"); |
155 |
requestAttention(3); |
156 |
requestAttention(5); |
157 |
mdl.removeTab(6); |
158 |
assertAtt(new int[] {3, 5}); |
159 |
mdl.removeTab(10); |
160 |
assertAtt(new int[] {3, 5}); |
161 |
} |
162 |
|
163 |
public void testRemoveSingleFirst() throws Exception { |
164 |
System.out.println("testRemoveSingleFirst"); |
165 |
requestAttention(3); |
166 |
requestAttention(5); |
167 |
mdl.removeTab(3); |
168 |
assertAtt(new int[] {4}); |
169 |
} |
170 |
|
171 |
|
172 |
public void testRemoveSingleSecond() throws Exception { |
173 |
System.out.println("testRemoveSingleSecond"); |
174 |
requestAttention(3); |
175 |
requestAttention(5); |
176 |
mdl.removeTab(5); |
177 |
assertAtt(new int[] {3}); |
178 |
} |
179 |
|
180 |
public void testAddSingleBefore() throws Exception { |
181 |
System.out.println("testAddSingleBefore"); |
182 |
requestAttention(3); |
183 |
requestAttention(5); |
184 |
TabData td = new TabData (new JLabel("Added"), null, "Added", "tip"); |
185 |
mdl.addTab(1, td); |
186 |
assertAtt(new int[] {4, 6}); |
187 |
} |
188 |
|
189 |
public void testAddSingleBetween() throws Exception { |
190 |
System.out.println("testAddSingleBetween"); |
191 |
requestAttention(3); |
192 |
requestAttention(5); |
193 |
TabData td = new TabData (new JLabel("Added"), null, "Added", "tip"); |
194 |
mdl.addTab(4, td); |
195 |
assertAtt(new int[] {3, 6}); |
196 |
} |
197 |
|
198 |
public void testAddSingleAt() throws Exception { |
199 |
System.out.println("testAddSingleAt"); |
200 |
requestAttention(3); |
201 |
requestAttention(5); |
202 |
TabData td = new TabData (new JLabel("Added"), null, "Added", "tip"); |
203 |
mdl.addTab(3, td); |
204 |
assertAtt(new int[] {4, 6}); |
205 |
} |
206 |
|
207 |
public void testAddSingleAfter() throws Exception { |
208 |
System.out.println("testAddSingleAfter"); |
209 |
requestAttention(3); |
210 |
requestAttention(5); |
211 |
TabData td = new TabData (new JLabel("Added"), null, "Added", "tip"); |
212 |
mdl.addTab(7, td); |
213 |
assertAtt(new int[] {3, 5}); |
214 |
} |
215 |
|
216 |
public void testAddSingleAtEnd() throws Exception { |
217 |
System.out.println("testAddSingleAtEnd"); |
218 |
requestAttention(3); |
219 |
requestAttention(5); |
220 |
TabData td = new TabData (new JLabel("Added"), null, "Added", "tip"); |
221 |
mdl.addTab(5, td); |
222 |
assertAtt(new int[] {3, 6}); |
223 |
} |
224 |
|
225 |
public void testAddMultipleBefore() throws Exception { |
226 |
System.out.println("testAddMultipleBefore"); |
227 |
requestAttention(3); |
228 |
requestAttention(5); |
229 |
TabData att1 = mdl.getTab(3); |
230 |
TabData att2 = mdl.getTab(5); |
231 |
|
232 |
TabData td1 = new TabData (new JLabel("Added 1"), null, "Added 1", "tip"); |
233 |
TabData td2 = new TabData (new JLabel("Added 2"), null, "Added 2", "tip"); |
234 |
mdl.addTabs(1, new TabData[] {td1, td2}); |
235 |
assertAtt(new int[] {5, 7}); |
236 |
|
237 |
int[] tabs = state.getAlarmTabs(); |
238 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
239 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
240 |
} |
241 |
|
242 |
|
243 |
public void testAddMultipleAfter() throws Exception { |
244 |
System.out.println("testAddMultipleAfter"); |
245 |
requestAttention(3); |
246 |
requestAttention(5); |
247 |
TabData td1 = new TabData (new JLabel("Added 1"), null, "Added 1", "tip"); |
248 |
TabData td2 = new TabData (new JLabel("Added 2"), null, "Added 2", "tip"); |
249 |
mdl.addTabs(7, new TabData[] {td1, td2}); |
250 |
assertAtt(new int[] {3, 5}); |
251 |
} |
252 |
|
253 |
public void testAddMultipleBetween() throws Exception { |
254 |
System.out.println("testAddMultipleBetween"); |
255 |
requestAttention(3); |
256 |
requestAttention(5); |
257 |
TabData att1 = mdl.getTab(3); |
258 |
TabData att2 = mdl.getTab(5); |
259 |
|
260 |
TabData td1 = new TabData (new JLabel("Added 1"), null, "Added 1", "tip"); |
261 |
TabData td2 = new TabData (new JLabel("Added 2"), null, "Added 2", "tip"); |
262 |
mdl.addTabs(4, new TabData[] {td1, td2}); |
263 |
assertAtt(new int[] {3, 7}); |
264 |
|
265 |
int[] tabs = state.getAlarmTabs(); |
266 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
267 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
268 |
} |
269 |
|
270 |
|
271 |
public void testRemoveMultipleBetween() throws Exception { |
272 |
System.out.println("testRemoveMultipleBetween"); |
273 |
requestAttention(3); |
274 |
requestAttention(6); |
275 |
TabData att1 = mdl.getTab(3); |
276 |
TabData att2 = mdl.getTab(6); |
277 |
|
278 |
int sz = mdl.size(); |
279 |
mdl.removeTabs(4, 5); |
280 |
assertTrue ("After removing tabs 4 and 5, model size should be 2 smaller - was " + sz + " is " + mdl.size(), mdl.size() == sz-2); |
281 |
|
282 |
assertAtt (new int[] {3, 4}); |
283 |
|
284 |
int[] tabs = state.getAlarmTabs(); |
285 |
System.out.println("Alarm tabs are " + tabs[0] + "," + tabs[1]); |
286 |
System.err.println("First attention tab " + mdl.getTab(tabs[0])); |
287 |
System.err.println("Second attention tab " + mdl.getTab(tabs[1])); |
288 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
289 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
290 |
} |
291 |
|
292 |
public void testRemoveMultipleBefore() throws Exception { |
293 |
System.out.println("testRemoveMultipleBefore"); |
294 |
requestAttention(3); |
295 |
requestAttention(6); |
296 |
TabData att1 = mdl.getTab(3); |
297 |
TabData att2 = mdl.getTab(6); |
298 |
int sz = mdl.size(); |
299 |
|
300 |
mdl.removeTabs(1, 2); |
301 |
|
302 |
assertTrue ("After removing tabs 1 and 2, model size should be 2 smaller - was " + sz + " is " + mdl.size(), mdl.size() == sz-2); |
303 |
assertAtt (new int[] {1, 4}); |
304 |
|
305 |
int[] tabs = state.getAlarmTabs(); |
306 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
307 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
308 |
} |
309 |
|
310 |
public void testRemoveMultipleAfter() throws Exception { |
311 |
System.out.println("testRemoveMultipleAfter"); |
312 |
requestAttention(3); |
313 |
requestAttention(6); |
314 |
mdl.removeTabs(7, 10); |
315 |
assertAtt (new int[] {3, 6}); |
316 |
} |
317 |
|
318 |
public void testRemoveMultipleIncluding() throws Exception { |
319 |
System.out.println("testRemoveMultipleIncluding"); |
320 |
requestAttention(3); |
321 |
requestAttention(6); |
322 |
mdl.removeTabs(6, 10); |
323 |
assertAtt (new int[] {3}); |
324 |
} |
325 |
|
326 |
public void testRemoveMultipleInclusive() throws Exception { |
327 |
System.out.println("testRemoveMultipleInclusive"); |
328 |
requestAttention(3); |
329 |
requestAttention(6); |
330 |
mdl.removeTabs(2, 7); |
331 |
assertAtt (new int[0]); |
332 |
} |
333 |
|
334 |
public void testAddDiscontiguousBefore() throws Exception { |
335 |
System.out.println("testAddDiscontiguousBefore"); |
336 |
requestAttention(7); |
337 |
requestAttention(9); |
338 |
TabData td1 = new TabData (new JLabel("Added 1"), null, "Added 1", "tip"); |
339 |
TabData td2 = new TabData (new JLabel("Added 2"), null, "Added 2", "tip"); |
340 |
TabData td3 = new TabData (new JLabel("Added 3"), null, "Added 3", "tip"); |
341 |
mdl.addTabs (new int[] { 1, 3, 5}, new TabData[] {td1, td2, td3}); |
342 |
assertAtt (new int[] {10, 12}); |
343 |
} |
344 |
|
345 |
public void testRemoveDiscontiguousBefore() throws Exception { |
346 |
System.out.println("testRemoveDiscontiguousBefore"); |
347 |
requestAttention(7); |
348 |
requestAttention(9); |
349 |
mdl.removeTabs (new int[] {1,3,5}); |
350 |
assertAtt (new int[] {4, 6}); |
351 |
} |
352 |
|
353 |
public void testRemoveDiscontiguousAfter() throws Exception { |
354 |
System.out.println("testRemoveDiscontiguousAfter"); |
355 |
requestAttention(5); |
356 |
requestAttention(7); |
357 |
mdl.removeTabs (new int[] {8,10,11}); |
358 |
assertAtt (new int[] {5, 7}); |
359 |
} |
360 |
|
361 |
|
362 |
public void testAddDiscontiguousBeforeAndBetween() throws Exception { |
363 |
System.out.println("testAddDiscontiguousBeforeAndBetween"); |
364 |
requestAttention(7); |
365 |
requestAttention(9); |
366 |
TabData att1 = mdl.getTab(7); |
367 |
TabData att2 = mdl.getTab(9); |
368 |
|
369 |
TabData td1 = new TabData (new JLabel("Added 1"), null, "Added 1", "tip"); |
370 |
TabData td2 = new TabData (new JLabel("Added 2"), null, "Added 2", "tip"); |
371 |
TabData td3 = new TabData (new JLabel("Added 3"), null, "Added 3", "tip"); |
372 |
mdl.addTabs (new int[] {1, 3, 8}, new TabData[] {td1, td2, td3}); |
373 |
assertAtt (new int[] {10, 12}); |
374 |
|
375 |
int[] tabs = state.getAlarmTabs(); |
376 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
377 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
378 |
} |
379 |
|
380 |
public void testRemoveDiscontiguousBeforeAndBetween() throws Exception { |
381 |
System.out.println("testRemoveDiscontiguousBeforeAndBetween"); |
382 |
requestAttention(7); |
383 |
requestAttention(9); |
384 |
TabData att1 = mdl.getTab(7); |
385 |
TabData att2 = mdl.getTab(9); |
386 |
mdl.removeTabs (new int[] {1,3,8}); |
387 |
assertAtt (new int[] {5, 6}); |
388 |
int[] tabs = state.getAlarmTabs(); |
389 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
390 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
391 |
} |
392 |
|
393 |
public void testRemoveDiscontiguousBeforeAndBetweenIncludingOne() throws Exception { |
394 |
System.out.println("testRemoveDiscontiguousBeforeAndBetweenIncludingOne"); |
395 |
requestAttention(7); |
396 |
requestAttention(9); |
397 |
TabData att1 = mdl.getTab(7); |
398 |
TabData att2 = mdl.getTab(9); |
399 |
mdl.removeTabs (new int[] {1,3,7}); |
400 |
assertAtt (new int[] {6}); |
401 |
} |
402 |
|
403 |
public void testReorderComplex() throws Exception { |
404 |
System.out.println("testReorderComplex"); |
405 |
requestAttention(7); |
406 |
requestAttention(9); |
407 |
TabData att1 = mdl.getTab(7); |
408 |
TabData att2 = mdl.getTab(9); |
409 |
|
410 |
TabData[] data = (TabData[]) mdl.getTabs().toArray(new TabData[mdl.size()]); |
411 |
TabData[] nue = new TabData[data.length]; |
412 |
for (int i=data.length-1; i >=0; i--) { |
413 |
nue [data.length-(i+1)] = data[i]; |
414 |
} |
415 |
mdl.setTabs(nue); |
416 |
int[] tabs = state.getAlarmTabs(); |
417 |
Arrays.sort(tabs); |
418 |
assertSame ("First attention tab should be " + att2 + " not " + mdl.getTab(tabs[0]), att2, mdl.getTab(tabs[0])); |
419 |
assertSame ("Second attention tab should be " + att1 + " not " + mdl.getTab(tabs[1]), att1, mdl.getTab(tabs[1])); |
420 |
} |
421 |
|
422 |
public void testReplaceComplex() throws Exception { |
423 |
System.out.println("testReplaceComplex"); |
424 |
requestAttention(7); |
425 |
requestAttention(9); |
426 |
|
427 |
TabData[] data = (TabData[]) mdl.getTabs().toArray(new TabData[mdl.size()]); |
428 |
data[7] = new TabData (new JLabel("foo"), null, "foo", "foo"); |
429 |
mdl.setTabs(data); |
430 |
|
431 |
assertAtt(new int[] {9}); |
432 |
|
433 |
data[9] = new TabData (new JLabel("goo"), null, "goo", "goo"); |
434 |
mdl.setTabs(data); |
435 |
assertAtt(new int[0]); |
436 |
} |
437 |
|
438 |
public void testRemoveComplex() throws Exception { |
439 |
System.out.println("testRemoveComplex"); |
440 |
requestAttention(7); |
441 |
requestAttention(9); |
442 |
TabData att1 = mdl.getTab(7); |
443 |
TabData att2 = mdl.getTab(9); |
444 |
|
445 |
TabData[] data = (TabData[]) mdl.getTabs().toArray(new TabData[mdl.size()]); |
446 |
TabData[] nue = new TabData[data.length-1]; |
447 |
int ct = 0; |
448 |
for (int i=0; i < data.length; i++) { |
449 |
nue [ct] = data[i]; |
450 |
if (i != 7) { |
451 |
ct++; |
452 |
} |
453 |
} |
454 |
mdl.setTabs(nue); |
455 |
int[] tabs = state.getAlarmTabs(); |
456 |
|
457 |
assertTrue (tabs.length ==1); |
458 |
assertTrue (tabs[0] == 8); |
459 |
assertSame (mdl.getTab(tabs[0]), att2); |
460 |
} |
461 |
|
462 |
|
463 |
public void testAddComplex() throws Exception { |
464 |
System.out.println("testAddComplex"); |
465 |
requestAttention(7); |
466 |
requestAttention(9); |
467 |
TabData att1 = mdl.getTab(7); |
468 |
TabData att2 = mdl.getTab(9); |
469 |
|
470 |
TabData[] data = (TabData[]) mdl.getTabs().toArray(new TabData[mdl.size()]); |
471 |
|
472 |
ArrayList al = new ArrayList (Arrays.asList(data)); |
473 |
al.add (8, new TabData(new JLabel("boo"), null, "boo", "boo")); |
474 |
al.add (2, new TabData(new JLabel("moo"), null, "moo", "moo")); |
475 |
|
476 |
TabData[] nue = (TabData[]) al.toArray(new TabData[0]); |
477 |
|
478 |
mdl.setTabs(nue); |
479 |
int[] tabs = state.getAlarmTabs(); |
480 |
Arrays.sort(tabs); |
481 |
assertSame ("First attention tab should be " + att1 + " not " + mdl.getTab(tabs[0]), att1, mdl.getTab(tabs[0])); |
482 |
assertSame ("Second attention tab should be " + att2 + " not " + mdl.getTab(tabs[1]), att2, mdl.getTab(tabs[1])); |
483 |
} |
484 |
|
485 |
//Make sure (non)exceptional case of only 1 tab works |
486 |
|
487 |
private void makeSingle() throws Exception { |
488 |
SwingUtilities.invokeAndWait(new Runnable() { |
489 |
public void run() { |
490 |
TabData[] td = new TabData[] { |
491 |
new TabData (new JLabel("Single"), null, "single", "single") |
492 |
}; |
493 |
mdl.setTabs(td); |
494 |
state.addAlarmTab(0); |
495 |
assertTrue (state.getAlarmTabs().length == 1); |
496 |
} |
497 |
}); |
498 |
Thread.currentThread().sleep(50); |
499 |
} |
500 |
|
501 |
public void testHandleSingle1() throws Exception { |
502 |
System.out.println("testHandleSingle1"); |
503 |
makeSingle(); |
504 |
|
505 |
mdl.removeTab(0); |
506 |
assertAtt (new int[0]); |
507 |
} |
508 |
|
509 |
public void testHandleSingle2() throws Exception { |
510 |
System.out.println("testHandleSingle2"); |
511 |
makeSingle(); |
512 |
mdl.removeTabs(0, 0); |
513 |
assertAtt (new int[0]); |
514 |
} |
515 |
|
516 |
public void testHandleSingle3() throws Exception { |
517 |
System.out.println("testHandleSingle3"); |
518 |
makeSingle(); |
519 |
mdl.removeTabs(new int[] {0}); |
520 |
assertAtt (new int[0]); |
521 |
} |
522 |
|
523 |
public void testAddSingle1() throws Exception { |
524 |
System.out.println("testAddSingle1"); |
525 |
makeSingle(); |
526 |
mdl.addTab(0, new TabData(new JLabel("foo"), null, "foo", "foo")); |
527 |
assertTrue ("Size should be 2", mdl.size() == 2); |
528 |
assertAtt(new int[] {1}); |
529 |
} |
530 |
|
531 |
public void testAddSingle2() throws Exception { |
532 |
System.out.println("testAddSingle2"); |
533 |
makeSingle(); |
534 |
mdl.addTabs(0, new TabData[] {new TabData(new JLabel("foo"), null, "foo", "foo")}); |
535 |
assertTrue ("Size should be 2", mdl.size() == 2); |
536 |
assertAtt(new int[] {1}); |
537 |
} |
538 |
|
539 |
public void testAddSingle3() throws Exception { |
540 |
System.out.println("testAddSingle3"); |
541 |
makeSingle(); |
542 |
mdl.addTabs(new int[] {0}, new TabData[] {new TabData(new JLabel("foo"), null, "foo", "foo")}); |
543 |
assertTrue ("Size should be 2", mdl.size() == 2); |
544 |
assertAtt(new int[] {1}); |
545 |
} |
546 |
|
547 |
public void testAddSingle4() throws Exception { |
548 |
System.out.println("testAddSingle4"); |
549 |
makeSingle(); |
550 |
mdl.addTabs(new int[] {1}, new TabData[] {new TabData(new JLabel("foo"), null, "foo", "foo")}); |
551 |
assertTrue ("Size should be 2", mdl.size() == 2); |
552 |
assertAtt(new int[] {0}); |
553 |
} |
554 |
} |