summaryrefslogtreecommitdiffstats
path: root/tests/systemtests/sys_SensorElements/sys_declarative-sensor-elements.qtt
blob: c596f8e7ab511595bafd3cda1c37b6038d7dc44d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtSensors module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights.  These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

//include("Device.qtx")
//include("extrafunctions.qtt")

//TESTED_COMPONENT=src/sensors

testcase = {

/*
init: function() {
    qtuitest.checkActiveWindow = false;
    qtuitest.autoTerminate = false;
    wait(500);
    unlock();
    wait(500);
},


cleanup: function() {
    print("Cleanup test function");
    unlock();
    wait(500);
    Gesture.swipe(Screen.leftCenter(), Screen.rightCenter()); //close applicatin
    wait(500);
},
*/

// As a QML Application developer I need information about the position of the device (rotation angles from X and Y Axis)
    Device_Rotational_Position: function()
    {
        // Test meta data
        testTitle = "device position (rotation angles from X and Y Axis)";
        testBinary = "QML QtSensors";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_qmlqtsensors";
        testGoal = "Verify that the values of the X and Y axis are returned from the application and match those of the actual phone";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

      // Test steps
//        mouseClick(findByProperty("label", testBinary)); wait(500);
        prompt(twiki("---+++ " + testTitle + "<br><br>
            *Goal:* " + testGoal + "<br>
            *Pre-Requisites:* " + testPreconditions + "<br>
            *Tested Binary:* " + testBinary + "<br>

            | *Step* | *Verification* |
            | Launch " + testBinary + " | App launches normally |
            | Press the *Start* button for the accelerometer | The button now displays *running* and numeric values are displayed for X and Y Rotation |
            | Hold the device with the screen facing up in portrait | Verfy the x, y rotation values are approximatly 0,0 |
            | Rotate the device toward you along the x axis | Verify that the x rotation values increase from zero as the device is rotated and the y values remain at approximatly 0 |
            | Return the device to the screen facing up in portrait position | Verfy the x, y rotation values are approximatly 0,0 |
            | Rotate the device away from you along the x axis | Verify that the x rotation values decrease from zero (become negitive) as the device is rotated and the y values remain at approximatly 0 |
            | Return the device to the screen facing up in portrait position | Verfy the x, y rotation values are approximatly 0,0 |
            | Rotate the device to the right along the y axis | Verify that the y rotation values increase from zero as the device is rotated and the x values remain at approximatly 0 |
            | Return the device to the screen facing up in portrait position | Verfy the x, y rotation values are approximatly 0,0 |
            | Rotate the device to the left along the y axis | Verify that the y rotation values decrease from zero (become negitive) as the device is rotated and the x values remain at approximatly 0 |
        "));
    },

// As a QML Application developer I want to calibrate the current device position
    Calibrate_Current_Device_Position: function()
    {
        // Test meta data
        testTitle = "Accelerometer Calibration";
        testBinary = "QML QtSensors";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_qmlqtsensors"
        testGoal = "Verify that the application can be set to read an X and Y value of zero for the current phone position";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

        // Test steps
//        mouseClick(findByProperty("label", testBinary)); wait(500);
        prompt(twiki("---+++ " + testTitle + "<br><br>
           *Goal:* " + testGoal + "<br>
           *Pre-Requisites:* " + testPreconditions + "<br>
           *Tested Binary:* " + testBinary + "<br>

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | Press the *Start* button for the accelerometer | The button now displays *running* and numeric values are displayed for X and Y Rotation |
           | Hold the device with the screen facing up in portrait | Verfy the x, y rotation values are approximatly 0,0 |
           | Rotate the device toward you along the x axis until the device is at 90 degrees| Verify that the x rotation values show approximatly 90 degrees and the y values remain at approximatly 0 |
           | While holding the device in this position select the calibrate button | Verify that the x, y values now show approximatly 0,0 |
           | Return the device to the face up position | Verify that the accelerometer x, y rotation shows approximatly -90,0 |
           | While holding the device in this position select the calibrate button | Verify that the x, y values now show approximatly 0,0 |
           | Rotate the device toward the right along the y axis until the device is at 90 degrees| Verify that the x rotation values remain at approximatly 0 degrees and the y value show approximatly 90 degrees |
           | While holding the device in this position select the calibrate button | Verify that the x, y values now show approximatly 0,0 |
           | Return the device to the face up position | Verify that the accelerometer x, y rotation shows approximatly 0,-90 |
           | Select the calibrate button | Verify that the x, y values now show approximatly 0,0 |
       "));
    },

    // As a QML Application developer I want to find the device orientation
        Show_Device_Orientation: function()
     {
        // Test meta data
        testTitle = "Phone Orientation";
        testBinary = "sensor explorer";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_sensor_explorer"
        testGoal = "Verify that the application can show the orientation of the phone";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

            // Test steps
//            mouseClick(findByProperty("label", testBinary)); wait(500);
            prompt(twiki("---+++ " + testTitle + "<br><br>
               *Goal:* " + testGoal + "<br>
               *Pre-Requisites:* " + testPreconditions + "<br>
               *Tested Binary:* " + testBinary + "<br>

               | *Step* | *Verification* |
               | Launch " + testBinary + " | App launches normally |
               | Select orientation from the sensor list and press start | *Orientation* is highlighted and orientation type shows the current orientation |
               | Orient the device with the screen facing up | Verify that the orientation type shows *FaceUp* |
               | Orient the device with the left side facing up | Verify that the orientation type shows *LeftUp* |
               | Orient the device with the top down | Verify that the orientation type shows *TopDown* |
               | Orient the device with the face down | Verify that the orientation type shows *FaceDown* |
               | Orient the device with the right side facing up | Verify that the orientation type shows *FaceUp* |
               | Orient the device with the top facing up | Verify that the orientation type shows *TopUp* |
           "));
        },

// As a QML Application developer I would like to have one QML element per sensor type
// MTMW-427 QML System Test - Using only Proximity sensor does not start the sensor hardware
    Display_All_Sensor_Types: function()
    {
        // Test meta data
        testTitle = "List Sensor Types";
        testBinary = "sensor explorer";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_sensor_explorer"
        testGoal = "Verify that all sensor types are shown by the application";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

          // Test steps
//          mouseClick(findByProperty("label", testBinary)); wait(500);
          prompt(twiki("---+++ " + testTitle + "<br><br>
              *Goal:* " + testGoal + "<br>
              *Pre-Requisites:* " + testPreconditions + "<br>
              *Tested Binary:* " + testBinary + "<br>

              | *Step* | *Verification* |
              | Launch " + testBinary + " | App launches normally |
              | Ensure that none of the sensors are in a *running* state | Press any buttons that display *Running* to place that sensor in a *Stopped* state |
              | Each sensor button will display *start* or *Stopped*, press the accelerometer *Start* button | Verify that the accelerometer button displays *running* and operates as expected |
              | Press the accelerometer button again to stop the accelerometer | Verify the button reads *Stopped* and the X, Y Rotation values do not repond to movement |
              | Press the Ambient Light *Start* button | Verify that the Ambient Light sensor button displays *running* and operates as expected |
              | Press the Ambient Light button again to stop the Ambient Light sensor | Verify the button reads *Stopped* and the Ambient Light sensor does not respond when a shadow falls on it |
              | Press the Proximity sensor *Start* button | Verify that the Proximity sensor button displays *running* and operates as expected |
              | Press the Proximity sensor button again to stop the Proximity sensor | Verify the button reads *Stopped* and the Proximity sensor does not respond when when your palm is brought within 1 cm of the Proximity sensor |
              | Press all sensor buttons again to start all sensors | Verify all buttons read *Running* and all sensors operate as expected |
        "));
    },

// As a QML Application developer I would like to receive the rotation angles in Radian or Degree
    Display_Angles_Radian_Degrees: function()
    {
        // Test meta data
        testTitle = "Rotation Units";
        testBinary = "QML QtSensors";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_qmlqtsensors"
        testGoal = "Verify that the read values for the X and Y axis can be displayed in radians or degrees";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

          // Test steps
//          mouseClick(findByProperty("label", testBinary)); wait(500);
          prompt(twiki("---+++ " + testTitle + "<br><br>
              *Goal:* " + testGoal + "<br>
              *Pre-Requisites:* " + testPreconditions + "<br>
              *Tested Binary:* " + testBinary + "<br>

              | *Step* | *Verification* |
              | Launch " + testBinary + " | App launches normally |
              | Press the *Start* button for the accelerometer | The button now displays *running* and numeric values are displayed for X and Y Rotation |
              | Hold the device in portrait face up horizontal | Verify the x, y rotation values display 0,0 |
              | While holding the device in this position press the button marked *degree* | Verify the button now reads *radian* and the x, y rotation values display approximatly 0,0 |
              | Still holding the device in portrait tilt the device at right angles toward you (screen facing you) | Verify the x, y rotation values display approximatly 1.57,0|
              | While holding the device in this position press the button marked *radian* | Verify the button now reads *radian* and the x, y rotation values display approximatly 90,0 |
        "));
    },

// As a QML Application developer I would like to change my UI dependent of the ambient light
    Ambient_Light_Detection: function()
    {
        // Test meta data
        testTitle = "Ambient Light Sensor";
        testBinary = "QML QtSensors";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_qmlqtsensors";
        testGoal = "Verify that the ambient light values can be read";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "A bright light source such as a desk lamp";


          // Test steps
//          mouseClick(findByProperty("label", testBinary)); wait(500);
          prompt(twiki("---+++ " + testTitle + "<br><br>
              *Goal:* " + testGoal + "<br>
              *Pre-Requisites:* " + testPreconditions + "<br>
              *Tested Binary:* " + testBinary + "<br>

              | *Step* | *Verification* |
              | Launch " + testBinary + " | App launches normally |
              | Press the *Start* button for the ambient light sensor | The button now displays *running* and a value is displayed for *Ambient Light* |
              | Place the device close under a bright light | Verify that the Ambient Light is reported as *Sunny* |
              | Move the device a bit futher away from the light source | Verify that the Ambient Light is reported as *Bright* |
              | Move the device even futher away from the light source | Verify that the Ambient Light is reported as *Light* |
              | Place the light sensor element under a partial shadow, i.e. by holding your hand above the device | Verify that the Ambient Light is reported as *Twilight*, note that the amount of shadow may need to be adjusted by moving your hand to achieve this |
              | Place your finger over the sensor element | Verify that the Ambient Light now reads as *Dark* |
        "));
    },

// As a QML Application developer I would like to deactivate the touchscreen as soon the proximity of the user is close - no need for test app to lock screen, testing that the proximity is detected is sufficient
    Proximity_Detection: function()
    {
        // Test meta data
        testTitle = "Proximity";
        testBinary = "QML QtSensors";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_qmlqtsensors";
        testGoal = "Verify that close proximity can be detected";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

          // Test steps
//          mouseClick(findByProperty("label", testBinary)); wait(500);
          prompt(twiki("---+++ " + testTitle + "<br><br>
              *Goal:* " + testGoal + "<br>
              *Pre-Requisites:* " + testPreconditions + "<br>
              *Tested Binary:* " + testBinary + "<br>
              | *Step* | *Verification* |
              | Launch " + testBinary + " | App launches normally |
              | Press the *Start* button for the *Proximity* | The button now displays *running* and a value is displayed for *Proximity* |
              | Confirm that nothing is close to the proximity detector | Verify that the Proximity reads *far* |
              | Bring your hand to within 1 cm of the proximity sensor | Verify that the Proximity now reads *near* |
              | Move your hand away from the proximity sensor | Verify that the Proximity now reads *far* |
        "));
    },

// MTMW-426   Handle service errors gracefully
    Service_Errors: function()
    {
        // Test meta data
        testTitle = "Error Handling";
        testBinary = "QML QtSensors";
        testSource = "$QTDIR/qtsensors/examples/QtSensors/QtSensors_qmlqtsensors";
        testGoal = "Verify that service errors are handled so as to prevent baldr crashes if the sensor daemon stops unexpectedly";
        testPreconditions = "Nil.";
        testGroups = "BAT, 5.0";
        testRequirements = "";

          // Test steps
//          mouseClick(findByProperty("label", testBinary)); wait(500);
          prompt(twiki("---+++ " + testTitle + "<br><br>
              *Goal:* " + testGoal + "<br>
              *Pre-Requisites:* " + testPreconditions + "<br>
              *Tested Binary:* " + testBinary + "<br>
              | *Step* | *Verification* |
              | Launch " + testBinary + " | App launches normally |
              | Press start on the three sensors | Verify that the sensors are operating |
              | Log into the device using a console and enter the following commands: ps -A &#124; grep sensorq | Verify that the process ID number for sensorq is displayed |
              | Using the process ID from the previous step stop sensorq by typing kill processID at the console |  |
              | Check the sensors on " + testBinary + " | Verify that the sensors are still operating |
              | Repeat the previous steps to find the process ID and kill sensorq a second time | Verify the sensors are still operating and sensorq still has a process ID |
        "));
    },
}