cmmanager/cppacketdataapplugin/tsrc/ut/testcppacketdataapplugin.cpp
author hgs
Thu, 24 Jun 2010 11:36:05 +0300
changeset 41 bbb64eb3bdee
parent 32 5c4486441ae6
permissions -rw-r--r--
201025
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 changing of password.
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::tcChangePassword()
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
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   409
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   410
    
32
hgs
parents: 20
diff changeset
   411
    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   412
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   413
    // Erase old string
32
hgs
parents: 20
diff changeset
   414
    QString text = mTestView->mPasswordItem->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   415
    subClearLineEdit(text.size());
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   416
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   417
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   418
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   419
32
hgs
parents: 20
diff changeset
   420
    HbAutoTest::mouseClick(mMainWindow, mPasswordWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   421
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   422
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   423
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   424
        CMManagerShim::PacketDataIFAuthPass,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   425
        mTestView->mPasswordItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   426
        result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   427
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   428
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   429
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   430
 * Test data for password change test case.
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
void TestCpPacketDataApPlugin::tcChangePassword_data()
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
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   435
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   436
32
hgs
parents: 20
diff changeset
   437
    QTest::newRow("maximum length")
hgs
parents: 20
diff changeset
   438
        << "really long name 123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   439
        << "really long name 123456789012345678901234567890123";
hgs
parents: 20
diff changeset
   440
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   441
        << "too long name 1234567890123456789012345678901234567890123"
hgs
parents: 20
diff changeset
   442
        << "too long name 123456789012345678901234567890123456";
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
    QTest::newRow("basic")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   444
        << "password"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   445
        << "password";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
    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
   447
        << ""
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   448
        << "";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   449
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   450
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
 * Tests changing of authentication mode.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
void TestCpPacketDataApPlugin::tcChangeAuthenticationMode()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
{
32
hgs
parents: 20
diff changeset
   456
    QPointF normalPointOffset = comboBoxFirstItemOffset;
hgs
parents: 20
diff changeset
   457
    QPointF securePointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
hgs
parents: 20
diff changeset
   458
    
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
    // Set authentication mode to secure
32
hgs
parents: 20
diff changeset
   460
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    QTest::qWait(100);
32
hgs
parents: 20
diff changeset
   462
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget, securePointOffset);
20
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
    subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   465
        CMManagerShim::PacketDataDisablePlainTextAuth,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   466
        true);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
    // Set authentication mode to normal
32
hgs
parents: 20
diff changeset
   469
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   470
    QTest::qWait(100);
32
hgs
parents: 20
diff changeset
   471
    HbAutoTest::mouseClick(mMainWindow, mAuthenticationWidget, normalPointOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   472
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
    subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
        CMManagerShim::PacketDataDisablePlainTextAuth,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
        false);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
}
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
 * Tests changing of homepage.
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
void TestCpPacketDataApPlugin::tcChangeHomepage()
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
    QFETCH(QString, string);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
    QFETCH(QString, result);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   485
    
32
hgs
parents: 20
diff changeset
   486
    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   487
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
    // Erase old string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
    QString text = mTestView->mHomepageItem->contentWidgetData("text").toString();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
    subClearLineEdit(text.size());
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
    // Enter new string
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   494
32
hgs
parents: 20
diff changeset
   495
    HbAutoTest::mouseClick(mMainWindow, mHomepageWidget, exitEditorOffset);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   497
    // Verify both commsdat and UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
    subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   499
        CMManagerShim::CmStartPage,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   500
        mTestView->mHomepageItem,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
        result);
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
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   504
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
 * Test data for homepage change test case.
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
void TestCpPacketDataApPlugin::tcChangeHomepage_data()
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
    QTest::addColumn<QString>("string");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   510
    QTest::addColumn<QString>("result");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
  
32
hgs
parents: 20
diff changeset
   512
    QTest::newRow("long")
hgs
parents: 20
diff changeset
   513
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
hgs
parents: 20
diff changeset
   514
        << "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
   515
    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
   516
        << "http://www.symbian.org/"
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
        << "http://www.symbian.org/";
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
    QTest::newRow("empty")
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
        << ""
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
        << "";
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
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   523
/**
32
hgs
parents: 20
diff changeset
   524
 * Opens advanced settings view.
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   525
 */
32
hgs
parents: 20
diff changeset
   526
void TestCpPacketDataApPlugin::tcOpenAdvancedSettingsView()
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   527
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   528
    // Launch advanced settings view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   529
    bool status = connect(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   530
        this,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   531
        SIGNAL(menuActionTriggered(HbAction *)),
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   532
        mTestView,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   533
        SLOT(menuActionTriggered(HbAction *)));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
    Q_ASSERT(status);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   535
    emit menuActionTriggered(mTestView->mAdvancedSettingsAction);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   536
32
hgs
parents: 20
diff changeset
   537
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
   538
    
hgs
parents: 20
diff changeset
   539
    mTestViewAdvanced = static_cast<CpPacketDataApAdvancedView *>(mMainWindow->currentView());
hgs
parents: 20
diff changeset
   540
}
hgs
parents: 20
diff changeset
   541
hgs
parents: 20
diff changeset
   542
/**
hgs
parents: 20
diff changeset
   543
 * Expands the IP settings group.
hgs
parents: 20
diff changeset
   544
 */
hgs
parents: 20
diff changeset
   545
void TestCpPacketDataApPlugin::tcExpandIpSettings()
hgs
parents: 20
diff changeset
   546
{
hgs
parents: 20
diff changeset
   547
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipGroup);
hgs
parents: 20
diff changeset
   548
    
hgs
parents: 20
diff changeset
   549
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   550
}
hgs
parents: 20
diff changeset
   551
hgs
parents: 20
diff changeset
   552
/**
hgs
parents: 20
diff changeset
   553
 * Sets the network type to IPv4 and gets UI widget pointers.
hgs
parents: 20
diff changeset
   554
 */
hgs
parents: 20
diff changeset
   555
void TestCpPacketDataApPlugin::tcSetIpv4NetworkType()
hgs
parents: 20
diff changeset
   556
{
hgs
parents: 20
diff changeset
   557
    QPointF ipv4PointOffset = comboBoxFirstItemOffset;
hgs
parents: 20
diff changeset
   558
    
hgs
parents: 20
diff changeset
   559
    // Set network type to IPv4
hgs
parents: 20
diff changeset
   560
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget);
hgs
parents: 20
diff changeset
   561
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget, ipv4PointOffset, 100);
hgs
parents: 20
diff changeset
   562
    subVerifyUint(CMManagerShim::PacketDataPDPType, RPacketContext::EPdpTypeIPv4);
hgs
parents: 20
diff changeset
   563
    
hgs
parents: 20
diff changeset
   564
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   565
}
hgs
parents: 20
diff changeset
   566
hgs
parents: 20
diff changeset
   567
/**
hgs
parents: 20
diff changeset
   568
 * Tests enabling of automatic phone IP address.
hgs
parents: 20
diff changeset
   569
 */
hgs
parents: 20
diff changeset
   570
void TestCpPacketDataApPlugin::tcEnableAutomaticIpv4Address()
hgs
parents: 20
diff changeset
   571
{
hgs
parents: 20
diff changeset
   572
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   573
        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   574
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   575
        // Disable automatic IP address
hgs
parents: 20
diff changeset
   576
        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
hgs
parents: 20
diff changeset
   577
    }
hgs
parents: 20
diff changeset
   578
    // Enable automatic IP address
