/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $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
testApplication = "qmlsensors2";
testBinary = "Sensors2"; // Running QML using qmlrunner will insert test app binary name when compiled
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";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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
testApplication = "qmlsensors2";
testBinary = "Sensors2";
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";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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
testApplication = "qmlsensors2";
testBinary = "QtSensor...";
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";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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 |
| Select the *Facing Up* radio button | Verify that when the device is orientated with the screen facing up the x, y rotation shows approximatly 0,0 |
| Select the *Left Up* radio button | Verify that when the device is orientated with the left up up (starting from portrait) the x, y rotation shows approximatly 0,0 |
| Select the *Top Down* radio button | Verify that when the device is orientated with the top edge down (starting from portrait) the x, y rotation shows approximatly 0,0 |
| Select the *Face Down* radio button | Verify that when the device is orientated with the face down the x, y rotation shows approximatly 0,0 |
| Select the *Right Up* radio button | Verify that when the device is orientated with the right edge up (starting from portrait) the x, y rotation shows approximatly 0,0 |
| Select the *Top Up* radio button | Verify that when the device is orientated with the top edge up (starting from portrait) the x, y rotation shows approximatly 0,0 |
"));
},
// 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
testApplication = "qmlsensors2";
testBinary = "Sensors2";
testGoal = "Verify that all sensor types are shown by the application";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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
testApplication = "qmlsensors2";
testBinary = "Sensors2";
testGoal = "Verify that the read values for the X and Y axis can be displayed in radians and degrees";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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
testApplication = "qmlsensors2";
testBinary = "Sensors2";
testGoal = "Verify that the ambient light values can be read";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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 under normal room lighting | Verify that the Ambient Light is reported as *Bright* |
| 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 *Light*, note that the amount of shadow may need to be adjusted by moving your hand to achieve this |
| Make the shadow darker by moving your hand closer to the sensor | Verify that the Ambient Light now reads *Twilight* |
| 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
testApplication = "qmlsensors2";
testBinary = "Sensors2";
testGoal = "Verify that the touch screen deactivates when the proximity of the user is less than a predefined value";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *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 *false* |
| Bring your hand to within 1 cm of the proximity sensor | Verify that the Proximity now reads *true* |
| Move your hand away from the proximity sensor | Verify that the Proximity now reads *false* |
"));
},
// MTMW-426 Handle service errors gracefully
Service_Errors: function()
{
// Test meta data
testApplication = "Grue Sensor";
testBinary = "Grue Sensor";
testGoal = "Verify that service errors are handled so as to prevent baldr crashes if the sensor daemon stops unexpectedly";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *Step* | *Verification* |
| Launch " + testBinary + " | App launches normally |
| Bring your hand to within 1 cm of the proximity sensor | Verify that the Proximity sensor is operating |
| Log into the device using a console and enter the following commands: ps -A | 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 | |
| View the baldr log | Verify that sensorq is killed and restarted by baldr |
| Repeat the previous steps to find the process ID and kill sensorq a second time | View the baldr logs again to verify that sensorq has started again |
"));
},
// MTMW-423 QML System Test - Ensure sensor defaults to 10hz - accelerometer
Accelerometer_Default: function()
{
// Test meta data
testApplication = "sensortest";
testBinary = "sensortest";
testGoal = "Verify that the accelerometer maximum sample rate defaults to 10 hz";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *Step* | *Verification* |
| Connect to the console on the device via ssh and launch *" + testBinary + " accel* | App launches normally |
| A stream of data is displayed, move the device in various directions and observe the X, Y and Z data | Verify that the data varies indicating the accelerometer is operating |
| While continuing to move the device observe the sample rate data (last value on each line) | Verify that the default sample rate does not go higher than 10 Hz |
| Stop the " + testBinary + " application using ctrl c and restart using the following command *" + testBinary + " accel -r 100* | |
| Continue moving the device and observe the sample rate data | Verify the sample rate now doesn't go above 100 Hz |
| Stop the " + testBinary + " application and restart using the following command *" + testBinary + " accel* | |
| Continue moving the device and observe the sample rate data | Verify that the sample rate now doesn't go above 10 Hz |
"));
},
// MTMW-438 QML System Test - Ensure sensor defaults to 10hz - IR proximity
IR_Proximity_Default: function()
{
// Test meta data
testApplication = "sensortest";
testBinary = "sensortest";
testGoal = "Verify that the IR proximity sensor maximum sample rate defaults to 10 hz";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *Step* | *Verification* |
| Connect to the console on the device via ssh and launch *" + testBinary + " irprox* | App launches normally |
| A stream of data is displayed, move your finger in front of the proximity sensor and observe the IR reflectance value | Verify that the data varies indicating the IR proximity sensor is operating |
| While continuing to move your finger in front of the proximity sensor observe the sample rate data (last value on each line) | Verify that the default sample rate does not go higher than 10 Hz |
| Stop the " + testBinary + " application using ctrl c and restart using the following command *" + testBinary + " irprox -r 100* | |
| Continue moving your finger in front of the proximity sensor and observe the sample rate data | Verify the sample rate now doesn't go above 100 Hz and does occasionly go above 10 Hz |
| Stop the " + testBinary + " application and restart using the following command *" + testBinary + " irprox* | |
| Continue moving your finger in front of the proximity sensor and observe the sample rate data | Verify that the sample rate now doesn't go above 10 Hz |
"));
},
// MTMW-439 QML System Test - Ensure sensor defaults to 10hz - light sensor
Light_Sensor_Default: function()
{
// Test meta data
testApplication = "sensortest";
testBinary = "sensortest";
testGoal = "Verify that the light sensor maximum sample rate defaults to 10 hz";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *Step* | *Verification* |
| Connect to the console on the device via ssh and launch *" + testBinary + " light* | App launches normally |
| A stream of data is displayed, vary the light falling on the device and observe the lux value of the data | Verify that the data varies indicating the light sensor is operating |
| While continuing to vary the light falling on the device observe the sample rate data (last value on each line) | Verify that the default sample rate does not go higher than 10 Hz |
| Stop the " + testBinary + " application using ctrl c and restart using the following command *" + testBinary + " light -r 5* | |
| Continue to vary the light falling on the device and observe the sample rate data | Verify the sample rate now doesn't go above 5 Hz |
| Stop the " + testBinary + " application and restart using the following command *" + testBinary + " light* | |
| Continue to vary the light falling on the device and observe the sample rate data | Verify that the sample rate now doesn't go above 10 Hz |
"));
},
// MTMW-424 - Slow down IR Proxy polling when close
Slow_Down_IR_Proxy: function()
{
// Test meta data
testApplication = "sensortest";
testBinary = "sensortest";
testGoal = "Verify that the IR Proxy poll rate slows down to 5 Hz when objects are close";
testPreconditions = "Nil.";
testGroups = "BAT";
// Test steps
// mouseClick(findByProperty("label", testBinary)); wait(500);
prompt(twiki("---+++ " + testApplication + "
*Goal:* " + testGoal + "
*Pre-Requisites:* " + testPreconditions + "
*Tested Binary:* " + testBinary + "
| *Step* | *Verification* |
| Connect to the console on the device via ssh and launch *" + testBinary + " irprox* | Verify the App launches normally and displays *loaded the grue plugin*, *loaded the Meltemi plugin* |
| | Verify it also displays *Detected: HW35*, *Sensor 0, IR Reflectance 0.0%* |
| Move your hand to within 1 cm of the IR Proxy sensor | Verify that the IR Reflectance data increases to about 10Hz briefly and then goes down to 5Hz or less - note that the readings will not update unless your hand is moving |
| Move your hand a small amount without moving further away than 1 cm | Verify that the values update but never go above 5Hz |
| Move your hand further away than 1 cm | Verify the updating stops |
| Move your hand to within 1 cm of the IR Proxy sensor again | Verify that the IR Reflectance data increases to about 10Hz briefly and then goes down to 5Hz or less |
"));
},
}