cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.cpp
author hgs
Mon, 24 May 2010 20:51:35 +0300
changeset 32 5c4486441ae6
parent 20 9c97ad6591ae
child 41 bbb64eb3bdee
permissions -rw-r--r--
201021
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
* Control Panel packet data AP plugin unit testing.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <HbApplication>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <HbMainWindow>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <HbView>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#include <HbDialog>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <HbRadioButtonList>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <HbAction>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include <HbDataForm>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include <HbDataFormModel>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <HbDataFormModelItem>
32
hgs
parents: 20
diff changeset
    27
#include <HbDataFormViewItem>
hgs
parents: 20
diff changeset
    28
#include <HbModelIterator>
hgs
parents: 20
diff changeset
    29
#include <HbComboBox>
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
#include <QtTest/QtTest>
32
hgs
parents: 20
diff changeset
    31
#include <etelpckt.h>
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include <cpbearerapplugininterface.h>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include <cmmanager_shim.h>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
#include <cmconnectionmethod_shim.h>
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include "cppacketdataapview.h"
32
hgs
parents: 20
diff changeset
    37
#include "cppacketdataapadvancedview.h"
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include "hbautotest.h"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include "testcppacketdataapplugin.h"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
// STATIC TEST DATA
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
// Connection method (AP) ID used for testing
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
static const uint testApId = 1;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
static const QString pluginDir =
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
    "\\resource\\qt\\plugins\\controlpanel\\bearerap";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
static const QString pluginName = "cppacketdataapplugin.dll";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
// Time to wait before continuing after an UI step
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
static const int waitTime = 10;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
// UI coordinates
32
hgs
parents: 20
diff changeset
    58
static const QPoint scrollMiddle(350, 280);
hgs
parents: 20
diff changeset
    59
static const QPoint scrollTop(350, 30);
hgs
parents: 20
diff changeset
    60
static const QPoint scrollBottom(350, 540);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
32
hgs
parents: 20
diff changeset
    62
// Use positive offset if dropdown opens under the combobox
hgs
parents: 20
diff changeset
    63
static const QPoint comboBoxFirstItemOffset(80, 75);
hgs
parents: 20
diff changeset
    64
static const QPoint comboBoxItemOffset(0, 51);
hgs
parents: 20
diff changeset
    65
// Use negative offset if dropdown opens above the combobox
hgs
parents: 20
diff changeset
    66
static const QPoint comboBoxFirstItemNegativeOffset(80, -29);
hgs
parents: 20
diff changeset
    67
static const QPoint comboBoxItemNegativeOffset(0, -51);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
32
hgs
parents: 20
diff changeset
    69
static const QPoint exitEditorOffset(-10, -20);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
32
hgs
parents: 20
diff changeset
    71
static const QPoint messageBoxOkButtonOffset(160, 140);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
32
hgs
parents: 20
diff changeset
    73
// Advanced settings groups
hgs
parents: 20
diff changeset
    74
static const QPoint ipGroup(160, 10);
hgs
parents: 20
diff changeset
    75
static const QPoint proxyGroup(160, 60);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
32
hgs
parents: 20
diff changeset
    77
// Test strings
hgs
parents: 20
diff changeset
    78
static const QString tooLongUserName =
hgs
parents: 20
diff changeset
    79
    "too long name 123456789012345678901234567890123456THISISEXTRA";
hgs
parents: 20
diff changeset
    80
static const QString truncatedUserName =
hgs
parents: 20
diff changeset
    81
    "too long name 123456789012345678901234567890123456";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
// FRAMEWORK FUNCTIONS
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
 * Test main function. Runs all test cases.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
#ifndef TESTCMAPPLSETTINGSUI_NO_OUTPUT_REDIRECT
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
int main(int argc, char *argv[])
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    HbApplication app(argc, argv);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    app.setApplicationName("TestCpPacketDataApPlugin");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
    char *pass[3];  
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
    pass[0] = argv[0];
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
    pass[1] = "-o"; 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
    pass[2] = "c:\\data\\TestCpPacketDataApPlugin.txt";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    TestCpPacketDataApPlugin tc;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    int res = QTest::qExec(&tc, 3, pass);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    return res;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
#else
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
QTEST_MAIN(TestCpPacketDataApPlugin)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
#endif
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
 * This function is be called before the first test case is executed.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
void TestCpPacketDataApPlugin::initTestCase()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
    mMainWindow = new HbAutoTestMainWindow;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    //mMainWindow = new HbMainWindow;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
    mMainWindow->show();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    // Load plugin
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
    QDir dir(pluginDir);
32
hgs
parents: 20
diff changeset
   121
    mPluginLoader = new QPluginLoader(dir.absoluteFilePath(pluginName));
hgs
parents: 20
diff changeset
   122
    mPlugin = qobject_cast<CpBearerApPluginInterface *>(mPluginLoader->instance());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    QVERIFY(mPlugin != NULL);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
    // Verify plugin bearer type
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
    QVERIFY(mPlugin->bearerType() == CMManagerShim::BearerTypePacketData);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
    
32
hgs
parents: 20
diff changeset
   128
    // Write initial settings to CommsDat
hgs
parents: 20
diff changeset
   129
    subInitializeCommsDat();
hgs
parents: 20
diff changeset
   130
    
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
    // Create packet data settings view (connection method ID given)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
    subCreateSettingsView(testApId);
32
hgs
parents: 20
diff changeset
   133
    
hgs
parents: 20
diff changeset
   134
    subGetUiWidgets();
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
 * This function is be called after the last test case was executed.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
void TestCpPacketDataApPlugin::cleanupTestCase()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    delete mMainWindow;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    mMainWindow = 0;
32
hgs
parents: 20
diff changeset
   144
    
hgs
parents: 20
diff changeset
   145
    // Force unloading of plugin
hgs
parents: 20
diff changeset
   146
    mPluginLoader->unload();
hgs
parents: 20
diff changeset
   147
    delete mPluginLoader;
hgs
parents: 20
diff changeset
   148
    mPluginLoader = 0;
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
 * This function is be called before each test case is executed.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
void TestCpPacketDataApPlugin::init()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    QTest::qWait(1000);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
 * This function is be called after each test case is executed.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
void TestCpPacketDataApPlugin::cleanup()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
// TEST CASES
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
 * Tests changing of connection name.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
void TestCpPacketDataApPlugin::tcChangeConnectionName()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    
32
hgs
parents: 20
diff changeset
   178
    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
    // Erase old string
32
hgs
parents: 20
diff changeset
   181
    QString text = mTestView->mConnectionNameItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   182
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
32
hgs
parents: 20
diff changeset
   187
    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
        CMManagerShim::CmName,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
        mTestView->mConnectionNameItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
        result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
 * Test data for connection name change test case.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
void TestCpPacketDataApPlugin::tcChangeConnectionName_data()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    QTest::newRow("maximum length")
32
hgs
parents: 20
diff changeset
   205
        << "really long name 123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   206
        << "really long name 123456789012345678901234567890123";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    QTest::newRow("too long")
32
hgs
parents: 20
diff changeset
   208
        << "too long name 12345678901234567890123456789012345678901234"
hgs
parents: 20
diff changeset
   209
        << "too long name 123456789012345678901234567890123456";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
    QTest::newRow("basic") // last one must always fit on one line in UI
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
        << "test packet AP"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
        << "test packet AP";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
 * Tests that empty connection name is not accepted.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
void TestCpPacketDataApPlugin::tcConnectionNameEmpty()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
    QString previous = 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
        mTestView->mConnectionNameItem->contentWidgetData("text").toString();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    
32
hgs
parents: 20
diff changeset
   223
    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
    // Erase old string
32
hgs
parents: 20
diff changeset
   226
    QString text = mTestView->mConnectionNameItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   227
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
    
32
hgs
parents: 20
diff changeset
   229
    HbAutoTest::mouseClick(mMainWindow, mConnectionNameWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
    QTest::qWait(100);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
    // Dismiss messagebox
32
hgs
parents: 20
diff changeset
   233
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
   234
        mMainWindow,
hgs
parents: 20
diff changeset
   235
        mTestView->mMessageBox.data(),
hgs
parents: 20
diff changeset
   236
        messageBoxOkButtonOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
        CMManagerShim::CmName,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
        mTestView->mConnectionNameItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
        previous);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
 * Tests changing of access point name.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
void TestCpPacketDataApPlugin::tcChangeAccessPointName()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
    
32
hgs
parents: 20
diff changeset
   253
    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
    // Erase old string
32
hgs
parents: 20
diff changeset
   256
    QString text = mTestView->mAccessPointNameItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   257
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
32
hgs
parents: 20
diff changeset
   262
    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
        CMManagerShim::PacketDataAPName,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
        mTestView->mAccessPointNameItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
        result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
 * Test data for access point name change test case.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