hgs
parents: 20
diff changeset
   579
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
hgs
parents: 20
diff changeset
   580
    subVerifyBool(
hgs
parents: 20
diff changeset
   581
        CMManagerShim::PacketDataIPAddrFromServer,
hgs
parents: 20
diff changeset
   582
        true);
hgs
parents: 20
diff changeset
   583
    
hgs
parents: 20
diff changeset
   584
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   585
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
hgs
parents: 20
diff changeset
   586
}
hgs
parents: 20
diff changeset
   587
hgs
parents: 20
diff changeset
   588
/**
hgs
parents: 20
diff changeset
   589
 * Tests disabling of automatic phone IP address.
hgs
parents: 20
diff changeset
   590
 */
hgs
parents: 20
diff changeset
   591
void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv4Address()
hgs
parents: 20
diff changeset
   592
{
hgs
parents: 20
diff changeset
   593
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   594
        (mTestViewAdvanced->mIpv4Automatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   595
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   596
        // Disable automatic IP address
hgs
parents: 20
diff changeset
   597
        HbAutoTest::mouseClick(mMainWindow, mIpv4AddressAutomaticWidget);
hgs
parents: 20
diff changeset
   598
    }
hgs
parents: 20
diff changeset
   599
    // Can't verify the setting from CommsDat here, because CMManager will
hgs
parents: 20
diff changeset
   600
    // set it back to true if no valid IP address is yet defined. The flag
hgs
parents: 20
diff changeset
   601
    // is verified in tcChangeIpAddress().
hgs
parents: 20
diff changeset
   602
}
hgs
parents: 20
diff changeset
   603
hgs
parents: 20
diff changeset
   604
/**
hgs
parents: 20
diff changeset
   605
 * Tests changing of IP address.
hgs
parents: 20
diff changeset
   606
 */
hgs
parents: 20
diff changeset
   607
void TestCpPacketDataApPlugin::tcChangeIpAddress()
hgs
parents: 20
diff changeset
   608
{
hgs
parents: 20
diff changeset
   609
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
   610
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
   611
    
hgs
parents: 20
diff changeset
   612
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget);
hgs
parents: 20
diff changeset
   613
    
hgs
parents: 20
diff changeset
   614
    // Erase old string
hgs
parents: 20
diff changeset
   615
    QString text = mTestViewAdvanced->mIpv4Address->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   616
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   617
    
hgs
parents: 20
diff changeset
   618
    // Enter new string
hgs
parents: 20
diff changeset
   619
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   620
hgs
parents: 20
diff changeset
   621
    HbAutoTest::mouseClick(mMainWindow, mIpv4AddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   622
hgs
parents: 20
diff changeset
   623
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   624
    subVerifyString(
hgs
parents: 20
diff changeset
   625
        CMManagerShim::PacketDataIPAddr,
hgs
parents: 20
diff changeset
   626
        mTestViewAdvanced->mIpv4Address,
hgs
parents: 20
diff changeset
   627
        result);
hgs
parents: 20
diff changeset
   628
    subVerifyBool(
hgs
parents: 20
diff changeset
   629
        CMManagerShim::PacketDataIPAddrFromServer,
hgs
parents: 20
diff changeset
   630
        false);
hgs
parents: 20
diff changeset
   631
}
hgs
parents: 20
diff changeset
   632
hgs
parents: 20
diff changeset
   633
/**
hgs
parents: 20
diff changeset
   634
 * Test data for IP address change test case.
hgs
parents: 20
diff changeset
   635
 */
hgs
parents: 20
diff changeset
   636
void TestCpPacketDataApPlugin::tcChangeIpAddress_data()
hgs
parents: 20
diff changeset
   637
{
hgs
parents: 20
diff changeset
   638
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
   639
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
   640
  
hgs
parents: 20
diff changeset
   641
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   642
        << "255.255.255.2551234"
hgs
parents: 20
diff changeset
   643
        << "255.255.255.255";
hgs
parents: 20
diff changeset
   644
    QTest::newRow("normal")
hgs
parents: 20
diff changeset
   645
        << "192.168.0.1"
hgs
parents: 20
diff changeset
   646
        << "192.168.0.1";
hgs
parents: 20
diff changeset
   647
}
hgs
parents: 20
diff changeset
   648
hgs
parents: 20
diff changeset
   649
/**
hgs
parents: 20
diff changeset
   650
 * Scrolls the tested view to the bottom.
hgs
parents: 20
diff changeset
   651
 */
hgs
parents: 20
diff changeset
   652
void TestCpPacketDataApPlugin::tcScrollToBottom2()
hgs
parents: 20
diff changeset
   653
{
hgs
parents: 20
diff changeset
   654
    subScrollToBottom();
hgs
parents: 20
diff changeset
   655
    
hgs
parents: 20
diff changeset
   656
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   657
}
hgs
parents: 20
diff changeset
   658
hgs
parents: 20
diff changeset
   659
/**
hgs
parents: 20
diff changeset
   660
 * Tests enabling of automatic IPv4 DNS addresses.
hgs
parents: 20
diff changeset
   661
 */
hgs
parents: 20
diff changeset
   662
void TestCpPacketDataApPlugin::tcEnableAutomaticIpv4DnsAddress()
hgs
parents: 20
diff changeset
   663
{
hgs
parents: 20
diff changeset
   664
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   665
        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   666
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   667
        // Disable automatic IPv4 DNS address
hgs
parents: 20
diff changeset
   668
        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   669
    }
hgs
parents: 20
diff changeset
   670
    // Enable automatic IPv4 DNS address
hgs
parents: 20
diff changeset
   671
    HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   672
    subVerifyBool(
hgs
parents: 20
diff changeset
   673
        CMManagerShim::PacketDataIPDNSAddrFromServer,
hgs
parents: 20
diff changeset
   674
        true);
hgs
parents: 20
diff changeset
   675
    
hgs
parents: 20
diff changeset
   676
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   677
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   678
    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   679
}
hgs
parents: 20
diff changeset
   680
hgs
parents: 20
diff changeset
   681
/**
hgs
parents: 20
diff changeset
   682
 * Tests disabling of automatic IPv4 DNS addresses.
hgs
parents: 20
diff changeset
   683
 */
hgs
parents: 20
diff changeset
   684
