diff options
author | dac <qt-info@nokia.com> | 2010-06-09 16:24:18 +1000 |
---|---|---|
committer | dac <qt-info@nokia.com> | 2010-06-09 16:24:18 +1000 |
commit | 22cb28276882c6cd82b83dcbf5e29153d1f1eee6 (patch) | |
tree | 27efc9ddc0451e3a6b594ff9cddd9bbec4d96d0f | |
parent | 6bee6f061201eada7d8314c0202b4833d3023b8b (diff) |
Add automatic version of sys_contacts
-rw-r--r-- | QtMobility/QtMobility.pro | 2 | ||||
-rw-r--r-- | QtMobility/sys_contacts_automatic/sys_contacts_automatic.js | 243 | ||||
-rw-r--r-- | QtMobility/sys_contacts_automatic/sys_contacts_automatic.pro | 2 | ||||
-rw-r--r-- | QtMobility/sys_contacts_automatic/testdata/avatar1.png | bin | 0 -> 8031 bytes | |||
-rw-r--r-- | QtMobility/sys_contacts_automatic/testdata/avatar2.png | bin | 0 -> 19412 bytes | |||
-rw-r--r-- | QtMobility/sys_contacts_automatic/testdata/avatar3.png | bin | 0 -> 20374 bytes | |||
-rw-r--r-- | QtMobility/sys_contacts_manual/sys_contacts.js (renamed from QtMobility/sys_contacts/sys_contacts.js) | 0 | ||||
-rw-r--r-- | QtMobility/sys_contacts_manual/sys_contacts.pro (renamed from QtMobility/sys_contacts/sys_contacts.pro) | 0 |
8 files changed, 246 insertions, 1 deletions
diff --git a/QtMobility/QtMobility.pro b/QtMobility/QtMobility.pro index d7f1f91..decf06a 100644 --- a/QtMobility/QtMobility.pro +++ b/QtMobility/QtMobility.pro @@ -1,2 +1,2 @@ TEMPLATE=subdirs -SUBDIRS+=sys_bearer sys_calendar sys_contacts sys_messaging sys_multimedia sys_sensors +SUBDIRS+=sys_bearer sys_calendar sys_contacts_automatic sys_contacts_manual sys_messaging sys_multimedia sys_sensors diff --git a/QtMobility/sys_contacts_automatic/sys_contacts_automatic.js b/QtMobility/sys_contacts_automatic/sys_contacts_automatic.js new file mode 100644 index 0000000..3864104 --- /dev/null +++ b/QtMobility/sys_contacts_automatic/sys_contacts_automatic.js @@ -0,0 +1,243 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of QtUiTest. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//TESTED_COMPONENT=src/contacts + +// helper function re :contact actions may be in a separate "Contacts menu" +function contactsMenuItem(menuText) +{ + var menuEntries = getValue(menuBar()).toString().split("\n"); + var index = 0; + var separateMenu = false; // optimize number of calls to indexOf + + for (index = 0; index < menuEntries.length; index++){ + if (!separateMenu && menuEntries[index].indexOf("&Contacts") >= 0){ + separateMenu = true; + menuText = "&Contacts/" + menuText; + } + if (menuEntries[index] == menuText) + return menuText; + } + + return undefined; + +} + +// Returns true if contact named,name, can be found in contact list +function contactFind(name, partialMatch){ + var contactList = findWidget( { className: "QListWidget" } ); + var nameList = getValue(contactList).split("\n"); + var index = 0; + var found = false; + if (partialMatch == undefined){ + partialMatch = false; + } + for (index = 0; index < nameList.length; index++){ + if ((!partialMatch && nameList[index] == name) + || (partialMatch && nameList[index].contains(name))){ + found = true; + break; + } + } + + return found; +} + +testcase = { + + + initTestCase: function() + { + startApplication("samplephonebook"); + }, + + + /* Requirement: Add some contacts */ + addContact: function(name, phone, email, address, avatar) + { + select("Add"); + enter(name, "Name"); + enter(phone, "Phone"); + enter(email, "Email"); + enter(address, "Address"); + var selectPictureBtn = findByProperty( { className: "QPushButton", text : "Set picture" }); + select(selectPictureBtn[0]); + enter(avatar, "File name:"); + // need to accept entry due to autocompletion + keyClick(Qt.Key_Enter); + select("&Save"); + }, + + addContact_data : { + Name1 : ["Name1", "Phone1", "Email1", "Address1", "testdata/avatar1.png"], + Name2 : ["Name2", "Phone2", "Email2", "Address2", "testdata/avatar2.png"], + Name3 : ["Name3", "Phone3", "Email3", "Address3", "testdata/avatar3.png"] + }, + + + /* verify added contact by name */ + checkAddedContactName: function(name) + { + var contactList = findWidget( { className: "QListWidget" } ); + select(name, contactList[0]); + }, + + checkAddedContactName_data : { + Name1 : ["Name1"], + Name2 : ["Name2"], + Name3 : ["Name3"] + }, + + + /* Requirement: Verify the contact details and confirm that it can be updated */ + /* verify added contact details and update contact name */ + checkContactDetails : function (name, phone, email, address) + { + var contactList = findWidget( { className: "QListWidget" } ); + select(name, contactList[0]); + select("&Edit"); + compare(getText("Name"), name); + enter(name+"*", "Name"); + compare(getText("Phone"), phone); + compare(getText("Email"), email); + compare(getText("Address"), address); + select("&Save"); + }, + + checkContactDetails_data : { + Name1 : ["Name1", "Phone1", "Email1", "Address1"], + Name2 : ["Name2", "Phone2", "Email2", "Address2"], + Name3 : ["Name3", "Phone3", "Email3", "Address3"] + }, + + + /* verify updated contact name*/ + checkModifiedContactName: function(name) + { + var contactList = findWidget( { className: "QListWidget" } ); + select(name, contactList[0]); + }, + checkModifiedContactName_data : { + Name1 : ["Name1*"], + Name2 : ["Name2*"], + Name3 : ["Name3*"] + }, + + + /* Requirement : Verify the correct match of contacts against a simple filter */ + /* Test the "Apply &Filter" function */ + filterCheck : function(name, exists, message, partialMatch) { + var menuItemName = "Apply &Filter..."; + var menuItem = contactsMenuItem(menuItemName); + verify(menuItem != undefined, "No such \"" + menuItemName + "\" menu") + select(menuItem, menuBar()); + enter(name, "Name"); + select("&Filter"); + verify(contactFind(name, partialMatch) == exists, "Apply filter failed: " +name + ":" + exists + " " + message); + }, + + filterCheck_data : { + Name1 : ["Name1*", true, false, "Full contact name match"], + Name2 : ["2", true, true, "Partial contact name match"], + Name3 : ["NonExistant", false, false, "Non-existant contact name"] + + }, + + + /* Test the "Clear Filter" function, this is pre-requisite for deleteContact(name) */ + clearFilterCheck : function(name){ + select(contactsMenuItem("&Clear Filter"), menuBar()); + verify(contactFind(name), "Clear filter failed: Looking for " + name); + }, + + clearFilterCheck_data : { + Name1 : ["Name1*"] + }, + + + /* Requirement : Verify contact export*/ + /* If versit suport is present test it */ + exportContacts: function(name1, name2, name3) + { + var menuItemName = "Ex&port contacts..."; + var menuItem = contactsMenuItem(menuItemName); + if (menuItem == undefined) + skip("Versit support not enabled", SkipAll); + + select(menuItem, menuBar()); + + var contactsVCFFile = "testdata/contacts.vcf"; + + enter(contactsVCFFile, "File name:"); + select("&Save"); + var contactVCFData = getData(contactsVCFFile); + if (!(contactVCFData.indexOf(name1) + && contactVCFData.indexOf(name2) + && contactVCFData.indexOf(name3))){ + print(".vcf contains:" + contactVCFData); + deletePath(contactsVCFFile); + fail("Did not find in .vcf:" + name1 + "," + name2 + "," + name3); + } + deletePath(contactsVCFFile); + + }, + + exportContacts_data : { + NameSet1 : ["FN:Name1*", "FN:Name2*", "FN:Name3*"] + }, + + + /* Requirement: Verify that a contact can be deleted */ + deleteContact : function(name){ + var contactList = findWidget( { className: "QListWidget" } ); + select(name, contactList[0]); + select("&Delete"); + + verify(!contactFind(name), "Delete contact failed on " + name); + }, + deleteContact_data : { + Name1 : ["Name3*"], + Name2 : ["Name1*"], + Name3 : ["Name2*"] + }, + + +} diff --git a/QtMobility/sys_contacts_automatic/sys_contacts_automatic.pro b/QtMobility/sys_contacts_automatic/sys_contacts_automatic.pro new file mode 100644 index 0000000..1e30faf --- /dev/null +++ b/QtMobility/sys_contacts_automatic/sys_contacts_automatic.pro @@ -0,0 +1,2 @@ +SOURCES=sys_contacts_automatic.js +CONFIG+=systemtest diff --git a/QtMobility/sys_contacts_automatic/testdata/avatar1.png b/QtMobility/sys_contacts_automatic/testdata/avatar1.png Binary files differnew file mode 100644 index 0000000..ba516d6 --- /dev/null +++ b/QtMobility/sys_contacts_automatic/testdata/avatar1.png diff --git a/QtMobility/sys_contacts_automatic/testdata/avatar2.png b/QtMobility/sys_contacts_automatic/testdata/avatar2.png Binary files differnew file mode 100644 index 0000000..94f85d7 --- /dev/null +++ b/QtMobility/sys_contacts_automatic/testdata/avatar2.png diff --git a/QtMobility/sys_contacts_automatic/testdata/avatar3.png b/QtMobility/sys_contacts_automatic/testdata/avatar3.png Binary files differnew file mode 100644 index 0000000..36d43aa --- /dev/null +++ b/QtMobility/sys_contacts_automatic/testdata/avatar3.png diff --git a/QtMobility/sys_contacts/sys_contacts.js b/QtMobility/sys_contacts_manual/sys_contacts.js index 3cfda1d..3cfda1d 100644 --- a/QtMobility/sys_contacts/sys_contacts.js +++ b/QtMobility/sys_contacts_manual/sys_contacts.js diff --git a/QtMobility/sys_contacts/sys_contacts.pro b/QtMobility/sys_contacts_manual/sys_contacts.pro index 53d6d16..53d6d16 100644 --- a/QtMobility/sys_contacts/sys_contacts.pro +++ b/QtMobility/sys_contacts_manual/sys_contacts.pro |