/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL21$
** 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 The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/

//TESTED_COMPONENT=src/multimedia

testcase = {

/* Notes
Ensure radio reception is available in testing area
Most tier 1 platforms require a radio module
A device specific headset is required to be connected to device for radio testing
*/

    initTestCase: function()
    {
    },

    play_a_radio_transmission: function()
    {
        // Test meta data
        testTitle = "Multimedia - Play Radio Transmission";
        testBinary = "radio";
        testSource ="qt5/qtmultimedia/examples/radio"
        testGoal = "Verify that radio stations can be played.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Device must have a suppported radio module.";
        testGroups = "BAT, 1.2";

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

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | | If not first time running application on image, verify that you are presented with a list of previously scanned radio stations |
           | Select a radio station from the list | Verify that the station is properly selected |
           | Select the power icon next to the station name | Verify that audio from the radio station is now heard through the headphones |
           | Deselect the power icon next to the station name | Verify that audio from the radio station is no longer heard through the headphones |
           | Exit the radio application | Verify that the radio application closes cleanly |
         "));
    },

    change_a_radio_station: function()
    {
        // Test meta data
        testTitle = "Multimedia - Radio: Change radio station";
        testBinary = "radio";
        testSource ="qt5/qtmultimedia/examples/radio"
        testGoal = "Verify that radio station can be changed from station playlist.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
        testGroups = "BAT, 1.2";

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

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | Select a radio station from the list | Verify that the station is heard through the headphones |
           | If in the visualization view, select the down icon to return to the station selection view | Verify that you are presented with the list of stations |
           | Select a different station | Verify that you are now listening to a different radio station |
           | Deselect the power icon next to the station name | Verify that audio from the radio station is no longer heard through the headphones |
           | Exit the radio application | Verify that the radio application closes cleanly |
         "));
    },

    manually_tune_radio_station: function()
    {
        // Test meta data
        testTitle = "Multimedia - Manually tune radio station";
        testBinary = "radio";
        testSource ="qt5/qtmultimedia/examples/radio"
        testGoal = "Verify that user can manually change radio station.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
        testGroups = "BAT, 1.2";

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


           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | Select a radio station from the list | Verify that the station is heard through the headphones |
           | Select the up icon to be presented to the visualization view | |
           | Select the Plus icon on the menu bar | Verify that you are presented with the frequency dial |
           | Note the current selected frequency | |
           | Select the dot indicator on the frequency dial, and move finger to right | Verify that the frequency on the indicator is now rising and that the audio has gone off the previous station |
           | Keep moving selector until a radio station is heard | Verify that the frequency of the selected station is higher than the originally selected station |
           | | Verify that the station is playing properly |
           | Select to save the selected radio station frequency | Verify that the station is saved in the radio station playlist |
           | Exit the radio application | Verify that the radio application closes cleanly |
         "));
    },

    scan_up_and_down: function()
    {
        // Test meta data
        testTitle = "Multimedia - Scan up and down the frequency";
        testBinary = "radio";
        testSource ="qt5/qtmultimedia/examples/radio"
        testGoal = "Verify that radio can scan up and down the FM frequency.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
        testGroups = "BAT, 1.2";

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

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | Select a radio station from the list | Verify that the station is heard through the headphones |
           | Select the up icon to be presented to the visualization view | |
           | Select the Plus icon on the menu bar | Verify that you are presented with the frequency dial |
           | Note the current selected frequency | |
           | Select the Scan Up Frequency control | Verify that application has located a new station and that the frequency displayed is of the new station |
           | | Verify that the station is playing properly |
           | Select to save the selected radio station frequency | Verify that the station is saved in the radio station playlist |
           | Select the Scan Down Frequency control | Verify that application has located the original station and that the frequency displayed is of the original station |
           | | Verify that the station is playing properly |
           | Select to save the selected radio station frequency | Verify that the station is saved in the radio station playlist |
           | Exit the radio application | Verify that the radio application closes cleanly |
         "));
    },

    scan_for_multiple_radio_stations: function()
       {
        // Test meta data
        testTitle = "Multimedia - Radio: Scan for multiple radio station";
        testBinary = "radio";
        testSource ="qt5/qtmultimedia/examples/radio"
        testGoal = "Verify that radio can scan for multiple stations at once.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
        testGroups = "BAT, 1.2";

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

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | On the menu, select Find new station | In the Radio Dialog Scanning view, observe the number of stations found |
           | Exit the radio application | Verify that the radio application closes cleanly |
         "));
    },

    save_radio_station_list: function()
    {
        // Test meta data
        testTitle = "Multimedia - Radio: Save station playlist";
        testBinary = "radio";
        testSource ="qt5/qtmultimedia/examples/radio"
        testGoal = "Verify that radio can save station playlist.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
        testGroups = "BAT, 1.2";

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

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | Select to scan for multiple stations | Verify that multiple stations have been found |
           | Select to save station playlist | |
           | Close application | Verify that the application closes |
           | Reopen " + testBinary + " | Verify that the app launches normally |
           | Go to station playlist | Verify that the stations from the previous search are listed |
           | Select various stations from playlist | Verify that radio station play properly |
           | Close application | Verify that radio application closes properly |
           "));
    },


 radio_interrupted_by_system_notification: function()
    {
        // Test meta data
        testTitle = "Multimedia - Radio interrupted by System Notification";
        testBinary = "radio";
        testSource ="$QTDIR/qtmultimediakit/examples/Radio"
        testGoal = "Verify that radio can recover audio playback from various system notifications.";
        testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
        testGroups = "BAT, 1.2";

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

           | *Step* | *Verification* |
           | Launch " + testBinary + " | App launches normally |
           | Locate a strong radio station signal by scanning up/down | |
           | While on a strong and audible radio signal, evoke a system notification on device (eg: alarm notification) | Verify that the radio has muted, and after the system notification has been delivered, the radio reverts to outputting the audio signal back through the headphones |
           | While on a strong and audible radio signal, call the device | Verify that the radio has been muted, and stays muted during the duration of the call, and resumes once the call has ended  |
           | Close application | Verify that radio application closes properly |
        "));
    },

    radio_volume_control: function()
    {
     // Test meta data
     testTitle = "Multimedia - Radio Volume Control";
     testBinary = "radio";
     testGoal = "Verify that the radio volume can be controlled via volume controls.";
     testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
     testGroups = "BAT, 1.2";

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

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally |
        | Locate a strong radio station signal by scanning up or down the frequency | |
        | While on a strong and audible radio signal, move volume slider to the right | Verify that the audio volume of the radio station is amplified |
        | Move volume slider to the left | Verify that the audio volume is lowered |
        | Move the volume slider all the way to the left | Verify that the sound is now completely muted |
        | Return the volume to a value above 50% and click the Mute/unmute command | Verify that the audio changes from being muted to unmuted and back |
       "));
    },

 display_radio_metadata: function()
    {
     // Test meta data
     testTitle = "Multimedia - Display Radio Meta data";
     testBinary = "radio";
     testGoal = "Verify that the radio API can display properly formatted meta data.";
     testPreconditions = "1. Radio reception should be available in the test area.<br>2. Wired headphones act as an antenna to the device and must be connected.";
     testGroups = "BAT, 1.2";

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

        | *Step* | *Verification* |
        | Launch " + testBinary + " | App launches normally |
        | Locate a strong radio station signal by scanning up or down the frequency | Verify that the Frequency field is populated with the correct frequency for the given radio station |
        |  | Verify that the Volume field is displaying the proper volume % |
        | Click on the Mute/Unmute command | Verify that Muted field changes from 'false' to 'true' and back  |
        |  | If applicable, confirm that the Station Name field is properly displayed |
        |  | If applicable, confirm that the Station Id field is properly displayed |
        |  | If applicable, confirm that the Program Type field is properly displayed |
        |  | If applicable, confirm that the Radio Text field is properly displayed |
       "));
    },
}