void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv4DnsAddress()
hgs
parents: 20
diff changeset
   685
{
hgs
parents: 20
diff changeset
   686
    Qt::CheckState state = static_cast<Qt::CheckState>
hgs
parents: 20
diff changeset
   687
        (mTestViewAdvanced->mIpv4DnsAutomatic->contentWidgetData("checkState").toInt());
hgs
parents: 20
diff changeset
   688
    if (state == Qt::Checked) {
hgs
parents: 20
diff changeset
   689
        // Disable automatic IPv4 DNS address
hgs
parents: 20
diff changeset
   690
        HbAutoTest::mouseClick(mMainWindow, mIpv4DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   691
    }
hgs
parents: 20
diff changeset
   692
    // Can't verify the setting from CommsDat here, because CMManager will
hgs
parents: 20
diff changeset
   693
    // set it back to true if no valid IP address is yet defined. The flag
hgs
parents: 20
diff changeset
   694
    // is verified in tcChangeIpv4DnsAddress().
hgs
parents: 20
diff changeset
   695
}
hgs
parents: 20
diff changeset
   696
hgs
parents: 20
diff changeset
   697
/**
hgs
parents: 20
diff changeset
   698
 * Tests changing of IPv4 DNS addresses.
hgs
parents: 20
diff changeset
   699
 */
hgs
parents: 20
diff changeset
   700
void TestCpPacketDataApPlugin::tcChangeIpv4DnsAddress()
hgs
parents: 20
diff changeset
   701
{
hgs
parents: 20
diff changeset
   702
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
   703
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
   704
    
hgs
parents: 20
diff changeset
   705
    // Primary DNS address
hgs
parents: 20
diff changeset
   706
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   707
    
hgs
parents: 20
diff changeset
   708
    // Erase old string
hgs
parents: 20
diff changeset
   709
    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   710
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   711
    
hgs
parents: 20
diff changeset
   712
    // Enter new string
hgs
parents: 20
diff changeset
   713
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   714
hgs
parents: 20
diff changeset
   715
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   716
hgs
parents: 20
diff changeset
   717
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   718
    subVerifyString(
hgs
parents: 20
diff changeset
   719
        CMManagerShim::PacketDataIPNameServer1,
hgs
parents: 20
diff changeset
   720
        mTestViewAdvanced->mIpv4DnsAddress1,
hgs
parents: 20
diff changeset
   721
        result);
hgs
parents: 20
diff changeset
   722
    
hgs
parents: 20
diff changeset
   723
    // Secondary DNS address
hgs
parents: 20
diff changeset
   724
    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   725
    
hgs
parents: 20
diff changeset
   726
    // Erase old string
hgs
parents: 20
diff changeset
   727
    text = mTestViewAdvanced->mIpv4DnsAddress2->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   728
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   729
    
hgs
parents: 20
diff changeset
   730
    // Enter new string
hgs
parents: 20
diff changeset
   731
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   732
hgs
parents: 20
diff changeset
   733
    HbAutoTest::mouseClick(mMainWindow, mIpv4SecondaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   734
hgs
parents: 20
diff changeset
   735
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   736
    subVerifyString(
hgs
parents: 20
diff changeset
   737
        CMManagerShim::PacketDataIPNameServer2,
hgs
parents: 20
diff changeset
   738
        mTestViewAdvanced->mIpv4DnsAddress2,
hgs
parents: 20
diff changeset
   739
        result);
hgs
parents: 20
diff changeset
   740
    
hgs
parents: 20
diff changeset
   741
    // Verify user defined address is in use
hgs
parents: 20
diff changeset
   742
    subVerifyBool(
hgs
parents: 20
diff changeset
   743
        CMManagerShim::PacketDataIPDNSAddrFromServer,
hgs
parents: 20
diff changeset
   744
        false);
hgs
parents: 20
diff changeset
   745
}
hgs
parents: 20
diff changeset
   746
hgs
parents: 20
diff changeset
   747
/**
hgs
parents: 20
diff changeset
   748
 * Test data for IPv4 DNS address change test case.
hgs
parents: 20
diff changeset
   749
 */
hgs
parents: 20
diff changeset
   750
void TestCpPacketDataApPlugin::tcChangeIpv4DnsAddress_data()
hgs
parents: 20
diff changeset
   751
{
hgs
parents: 20
diff changeset
   752
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
   753
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
   754
  
hgs
parents: 20
diff changeset
   755
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
   756
        << "255.255.255.2551234"
hgs
parents: 20
diff changeset
   757
        << "255.255.255.255";
hgs
parents: 20
diff changeset
   758
    QTest::newRow("normal")
hgs
parents: 20
diff changeset
   759
        << "192.168.0.1"
hgs
parents: 20
diff changeset
   760
        << "192.168.0.1";
hgs
parents: 20
diff changeset
   761
}
hgs
parents: 20
diff changeset
   762
hgs
parents: 20
diff changeset
   763
/**
hgs
parents: 20
diff changeset
   764
 * Tests invalid IPv4 DNS address.
hgs
parents: 20
diff changeset
   765
 */
hgs
parents: 20
diff changeset
   766
void TestCpPacketDataApPlugin::tcInvalidIpv4DnsAddress()
hgs
parents: 20
diff changeset
   767
{
hgs
parents: 20
diff changeset
   768
    QString previous = 
hgs
parents: 20
diff changeset
   769
        mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   770
    
hgs
parents: 20
diff changeset
   771
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   772
    
hgs
parents: 20
diff changeset
   773
    // Erase old string
hgs
parents: 20
diff changeset
   774
    QString text = mTestViewAdvanced->mIpv4DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   775
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   776
    
hgs
parents: 20
diff changeset
   777
    // Enter new string
hgs
parents: 20
diff changeset
   778
    HbAutoTest::keyClicks(mMainWindow, "999.999.999.999", 0, waitTime);
hgs
parents: 20
diff changeset
   779
hgs
parents: 20
diff changeset
   780
    HbAutoTest::mouseClick(mMainWindow, mIpv4PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   781
hgs
parents: 20
diff changeset
   782
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   783
    // Dismiss messagebox
hgs
parents: 20
diff changeset
   784
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
   785
        mMainWindow,
hgs
parents: 20
diff changeset
   786
        mTestViewAdvanced->mMessageBox.data(),
hgs
parents: 20
diff changeset
   787
        messageBoxOkButtonOffset);
hgs
parents: 20
diff changeset
   788
    
hgs
parents: 20
diff changeset
   789
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   790
    subVerifyString(
hgs
parents: 20
diff changeset
   791
        CMManagerShim::PacketDataIPNameServer1,
hgs
parents: 20
diff changeset
   792
        mTestViewAdvanced->mIpv4DnsAddress1,
hgs
parents: 20
diff changeset
   793
        previous);
hgs
parents: 20
diff changeset
   794
}
hgs
parents: 20
diff changeset
   795
hgs
parents: 20
diff changeset
   796
/**
hgs
parents: 20
diff changeset
   797
 * Scrolls the tested view to the top.
hgs
parents: 20
diff changeset
   798
 */
hgs
parents: 20
diff changeset
   799
void TestCpPacketDataApPlugin::tcScrollToTop()
hgs
parents: 20
diff changeset
   800
{
hgs
parents: 20
diff changeset
   801
    subScrollToTop();
hgs
parents: 20
diff changeset
   802
}
hgs
parents: 20
diff changeset
   803
hgs
parents: 20
diff changeset
   804
/**
hgs
parents: 20
diff changeset
   805
 * Sets the network type to IPv6 and gets UI widget pointers.
hgs
parents: 20
diff changeset
   806
 */
hgs
parents: 20
diff changeset
   807
void TestCpPacketDataApPlugin::tcSetIpv6NetworkType()
hgs
parents: 20
diff changeset
   808
{
hgs
parents: 20
diff changeset
   809
    QPointF ipv6PointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
hgs
parents: 20
diff changeset
   810
    
hgs
parents: 20
diff changeset
   811
    // Set network type to IPv6
hgs
parents: 20
diff changeset
   812
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget);
hgs
parents: 20
diff changeset
   813
    HbAutoTest::mouseClick(mMainWindow, mNetworkTypeWidget, ipv6PointOffset, 100);
hgs
parents: 20
diff changeset
   814
    subVerifyUint(CMManagerShim::PacketDataPDPType, RPacketContext::EPdpTypeIPv6);
hgs
parents: 20
diff changeset
   815
hgs
parents: 20
diff changeset
   816
    subGetAdvancedUiWidgets(0);
hgs
parents: 20
diff changeset
   817
}
hgs
parents: 20
diff changeset
   818
hgs
parents: 20
diff changeset
   819
/**
hgs
parents: 20
diff changeset
   820
 * Tests enabling of automatic IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   821
 */
hgs
parents: 20
diff changeset
   822
void TestCpPacketDataApPlugin::tcEnableAutomaticIpv6DnsAddress()
hgs
parents: 20
diff changeset
   823
{
hgs
parents: 20
diff changeset
   824
    // Enable automatic IPv6 DNS address
hgs
parents: 20
diff changeset
   825
    QPointF automaticPointOffset = comboBoxFirstItemOffset;
hgs
parents: 20
diff changeset
   826
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   827
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   828
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, automaticPointOffset, 100);
hgs
parents: 20
diff changeset
   829
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   830
    subVerifyBool(
hgs
parents: 20
diff changeset
   831
        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
hgs
parents: 20
diff changeset
   832
        true);
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   833
    
32
hgs
parents: 20
diff changeset
   834
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   835
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   836
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   837
}
hgs
parents: 20
diff changeset
   838
