/****************************************************************************
**
** 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_geocode_data: {
        australian_place:["Brandl st", "Eight Mile Plains", "Australia", "-27.5816", "153.0973"],
        russian_place:["Minina I Pozharskogo Ploshchad", "Nizhny Novgorod", "Russia", "56.329", "44.0085"]
    },

    qml_geocode: function(street, city, country, latitude, longitude)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Geocoding";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that location can be geocoded.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-236: QML Geocoding";

        // 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 [Geocode] menu item | |
        | Select [Clear] button | |
        | Fill in [" + street + "] in Street field | |
        | Fill in [" + city + "] in City field | |
        | Fill in [" + country + "] in Country field | |
        | Select [Go!] button | |
        | Wait for message appears on the screen | Verify that latitude is [" + latitude + "], longitude is [" + longitude + "]. |"
        ));
    },

    qml_geocode_fictional_place_data: {
        fictional_place:["My street", "The Best City", "Australia"]
    },

    qml_geocode_fictional_place: function(street, city, country)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Geocoding";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that location can not be found.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-236: QML Geocoding";

        // 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 [Geocode] menu item | |
        | Select [Clear] button | |
        | Fill in [" + street + "] in Street field | |
        | Fill in [" + city + "] in City field | |
        | Fill in [" + country + "] in Country field | |
        | Select [Go!] button | |
        | Wait for message appears on the screen | Verify that place is not found. |"
        ));
    },

    qml_geocode_not_unique_location_data: {
        request:["Moscow", "Idaho","USA", "3", "46.7323", "-117.0005"]
    },

    qml_geocode_not_unique_location: function(city, state, country, places, latitude, longitude)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Geocoding of non-unique address";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that location can be geocoded.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-236: QML Geocoding";

        // 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 [Geocode] menu item | |
        | Select [Clear] button | |
        | Fill in [" + city + "] in City field | |
        | Fill in [" + country + "] in Country field | |
        | Select [Go!] button | |
        | Wait for message appears on the screen | Verify that [" + places + "] locations were found. |
        | Select [Tools] button | |
        | Select [Geocode] menu item | |
        | Fill in [" + state + "] in State field | |
        | Wait for message appears on the screen | Verify that latitude is [" + latitude + "], longitude is [" + longitude + "]. |"
        ));
    },

    qml_geocode_request_with_post_code_data: {
        request:["Brandl", "4113", "Australia", "-27.5816", "153.0973"]
    },

    qml_geocode_request_with_post_code: function(street, postcode, country, latitude, longitude)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Geocode post code";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that location can be geocoded.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-236: QML Geocoding";

        // 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 [Geocode] menu item | |
        | Select [Clear] button | |
        | Fill in [" + street + "] in Street field | |
        | Fill in [" + postcode + "] in Post Code field | |
        | Fill in [" + country + "] in Country field | |
        | Select [Go!] button | |
        | Wait for message appears on the screen | Verify that latitude is [" + latitude + "], longitude is [" + longitude + "]. |"
        ));
    },

    qml_reverse_geocode_data: {
        australian_place:["-27.575", "153.088", "230 Padstow Rd"],
        russian_place:["56.3264", "44.0048", "Minina i Pozharskogo ploshchad'"]
    },

    qml_reverse_geocode: function(latitude, longitude, street)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Reverse geocode";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that location can be geocoded.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-237:QML Reverse geocoding";

        // 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 [Reverse] Geocode | |
        | Select [Clear] button | |
        | Fill in [" + latitude + "] in Latitude field | |
        | Fill in [" + longitude + "] in Longitude field | |
        | Select [Go!] button | |
        | Wait for message appears on the screen | Verify that street is [" + street + "] |"
        ));
    },

    qml_reverse_geocode_uninhabited_place_data: {
        uninhabited_place:["-27", "155"]
    },

    qml_reverse_geocode_uninhabited_place: function(latitude, longitude)
    {
        // Test meta data
        testTitle = "QML: Maps and Navigation - Reverse geocode";
        testBinary = "qml_location_mapviewer";
        testSource = "$QTDIR/qtlocation/examples/declarative/mapviewer"
        testGoal = "Verify that location can be geocoded.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        testGroups = "BAT, 5.0";
        testRequirements = "MTMW-237:QML Reverse geocoding";

        // 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 [Reverse] Geocode | |
        | Select [Clear] button | |
        | Fill in [" + latitude + "] in Latitude field | |
        | Fill in [" + longitude + "] in Longitude field | |
        | Select [Go!] button | |
        | Wait for message appears on the screen | Verify that location is not found. |"
        ));
    },

    qml_geocoding_and_locale_data: {
        english:["38", "24", "en", "English"],
        greek:["38", "24", "el", "Greek"]
    },

    qml_geocoding_and_locale: function(latitude, longitude, locale, language)
    {
        // Test meta data
        testTitle = "QML: Geocoding - Locale handling";
        testBinary = "qml_location_places";
        testSource = "$QTDIR/qtlocation/examples/declarative/places"
        testGoal = "Verify that geocode information can be present in different languages.";
        testPreconditions = "Internet connection is required for this test case. Pass proxy settings to app if needed.";
        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!] | |
        | Select [Tools] button | |
        | Select [Reverse] geocode | |
        | Fill in [" + latitude + "] in Latitude field | |
        | Fill in [" + longitude + "] in Longitude field | |
        | Select [Go!] | |
        | Wait for success geocode message | Verify that address is in [" + language + "] |"
        ));
    }

}  // end of testcase