void TestCpPacketDataApPlugin::tcChangeAccessPointName_data()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
    QTest::newRow("maximum length")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
        << "really long name 12345678901234567890123456789012345678901234567890123456789012345678901234567890123"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
        << "really long name 12345678901234567890123456789012345678901234567890123456789012345678901234567890123";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
    QTest::newRow("too long")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
        << "too long name 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
        << "too long name 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
    QTest::newRow("basic") // last one must always fit on one line in UI
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
        << "test AP name"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
        << "test AP name";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
 * Tests that empty access point name is not accepted.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
void TestCpPacketDataApPlugin::tcAccessPointNameEmpty()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
    QString previous = 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
        mTestView->mAccessPointNameItem->contentWidgetData("text").toString();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
    
32
hgs
parents: 20
diff changeset
   298
    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
    // Erase old string
32
hgs
parents: 20
diff changeset
   301
    QString text = mTestView->mAccessPointNameItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   302
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
    
32
hgs
parents: 20
diff changeset
   304
    HbAutoTest::mouseClick(mMainWindow, mAccessPointNameWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
    QTest::qWait(100);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
    // Dismiss messagebox
32
hgs
parents: 20
diff changeset
   308
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
   309
        mMainWindow,
hgs
parents: 20
diff changeset
   310
        mTestView->mMessageBox.data(),
hgs
parents: 20
diff changeset
   311
        messageBoxOkButtonOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
        CMManagerShim::PacketDataAPName,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
        mTestView->mAccessPointNameItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
        previous);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
32
hgs
parents: 20
diff changeset
   320
hgs
parents: 20
diff changeset
   321
/**
hgs
parents: 20
diff changeset
   322
 * Tests handling of too long string from CommsDat (longer than UI accepts).
hgs
parents: 20
diff changeset
   323
 */
hgs
parents: 20
diff changeset
   324
void TestCpPacketDataApPlugin::tcTooLongUserNameInCommsDat()
hgs
parents: 20
diff changeset
   325
{
hgs
parents: 20
diff changeset
   326
    // Verify UI text, the widget contains the too long string, even though
hgs
parents: 20
diff changeset
   327
    // it is not shown completely on UI
hgs
parents: 20
diff changeset
   328
    QString text = mTestView->mUserNameItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   329
    QCOMPARE(tooLongUserName, text);
hgs
parents: 20
diff changeset
   330
hgs
parents: 20
diff changeset
   331
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
   332
    
hgs
parents: 20
diff changeset
   333
    // Visit editing state, truncated string should be saved to CommsDat
hgs
parents: 20
diff changeset
   334
    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget);
hgs
parents: 20
diff changeset
   335
    
hgs
parents: 20
diff changeset
   336
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
   337
    
hgs
parents: 20
diff changeset
   338
    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   339
hgs
parents: 20
diff changeset
   340
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   341
    subVerifyString(
hgs
parents: 20
diff changeset
   342
        CMManagerShim::PacketDataIFAuthName,
hgs
parents: 20
diff changeset
   343
        mTestView->mUserNameItem,
hgs
parents: 20
diff changeset
   344
        truncatedUserName);
hgs
parents: 20
diff changeset
   345
}
hgs
parents: 20
diff changeset
   346
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   347
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   348
 * Tests changing of user name.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   349
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   350
void TestCpPacketDataApPlugin::tcChangeUserName()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   351
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   352
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   353
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   354
    
32
hgs
parents: 20
diff changeset
   355
    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   356
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   357
    // Erase old string
32
hgs
parents: 20
diff changeset
   358
    QString text = mTestView->mUserNameItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   359
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   360
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   361
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   362
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   363
32
hgs
parents: 20
diff changeset
   364
    HbAutoTest::mouseClick(mMainWindow, mUserNameWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   365
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   366
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   367
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   368
        CMManagerShim::PacketDataIFAuthName,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   369
        mTestView->mUserNameItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   370
        result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   371
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   372
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   373
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   374
 * Test data for user name change test case.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   375
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   376
void TestCpPacketDataApPlugin::tcChangeUserName_data()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   377
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   378
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   379
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   380
32
hgs
parents: 20
diff changeset
   381
    QTest::newRow("maximum length")
hgs
parents: 20
diff changeset
   382
        << "really long name 123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   383
        << "really long name 123456789012345678901234567890123";
hgs
parents: 20
diff changeset
   384
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   385
        << "too long name 1234567890123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   386
        << "too long name 123456789012345678901234567890123456";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
    QTest::newRow("basic")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
        << "username"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
        << "username";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
    QTest::newRow("empty") // last one must always fit on one line in UI
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   391
        << ""
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   392
        << "";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   393
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   394
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   395
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   396
 * Scrolls the tested view to the bottom.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   397
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   398
void TestCpPacketDataApPlugin::tcScrollToBottom()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   399
{
32
hgs
parents: 20
diff changeset
   400
    subScrollToBottom();
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   401
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   402
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   403
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   404
 * Tests "prompt" password checkbox.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   405
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   406
void TestCpPacketDataApPlugin::tcChangePromptPassword()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   407
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   408
    // Ensure prompt for password is unchecked
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
    bool prompt = subGetBool(CMManagerShim::PacketDataIFPromptForAuth);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
    if (prompt) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   411
        // Disable prompt for password
32
hgs
parents: 20
diff changeset
   412
        HbAutoTest::mouseClick(mMainWindow, mPasswordPromptWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
    }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   414
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   415
    // Enable prompt for password and verify
32
hgs
parents: 20
diff changeset
   416
    HbAutoTest::mouseClick(mMainWindow, mPasswordPromptWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
    subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
        CMManagerShim::PacketDataIFPromptForAuth,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
        true);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   420
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
    // Verify that password lineedit is disabled, following steps will
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
    // fail if editing is allowed
32
hgs
parents: 20
diff changeset
   423
    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
    QTest::qWait(waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
    // Disable prompt for password and verify
32
hgs
parents: 20
diff changeset
   427
    HbAutoTest::mouseClick(mMainWindow, mPasswordPromptWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
    subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
        CMManagerShim::PacketDataIFPromptForAuth,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
        false);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   431
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   432
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   433
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   434
 * Tests changing of password.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
void TestCpPacketDataApPlugin::tcChangePassword()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   437
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   438
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   439
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
    
32
hgs
parents: 20
diff changeset
   441
    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   442
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
    // Erase old string
32
hgs
parents: 20
diff changeset
   444
    QString text = mTestView->mPasswordItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   445
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   447
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
32
hgs
parents: 20
diff changeset
   450
    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   451
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
        CMManagerShim::PacketDataIFAuthPass,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
        mTestView->mPasswordItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
        result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   458
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
 * Test data for password change test case.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   462
void TestCpPacketDataApPlugin::tcChangePassword_data()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   463
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   464
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
32
hgs
parents: 20
diff changeset
   467
    QTest::newRow("maximum length")
hgs
parents: 20
diff changeset
   468
        << "really long name 123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   469
        << "really long name 123456789012345678901234567890123";
hgs
parents: 20
diff changeset
   470
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   471
        << "too long name 1234567890123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   472
        << "too long name 123456789012345678901234567890123456";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
    QTest::newRow("basic")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
        << "password"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
        << "password";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
    QTest::newRow("empty") // last one must always fit on one line in UI
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
        << ""
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
        << "";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   479
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   480
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   481
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
 * Tests changing of authentication mode.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
void TestCpPacketDataApPlugin::tcChangeAuthenticationMode()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
{
32
hgs
parents: 20
diff changeset
   486
    QPointF normalPointOffset = comboBoxFirstItemOffset;
hgs
parents: 20
diff changeset
   487
    QPointF securePointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
hgs
parents: 20
diff changeset
   488
    
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
    // Set authentication mode to secure
32
hgs
parents: 20
diff changeset
   490
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
    QTest::qWait(100);
32
hgs
parents: 20
diff changeset
   492
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget, securePointOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
    subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
        CMManagerShim::PacketDataDisablePlainTextAuth,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
        true);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
    // Set authentication mode to normal
32
hgs
parents: 20
diff changeset
   499
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
    QTest::qWait(100);
32
hgs
parents: 20
diff changeset
   501
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget, normalPointOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
    subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
        CMManagerShim::PacketDataDisablePlainTextAuth,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
        false);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
 * Tests changing of homepage.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
void TestCpPacketDataApPlugin::tcChangeHomepage()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   513
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   514
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   515
    
32
hgs
parents: 20
diff changeset
   516
    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
    // Erase old string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
    QString text = mTestView->mHomepageItem->contentWidgetData("text").toString();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
    subClearLineEdit(text.size());
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   522
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   524
32
hgs
parents: 20
diff changeset
   525
    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   526
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
        CMManagerShim::CmStartPage,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
        mTestView->mHomepageItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
        result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
 * Test data for homepage change test case.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   537
void TestCpPacketDataApPlugin::tcChangeHomepage_data()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   538
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   539
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   540
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   541
  
32
hgs
parents: 20
diff changeset
   542
    QTest::newRow("long")
hgs
parents: 20
diff changeset
   543
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
hgs
parents: 20
diff changeset
   544
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   545
    QTest::newRow("basic") // last one should always fit on one line in UI
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   546
        << "http://www.symbian.org/"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   547
        << "http://www.symbian.org/";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   548
    QTest::newRow("empty")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   549
        << ""
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   550
        << "";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   551
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   552
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   553
/**
32
hgs
parents: 20
diff changeset
   554
 * Opens advanced settings view.
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   555
 */
32
hgs
parents: 20
diff changeset
   556
void TestCpPacketDataApPlugin::tcOpenAdvancedSettingsView()
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   557
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   558
    // Launch advanced settings view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   559
    bool status = connect(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   560
        this,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
        SIGNAL(menuActionTriggered(HbAction *)),
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
        mTestView,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   563
        SLOT(menuActionTriggered(HbAction *)));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   564
    Q_ASSERT(status);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
    emit menuActionTriggered(mTestView->mAdvancedSettingsAction);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
32
hgs
parents: 20
diff changeset
   567
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
   568
    
hgs
parents: 20
diff changeset
   569
    mTestViewAdvanced = static_cast<CpPacketDataApAdvancedView *>(mMainWindow->currentView());
hgs
parents: 20
diff changeset
   570
}
hgs
parents: 20
diff changeset
   571
hgs
parents: 20
diff changeset
   572
/**
hgs
parents: 20
diff changeset
   573
 * Expands the IP settings group.
hgs
parents: 20
diff changeset
   574
 */
hgs
parents: 20
diff changeset
   575
void TestCpPacketDataApPlugin::tcExpandIpSettings()
hgs
parents: 20
diff changeset
   576
{
hgs
parents: 20
diff changeset
   577
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipGroup);
hgs
parents: 20
diff changeset
   578
    
hgs
parents: 20
diff changeset
   579
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   580
}
hgs
parents: 20
diff changeset
   581
