source: trunk/tests/org/expeditee/gui/FreeItemsTest.java@ 240

Last change on this file since 240 was 240, checked in by ra33, 16 years ago

Added tests for FreeItems class

File size: 1.4 KB
Line 
1package org.expeditee.gui;
2
3import junit.framework.TestCase;
4
5public class FreeItemsTest extends TestCase {
6 static Browser b;
7
8 protected void setUp() throws Exception {
9 b = Browser.initializeForTesting();
10 super.setUp();
11 }
12
13 /**
14 * Test the picking up and putting down of objects on a frame.
15 * @throws Exception
16 */
17 public final void testAttachedToCursor() throws Exception {
18 Frame testFrame = FrameIO.LoadFrame("ExpediteeTest2");
19 DisplayIO.setCurrentFrame(testFrame, true);
20
21 FrameMouseActions.pickup(testFrame.getTitleItem());
22 assertTrue(FreeItems.itemsAttachedToCursor());
23 assertTrue(FreeItems.textOnlyAttachedToCursor());
24
25 FrameMouseActions.anchor(FreeItems.getInstance());
26 assertFalse(FreeItems.itemsAttachedToCursor());
27 assertFalse(FreeItems.textOnlyAttachedToCursor());
28
29 FrameMouseActions.pickup(testFrame.getAllItems());
30 assertTrue(FreeItems.itemsAttachedToCursor());
31 assertFalse(FreeItems.textOnlyAttachedToCursor());
32 assertEquals(8, FreeItems.getTextItems().size());
33
34 assertEquals(1, FreeItems.getGroupedText().get("").size());
35 assertEquals(2, FreeItems.getGroupedText().get("Label").size());
36 assertEquals(3, FreeItems.getGroupedText().get("Label2").size());
37 assertEquals(null, FreeItems.getGroupedText().get("non existing label"));
38
39 FrameMouseActions.anchor(FreeItems.getInstance());
40 assertFalse(FreeItems.itemsAttachedToCursor());
41 assertFalse(FreeItems.textOnlyAttachedToCursor());
42 }
43}
Note: See TracBrowser for help on using the repository browser.