hgs
parents: 20
diff changeset
   839
/**
hgs
parents: 20
diff changeset
   840
 * Tests enabling of well-known IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   841
 */
hgs
parents: 20
diff changeset
   842
void TestCpPacketDataApPlugin::tcEnableWellKnownIpv6DnsAddress()
hgs
parents: 20
diff changeset
   843
{
hgs
parents: 20
diff changeset
   844
    // Enable well-known IPv6 DNS address
hgs
parents: 20
diff changeset
   845
    QPointF wellKnownPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset;
hgs
parents: 20
diff changeset
   846
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   847
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   848
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, wellKnownPointOffset, 100);
hgs
parents: 20
diff changeset
   849
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   850
    subVerifyBool(
hgs
parents: 20
diff changeset
   851
        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
hgs
parents: 20
diff changeset
   852
        false);
hgs
parents: 20
diff changeset
   853
    subVerifyString(
hgs
parents: 20
diff changeset
   854
        CMManagerShim::PacketDataIPIP6NameServer1,
hgs
parents: 20
diff changeset
   855
        mTestViewAdvanced->mIpv6DnsAddress1,
hgs
parents: 20
diff changeset
   856
        "fec0:000:0000:ffff::1");
hgs
parents: 20
diff changeset
   857
    subVerifyString(
hgs
parents: 20
diff changeset
   858
        CMManagerShim::PacketDataIPIP6NameServer2,
hgs
parents: 20
diff changeset
   859
        mTestViewAdvanced->mIpv6DnsAddress2,
hgs
parents: 20
diff changeset
   860
        "fec0:000:0000:ffff::2");
hgs
parents: 20
diff changeset
   861
    
hgs
parents: 20
diff changeset
   862
    // Ensure that editing the IP address is not allowed
hgs
parents: 20
diff changeset
   863
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   864
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   865
}
hgs
parents: 20
diff changeset
   866
hgs
parents: 20
diff changeset
   867
/**
hgs
parents: 20
diff changeset
   868
 * Tests enabling of user defined IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   869
 */
hgs
parents: 20
diff changeset
   870
void TestCpPacketDataApPlugin::tcEnableUserDefinedIpv6DnsAddress()
hgs
parents: 20
diff changeset
   871
{
hgs
parents: 20
diff changeset
   872
    // Select user defined IPv6 DNS address
hgs
parents: 20
diff changeset
   873
    QPointF userDefinedPointOffset = comboBoxFirstItemOffset + comboBoxItemOffset * 2;
hgs
parents: 20
diff changeset
   874
    //QPointF userDefinedPointOffset(0, 160);
hgs
parents: 20
diff changeset
   875
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget);
hgs
parents: 20
diff changeset
   876
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   877
    HbAutoTest::mouseClick(mMainWindow, mIpv6DnsAddressAutomaticWidget, userDefinedPointOffset, 100);
hgs
parents: 20
diff changeset
   878
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   879
    // Can't verify the setting from CommsDat here, because CMManager will
hgs
parents: 20
diff changeset
   880
    // set it back to true if no valid IP address is yet defined. The flag
hgs
parents: 20
diff changeset
   881
    // is verified in tcChangeIpv4DnsAddress().
hgs
parents: 20
diff changeset
   882
}
hgs
parents: 20
diff changeset
   883
hgs
parents: 20
diff changeset
   884
/**
hgs
parents: 20
diff changeset
   885
 * Tests changing of IPv6 DNS addresses.
hgs
parents: 20
diff changeset
   886
 */
hgs
parents: 20
diff changeset
   887
void TestCpPacketDataApPlugin::tcChangeIpv6DnsAddress()
hgs
parents: 20
diff changeset
   888
{
hgs
parents: 20
diff changeset
   889
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
   890
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
   891
    
hgs
parents: 20
diff changeset
   892
    // Primary DNS address
hgs
parents: 20
diff changeset
   893
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   894
    
hgs
parents: 20
diff changeset
   895
    // Erase old string
hgs
parents: 20
diff changeset
   896
    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   897
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   898
    
hgs
parents: 20
diff changeset
   899
    // Enter new string
hgs
parents: 20
diff changeset
   900
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   901
hgs
parents: 20
diff changeset
   902
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   903
hgs
parents: 20
diff changeset
   904
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   905
    subVerifyString(
hgs
parents: 20
diff changeset
   906
        CMManagerShim::PacketDataIPIP6NameServer1,
hgs
parents: 20
diff changeset
   907
        mTestViewAdvanced->mIpv6DnsAddress1,
hgs
parents: 20
diff changeset
   908
        result);
hgs
parents: 20
diff changeset
   909
    
hgs
parents: 20
diff changeset
   910
    // Secondary DNS address
hgs
parents: 20
diff changeset
   911
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   912
    
hgs
parents: 20
diff changeset
   913
    // Erase old string
hgs
parents: 20
diff changeset
   914
    text = mTestViewAdvanced->mIpv6DnsAddress2->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   915
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   916
    
hgs
parents: 20
diff changeset
   917
    // Enter new string
hgs
parents: 20
diff changeset
   918
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
   919
hgs
parents: 20
diff changeset
   920
    HbAutoTest::mouseClick(mMainWindow, mIpv6SecondaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   921
hgs
parents: 20
diff changeset
   922
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   923
    subVerifyString(
hgs
parents: 20
diff changeset
   924
        CMManagerShim::PacketDataIPIP6NameServer2,
hgs
parents: 20
diff changeset
   925
        mTestViewAdvanced->mIpv6DnsAddress2,
hgs
parents: 20
diff changeset
   926
        result);
hgs
parents: 20
diff changeset
   927
    
hgs
parents: 20
diff changeset
   928
    // Verify user defined address is in use
hgs
parents: 20
diff changeset
   929
    subVerifyBool(
hgs
parents: 20
diff changeset
   930
        CMManagerShim::PacketDataIPIP6DNSAddrFromServer,
hgs
parents: 20
diff changeset
   931
        false);
hgs
parents: 20
diff changeset
   932
}
hgs
parents: 20
diff changeset
   933
hgs
parents: 20
diff changeset
   934
/**
hgs
parents: 20
diff changeset
   935
 * Test data for IPv6 DNS address change test case.
hgs
parents: 20
diff changeset
   936
 */
hgs
parents: 20
diff changeset
   937
void TestCpPacketDataApPlugin::tcChangeIpv6DnsAddress_data()
hgs
parents: 20
diff changeset
   938
{
hgs
parents: 20
diff changeset
   939
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
   940
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
   941
  
hgs
parents: 20
diff changeset
   942
    QTest::newRow("normal")
hgs
parents: 20
diff changeset
   943
        << "2001:db8:85a3::8a2e:370:7334"
hgs
parents: 20
diff changeset
   944
        << "2001:db8:85a3:0:0:8a2e:370:7334";
hgs
parents: 20
diff changeset
   945
}
hgs
parents: 20
diff changeset
   946
hgs
parents: 20
diff changeset
   947
/**
hgs
parents: 20
diff changeset
   948
 * Tests invalid IPv6 DNS address.
hgs
parents: 20
diff changeset
   949
 */
hgs
parents: 20
diff changeset
   950
void TestCpPacketDataApPlugin::tcInvalidIpv6DnsAddress()
hgs
parents: 20
diff changeset
   951
{
hgs
parents: 20
diff changeset
   952
    QString previous = 
hgs
parents: 20
diff changeset
   953
        mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   954
    
hgs
parents: 20
diff changeset
   955
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget);
hgs
parents: 20
diff changeset
   956
    
hgs
parents: 20
diff changeset
   957
    // Erase old string
hgs
parents: 20
diff changeset
   958
    QString text = mTestViewAdvanced->mIpv6DnsAddress1->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
   959
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
   960
    
hgs
parents: 20
diff changeset
   961
    // Enter new string
hgs
parents: 20
diff changeset
   962
    HbAutoTest::keyClicks(mMainWindow, "abcdef:fedcba", 0, waitTime);
hgs
parents: 20
diff changeset
   963
hgs
parents: 20
diff changeset
   964
    HbAutoTest::mouseClick(mMainWindow, mIpv6PrimaryDnsAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
   965
hgs
parents: 20
diff changeset
   966
    QTest::qWait(100);
hgs
parents: 20
diff changeset
   967
    // Dismiss messagebox
hgs
parents: 20
diff changeset
   968
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
   969
        mMainWindow,
hgs
parents: 20
diff changeset
   970
        mTestViewAdvanced->mMessageBox.data(),
hgs
parents: 20
diff changeset
   971
        messageBoxOkButtonOffset);
hgs
parents: 20
diff changeset
   972
    
hgs
parents: 20
diff changeset
   973
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
   974
    subVerifyString(
hgs
parents: 20
diff changeset
   975
        CMManagerShim::PacketDataIPIP6NameServer1,
hgs
parents: 20
diff changeset
   976
        mTestViewAdvanced->mIpv6DnsAddress1,
hgs
parents: 20
diff changeset
   977
        previous);
hgs
parents: 20
diff changeset
   978
}
hgs
parents: 20
diff changeset
   979