hgs
parents: 20
diff changeset
   582
/**
hgs
parents: 20
diff changeset
   583
 * Sets the network type to IPv4 and gets UI widget pointers.
hgs
parents: 20
diff changeset
   584
 */
hgs
parents: 20
diff changeset
   585
void TestCpPacketDataApPlugin::tcSetIpv4NetworkType()
hgs
parents: 20
diff changeset
   586
{
hgs
parents: 20
diff changeset
   587
    QPointF ipv4PointOffset = comboBoxFirstItemOffset;
hgs
parents: 20
diff changeset
   588
    
hgs
parents: 20
diff changeset
   589
    // Set network type to IPv4
hgs
parents: 20
diff changeset
   590
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget);
hgs
parents: 20
diff changeset
   591
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget, ipv4PointOffset, 100);
hgs
parents: 20
diff changeset
   592
    subVerifyUint(CMManagerShim::PacketDataPDPType, RPacketContext::EPdpTypeIPv4);
hgs
parents: 20
diff changeset
   593
    
hgs
parents: 20
diff changeset
   594
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   595
}
hgs
parents: 20
diff changeset
   596
hgs
parents: 20
diff changeset
   597
/**
hgs
parents: 20
diff changeset
   598
 * Tests enabling of automatic phone IP address.
hgs
parents: 20
diff changeset
   599
 */
hgs
parents: 20
diff changeset
   600
void TestCpPacketDataApPlugin::tcEnableAutomaticIpv4Address()
hgs
parents: 20
diff changeset
   601
{
hgs
parents: 20
diff changeset
   602
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   603
        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   604
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   605
        // Disable automatic IP address
hgs
parents: 20
diff changeset
   606
        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
hgs
parents: 20
diff changeset
   607
    }
hgs
parents: 20
diff changeset
   608
    // Enable automatic IP address
hgs
parents: 20
diff changeset
   609
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
hgs
parents: 20
diff changeset
   610
    subVerifyBool(
hgs
parents: 20
diff changeset
   611
        CMManagerShim::PacketDataIPAddrFromServer,
hgs
parents: 20
diff changeset
   612
        true);
hgs
parents: 20
diff changeset
   613
    
hgs
parents: 20
diff changeset
   614
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   615
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
hgs
parents: 20
diff changeset
   616
}
hgs
parents: 20
diff changeset
   617
hgs
parents: 20
diff changeset
   618
/**
hgs
parents: 20
diff changeset
   619
 * Tests disabling of automatic phone IP address.
hgs
parents: 20
diff changeset
   620
 */
hgs
parents: 20
diff changeset
   621
void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv4Address()
hgs
parents: 20
diff changeset
   622
{
hgs
parents: 20
diff changeset
   623
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   624
        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   625
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   626
        // Disable automatic IP address
hgs
parents: 20
diff changeset
   627
        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
hgs
parents: 20
diff changeset
   628
    }
hgs
parents: 20
diff changeset
   629
    // Can't verify the setting from CommsDat here, because CMManager will
hgs
parents: 20
diff changeset
   630
    // set it back to true if no valid IP address is yet defined. The flag
hgs
parents: 20
diff changeset
   631
    // is verified in tcChangeIpAddress().
hgs
parents: 20
diff changeset
   632
}
hgs
parents: 20
diff changeset
   633
hgs
parents: 20
diff changeset
   634
/**
hgs
parents: 20
diff changeset
   635
 * Tests changing of IP address.
hgs
parents: 20
diff changeset
   636
 */
hgs
parents: 20
diff changeset
   637
void TestCpPacketDataApPlugin::tcChangeIpAddress()
hgs
parents: 20
diff changeset
   638
{
hgs
parents: 20
diff changeset
   639
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
   640
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
   641
    
hgs
parents: 20
diff changeset
   642
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
hgs
parents: 20
diff changeset
   643
    
hgs
parents: 20
diff changeset
   644
    // Erase old string
hgs
parents: 20
diff changeset
   645
    QString text = mTestViewAdvanced->mIpv4Address->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   646
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   647
    
hgs
parents: 20
diff changeset
   648
    // Enter new string
hgs
parents: 20
diff changeset
   649
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   650
hgs
parents: 20
diff changeset
   651
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   652
hgs
parents: 20
diff changeset
   653
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   654
    subVerifyString(
hgs
parents: 20
diff changeset
   655
        CMManagerShim::PacketDataIPAddr,
hgs
parents: 20
diff changeset
   656
        mTestViewAdvanced->mIpv4Address,
hgs
parents: 20
diff changeset
   657
        result);
hgs
parents: 20
diff changeset
   658
    subVerifyBool(
hgs
parents: 20
diff changeset
   659
        CMManagerShim::PacketDataIPAddrFromServer,
hgs
parents: 20
diff changeset
   660
        false);
hgs
parents: 20
diff changeset
   661
}
hgs
parents: 20
diff changeset
   662
hgs
parents: 20
diff changeset
   663
/**
hgs
parents: 20
diff changeset
   664
 * Test data for IP address change test case.
hgs
parents: 20
diff changeset
   665
 */
hgs
parents: 20
diff changeset
   666
void TestCpPacketDataApPlugin::tcChangeIpAddress_data()
hgs
parents: 20
diff changeset
   667
{
hgs
parents: 20
diff changeset
   668
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
   669
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
   670
  
hgs
parents: 20
diff changeset
   671
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   672
        << "255.255.255.2551234"
hgs
parents: 20
diff changeset
   673
        << "255.255.255.255";
hgs
parents: 20
diff changeset
   674
    QTest::newRow("normal")
hgs
parents: 20
diff changeset
   675
        << "192.168.0.1"
hgs
parents: 20
diff changeset
   676
        << "192.168.0.1";
hgs
parents: 20
diff changeset
   677
}
hgs
parents: 20
diff changeset
   678
hgs
parents: 20
diff changeset
   679
/**
hgs
parents: 20
diff changeset
   680
 * Scrolls the tested view to the bottom.
hgs
parents: 20
diff changeset
   681
 */
hgs
parents: 20
diff changeset
   682
void TestCpPacketDataApPlugin::tcScrollToBottom2()
hgs
parents: 20
diff changeset
   683
{
hgs
parents: 20
diff changeset
   684
    subScrollToBottom();
hgs
parents: 20
diff changeset
   685
    
hgs
parents: 20
diff changeset
   686
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   687
}
hgs
parents: 20
diff changeset
   688
hgs
parents: 20
diff changeset
   689
/**
hgs
parents: 20
diff changeset
   690
 * Tests enabling of automatic IPv4 DNS addresses.
hgs
parents: 20
diff changeset
   691
 */
hgs
parents: 20
diff changeset
   692
