|
1 package com.nokia.mj.impl.uitestutils; |
|
2 |
|
3 |
|
4 final class S60Utils { |
|
5 |
|
6 static { |
|
7 // Should use vmport, this is CDC/J2SE API |
|
8 //System.loadLibrary("s60uitestutils"); |
|
9 org.eclipse.swt.internal.Library.loadLibrary("s60uitestutils"); |
|
10 } |
|
11 |
|
12 /** |
|
13 * Constant for key press event. |
|
14 */ |
|
15 static final int PRESS = 0; |
|
16 |
|
17 /** |
|
18 * Constant for key release event. |
|
19 */ |
|
20 static final int RELEASE = 1; |
|
21 |
|
22 /** |
|
23 * Button constants. |
|
24 */ |
|
25 static final int BUTTON1 = 1; |
|
26 static final int BUTTON2 = 2; |
|
27 static final int BUTTON3 = 3; |
|
28 |
|
29 |
|
30 /** |
|
31 * Sends a key event to the window which has the keyboard focus. Get the keycode of |
|
32 * the desired symbol using XKeysymToKeycode and pass that here. Or if the desired |
|
33 * keycode is known it can be passed directly. |
|
34 * @param keycode The keycode of the key to send. |
|
35 * @param modifiers The modifiers to send. |
|
36 * @param pressOrRelease Either PRESS or RELEASE must be passed here. |
|
37 * @return 0 if successful, otherwise a non-zero error code |
|
38 * @see XlibKeys |
|
39 */ |
|
40 static final native int S60SendKeyToFocusWindow(int keycode, int modifiers, int pressOrRelease); |
|
41 |
|
42 /** |
|
43 * Returns the keycode of the given symbol (keysym) in the currently active |
|
44 * keyboard layout. Keysym constants are defined in XlibKeys. |
|
45 * @param keysym |
|
46 * @return The keycode or zero in case of an error |
|
47 * @see XlibKeys |
|
48 */ |
|
49 static final native int S60KeysymToKeycode(int keysym); |
|
50 |
|
51 /** |
|
52 * Sends a pointer press or release event. |
|
53 * @param x X-coordinate to send, relative to X root window (i.e. screen). |
|
54 * @param y Y-coordinate to send, relative to X root window (i.e. screen). |
|
55 * @param modifiers The modifiers to send. |
|
56 * @param button The button that's pressed or released. |
|
57 * @param pressOrRelease Either PRESS or RELEASE must be passed here. |
|
58 * @return 0 if successful, otherwise a non-zero error code |
|
59 */ |
|
60 static final native int S60SendPointerEvent(int x, int y, int button, int pressOrRelease); |
|
61 |
|
62 /** |
|
63 * Sends a pointer move event. |
|
64 * @param x X-coordinate to send, relative to X root window (i.e. screen). |
|
65 * @param y Y-coordinate to send, relative to X root window (i.e. screen). |
|
66 * @param button The button that's held pressed during the move. |
|
67 * @return 0 if successful, otherwise a non-zero error code |
|
68 */ |
|
69 static final native int S60SendPointerMoveEvent(int x, int y, int button); |
|
70 |
|
71 /** |
|
72 * Disables the screensaver. |
|
73 */ |
|
74 static final native void S60DisableScreensaver(); |
|
75 |
|
76 /** |
|
77 * Sets the doubleclick interval. Set to 0 to disable doubleclicks. |
|
78 * @param interval New doubleclick interval |
|
79 */ |
|
80 static final native void S60SetDoubleclickInterval(int interval); |
|
81 |
|
82 /*static final native int _create(int toolkitHandle, UITestUtils testUtils); |
|
83 static final native void _dispose(int toolkitHandle, UITestUtils testUtils, int testUtilsHandle); |
|
84 |
|
85 static final native void _startTest(int toolkitHandle, int handle, String screenShotDir); |
|
86 static final native void _endTest(int toolkitHandle, int handle, boolean passed, String msg); |
|
87 |
|
88 static final native void _log(int toolkitHandle, int handle, String msg); |
|
89 static final native void _logResult(int toolkitHandle, int handle, boolean passed, String msgPassed, String msgFailed); |
|
90 |
|
91 static final native void _triggerKeyPressEvent(int toolkitHandle, int handle, int keyCode, int scanCode); |
|
92 static final native int _triggerKeyRepeatEvents(int toolkitHandle, int handle, int keyCode, int scanCode, int count); |
|
93 static final native int _triggerMediaKeyRepeatEvents(int toolkitHandle, int handle, int keyCode, int scanCode, int pressedTimeInMillis); |
|
94 |
|
95 static final native boolean _getScreenShot(int toolkitHandle, int handle, String screenShotName); |
|
96 static final native boolean _getScreenShot(int toolkitHandle, int handle, String screenShotName, |
|
97 int areaToCompare, int displayableType); |
|
98 static final native boolean _getScreenShot(int toolkitHandle, int handle, String screenShotName, |
|
99 int topLeftX, int topLeftY, int bottomRightX, int bottomRightY); |
|
100 |
|
101 static final native void _triggerPointerDownEvent(int toolkitHandle, int handle, int x, int y); |
|
102 static final native void _triggerPointerUpEvent(int toolkitHandle, int handle, int x, int y); |
|
103 static final native void _triggerPointerDragEvent(int toolkitHandle, int handle, int x, int y); |
|
104 |
|
105 static final native void _changeQwertyInput(int toolkitHandle, int handle, boolean aOn); |
|
106 static final native int _switchResolution(int toolkitHandle, int handle, int numTimes, int delayMillis); |
|
107 |
|
108 static final native void _getBoundsOf(int toolkitHandle, int handle, int type, int[] coordinates); |
|
109 |
|
110 static final native void _allowScreenSaver(int toolkitHandle, int handle, int allow);*/ |
|
111 |
|
112 } |