source: trunk/tests/org/expeditee/gui/FrameKeyboardsActionsTest.java@ 1102

Last change on this file since 1102 was 1102, checked in by davidb, 6 years ago

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File size: 1.4 KB
Line 
1package org.expeditee.gui;
2
3import java.awt.event.InputEvent;
4import java.awt.event.KeyEvent;
5
6import org.expeditee.items.Item;
7
8public class FrameKeyboardsActionsTest extends GuiTestCase {
9
10 public static int DELAY = 200;
11
12 public final void testTypeText() throws Exception {
13 Frame testFrame = showBlankFrame();
14 DisplayController.typeKey(KeyEvent.VK_ESCAPE);
15 DisplayController.typeText("hello");
16 // Pick the item up in the middle
17 Item currentItem = FrameUtils.getCurrentItem();
18 assertNotNull(currentItem);
19 DisplayController.setCursorPosition(currentItem.getX()
20 + currentItem.getBoundsWidth() / 2,
21 FrameMouseActions.MouseY - 2);
22 Thread.sleep(DELAY);
23 DisplayController.clickMouse(InputEvent.BUTTON2_MASK);
24 Thread.sleep(DELAY);
25 DisplayController.setCursorPosition(
26 Math.round(FrameGraphics.getMaxFrameSize().getWidth() / 2),
27 FrameMouseActions.MouseY);
28 Thread.sleep(DELAY);
29 DisplayController.typeKey(KeyEvent.VK_ESCAPE);
30 Thread.sleep(DELAY);
31 DisplayController.clickMouse(InputEvent.BUTTON2_MASK);
32 Thread.sleep(DELAY);
33
34 // Check that the current position is the origin of the item
35 assertEquals(currentItem.getX(), FrameMouseActions.getX());
36
37 DisplayController.typeKey(KeyEvent.VK_ESCAPE);
38
39 DisplayController.typeStringDirect(0.05, "Hello Again!");
40
41 DisplayController.typeKey(KeyEvent.VK_ESCAPE);
42
43 DisplayController.typeText("Hello Again");
44
45 assertEquals(4, testFrame.getItems(false).size());
46
47 }
48}
Note: See TracBrowser for help on using the repository browser.