void TestCpPacketDataApPlugin::tcEnableAutomaticIpv4DnsAddress()
hgs
parents: 20
diff changeset
   693
{
hgs
parents: 20
diff changeset
   694
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   695
        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   696
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   697
        // Disable automatic IPv4 DNS address
hgs
parents: 20
diff changeset
   698
        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   699
    }
hgs
parents: 20
diff changeset
   700
    // Enable automatic IPv4 DNS address
hgs
parents: 20
diff changeset
   701
    HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   702
    subVerifyBool(
hgs
parents: 20
diff changeset
   703
        CMManagerShim::PacketDataIPDNSAddrFromServer,
hgs
parents: 20
diff changeset
   704
        true);
hgs
parents: 20
diff changeset
   705
    
hgs
parents: 20
diff changeset
   706
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   707
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   708
    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   709
}
hgs
parents: 20
diff changeset
   710
hgs
parents: 20
diff changeset
   711
/**
hgs
parents: 20
diff changeset
   712
 * Tests disabling of automatic IPv4 DNS addresses.
hgs
parents: 20
diff changeset
   713
 */
hgs
parents: 20
diff changeset
   714
void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv4DnsAddress()
hgs
parents: 20
diff changeset
   715
{
hgs
parents: 20
diff changeset
   716
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   717
        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   718
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   719
        // Disable automatic IPv4 DNS address
hgs
parents: 20
diff changeset
   720
        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   721
    }
hgs
parents: 20
diff changeset
   722
    // Can't verify the setting from CommsDat here, because CMManager will
hgs
parents: 20
diff changeset
   723
    // set it back to true if no valid IP address is yet defined. The flag
hgs
parents: 20
diff changeset
   724
    // is verified in tcChangeIpv4DnsAddress().
hgs
parents: 20
diff changeset
   725
}
hgs
parents: 20
diff changeset
   726
hgs
parents: 20
diff changeset
   727
/**
hgs
parents: 20
diff changeset
   728
 * Tests changing of IPv4 DNS addresses.
hgs
parents: 20
diff changeset
   729
 */
hgs
parents: 20
diff changeset
   730
void TestCpPacketDataApPlugin::tcChangeIpv4DnsAddress()
hgs
parents: 20
diff changeset
   731
{
hgs
parents: 20
diff changeset
   732
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
   733
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
   734
    
hgs
parents: 20
diff changeset
   735
    // Primary DNS address
hgs
parents: 20
diff changeset
   736
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   737
    
hgs
parents: 20
diff changeset
   738
    // Erase old string
hgs
parents: 20
diff changeset
   739
    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   740
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   741
    
hgs
parents: 20
diff changeset
   742
    // Enter new string
hgs
parents: 20
diff changeset
   743
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   744
hgs
parents: 20
diff changeset
   745
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   746
hgs
parents: 20
diff changeset
   747
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   748
    subVerifyString(
hgs
parents: 20
diff changeset
   749
        CMManagerShim::PacketDataIPNameServer1,
hgs
parents: 20
diff changeset
   750
        mTestViewAdvanced->mIpv4DnsAddress1,
hgs
parents: 20
diff changeset
   751
        result);
hgs
parents: 20
diff changeset
   752
    
hgs
parents: 20
diff changeset
   753
    // Secondary DNS address
hgs
parents: 20
diff changeset
   754
    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   755
    
hgs
parents: 20
diff changeset
   756
    // Erase old string
hgs
parents: 20
diff changeset
   757
    text = mTestViewAdvanced->mIpv4DnsAddress2->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   758
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   759
    
hgs
parents: 20
diff changeset
   760
    // Enter new string
hgs
parents: 20
diff changeset
   761
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   762
hgs
parents: 20
diff changeset
   763
    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   764
hgs
parents: 20
diff changeset
   765
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   766
    subVerifyString(
hgs
parents: 20
diff changeset
   767
        CMManagerShim::PacketDataIPNameServer2,
hgs
parents: 20
diff changeset
   768
        mTestViewAdvanced->mIpv4DnsAddress2,
hgs
parents: 20
diff changeset
   769
        result);
hgs
parents: 20
diff changeset
   770
    
hgs
parents: 20
diff changeset
   771
    // Verify user defined address is in use
hgs
parents: 20
diff changeset
   772
    subVerifyBool(
hgs
parents: 20
diff changeset
   773
        CMManagerShim::PacketDataIPDNSAddrFromServer,
hgs
parents: 20
diff changeset
   774
        false);
hgs
parents: 20
diff changeset
   775
}
hgs
parents: 20
diff changeset
   776
hgs
parents: 20
diff changeset
   777
/**
hgs
parents: 20
diff changeset
   778
 * Test data for IPv4 DNS address change test case.
hgs
parents: 20
diff changeset
   779
 */
hgs
parents: 20
diff changeset
   780
void TestCpPacketDataApPlugin::tcChangeIpv4DnsAddress_data()
hgs
parents: 20
diff changeset
   781
{
hgs
parents: 20
diff changeset
   782
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
   783
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
   784
  
hgs
parents: 20
diff changeset
   785
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   786
        << "255.255.255.2551234"
hgs
parents: 20
diff changeset
   787
        << "255.255.255.255";
hgs
parents: 20
diff changeset
   788
    QTest::newRow("normal")
hgs
parents: 20
diff changeset
   789
        << "192.168.0.1"
hgs
parents: 20
diff changeset
   790
        << "192.168.0.1";
hgs
parents: 20
diff changeset
   791
}
hgs
parents: 20
diff changeset
   792
hgs
parents: 20
diff changeset
   793
/**
hgs
parents: 20
diff changeset
   794
 * Tests invalid IPv4 DNS address.
hgs
parents: 20
diff changeset
   795
 */
hgs
parents: 20
diff changeset
   796
void TestCpPacketDataApPlugin::tcInvalidIpv4DnsAddress()
hgs
parents: 20
diff changeset
   797
{
hgs
parents: 20
diff changeset
   798
    QString previous = 
hgs
parents: 20
diff changeset
   799
        mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   800
    
hgs
parents: 20
diff changeset
   801
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   802
    
hgs
parents: 20
diff changeset
   803
    // Erase old string
hgs
parents: 20
diff changeset
   804
    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   805
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   806
    
hgs
parents: 20
diff changeset
   807
    // Enter new string
hgs
parents: 20
diff changeset
   808
    HbAutoTest::keyClicks(mMainWindow, "999.999.999.999", 0, waitTime);
hgs
parents: 20
diff changeset
   809
hgs
parents: 20
diff changeset
   810
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   811
hgs
parents: 20
diff changeset
   812
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   813
    // Dismiss messagebox
hgs
parents: 20
diff changeset
   814
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
   815
        mMainWindow,
hgs
parents: 20
diff changeset
   816
        mTestViewAdvanced->mMessageBox.data(),
hgs
parents: 20
diff changeset
   817
        messageBoxOkButtonOffset);
hgs
parents: 20
diff changeset
   818
    
hgs
parents: 20
diff changeset
   819
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   820
    subVerifyString(
hgs
parents: 20
diff changeset
   821
        CMManagerShim::PacketDataIPNameServer1,
hgs
parents: 20
diff changeset
   822
        mTestViewAdvanced->mIpv4DnsAddress1,
hgs
parents: 20
diff changeset
   823
        previous);
hgs
parents: 20
diff changeset
   824
}
hgs
parents: 20
diff changeset
   825
hgs
parents: 20
diff changeset
   826
/**
hgs
parents: 20
diff changeset
   827
 * Scrolls the tested view to the top.
hgs
parents: 20
diff changeset
   828
 */
hgs
parents: 20
diff changeset
   829
void TestCpPacketDataApPlugin::tcScrollToTop()
hgs
parents: 20
diff changeset
   830
{
hgs
parents: 20
diff changeset
   831
    subScrollToTop();
hgs
parents: 20
diff changeset
   832
}
hgs
parents: 20
diff changeset
   833
hgs
parents: 20
diff changeset
   834
/**
hgs
parents: 20
diff changeset
   835
 * Sets the network type to IPv6 and gets UI widget pointers.
hgs
parents: 20
diff changeset
   836
 */
hgs
parents: 20
diff changeset
   837
void TestCpPacketDataApPlugin::tcSetIpv6NetworkType()
hgs
parents: 20
diff changeset
   838
{
hgs
parents: 20
diff changeset
   839
    QPointF ipv6PointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
hgs
parents: 20
diff changeset
   840
    
hgs
parents: 20
diff changeset
   841
    // Set network type to IPv6
hgs
parents: 20
diff changeset
   842
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget);
hgs
parents: 20
diff changeset
   843
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget, ipv6PointOffset, 100);
hgs
parents: 20
diff changeset
   844
    subVerifyUint(CMManagerShim::PacketDataPDPType, RPacketContext::EPdpTypeIPv6);