hgs
parents: 20
diff changeset
   980
/**
hgs
parents: 20
diff changeset
   981
 * Collapses the IP settings group.
hgs
parents: 20
diff changeset
   982
 */
hgs
parents: 20
diff changeset
   983
void TestCpPacketDataApPlugin::tcCollapseIpSettings()
hgs
parents: 20
diff changeset
   984
{
hgs
parents: 20
diff changeset
   985
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, ipGroup);
hgs
parents: 20
diff changeset
   986
}
hgs
parents: 20
diff changeset
   987
hgs
parents: 20
diff changeset
   988
/**
hgs
parents: 20
diff changeset
   989
 * Expands the proxy settings group and gets UI widget pointers.
hgs
parents: 20
diff changeset
   990
 */
hgs
parents: 20
diff changeset
   991
void TestCpPacketDataApPlugin::tcExpandProxySettingsAndGetUiWidgets()
hgs
parents: 20
diff changeset
   992
{
hgs
parents: 20
diff changeset
   993
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
hgs
parents: 20
diff changeset
   994
hgs
parents: 20
diff changeset
   995
    QTest::qWait(500);
hgs
parents: 20
diff changeset
   996
    
hgs
parents: 20
diff changeset
   997
    subGetAdvancedUiWidgets(1);
hgs
parents: 20
diff changeset
   998
}
hgs
parents: 20
diff changeset
   999
hgs
parents: 20
diff changeset
  1000
/**
hgs
parents: 20
diff changeset
  1001
 * Tests changing of proxy server address.
hgs
parents: 20
diff changeset
  1002
 */
hgs
parents: 20
diff changeset
  1003
void TestCpPacketDataApPlugin::tcChangeProxyServerAddress()
hgs
parents: 20
diff changeset
  1004
{
hgs
parents: 20
diff changeset
  1005
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
  1006
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
  1007
    
hgs
parents: 20
diff changeset
  1008
    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget);
hgs
parents: 20
diff changeset
  1009
    
hgs
parents: 20
diff changeset
  1010
    // Erase old string
hgs
parents: 20
diff changeset
  1011
    QString text = mTestViewAdvanced->mProxyServer->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
  1012
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
  1013
    
hgs
parents: 20
diff changeset
  1014
    // Enter new string
hgs
parents: 20
diff changeset
  1015
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
  1016
hgs
parents: 20
diff changeset
  1017
    HbAutoTest::mouseClick(mMainWindow, mProxyServerAddressWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
  1018
hgs
parents: 20
diff changeset
  1019
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1020
    subVerifyString(
hgs
parents: 20
diff changeset
  1021
        CMManagerShim::CmProxyServerName,
hgs
parents: 20
diff changeset
  1022
        mTestViewAdvanced->mProxyServer,
hgs
parents: 20
diff changeset
  1023
        result);
hgs
parents: 20
diff changeset
  1024
    // Verify user defined address flag is set correctly
hgs
parents: 20
diff changeset
  1025
    if (result.isEmpty()) {
hgs
parents: 20
diff changeset
  1026
        subVerifyBool(
hgs
parents: 20
diff changeset
  1027
            CMManagerShim::CmProxyUsageEnabled,
hgs
parents: 20
diff changeset
  1028
            false);
hgs
parents: 20
diff changeset
  1029
    } else {
hgs
parents: 20
diff changeset
  1030
        subVerifyBool(
hgs
parents: 20
diff changeset
  1031
            CMManagerShim::CmProxyUsageEnabled,
hgs
parents: 20
diff changeset
  1032
            true);
hgs
parents: 20
diff changeset
  1033
    }
hgs
parents: 20
diff changeset
  1034
}
hgs
parents: 20
diff changeset
  1035
hgs
parents: 20
diff changeset
  1036
/**
hgs
parents: 20
diff changeset
  1037
 * Test data for proxy server address change test case.
hgs
parents: 20
diff changeset
  1038
 */
hgs
parents: 20
diff changeset
  1039
void TestCpPacketDataApPlugin::tcChangeProxyServerAddress_data()
hgs
parents: 20
diff changeset
  1040
{
hgs
parents: 20
diff changeset
  1041
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
  1042
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
  1043
  
hgs
parents: 20
diff changeset
  1044
    QTest::newRow("long")
hgs
parents: 20
diff changeset
  1045
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html"
hgs
parents: 20
diff changeset
  1046
        << "http://developer.symbian.org/main/documentation/reference/s^3/doc_source/AboutSymbianOSLibrary9.6/index.html";
hgs
parents: 20
diff changeset
  1047
    QTest::newRow("empty")
hgs
parents: 20
diff changeset
  1048
        << ""
hgs
parents: 20
diff changeset
  1049
        << "";
hgs
parents: 20
diff changeset
  1050
    QTest::newRow("basic") // last one should always fit on one line in UI
hgs
parents: 20
diff changeset
  1051
        << "http://www.symbian.org/"
hgs
parents: 20
diff changeset
  1052
        << "http://www.symbian.org/";
hgs
parents: 20
diff changeset
  1053
}
hgs
parents: 20
diff changeset
  1054
hgs
parents: 20
diff changeset
  1055
