/****************************************************************************
**
** 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_no_route_data: {
        distant_points:["-27.575", "153.088", "56", "44"]
    },

    qml_no_route: function(lat1, long1, lat2, long2)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - no available route";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that route can not be calculated.";
        testPreconditions = "Internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-235: QML Routing";

        // 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 [Tools] button | |
        | Select [Route] menu item | |
        | Select [Clear] button | |
        | Fill in [" + lat1 + "] in From Latitude field | |
        | Fill in [" + long1 + "] in From Longitude field | |
        | Fill in [" + lat2 + "] in To Latitude field | |
        | Fill in [" + long2 + "] in To Longitude field | |
        | Select [Go!] button | Verify that route cannot be calculated |"
        ));
    },

    qml_route_for_two_points_data: {
        close_points:["-27.575", "153.088", "-27.465", "153.023", "15.9km", "8"],
        distant_points:["-27.4709", "153.0235", "-33.8689", "151.2071", "923km", "30"],
        loop_test_points:["51.5", "-0.11", "51.2207", "0.1", "50.9km", "19"]      //test for QTBUG-20869
    },

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

        // 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 [Tools] button | |
        | Select [Route] menu item | |
        | Select [Clear] button | |
        | Fill in [" + lat1 + "] in From Latitude field | |
        | Fill in [" + long1 + "] in From Longitude field | |
        | Fill in [" + lat2 + "] in To Latitude field | |
        | Fill in [" + long2 + "] in To Longitude field | |
        | Select [Go!] button | |
        | Wait for the route to be calculated. | Verify that distance is [" + distance + "], there are [" + steps + "] steps. All steps are not empty. |"
        ));
    },

    qml_route_for_two_addresses_data: {
        points:["Brandle st","Eight Mile Plains", "Australia", "Heal st", "New Farm", "Australia", "18.5km", "12"],
    },


    qml_route_for_two_addresses: function(street1, city1, country1, street2, city2, country2, distance, steps) {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Route for two addresses";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that route can be calculated.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-235: QML Routing";

        // 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 [Tools] button | |
        | Select [Route] menu item | |
        | Select second option group to enter start and end points as address | |
        | Select [Clear] button | |
        | Fill in [" + street1 + "] in From Street field | |
        | Fill in [" + city1 + "] in From City field | |
        | Fill in [" + country1 + "] in From Country field | |
        | Fill in [" + city2 + "] in To City field | |
        | Fill in [" + country2 + "] in To Country field | |
        | Fill in [" + street2 + "] in From Street field | |
        | Select [Go!] button | |
        | Wait for the route to be calculated. | Verify that distance is [" + distance + "], there are [" + steps + "] steps. All steps are not empty. |"
        ));
    },

    qml_route_for_three_points_data:{
        points:["-27.575", "153.088", "-27.465", "153.023", "-27.3614", "153.0043", "29.5km", "19"]
    },

    qml_route_for_three_points: function(lat1, long1, lat2, long2, lat3, long3, distance, steps)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Route for several waypoints";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that route can be calculated.";
        testPreconditions = "Internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-235: QML Routing";

        // 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 | |
        | Create third Marker | |
        | Long Press on the third marker | |
        | Select [Move to] menu item | |
        | Fill in [" + lat3 + "] in Latitude field | |
        | Fill in [" + long3 + "] in Longitude | |
        | Press [Go!] button | |
        | Long press on the map | |
        | Select [Route to next points] | |
        | Wait for the route to be calculated. | Verify that distance is [" + distance + "], there are [" + steps + "] steps. All steps are not empty. |"
        ));
    },

    qml_travel_mode_data: {
        car:["-27.5789", "153.0919", "-27.5792", "153.096", "Vehicle", "2.2km", "7"],
        pedestrian:["-27.5789", "153.0919", "-27.5792", "153.096", "Pedestrian", "1.7km", "16"]
    },

    qml_travel_mode: function(lat1, long1, lat2, long2, mode, distance, steps)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Travel mode (Car and Pedestrian)";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that route can be calculated.";
        testPreconditions = "Internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-235: QML Routing";

        // 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 [Tools] button | |
        | Select [Route] menu item | |
        | Selec first option group | |
        | Select [Clear] button | |
        | Fill in [" + lat1 + "] in From Latitude field | |
        | Fill in [" + long1 + "] in From Longitude field | |
        | Fill in [" + lat2 + "] in To Latitude field | |
        | Fill in [" + long2 + "] in To Longitude field | |
        | Select [" + mode + "] option button | |
        | Select [Go!] button | |
        | Wait for the route to be calculated. | Verify that distance is [" + distance + "], there are [" + steps + "] steps. All steps are not empty. |"
        ));
    },

    qml_route_feature_type_data: {
        tolls:["-27.5299", "153.0713", "-27.4395", "153.0504", "Avoid toll roads", "16.8km", "11"],
        highways:["-27.5299", "153.0713", "-27.4395", "153.0504", "Avoid highways", "12.6km", "14"]
    },

    qml_route_feature_type: function(lat1, long1, lat2, long2, feature, distance, steps)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Route features (Avoid Highways and Avoid Tool Road)";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that route can be calculated.";
        testPreconditions = "Internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-235: QML Routing";

        // 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 [Tools] button | |
        | Select [Route] menu item | |
        | Selec first option group | |
        | Select [Clear] button | |
        | Fill in [" + lat1 + "] in From Latitude field | |
        | Fill in [" + long1 + "] in From Longitude field | |
        | Fill in [" + lat2 + "] in To Latitude field | |
        | Fill in [" + long2 + "] in To Longitude field | |
        | Select [" +feature + "] checkbox | |
        | Select [Go!] button | |
        | Wait for the route to be calculated. | Verify that distance is [" + distance + "], there are [" + steps + "] steps. All steps are not empty. |"
        ));
    },

    qml_route_optimization_data: {
        fastest:["-27.5374", "153.084", "-27.4391", "153.0488", "Fastest", "16.4km", "11"],
        shortest:["-27.5374", "153.084", "-27.4391", "153.0488", "Shortest", "14.4km", "15"]
    },

    qml_route_optimization: function(lat1, long1, lat2, long2, optimization, distance, steps)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Route optimization (Shortest and Fastest)";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that route can be calculated.";
        testPreconditions = "Internet connection is required for this test case";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-235: QML Routing";

        // 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 [Tools] button | |
        | Select [Route] menu item | |
        | Selec first option group | |
        | Select [Clear] button | |
        | Fill in [" + lat1 + "] in From Latitude field | |
        | Fill in [" + long1 + "] in From Longitude field | |
        | Fill in [" + lat2 + "] in To Latitude field | |
        | Fill in [" + long2 + "] in To Longitude field | |
        | Select [" + optimization + "] option button | |
        | Select [Go!] button | |
        | Wait for the route to be calculated. | Verify that distance is [" + distance + "], there are [" + steps + "] steps. All steps are not empty. |"
        ));
    },

    qml_routing_and_locale_data: {
        english:["en", "English", "Imperial"],
        french: ["fr", "French", "Metric"]
    },

    qml_routing_and_locale: function(locale, language, system_type)
    {
        // Test meta data
        testTitle = "QML: Routing - Locale handling";
        testBinary = "qml_location_places";
        testSource = "$QTDIR/qtlocation/examples/declarative/places"
        testGoal = "Verify that route information can be present in different languages and measurement systems.";
        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 |
        | Select Language button | |
        | Select [Other] | |
        | Fill in [" +  locale + "] in Language field | |
        | Select [Go!] button | |
        | Select [Tools] button | |
        | Select [Route] menu item | |
        | Select [Go!] | |
        | Expand information about the route | Verify that instructions are in [" + language + "]  and uses [" + system_type + "] system |"
        ));
    }

}  // end of testcase