hgs
parents: 20
diff changeset
   845
hgs
parents: 20
diff changeset
   846
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   847
}
hgs
parents: 20
diff changeset
   848
hgs
parents: 20
diff changeset
   849
/**
hgs
parents: 20
diff changeset
   850
 * Tests enabling of automatic IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   851
 */
hgs
parents: 20
diff changeset
   852
void TestCpPacketDataApPlugin::tcEnableAutomaticIpv6DnsAddress()
hgs
parents: 20
diff changeset
   853
{
hgs
parents: 20
diff changeset
   854
    // Enable automatic IPv6 DNS address
hgs
parents: 20
diff changeset
   855
    QPointF automaticPointOffset = comboBoxFirstItemOffset;
hgs
parents: 20
diff changeset
   856
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   857
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   858
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, automaticPointOffset, 100);
hgs
parents: 20
diff changeset
   859
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   860
    subVerifyBool(
hgs
parents: 20
diff changeset
   861
        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
hgs
parents: 20
diff changeset
   862
        true);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   863
    
32
hgs
parents: 20
diff changeset
   864
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   865
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   866
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   867
}
hgs
parents: 20
diff changeset
   868
hgs
parents: 20
diff changeset
   869
/**
hgs
parents: 20
diff changeset
   870
 * Tests enabling of well-known IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   871
 */
hgs
parents: 20
diff changeset
   872
void TestCpPacketDataApPlugin::tcEnableWellKnownIpv6DnsAddress()
hgs
parents: 20
diff changeset
   873
{
hgs
parents: 20
diff changeset
   874
    // Enable well-known IPv6 DNS address
hgs
parents: 20
diff changeset
   875
    QPointF wellKnownPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
hgs
parents: 20
diff changeset
   876
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   877
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   878
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, wellKnownPointOffset, 100);
hgs
parents: 20
diff changeset
   879
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   880
    subVerifyBool(
hgs
parents: 20
diff changeset
   881
        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
hgs
parents: 20
diff changeset
   882
        false);
hgs
parents: 20
diff changeset
   883
    subVerifyString(
hgs
parents: 20
diff changeset
   884
        CMManagerShim::PacketDataIPIP6NameServer1,
hgs
parents: 20
diff changeset
   885
        mTestViewAdvanced->mIpv6DnsAddress1,
hgs
parents: 20
diff changeset
   886
        "fec0:000:0000:ffff::1");
hgs
parents: 20
diff changeset
   887
    subVerifyString(
hgs
parents: 20
diff changeset
   888
        CMManagerShim::PacketDataIPIP6NameServer2,
hgs
parents: 20
diff changeset
   889
        mTestViewAdvanced->mIpv6DnsAddress2,
hgs
parents: 20
diff changeset
   890
        "fec0:000:0000:ffff::2");
hgs
parents: 20
diff changeset
   891
    
hgs
parents: 20
diff changeset
   892
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   893
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   894
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   895
}
hgs
parents: 20
diff changeset
   896
hgs
parents: 20
diff changeset
   897
/**
hgs
parents: 20
diff changeset
   898
 * Tests enabling of user defined IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   899
 */
hgs
parents: 20
diff changeset
   900
void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv6DnsAddress()
hgs
parents: 20
diff changeset
   901
{
hgs
parents: 20
diff changeset
   902
    // Select user defined IPv6 DNS address
hgs
parents: 20
diff changeset
   903
    QPointF userDefinedPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset * 2;
hgs
parents: 20
diff changeset
   904
    //QPointF userDefinedPointOffset(0, 160);
hgs
parents: 20
diff changeset
   905
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   906
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   907
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, userDefinedPointOffset, 100);
hgs
parents: 20
diff changeset
   908
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   909
    // Can't verify the setting from CommsDat here, because CMManager will
hgs
parents: 20
diff changeset
   910
    // set it back to true if no valid IP address is yet defined. The flag
hgs
parents: 20
diff changeset
   911
    // is verified in tcChangeIpv4DnsAddress().
hgs
parents: 20
diff changeset
   912
}
hgs
parents: 20
diff changeset
   913
hgs
parents: 20
diff changeset
   914
/**
hgs
parents: 20
diff changeset
   915
 * Tests changing of IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   916
 */
hgs
parents: 20
diff changeset
   917
void TestCpPacketDataApPlugin::tcChangeIpv6DnsAddress()
hgs
parents: 20
diff changeset
   918
{
hgs
parents: 20
diff changeset
   919
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
   920
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
   921
    
hgs
parents: 20
diff changeset
   922
    // Primary DNS address
hgs
parents: 20
diff changeset
   923
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   924
    
hgs
parents: 20
diff changeset
   925
    // Erase old string
hgs
parents: 20
diff changeset
   926
    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   927
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   928
    
hgs
parents: 20
diff changeset
   929
    // Enter new string
hgs
parents: 20
diff changeset
   930
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   931
hgs
parents: 20
diff changeset
   932
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   933
hgs
parents: 20
diff changeset
   934
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   935
    subVerifyString(
hgs
parents: 20
diff changeset
   936
        CMManagerShim::PacketDataIPIP6NameServer1,
hgs
parents: 20
diff changeset
   937
        mTestViewAdvanced->mIpv6DnsAddress1,
hgs
parents: 20
diff changeset
   938
        result);
hgs
parents: 20
diff changeset
   939
    
hgs
parents: 20
diff changeset
   940
    // Secondary DNS address
hgs
parents: 20
diff changeset
   941
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   942
    
hgs
parents: 20
diff changeset
   943
    // Erase old string
hgs
parents: 20
diff changeset
   944
    text = mTestViewAdvanced->mIpv6DnsAddress2->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   945
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   946
    
hgs
parents: 20
diff changeset
   947
    // Enter new string
hgs
parents: 20
diff changeset
   948
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   949
hgs
parents: 20
diff changeset
   950
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   951
hgs
parents: 20
diff changeset
   952
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   953
    subVerifyString(
hgs
parents: 20
diff changeset
   954
        CMManagerShim::PacketDataIPIP6NameServer2,
hgs
parents: 20
diff changeset
   955
        mTestViewAdvanced->mIpv6DnsAddress2,
hgs
parents: 20
diff changeset
   956
        result);
hgs
parents: 20
diff changeset
   957
    
hgs
parents: 20
diff changeset
   958
    // Verify user defined address is in use
hgs
parents: 20
diff changeset
   959
    subVerifyBool(
hgs
parents: 20
diff changeset
   960
        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
hgs
parents: 20
diff changeset
   961
        false);
hgs
parents: 20
diff changeset
   962
}
hgs
parents: 20
diff changeset
   963
hgs
parents: 20
diff changeset
   964
/**
hgs
parents: 20
diff changeset
   965
 * Test data for IPv6 DNS address change test case.
hgs
parents: 20
diff changeset
   966
 */
hgs
parents: 20
diff changeset
   967
void TestCpPacketDataApPlugin::tcChangeIpv6DnsAddress_data()
hgs
parents: 20
diff changeset
   968
{
hgs
parents: 20
diff changeset
   969
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
   970
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
   971
  
hgs
parents: 20
diff changeset
   972
    QTest::newRow("normal")
hgs
parents: 20
diff changeset
   973
        << "2001:db8:85a3::8a2e:370:7334"
hgs
parents: 20
diff changeset
   974
        << "2001:db8:85a3:0:0:8a2e:370:7334";
hgs
parents: 20
diff changeset
   975
}
hgs
parents: 20
diff changeset
   976
hgs
parents: 20
diff changeset
   977
/**
hgs
parents: 20
diff changeset
   978
 * Tests invalid IPv6 DNS address.
hgs
parents: 20
diff changeset
   979
 */
hgs
parents: 20
diff changeset
   980
void TestCpPacketDataApPlugin::tcInvalidIpv6DnsAddress()
hgs
parents: 20
diff changeset
   981
{
hgs
parents: 20
diff changeset
   982
    QString previous = 
hgs
parents: 20
diff changeset
   983
        mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   984
    
hgs
parents: 20
diff changeset
   985
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   986
    
hgs
parents: 20
diff changeset
   987
    // Erase old string
hgs
parents: 20
diff changeset
   988
    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   989
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   990
    
hgs
parents: 20
diff changeset
   991
    // Enter new string
hgs
parents: 20
diff changeset
   992
    HbAutoTest::keyClicks(mMainWindow, "abcdef:fedcba", 0, waitTime);
hgs
parents: 20
diff changeset
   993
hgs
parents: 20
diff changeset
   994
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   995
hgs
parents: 20
diff changeset
   996
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   997
    // Dismiss messagebox
hgs
parents: 20
diff changeset
   998
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
   999
        mMainWindow,
hgs
parents: 20
diff changeset
  1000
        mTestViewAdvanced->mMessageBox.data(),
hgs
parents: 20
diff changeset
  1001
        messageBoxOkButtonOffset);