/**
hgs
parents: 20
diff changeset
  1056
 * Tests changing of proxy port number.
hgs
parents: 20
diff changeset
  1057
 */
hgs
parents: 20
diff changeset
  1058
void TestCpPacketDataApPlugin::tcChangeProxyPortNumber()
hgs
parents: 20
diff changeset
  1059
{
hgs
parents: 20
diff changeset
  1060
    QFETCH(QString, string);
hgs
parents: 20
diff changeset
  1061
    QFETCH(QString, result);
hgs
parents: 20
diff changeset
  1062
    
hgs
parents: 20
diff changeset
  1063
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
hgs
parents: 20
diff changeset
  1064
    
hgs
parents: 20
diff changeset
  1065
    // Erase old string
hgs
parents: 20
diff changeset
  1066
    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
  1067
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
  1068
    
hgs
parents: 20
diff changeset
  1069
    // Enter new string
hgs
parents: 20
diff changeset
  1070
    HbAutoTest::keyClicks(mMainWindow, string, 0, waitTime);
hgs
parents: 20
diff changeset
  1071
hgs
parents: 20
diff changeset
  1072
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
  1073
hgs
parents: 20
diff changeset
  1074
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1075
    subVerifyUint(
hgs
parents: 20
diff changeset
  1076
        CMManagerShim::CmProxyPortNumber,
hgs
parents: 20
diff changeset
  1077
        result.toInt());
hgs
parents: 20
diff changeset
  1078
    QCOMPARE(
hgs
parents: 20
diff changeset
  1079
        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
hgs
parents: 20
diff changeset
  1080
        result.toInt());
hgs
parents: 20
diff changeset
  1081
}
hgs
parents: 20
diff changeset
  1082
hgs
parents: 20
diff changeset
  1083
/**
hgs
parents: 20
diff changeset
  1084
 * Test data for proxy port number change test case.
hgs
parents: 20
diff changeset
  1085
 */
hgs
parents: 20
diff changeset
  1086
void TestCpPacketDataApPlugin::tcChangeProxyPortNumber_data()
hgs
parents: 20
diff changeset
  1087
{
hgs
parents: 20
diff changeset
  1088
    QTest::addColumn<QString>("string");
hgs
parents: 20
diff changeset
  1089
    QTest::addColumn<QString>("result");
hgs
parents: 20
diff changeset
  1090
  
hgs
parents: 20
diff changeset
  1091
    QTest::newRow("basic")
hgs
parents: 20
diff changeset
  1092
        << "8080"
hgs
parents: 20
diff changeset
  1093
        << "8080";
hgs
parents: 20
diff changeset
  1094
    QTest::newRow("too long")
hgs
parents: 20
diff changeset
  1095
        << "1234567890"
hgs
parents: 20
diff changeset
  1096
        << "12345";
hgs
parents: 20
diff changeset
  1097
    QTest::newRow("zero")
hgs
parents: 20
diff changeset
  1098
        << "0"
hgs
parents: 20
diff changeset
  1099
        << "";
hgs
parents: 20
diff changeset
  1100
    QTest::newRow("empty")
hgs
parents: 20
diff changeset
  1101
        << ""
hgs
parents: 20
diff changeset
  1102
        << "";
hgs
parents: 20
diff changeset
  1103
}
hgs
parents: 20
diff changeset
  1104
hgs
parents: 20
diff changeset
  1105
/**
hgs
parents: 20
diff changeset
  1106
 * Tests invalid proxy port number.
hgs
parents: 20
diff changeset
  1107
 */
hgs
parents: 20
diff changeset
  1108
void TestCpPacketDataApPlugin::tcInvalidProxyPortNumber()
hgs
parents: 20
diff changeset
  1109
{
hgs
parents: 20
diff changeset
  1110
    int previous = 
hgs
parents: 20
diff changeset
  1111
        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt();
hgs
parents: 20
diff changeset
  1112
    
hgs
parents: 20
diff changeset
  1113
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget);
hgs
parents: 20
diff changeset
  1114
    
hgs
parents: 20
diff changeset
  1115
    // Erase old string
hgs
parents: 20
diff changeset
  1116
    QString text = mTestViewAdvanced->mProxyPort->contentWidgetData("text").toString();
hgs
parents: 20
diff changeset
  1117
    subClearLineEdit(text.size());
hgs
parents: 20
diff changeset
  1118
    
hgs
parents: 20
diff changeset
  1119
    // Enter new string
hgs
parents: 20
diff changeset
  1120
    HbAutoTest::keyClicks(mMainWindow, "65536", 0, waitTime);
hgs
parents: 20
diff changeset
  1121
hgs
parents: 20
diff changeset
  1122
    HbAutoTest::mouseClick(mMainWindow, mProxyPortNumberWidget, exitEditorOffset);
hgs
parents: 20
diff changeset
  1123
hgs
parents: 20
diff changeset
  1124
    QTest::qWait(100);
hgs
parents: 20
diff changeset
  1125
    // Dismiss messagebox
hgs
parents: 20
diff changeset
  1126
    HbAutoTest::mouseClick(
hgs
parents: 20
diff changeset
  1127
        mMainWindow,
hgs
parents: 20
diff changeset
  1128
        mTestViewAdvanced->mMessageBox.data(),
hgs
parents: 20
diff changeset
  1129
        messageBoxOkButtonOffset);
hgs
parents: 20
diff changeset
  1130
    
hgs
parents: 20
diff changeset
  1131
    // Verify both commsdat and UI widget
hgs
parents: 20
diff changeset
  1132
    subVerifyUint(
hgs
parents: 20
diff changeset
  1133
        CMManagerShim::CmProxyPortNumber,
hgs
parents: 20
diff changeset
  1134
        previous);
hgs
parents: 20
diff changeset
  1135
    QCOMPARE(
hgs
parents: 20
diff changeset
  1136
        mTestViewAdvanced->mProxyPort->contentWidgetData("text").toInt(),
hgs
parents: 20
diff changeset
  1137
        previous);
hgs
parents: 20
diff changeset
  1138
}
hgs
parents: 20
diff changeset
  1139
hgs
parents: 20
diff changeset
  1140
/**
hgs
parents: 20
diff changeset
  1141
 * Collapses the proxy settings group.
hgs
parents: 20
diff changeset
  1142
 */
hgs
parents: 20
diff changeset
  1143
void TestCpPacketDataApPlugin::tcCollapseProxySettings()
hgs
parents: 20
diff changeset
  1144
{
hgs
parents: 20
diff changeset
  1145
    HbAutoTest::mouseClick(mMainWindow, mTestViewAdvanced, proxyGroup);
hgs
parents: 20
diff changeset
  1146
}
hgs
parents: 20
diff changeset
  1147
hgs
parents: 20
diff changeset
  1148
/**
hgs
parents: 20
diff changeset
  1149
 * Returns from advanced settings view.
hgs
parents: 20
diff changeset
  1150
 */
hgs
parents: 20
diff changeset
  1151
