/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite 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$
**
****************************************************************************/

//TESTED_COMPONENT=src/location

testcase = {

    qml_select_service_provider: function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Select Service Provider";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that service provider can be selected";
        testPreconditions = "Several service providers should be available. Internet connection is required for this test case.";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861, MOBILITY-538: Maps and Navigation";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally. Map is displayed on the screen |
        | Pan the map | |
        | Select Provider button | Verify that one of the providers is indicated as current service provider |
        | Select other provider | Verify that map is displayed on the screen, Nokia point is at the centre of the map. |
        "));
    },

    qml_capturing_coordinates:function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Coordinate Capturing";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that coordinates can be captured when selecting a location on the map.";
        testPreconditions = "internet connection is required for this test case.";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861, MOBILITY-538: Maps and Navigation";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally. |
        | Select Provider button | |
        | Select nokia provider | Map is displayed on the screen |
        | Press and Hold on the dot which represents Brisbane | |
        | Select 'Get coordinate' menu item | Verify that dialog with coordinates appears on the screen. Latitude is about -27.46, longitude is about 153.02 |"
        ));
    },

    qml_map_types: function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Map View options";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that maps can be shown in different modes.";
        testPreconditions = "internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861, QTMOBILITY-796: QML for Maps & Navigation: mapping";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | Verify that map is loaded in 'Street' view. Nokia point is a centre of the map |
        | Select Provider button | |
        | Select nokia provider | Verify that map is displayed in 'Street' view |
        | Select 'Map Type' button | |
        | Select 'Satelite Map(day)' | Verify that map is displayed in 'Satelite (day)' view |
        | Pan map | Verify that new map tiles are in 'Satelite (day)' view |
        | Zoom in map | Verify that new map tiles are in 'Satelite (day)' view |
        | Select 'Map Type' button | |
        | Select 'Terrain Map' | Verify that map is displayed in 'Terrain' view, centre of the map is not changed |
        | Select 'Map Type' button | |
        | Select 'Hybrid Map' | Verify that map is displayed in 'Hybrid' view |
        | Select 'Map Type' button | |
        | Select 'Transit Map' | Verify that map is displayed in 'Transit' view |
        | Select 'Map Type' button | |
        | Select Gray Street Map | Verify that map is displayed in 'Gray Street' view |
        | Select 'Map Type' button | |
        | Select 'Mobile Street Map' | Verify that map is displayed in 'Mobile Street' view |
        | Select 'Map Type' button | |
        | Select Mobile Terrain Map | Verify that map is displayed in 'Mobile Terrain' view |
        | Select 'Map Type' button | |
        | Select Mobile Hybrid Map | Verify that map is displayed in 'Mobile Hybrid' view |
        | Select 'Map Type' button | |
        | Select 'Mobile Transit Map' | Verify that map is displayed in 'Mobile Transit' view |
        | Select 'Map Type' button | |
        | Select 'Mobile Gray Street Map' | Verify that map is displayed in 'Mobile Gray Street' view |
        | Select 'Map Type' button | |
        | Select 'Street Map' | Verify that map is displayed in 'Street (day)' view |"
        ));
    },

    qml_flick_a_map: function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Flick";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that flick gesture works correctly with map.";
        testPreconditions = "internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-239: QML for maps";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | Verify that map is loaded with the center next to Brisbane  |
        | Make a long flick gesture from the right side the left | Verify that map center was moving to the left with dropping speed at the end |
        | Make a short flick gesture from the left side the right | Verify that map center was moving to the rigth with dropping speed at the end. Verify that map center has been moved to the less distance in comparing with previous step |
        | Make a flick gesture 2 o'clock direction | Verify that map center was following flick gesture. |
        | Zoom in map close to the maximum zoom level | |
        | Flick map | Verify that flick gesture worked as expected. |
        | Select Tools button | |
        | Select Minimap | |
        | Make a flick gesture | Verify that flick gesture worked as expected, there is no dirt on the screen |"
        ));
    },

    qml_pinch_a_map: function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Pinch";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that pinch gesture works correctly with map.";
        testPreconditions = "internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | Verify that map is loaded with the center next to Brisbane  |
        | Make a long zooming in pinch gesture | Verify that map is zoomed in. Verify that centre of the pinch gesture is between touchpoints. |
        | Make a short zooming out pinch gesture | Verify that map is zoomed out to less degree in comparing with previous step. |"
        ));
    },

    qml_pan_a_map: function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Pan";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that pan gesture works correctly";
        testPreconditions = "internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | Verify that map is loaded with the center next to Brisbane  |
        | Pan a map | Verify that map center followed the finger/cursor. Verify that new tiles is uploaded if needed. |
        | Zoom in map close to the maximum zoom level | |
        | Pan map | Verify that pan gesture worked as expected. |"
        ));
    },

    qml_zoom_a_map: function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Zooming";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that maps can be zoomed in and out.";
        testPreconditions = "internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861, QTMOBILITY-796: QML for Maps & Navigation: mapping";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | Verify that map is loaded with Nokia at the center |
        | Move slider to the right | Verify that map is zoomed in |
        | Move slider to the left | Verify that map is zoomed out |
        | Move slider to have zoom level between 8 and 9 | |
        | Move slider the right to have zoom level less than 9 | Verify that map is scaled |
        | Move slider the right to jump over 9 zoom level but less than 10 | Verify that new tiles are displayed to reflect bigger zoom level |
        | Zoom in to the maximum level | Verify that map is not blurry |"
        ));
    },

    qml_distance_between_points_data: {
        points:["-27", "153", "-27.5", "153.1", "56.5"]
    },

    qml_distance_between_points:function(lat1, long1, lat2, long2, distance)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Distance between points";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that distance between points can be calculated.";
        testPreconditions = "Internet connection is required for this test case.";
        testGroups = "BAT,5.0";
        testRequirements = "MOBILITY-2861";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally |
        | Long press on the map | |
        | Select 'Add Marker' menu item | |
        | Long Press on the marker | |
        | Select 'Move to' menu item | |
        | Fill in " + lat1 + " in Latitude field | |
        | Fill in " + long1 + " in Longitude | |
        | Select Go! button | |
        | Create another Marker via Long Press | |
        | Long Press on the second marker | |
        | Select 'Move to' menu item | |
        | Fill in " + lat2 + " in Latitude field | |
        | Fill in " + long2 + " in Longitude | |
        | Select Go! button | |
        | Long Press on the first marker | |
        | Select 'Distance to the next point' | Verify that distance is " + distance + " |"
        ));
    },

    qml_border_wrapping_data: {
        markers:["-27", "150", "-27", "-170"]
    },

    qml_border_wrapping: function(lat1, long1, lat2, long2)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Border wrapping";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that border wrapping works correctly for map and map items.";
        testPreconditions = "Internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally |
        | Zoom out map to about level 3 | |
        | Long press on the map | |
        | Select 'Add Marker' menu item | |
        | Long Press on the marker | |
        | Select 'Move to' menu item | |
        | Fill in " + lat1 + " in Latitude field | |
        | Fill in " + long1 + " in Longitude | |
        | Select Go! button | |
        | Create another Marker via Long Press | |
        | Long Press on the second marker | |
        | Select 'Move to' menu item | |
        | Fill in " + lat2 + " in Latitude field | |
        | Fill in " + long2 + " in Longitude | |
        | Select Go! button | |
        | Pan map to the right so the map center crosses dateline | Verify that there are 2 markers on the screen |
        | Zoom out the map to zoom level 0 | |
        | Pan map to make round-the-world trip | Verify that map looks and behaves as unfolded cylinder. Verify that there are no markers. |
        | Flick map from right to left to make round-the-world trip | Verify that map doesn't bounce to the right.|
        | Pan map from North pole to the South pole | Verify that all markers visible and drawn correctly. |"
        ));
    },

    qml_several_maps:function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Several maps";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify several maps can be displayed at the same time.";
        testPreconditions = "Several service providers should be available. Internet connection is required for this test case.";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally. Map is displayed on the screen |
        | Select Provider button | |
        | Select nokia provider | Verify that map is displayed on the screen with default location next to Brisbane |
        | Select Tools button | |
        | Select Minimap button | Verify that another smaller map above the base map. |
        | | Verify that minimap's zoom level is smaller then base maps zoom level. |
        | | Verify that base maps's center is inside red rectangle on the minimap. |
        | Pan the base map | Verify that minimap is updated correctly with centre following base map centre |
        | Select Map Type button | |
        | Select Terrain Map button | Verify that base map is in Terrain view and minimap's type is unaltered |
        | Select Provider button | |
        | Select any other provider except nokia | Verify that map is displayed on the screen Nokia at the centre. |
        | Select Tools button | |
        | Select Minimap button | Verify that another smaller map above the base map. |
        | | Verify that Brisbane is inside red rectangle on the minimap. |
        | Pan the base map | Verify that minimap is updated smoothly with centre following base map centre. |"
        ));
    },

    qml_map_logo:function()
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Logo";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that map can display logo (watermark).";
        testPreconditions = "Internet connection is required for this test case.";
        testGroups = "BAT, 5.0";
        testRequirements = "MOBILITY-2861, QTMOBILITY-796: QML for Maps & Navigation: mapping";

        // Test steps
        prompt(twiki("---+++ " + testTitle + "<br><br>
        *Goal:* " + testGoal + "<br>
        *Pre-Requisites:* " + testPreconditions + "<br>
        *Tested Binary:* " + testBinary + "<br>
        *Requirements:* " + testRequirements + "<br>

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally. Map is displayed on the screen |
        | Select Provider button | |
        | Select nokia provider | |
        | Select Tools button | |
        | Select Minimap button | Verify that minimap with logo is displayed on the screen. |"
        ));
    }

}  // end of testcase