hgs
parents: 20
diff changeset
  1002
    
hgs
parents: 20
diff changeset
  1003
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1004
    subVerifyString(
hgs
parents: 20
diff changeset
  1005
        CMManagerShim::PacketDataIPIP6NameServer1,
hgs
parents: 20
diff changeset
  1006
        mTestViewAdvanced->mIpv6DnsAddress1,
hgs
parents: 20
diff changeset
  1007
        previous);
hgs
parents: 20
diff changeset
  1008
}
hgs
parents: 20
diff changeset
  1009
hgs
parents: 20
diff changeset
  1010
/**
hgs
parents: 20
diff changeset
  1011
 * Collapses the IP settings group.
hgs
parents: 20
diff changeset
  1012
 */
hgs
parents: 20
diff changeset
  1013
void TestCpPacketDataApPlugin::tcCollapseIpSettings()
hgs
parents: 20
diff changeset
  1014
{
hgs
parents: 20
diff changeset
  1015
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipGroup);
hgs
parents: 20
diff changeset
  1016
}
hgs
parents: 20
diff changeset
  1017
hgs
parents: 20
diff changeset
  1018
/**
hgs
parents: 20
diff changeset
  1019
 * Expands the proxy settings group and gets UI widget pointers.
hgs
parents: 20
diff changeset
  1020
 */
hgs
parents: 20
diff changeset
  1021
void TestCpPacketDataApPlugin::tcExpandProxySettingsAndGetUiWidgets()
hgs
parents: 20
diff changeset
  1022
{
hgs
parents: 20
diff changeset
  1023
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
hgs
parents: 20
diff changeset
  1024
hgs
parents: 20
diff changeset
  1025
    QTest::qWait(500);
hgs
parents: 20
diff changeset
  1026
    
hgs
parents: 20
diff changeset
  1027
    subGetAdvancedUiWidgets(1);
hgs
parents: 20
diff changeset
  1028
}
hgs
parents: 20
diff changeset
  1029
hgs
parents: 20
diff changeset
  1030
/**
hgs
parents: 20
diff changeset
  1031
 * Tests changing of proxy server address.
hgs
parents: 20
diff changeset
  1032
 */
hgs
parents: 20
diff changeset
  1033
void TestCpPacketDataApPlugin::tcChangeProxyServerAddress()
hgs
parents: 20
diff changeset
  1034
{
hgs
parents: 20
diff changeset
  1035
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
  1036
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
  1037
    
hgs
parents: 20
diff changeset
  1038
    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget);
hgs
parents: 20
diff changeset
  1039
    
hgs
parents: 20
diff changeset
  1040
    // Erase old string
hgs
parents: 20
diff changeset
  1041
    QString text = mTestViewAdvanced->mProxyServer->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
  1042
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
  1043
    
hgs
parents: 20
diff changeset
  1044
    // Enter new string
hgs
parents: 20
diff changeset
  1045
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
  1046
hgs
parents: 20
diff changeset
  1047
    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
  1048
hgs
parents: 20
diff changeset
  1049
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1050
    subVerifyString(
hgs
parents: 20
diff changeset
  1051
        CMManagerShim::CmProxyServerName,
hgs
parents: 20
diff changeset
  1052
        mTestViewAdvanced->mProxyServer,
hgs
parents: 20
diff changeset
  1053
        result);
hgs
parents: 20
diff changeset
  1054
    // Verify user defined address flag is set correctly
hgs
parents: 20
diff changeset
  1055
    if (result.isEmpty()) {
hgs
parents: 20
diff changeset
  1056
        subVerifyBool(
hgs
parents: 20
diff changeset
  1057
            CMManagerShim::CmProxyUsageEnabled,
hgs
parents: 20
diff changeset
  1058
            false);
hgs
parents: 20
diff changeset
  1059
    } else {
hgs
parents: 20
diff changeset
  1060
        subVerifyBool(
hgs
parents: 20
diff changeset
  1061
            CMManagerShim::CmProxyUsageEnabled,
hgs
parents: 20
diff changeset
  1062
            true);
hgs
parents: 20
diff changeset
  1063
    }
hgs
parents: 20
diff changeset
  1064
}
hgs
parents: 20
diff changeset
  1065
hgs
parents: 20
diff changeset
  1066
/**
hgs
parents: 20
diff changeset
  1067
 * Test data for proxy server address change test case.
hgs
parents: 20
diff changeset
  1068
 */
hgs
parents: 20
diff changeset
  1069
void TestCpPacketDataApPlugin::tcChangeProxyServerAddress_data()
hgs
parents: 20
diff changeset
  1070
{
hgs
parents: 20
diff changeset
  1071
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
  1072
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
  1073
  
hgs
parents: 20
diff changeset
  1074
    QTest::newRow("long")
hgs
parents: 20
diff changeset
  1075
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
hgs
parents: 20
diff changeset
  1076
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
hgs
parents: 20
diff changeset
  1077
    QTest::newRow("empty")
hgs
parents: 20
diff changeset
  1078
        << ""
hgs
parents: 20
diff changeset
  1079
        << "";
hgs
parents: 20
diff changeset
  1080
    QTest::newRow("basic") // last one should always fit on one line in UI
hgs
parents: 20
diff changeset
  1081
        << "http://www.symbian.org/"
hgs
parents: 20
diff changeset
  1082
        << "http://www.symbian.org/";
hgs
parents: 20
diff changeset
  1083
}
hgs
parents: 20
diff changeset
  1084
hgs
parents: 20
diff changeset
  1085
/**
hgs
parents: 20
diff changeset
  1086
 * Tests changing of proxy port number.
hgs
parents: 20
diff changeset
  1087
 */
hgs
parents: 20
diff changeset
  1088
void TestCpPacketDataApPlugin::tcChangeProxyPortNumber()
hgs
parents: 20
diff changeset
  1089
{
hgs
parents: 20
diff changeset
  1090
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
  1091
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
  1092
    
hgs
parents: 20
diff changeset
  1093
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
hgs
parents: 20
diff changeset
  1094
    
hgs
parents: 20
diff changeset
  1095
    // Erase old string
hgs
parents: 20
diff changeset
  1096
    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
  1097
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
  1098
    
hgs
parents: 20
diff changeset
  1099
    // Enter new string
hgs
parents: 20
diff changeset
  1100
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
  1101
hgs
parents: 20
diff changeset
  1102
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
  1103
hgs
parents: 20
diff changeset
  1104
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1105
    subVerifyUint(
hgs
parents: 20
diff changeset
  1106
        CMManagerShim::CmProxyPortNumber,
hgs
parents: 20
diff changeset
  1107
        result.toInt());
hgs
parents: 20
diff changeset
  1108
    QCOMPARE(
hgs
parents: 20
diff changeset
  1109
        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
hgs
parents: 20
diff changeset
  1110
        result.toInt());
hgs
parents: 20
diff changeset
  1111
}
hgs
parents: 20
diff changeset
  1112
hgs
parents: 20
diff changeset
  1113
/**
hgs
parents: 20
diff changeset
  1114
 * Test data for proxy port number change test case.
hgs
parents: 20
diff changeset
  1115
 */
hgs
parents: 20
diff changeset
  1116
void TestCpPacketDataApPlugin::tcChangeProxyPortNumber_data()
hgs
parents: 20
diff changeset
  1117
{
hgs
parents: 20
diff changeset
  1118
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
  1119
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
  1120
  
hgs
parents: 20
diff changeset
  1121
    QTest::newRow("basic")
hgs
parents: 20
diff changeset
  1122
        << "8080"
hgs
parents: 20
diff changeset
  1123
        << "8080";
hgs
parents: 20
diff changeset
  1124
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
  1125
        << "1234567890"
hgs
parents: 20
diff changeset
  1126
        << "12345";
hgs
parents: 20
diff changeset
  1127
    QTest::newRow("zero")
hgs
parents: 20
diff changeset
  1128
        << "0"
hgs
parents: 20
diff changeset
  1129
        << "";
hgs
parents: 20
diff changeset
  1130
    QTest::newRow("empty")
hgs
parents: 20
diff changeset
  1131
        << ""
hgs
parents: 20
diff changeset
  1132
        << "";
hgs
parents: 20
diff changeset
  1133
}
hgs
parents: 20
diff changeset
  1134
hgs
parents: 20
diff changeset
  1135
/**
hgs
parents: 20
diff changeset
  1136
 * Tests invalid proxy port number.
hgs
parents: 20
diff changeset
  1137
 */
hgs
parents: 20
diff changeset
  1138