void TestCpPacketDataApPlugin::tcCloseAdvancedSettingsView()
hgs
parents: 20
diff changeset
  1152
{
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1153
    // Return from advanced settings view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1154
    subClickWidget("HbNavigationButton");
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1155
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1156
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1157
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1158
// SUB TEST CASES
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1159
// -----------------------------------------------------------------------------
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1160
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1161
/**
32
hgs
parents: 20
diff changeset
  1162
 * Gets UI widget pointers.
hgs
parents: 20
diff changeset
  1163
 */
hgs
parents: 20
diff changeset
  1164
void TestCpPacketDataApPlugin::subGetUiWidgets()
hgs
parents: 20
diff changeset
  1165
{
hgs
parents: 20
diff changeset
  1166
    HbModelIterator iterator(mTestView->mModel);
hgs
parents: 20
diff changeset
  1167
    
hgs
parents: 20
diff changeset
  1168
    // Get "Access point settings" group item
hgs
parents: 20
diff changeset
  1169
    QModelIndex apGroupIndex = iterator.index(0);
hgs
parents: 20
diff changeset
  1170
    
hgs
parents: 20
diff changeset
  1171
    // Get UI widgets
hgs
parents: 20
diff changeset
  1172
    mConnectionNameWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1173
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1174
        iterator.index(0, apGroupIndex));
hgs
parents: 20
diff changeset
  1175
    mAccessPointNameWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1176
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1177
        iterator.index(1, apGroupIndex));
hgs
parents: 20
diff changeset
  1178
    mUserNameWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1179
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1180
        iterator.index(2, apGroupIndex));
hgs
parents: 20
diff changeset
  1181
    mPasswordWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1182
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1183
        iterator.index(4, apGroupIndex));
hgs
parents: 20
diff changeset
  1184
    mAuthenticationWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1185
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1186
        iterator.index(5, apGroupIndex));
hgs
parents: 20
diff changeset
  1187
    mHomepageWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1188
        mTestView->mForm,
hgs
parents: 20
diff changeset
  1189
        iterator.index(6, apGroupIndex));
hgs
parents: 20
diff changeset
  1190
}
hgs
parents: 20
diff changeset
  1191
hgs
parents: 20
diff changeset
  1192
/**
hgs
parents: 20
diff changeset
  1193
 * Gets advanced settings view UI widget pointers by group index.
hgs
parents: 20
diff changeset
  1194
 */
hgs
parents: 20
diff changeset
  1195
void TestCpPacketDataApPlugin::subGetAdvancedUiWidgets(
hgs
parents: 20
diff changeset
  1196
    uint index)
hgs
parents: 20
diff changeset
  1197
{
hgs
parents: 20
diff changeset
  1198
    // Get the group item
hgs
parents: 20
diff changeset
  1199
    HbModelIterator iterator(mTestViewAdvanced->mModel);
hgs
parents: 20
diff changeset
  1200
    QModelIndex groupIndex = iterator.index(index);
hgs
parents: 20
diff changeset
  1201
    
hgs
parents: 20
diff changeset
  1202
    // Get UI widgets
hgs
parents: 20
diff changeset
  1203
    if (index == 0) {
hgs
parents: 20
diff changeset
  1204
        // IP settings group
hgs
parents: 20
diff changeset
  1205
        mNetworkTypeWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1206
            mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1207
            iterator.index(0, groupIndex));
hgs
parents: 20
diff changeset
  1208
        if (qobject_cast<HbComboBox *>(mNetworkTypeWidget)->currentIndex() == 0) {
hgs
parents: 20
diff changeset
  1209
            // IPv4
hgs
parents: 20
diff changeset
  1210
            mIpv4AddressAutomaticWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1211
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1212
                iterator.index(1, groupIndex));
hgs
parents: 20
diff changeset
  1213
            mIpv4AddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1214
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1215
                iterator.index(2, groupIndex));
hgs
parents: 20
diff changeset
  1216
            mIpv4DnsAddressAutomaticWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1217
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1218
                iterator.index(3, groupIndex));
hgs
parents: 20
diff changeset
  1219
            mIpv4PrimaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1220
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1221
                iterator.index(4, groupIndex));
hgs
parents: 20
diff changeset
  1222
            mIpv4SecondaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1223
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1224
                iterator.index(5, groupIndex));
hgs
parents: 20
diff changeset
  1225
        } else {
hgs
parents: 20
diff changeset
  1226
            // IPv6
hgs
parents: 20
diff changeset
  1227
            mIpv6DnsAddressAutomaticWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1228
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1229
                iterator.index(1, groupIndex));
hgs
parents: 20
diff changeset
  1230
            mIpv6PrimaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1231
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1232
                iterator.index(2, groupIndex));
hgs
parents: 20
diff changeset
  1233
            mIpv6SecondaryDnsAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1234
                mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1235
                iterator.index(3, groupIndex));
hgs
parents: 20
diff changeset
  1236
        }
hgs
parents: 20
diff changeset
  1237
    } else {
hgs
parents: 20
diff changeset
  1238
        // Proxy settings group
hgs
parents: 20
diff changeset
  1239
        mProxyServerAddressWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1240
            mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1241
            iterator.index(0, groupIndex));
hgs
parents: 20
diff changeset
  1242
        mProxyPortNumberWidget = subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1243
            mTestViewAdvanced->mForm,
hgs
parents: 20
diff changeset
  1244
            iterator.index(1, groupIndex));
hgs
parents: 20
diff changeset
  1245
    }
hgs
parents: 20
diff changeset
  1246
}
hgs
parents: 20
diff changeset
  1247
hgs
parents: 20
diff changeset
  1248
/**
hgs
parents: 20
diff changeset
  1249
 * Gets an UI widget from HbDataForm by index. 
hgs
parents: 20
diff changeset
  1250
 */
hgs
parents: 20
diff changeset
  1251
HbWidget *TestCpPacketDataApPlugin::subGetWidgetByIndex(
hgs
parents: 20
diff changeset
  1252
    HbDataForm *form,
hgs
parents: 20
diff changeset
  1253
    const QModelIndex &index)
hgs
parents: 20
diff changeset
  1254
{
hgs
parents: 20
diff changeset
  1255
    HbDataFormViewItem *viewItem = qobject_cast<HbDataFormViewItem *>
hgs
parents: 20
diff changeset
  1256
        (form->itemByIndex(index));
hgs
parents: 20
diff changeset
  1257
    HbWidget *widget = viewItem->dataItemContentWidget();
hgs
parents: 20
diff changeset
  1258
    //QString widgetClassName(widget->metaObject()->className());
hgs
parents: 20
diff changeset
  1259
    //qDebug() << widgetClassName;
hgs
parents: 20
diff changeset
  1260
    return widget;
hgs
parents: 20
diff changeset
  1261
}
hgs
parents: 20
diff changeset
  1262
hgs
parents: 20
diff changeset
  1263
/**
hgs
parents: 20
diff changeset
  1264
 * Writes initial settings to CommsDat needed by some test cases.
hgs
parents: 20
diff changeset
  1265
 */
hgs
parents: 20
diff changeset
  1266
void TestCpPacketDataApPlugin::subInitializeCommsDat()
hgs
parents: 20
diff changeset
  1267
{
hgs
parents: 20
diff changeset
  1268
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
hgs
parents: 20
diff changeset
  1269
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
hgs
parents: 20
diff changeset
  1270
        cmManager->connectionMethod(testApId));
hgs
parents: 20
diff changeset
  1271
    
hgs
parents: 20
diff changeset
  1272
    // Initial settings
hgs
parents: 20
diff changeset
  1273
    connectionMethod->setStringAttribute(
hgs
parents: 20
diff changeset
  1274
        CMManagerShim::PacketDataIFAuthName,
hgs
parents: 20
diff changeset
  1275
        tooLongUserName);
hgs
parents: 20
diff changeset
  1276
    
hgs
parents: 20
diff changeset
  1277
    connectionMethod->update();
hgs
parents: 20
diff changeset
  1278
}
hgs
parents: 20
diff changeset
  1279
hgs
parents: 20
diff changeset
  1280
