telutils/keysequencerecognitionservice/tsrc/ut_keysequencehandler/ut_keysequencehandler.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     1 /*!
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QtGui>
       
    19 #include <QtTest/QtTest>
       
    20 #include "ut_keysequencehandler.h"
       
    21 #include "keysequencehandler.h"
       
    22 #include "qtestmains60.h"
       
    23 
       
    24 bool TestClassDriver::executeKeySequence(const QString &keySequence)
       
    25 {
       
    26     Q_UNUSED(keySequence)
       
    27     return true;
       
    28 }
       
    29 
       
    30 void TestClassDriver::setKeySequenceValidator(const QString &validator)
       
    31 {
       
    32     KeySequenceHandler::setKeySequenceValidator(validator);
       
    33 }
       
    34 
       
    35 UT_KeySequenceHandler::UT_KeySequenceHandler()
       
    36     :
       
    37     m_handler(0)
       
    38 {
       
    39     
       
    40 }
       
    41 
       
    42 UT_KeySequenceHandler::~UT_KeySequenceHandler()
       
    43 {
       
    44     
       
    45 }
       
    46 
       
    47 void UT_KeySequenceHandler::init()
       
    48 {
       
    49     initialize();
       
    50     
       
    51     m_handler = new TestClassDriver();
       
    52 }
       
    53 
       
    54 void UT_KeySequenceHandler::cleanup()
       
    55 {
       
    56     reset();
       
    57     
       
    58     delete m_handler;
       
    59     m_handler = 0;
       
    60 }
       
    61 
       
    62 
       
    63 void UT_KeySequenceHandler::t_keySequenceValidator()
       
    64 {
       
    65     QString validator = m_handler->keySequenceValidator();
       
    66     QCOMPARE(validator, QString(""));
       
    67 }
       
    68 
       
    69 
       
    70 void UT_KeySequenceHandler::t_setKeySequenceValidator()
       
    71 {
       
    72     const QString KValidatorString = "123";
       
    73     m_handler->setKeySequenceValidator(KValidatorString);
       
    74     QCOMPARE(m_handler->keySequenceValidator(), KValidatorString);
       
    75 }
       
    76 
       
    77 QTEST_MAIN_S60(UT_KeySequenceHandler)