void TestCpPacketDataApPlugin::tcInvalidProxyPortNumber()
hgs
parents: 20
diff changeset
  1139
{
hgs
parents: 20
diff changeset
  1140
    int previous = 
hgs
parents: 20
diff changeset
  1141
        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt();
hgs
parents: 20
diff changeset
  1142
    
hgs
parents: 20
diff changeset
  1143
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
hgs
parents: 20
diff changeset
  1144
    
hgs
parents: 20
diff changeset
  1145
    // Erase old string
hgs
parents: 20
diff changeset
  1146
    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
  1147
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
  1148
    
hgs
parents: 20
diff changeset
  1149
    // Enter new string
hgs
parents: 20
diff changeset
  1150
    HbAutoTest::keyClicks(mMainWindow, "65536", 0, waitTime);
hgs
parents: 20
diff changeset
  1151
hgs
parents: 20
diff changeset
  1152
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
  1153
hgs
parents: 20
diff changeset
  1154
    QTest::qWait(100);
hgs
parents: 20
diff changeset
  1155
    // Dismiss messagebox
hgs
parents: 20
diff changeset
  1156
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
  1157
        mMainWindow,
hgs
parents: 20
diff changeset
  1158
        mTestViewAdvanced->mMessageBox.data(),
hgs
parents: 20
diff changeset
  1159
        messageBoxOkButtonOffset);
hgs
parents: 20
diff changeset
  1160
    
hgs
parents: 20
diff changeset
  1161
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1162
    subVerifyUint(
hgs
parents: 20
diff changeset
  1163
        CMManagerShim::CmProxyPortNumber,
hgs
parents: 20
diff changeset
  1164
        previous);
hgs
parents: 20
diff changeset
  1165
    QCOMPARE(
hgs
parents: 20
diff changeset
  1166
        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
hgs
parents: 20
diff changeset
  1167
        previous);
hgs
parents: 20
diff changeset
  1168
}
hgs
parents: 20
diff changeset
  1169
hgs
parents: 20
diff changeset
  1170
/**
hgs
parents: 20
diff changeset
  1171
 * Collapses the proxy settings group.
hgs
parents: 20
diff changeset
  1172
 */
hgs
parents: 20
diff changeset
  1173
void TestCpPacketDataApPlugin::tcCollapseProxySettings()
hgs
parents: 20
diff changeset
  1174
{
hgs
parents: 20
diff changeset
  1175
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
hgs
parents: 20
diff changeset
  1176
}
hgs
parents: 20
diff changeset
  1177
hgs
parents: 20
diff changeset
  1178
/**
hgs
parents: 20
diff changeset
  1179
 * Returns from advanced settings view.
hgs
parents: 20
diff changeset
  1180
 */
hgs
parents: 20
diff changeset
  1181
void TestCpPacketDataApPlugin::tcCloseAdvancedSettingsView()
hgs
parents: 20
diff changeset
  1182
{
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1183
    // Return from advanced settings view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1184
    subClickWidget("HbNavigationButton");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1185
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1186
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1187
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1188
// SUB TEST CASES
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1189
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1190
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1191
/**
32
hgs
parents: 20
diff changeset
  1192
 * Gets UI widget pointers.
hgs
parents: 20
diff changeset
  1193
 */
hgs
parents: 20
diff changeset
  1194
void TestCpPacketDataApPlugin::subGetUiWidgets()
hgs
parents: 20
diff changeset
  1195
{
hgs
parents: 20
diff changeset
  1196
    HbModelIterator iterator(mTestView->mModel);
hgs
parents: 20
diff changeset
  1197
    
hgs
parents: 20
diff changeset
  1198
    // Get "Access point settings" group item
hgs
parents: 20
diff changeset
  1199
    QModelIndex apGroupIndex = iterator.index(0);
hgs
parents: 20
diff changeset
  1200
    
hgs
parents: 20
diff changeset
  1201
    // Get UI widgets
hgs
parents: 20
diff changeset
  1202
    mConnectionNameWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1203
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1204
        iterator.index(0, apGroupIndex));
hgs
parents: 20
diff changeset
  1205
    mAccessPointNameWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1206
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1207
        iterator.index(1, apGroupIndex));
hgs
parents: 20
diff changeset
  1208
    mUserNameWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1209
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1210
        iterator.index(2, apGroupIndex));
hgs
parents: 20
diff changeset
  1211
    mPasswordPromptWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1212
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1213
        iterator.index(3, apGroupIndex));
hgs
parents: 20
diff changeset
  1214
    mPasswordWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1215
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1216
        iterator.index(4, apGroupIndex));
hgs
parents: 20
diff changeset
  1217
    mAuthenticationWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1218
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1219
        iterator.index(5, apGroupIndex));
hgs
parents: 20
diff changeset
  1220
    mHomepageWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1221
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1222
        iterator.index(6, apGroupIndex));
hgs
parents: 20
diff changeset
  1223
}
hgs
parents: 20
diff changeset
  1224
hgs
parents: 20
diff changeset
  1225
/**
hgs
parents: 20
diff changeset
  1226
 * Gets advanced settings view UI widget pointers by group index.
hgs
parents: 20
diff changeset
  1227
 */
hgs
parents: 20
diff changeset
  1228
void TestCpPacketDataApPlugin::subGetAdvancedUiWidgets(
hgs
parents: 20
diff changeset
  1229
    uint index)
hgs
parents: 20
diff changeset
  1230
{
hgs
parents: 20
diff changeset
  1231
    // Get the group item
hgs
parents: 20
diff changeset
  1232
    HbModelIterator iterator(mTestViewAdvanced->mModel);
hgs
parents: 20
diff changeset
  1233
    QModelIndex groupIndex = iterator.index(index);
hgs
parents: 20
diff changeset
  1234
    
hgs
parents: 20
diff changeset
  1235
    // Get UI widgets
hgs
parents: 20
diff changeset
  1236
    if (index == 0) {
hgs
parents: 20
diff changeset
  1237
        // IP settings group
hgs
parents: 20
diff changeset
  1238
        mNetworkTypeWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1239
            mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1240
            iterator.index(0, groupIndex));
hgs
parents: 20
diff changeset
  1241
        if (qobject_cast<HbComboBox *>(mNetworkTypeWidget)->currentIndex() == 0) {
hgs
parents: 20
diff changeset
  1242
            // IPv4
hgs
parents: 20
diff changeset
  1243
            mIpv4AddressAutomaticWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1244
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1245
                iterator.index(1, groupIndex));
hgs
parents: 20
diff changeset
  1246
            mIpv4AddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1247
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1248
                iterator.index(2, groupIndex));
hgs
parents: 20
diff changeset
  1249
            mIpv4DnsAddressAutomaticWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1250
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1251
                iterator.index(3, groupIndex));
hgs
parents: 20
diff changeset
  1252
            mIpv4PrimaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1253
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1254
                iterator.index(4, groupIndex));
hgs
parents: 20
diff changeset
  1255
            mIpv4SecondaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1256
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1257
                iterator.index(5, groupIndex));
hgs
parents: 20
diff changeset
  1258
        } else {
hgs
parents: 20
diff changeset
  1259
            // IPv6
hgs
parents: 20
diff changeset
  1260
            mIpv6DnsAddressAutomaticWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1261
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1262
                iterator.index(1, groupIndex));
hgs
parents: 20
diff changeset
  1263
            mIpv6PrimaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1264
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1265
                iterator.index(2, groupIndex));
hgs
parents: 20
diff changeset
  1266
            mIpv6SecondaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1267
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1268
                iterator.index(3, groupIndex));
hgs
parents: 20
diff changeset
  1269
        }
hgs
parents: 20
diff changeset
  1270
    } else {
hgs
parents: 20
diff changeset
  1271
        // Proxy settings group
hgs
parents: 20
diff changeset
  1272
        mProxyServerAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1273
            mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1274
            iterator.index(0, groupIndex));
hgs
parents: 20
diff changeset
  1275
        mProxyPortNumberWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1276
            mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1277
            iterator.index(1, groupIndex));
hgs
parents: 20
diff changeset
  1278
    }
hgs
parents: 20
diff changeset
  1279
}
hgs
parents: 20
diff changeset
  1280
hgs
parents: 20
diff changeset
  1281
/**
hgs
parents: 20
diff changeset
  1282
 * Gets an UI widget from HbDataForm by index. 
hgs
parents: 20
diff changeset
  1283
 */
hgs
parents: 20
diff changeset
  1284
HbWidget *TestCpPacketDataApPlugin::subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1285
    HbDataForm *form,
hgs
parents: 20
diff changeset
  1286
    const QModelIndex &index)
hgs
parents: 20
diff changeset
  1287
{
hgs
parents: 20
diff changeset
  1288
    HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *>
hgs
parents: 20
diff changeset
  1289
        (form->itemByIndex(index));
hgs
parents: 20
diff changeset
  1290
    HbWidget *widget = viewItem->dataItemContentWidget();
hgs
parents: 20
diff changeset
  1291
    //QString widgetClassName(widget->metaObject()->className());
hgs
parents: 20
diff changeset
  1292
    //qDebug() << widgetClassName;
hgs
parents: 20
diff changeset
  1293
    return widget;
hgs
parents: 20
diff changeset
  1294
}
hgs
parents: 20
diff changeset
  1295