/**
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1281
 * Creates the settings view and shows it.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1282
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1283
void TestCpPacketDataApPlugin::subCreateSettingsView(uint connectionMethodId)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1284
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1285
    // Create settings view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1286
    HbView *view = mPlugin->createSettingView(connectionMethodId);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1287
    QVERIFY(view != NULL);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1288
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1289
    // Display the view
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1290
    mMainWindow->addView(view);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1291
    mMainWindow->setCurrentView(view);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1292
    // Store pointer to settings view class
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1293
    mTestView = static_cast<CpPacketDataApView *>(view);    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1294
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1295
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1296
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1297
 * 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
  1298
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1299
void TestCpPacketDataApPlugin::subVerifyString(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1300
    CMManagerShim::ConnectionMethodAttribute attribute,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1301
    HbDataFormModelItem *item,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1302
    QString expected)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1303
{
32
hgs
parents: 20
diff changeset
  1304
    QTest::qWait(waitTime);
hgs
parents: 20
diff changeset
  1305
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1306
    // Read attribute value from CommsDat
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1307
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1308
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1309
        cmManager->connectionMethod(testApId));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1310
    QString commsdat = connectionMethod->getStringAttribute(attribute);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1311
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1312
    QCOMPARE(commsdat, expected);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1313
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1314
    // Get value from UI widget
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1315
    QString widget = item->contentWidgetData("text").toString();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1316
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1317
    QCOMPARE(widget, expected);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1318
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1319
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1320
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1321
 * Clears a HbLineEdit.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1322
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1323
void TestCpPacketDataApPlugin::subClearLineEdit(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1324
    uint length)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1325
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1326
    // Move cursor to end of string
32
hgs
parents: 20
diff changeset
  1327
    //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
  1328
    HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1329
    HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1330
    HbAutoTest::keyClick(mMainWindow, Qt::Key_Down, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1331
    for (int i=0; i<25; i++) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1332
        HbAutoTest::keyClick(mMainWindow, Qt::Key_Right, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1333
    }
32
hgs
parents: 20
diff changeset
  1334
    // Erase string
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1335
    for (int i=0; i<length; i++) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1336
        HbAutoTest::keyClick(mMainWindow, Qt::Key_Backspace, 0, waitTime);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1337
    }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1338
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1339
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1340
/**
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1341
 * Gets value of a boolean attribute from CommsDat.
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1342
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1343
bool TestCpPacketDataApPlugin::subGetBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1344
    CMManagerShim::ConnectionMethodAttribute attribute)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1345
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1346
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1347
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1348
        cmManager->connectionMethod(testApId));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1349
    return connectionMethod->getBoolAttribute(attribute);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1350
}
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
 * 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
  1354
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1355
void TestCpPacketDataApPlugin::subVerifyBool(
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1356
    CMManagerShim::ConnectionMethodAttribute attribute,
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1357
    bool expected)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1358
{
32
hgs
parents: 20
diff changeset
  1359
    QTest::qWait(waitTime);
hgs
parents: 20
diff changeset
  1360
    
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1361
    // Read attribute value from CommsDat
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1362
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1363
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1364
        cmManager->connectionMethod(testApId));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1365
    bool commsdat = connectionMethod->getBoolAttribute(attribute);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1366
    
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1367
    QCOMPARE(commsdat, expected);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1368
}
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1369
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1370
/**
32
hgs
parents: 20
diff changeset
  1371
 * Verifies that given attribute contains expected integer value in CommsDat. 
hgs
parents: 20
diff changeset
  1372
 */
hgs
parents: 20
diff changeset
  1373
void TestCpPacketDataApPlugin::subVerifyUint(
hgs
parents: 20
diff changeset
  1374
    CMManagerShim::ConnectionMethodAttribute attribute,
hgs
parents: 20
diff changeset
  1375
    uint expected)
hgs
parents: 20
diff changeset
  1376
{
hgs
parents: 20
diff changeset
  1377
    QTest::qWait(waitTime);
hgs
parents: 20
diff changeset
  1378
hgs
parents: 20
diff changeset
  1379
    // Read attribute value from CommsDat
hgs
parents: 20
diff changeset
  1380
    QScopedPointer<CmManagerShim> cmManager(new CmManagerShim);
hgs
parents: 20
diff changeset
  1381
    QScopedPointer<CmConnectionMethodShim> connectionMethod( 
hgs
parents: 20
diff changeset
  1382
        cmManager->connectionMethod(testApId));
hgs
parents: 20
diff changeset
  1383
    uint commsdat = connectionMethod->getIntAttribute(attribute);
hgs
parents: 20
diff changeset
  1384
    
hgs
parents: 20
diff changeset
  1385
    QCOMPARE(commsdat, expected);
hgs
parents: 20
diff changeset
  1386
}
hgs
parents: 20
diff changeset
  1387
hgs
parents: 20
diff changeset
  1388
/**
20
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1389
 * 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
  1390
 */
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1391
void TestCpPacketDataApPlugin::subClickWidget(const QString &name)
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1392
{
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1393
    QList<QGraphicsItem *> itemList = mMainWindow->scene()->items();
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1394
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1395
    QGraphicsItem *target = 0;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1396
    foreach (QGraphicsItem* item, itemList) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1397
        if (item->isWidget()) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1398
            QString widgetClassName(static_cast<QGraphicsWidget*>(item)->metaObject()->className());
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1399
            //qDebug() << widgetClassName;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1400
            
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1401
            if (widgetClassName == name) {
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1402
                target = item;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1403
                break;
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1404
            }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1405
        }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1406
    }
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1407
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1408
    Q_ASSERT(target);
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1409
    HbAutoTest::mouseClick(mMainWindow, static_cast<HbWidget *>(target));
9c97ad6591ae Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1410
}
32
hgs
parents: 20
diff changeset
  1411
hgs
parents: 20
diff changeset
  1412
/**
hgs
parents: 20
diff changeset
  1413
 * Scrolls the tested view to the bottom.
hgs
parents: 20
diff changeset
  1414
 */
hgs
parents: 20
diff changeset
  1415
void TestCpPacketDataApPlugin::subScrollToBottom()
hgs
parents: 20
diff changeset
  1416
{
hgs
parents: 20
diff changeset
  1417
    // Scroll to the bottom of the view
hgs
parents: 20
diff changeset
  1418
    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
hgs
parents: 20
diff changeset
  1419
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
  1420
    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollTop);
hgs
parents: 20
diff changeset
  1421
    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollTop);
hgs
parents: 20
diff changeset
  1422
}
hgs
parents: 20
diff changeset
  1423
hgs
parents: 20
diff changeset
  1424
/**
hgs
parents: 20
diff changeset
  1425
 * Scrolls the tested view to the top.
hgs
parents: 20
diff changeset
  1426
 */
hgs
parents: 20
diff changeset
  1427
void TestCpPacketDataApPlugin::subScrollToTop()
hgs
parents: 20
diff changeset
  1428
{
hgs
parents: 20
diff changeset
  1429
    // Scroll to the top of the view
hgs
parents: 20
diff changeset
  1430
    HbAutoTest::mousePress(mMainWindow, mTestView, scrollMiddle);
hgs
parents: 20
diff changeset
  1431
    QTest::qWait(1000);
hgs
parents: 20
diff changeset
  1432
    HbAutoTest::mouseMove(mMainWindow, mTestView, scrollBottom);
hgs
parents: 20
diff changeset
  1433
    HbAutoTest::mouseRelease(mMainWindow, mTestView, scrollBottom);
hgs
parents: 20
diff changeset
  1434
}