hgs
parents: 20
diff changeset
  1296
/**
hgs
parents: 20
diff changeset
  1297
 * Writes initial settings to CommsDat needed by some test cases.
hgs
parents: 20
diff changeset
  1298
 */
hgs
parents: 20
diff changeset
  1299
void TestCpPacketDataApPlugin::subInitializeCommsDat()
hgs
parents: 20
diff changeset
  1300
{
hgs
parents: 20
diff changeset
  1301
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
hgs
parents: 20
diff changeset
  1302
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
hgs
parents: 20
diff changeset
  1303
        cmManager->connectionMethod(testApId));
hgs
parents: 20
diff changeset
  1304
    
hgs
parents: 20
diff changeset
  1305
    // Initial settings
hgs
parents: 20
diff changeset
  1306
    connectionMethod->setStringAttribute(
hgs
parents: 20
diff changeset
  1307
        CMManagerShim::PacketDataIFAuthName,
hgs
parents: 20
diff changeset
  1308
        tooLongUserName);
hgs
parents: 20
diff changeset
  1309
    
hgs
parents: 20
diff changeset
  1310
    connectionMethod->update();
hgs
parents: 20
diff changeset
  1311
}
hgs
parents: 20
diff changeset
  1312
hgs
parents: 20
diff changeset
  1313
/**
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1314
 * Creates the settings view and shows it.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1315
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1316
void TestCpPacketDataApPlugin::subCreateSettingsView(uint connectionMethodId)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1317
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1318
    // Create settings view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1319
    HbView *view = mPlugin->createSettingView(connectionMethodId);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1320
    QVERIFY(view != NULL);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1321
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1322
    // Display the view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1323
    mMainWindow->addView(view);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1324
    mMainWindow->setCurrentView(view);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1325
    // Store pointer to settings view class
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1326
    mTestView = static_cast<CpPacketDataApView *>(view);    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1327
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1328
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1329
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1330
 * Verifies that given string is correctly stored in CommsDat and shown on UI. 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1331
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1332
void TestCpPacketDataApPlugin::subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1333
    CMManagerShim::ConnectionMethodAttribute attribute,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1334
    HbDataFormModelItem *item,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1335
    QString expected)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1336
{
32
hgs
parents: 20
diff changeset
  1337
    QTest::qWait(waitTime);
hgs
parents: 20
diff changeset
  1338
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1339
    // Read attribute value from CommsDat
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1340
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1341
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1342
        cmManager->connectionMethod(testApId));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1343
    QString commsdat = connectionMethod->getStringAttribute(attribute);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1344
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1345
    QCOMPARE(commsdat, expected);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1346
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1347
    // Get value from UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1348
    QString widget = item->contentWidgetData("text").toString();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1349
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1350
    QCOMPARE(widget, expected);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1351
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1352
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1353
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1354
 * Clears a HbLineEdit.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1355
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1356
void TestCpPacketDataApPlugin::subClearLineEdit(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1357
    uint length)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1358
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1359
    // Move cursor to end of string
32
hgs
parents: 20
diff changeset
  1360
    //HbAutoTest::keyClick(mMainWindow, Qt::Key_End, Qt::ControlModifier, waitTime); // doesn't seem to do anything? 
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1361
    HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1362
    HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1363
    HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1364
    for (int i=0; i<25; i++) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1365
        HbAutoTest::keyClick(mMainWindow, Qt::Key_Right, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1366
    }
32
hgs
parents: 20
diff changeset
  1367
    // Erase string
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1368
    for (int i=0; i<length; i++) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1369
        HbAutoTest::keyClick(mMainWindow, Qt::Key_Backspace, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1370
    }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1371
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1372
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1373
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1374
 * Gets value of a boolean attribute from CommsDat.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1375
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1376
bool TestCpPacketDataApPlugin::subGetBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1377
    CMManagerShim::ConnectionMethodAttribute attribute)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1378
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1379
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1380
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1381
        cmManager->connectionMethod(testApId));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1382
    return connectionMethod->getBoolAttribute(attribute);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1383
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1384
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1385
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1386
 * Verifies that given attribute contains expected boolean value in CommsDat. 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1387
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1388
void TestCpPacketDataApPlugin::subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1389
    CMManagerShim::ConnectionMethodAttribute attribute,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1390
    bool expected)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1391
{
32
hgs
parents: 20
diff changeset
  1392
    QTest::qWait(waitTime);
hgs
parents: 20
diff changeset
  1393
    
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1394
    // Read attribute value from CommsDat
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1395
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1396
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1397
        cmManager->connectionMethod(testApId));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1398
    bool commsdat = connectionMethod->getBoolAttribute(attribute);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1399
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1400
    QCOMPARE(commsdat, expected);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1401
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1402
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1403
/**
32
hgs
parents: 20
diff changeset
  1404
 * Verifies that given attribute contains expected integer value in CommsDat. 
hgs
parents: 20
diff changeset
  1405
 */
hgs
parents: 20
diff changeset
  1406
void TestCpPacketDataApPlugin::subVerifyUint(
hgs
parents: 20
diff changeset
  1407
    CMManagerShim::ConnectionMethodAttribute attribute,
hgs
parents: 20
diff changeset
  1408
    uint expected)
hgs
parents: 20
diff changeset
  1409
{
hgs
parents: 20
diff changeset
  1410
    QTest::qWait(waitTime);
hgs
parents: 20
diff changeset
  1411
hgs
parents: 20
diff changeset
  1412
    // Read attribute value from CommsDat
hgs
parents: 20
diff changeset
  1413
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
hgs
parents: 20
diff changeset
  1414
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
hgs
parents: 20
diff changeset
  1415
        cmManager->connectionMethod(testApId));
hgs
parents: 20
diff changeset
  1416
    uint commsdat = connectionMethod->getIntAttribute(attribute);
hgs
parents: 20
diff changeset
  1417
    
hgs
parents: 20
diff changeset
  1418
    QCOMPARE(commsdat, expected);
hgs
parents: 20
diff changeset
  1419
}
hgs
parents: 20
diff changeset
  1420
hgs
parents: 20
diff changeset
  1421
/**
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1422
 * Clicks a widget currently on UI by class name.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1423
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1424
void TestCpPacketDataApPlugin::subClickWidget(const QString &name)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1425
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1426
    QList<QGraphicsItem *> itemList = mMainWindow->scene()->items();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1427
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1428
    QGraphicsItem *target = 0;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1429
    foreach (QGraphicsItem* item, itemList) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1430
        if (item->isWidget()) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1431
            QString widgetClassName(static_cast<QGraphicsWidget*>(item)->metaObject()->className());
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1432
            //qDebug() << widgetClassName;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1433
            
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1434
            if (widgetClassName == name) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1435
                target = item;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1436
                break;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1437
            }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1438
        }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1439
    }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1440
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1441
    Q_ASSERT(target);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1442
    HbAutoTest::mouseClick(mMainWindow, static_cast<HbWidget *>(target));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1443
}
32
hgs
parents: 20
diff changeset
  1444
hgs
parents: 20
diff changeset
  1445
/**
hgs
parents: 20
diff changeset
  1446
 * Scrolls the tested view to the bottom.
hgs
parents: 20
diff changeset
  1447
 */
hgs
parents: 20
diff changeset
  1448
void TestCpPacketDataApPlugin::subScrollToBottom()
hgs
parents: 20
diff changeset
  1449
{
hgs
parents: 20
diff changeset
  1450
    // Scroll to the bottom of the view
hgs
parents: 20
diff changeset
  1451
    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
hgs
parents: 20
diff changeset
  1452
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
  1453
    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollTop);
hgs
parents: 20
diff changeset
  1454
    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollTop);
hgs
parents: 20
diff changeset
  1455
}
hgs
parents: 20
diff changeset
  1456
hgs
parents: 20
diff changeset
  1457
/**
hgs
parents: 20
diff changeset
  1458
 * Scrolls the tested view to the top.
hgs
parents: 20
diff changeset
  1459
 */
hgs
parents: 20
diff changeset
  1460
void TestCpPacketDataApPlugin::subScrollToTop()
hgs
parents: 20
diff changeset
  1461
{
hgs
parents: 20
diff changeset
  1462
    // Scroll to the top of the view
hgs
parents: 20
diff changeset
  1463
    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
hgs
parents: 20
diff changeset
  1464
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
  1465
    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollBottom);
hgs
parents: 20
diff changeset
  1466
    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollBottom);
hgs
parents: 20
diff changeset
  1467
}