satui/satapp/tsrc/ut_satapp/src/ut_satappeventhandler.cpp
changeset 15 d7fc66ccd6fb
equal deleted inserted replaced
13:e32024264ebb 15:d7fc66ccd6fb
       
     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: Unit test for satappeventprovider
       
    15 *
       
    16 */
       
    17 
       
    18 #include "ut_satappeventhandler.h"
       
    19 //test class
       
    20 #include "satappeventprovider.h"
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // Ut_SatAppEventProvider::Ut_SatAppEventProvider
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 Ut_SatAppEventProvider::Ut_SatAppEventProvider(QObject *parent):
       
    27         QObject(parent), mEventHandler(0)
       
    28 {
       
    29     qDebug("Ut_SatAppEventProvider::Ut_SatAppEventProvider >");
       
    30     qDebug("Ut_SatAppEventProvider::Ut_SatAppEventProvider <");
       
    31 }
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // Ut_SatAppEventProvider::~Ut_SatAppEventProvider
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 Ut_SatAppEventProvider::~Ut_SatAppEventProvider()
       
    38 {
       
    39     qDebug("Ut_SatAppEventProvider::~Ut_SatAppEventProvider >");
       
    40     qDebug("Ut_SatAppEventProvider::~Ut_SatAppEventProvider <");
       
    41 }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // Ut_SatAppEventProvider::initTestCase
       
    45 // QTestLib cleanup method, called after the last testfunction .
       
    46 // -----------------------------------------------------------------------------
       
    47 void Ut_SatAppEventProvider::initTestCase()
       
    48 {
       
    49     qDebug("Ut_SatAppEventProvider::initTestCase >");
       
    50     qDebug("Ut_SatAppEventProvider::initTestCase <");
       
    51 }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // Ut_SatAppEventProvider::cleanupTestCase
       
    55 // 
       
    56 // Connects to test object signal and verifies received data.
       
    57 // -----------------------------------------------------------------------------
       
    58 void Ut_SatAppEventProvider::cleanupTestCase()
       
    59 {
       
    60     qDebug("Ut_SatAppEventProvider::cleanupTestCase >");
       
    61     delete mEventHandler;
       
    62     mEventHandler = 0;
       
    63     qDebug("Ut_SatAppEventProvider::cleanupTestCase <");
       
    64 }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // Ut_SatAppEventProvider::testProfileState
       
    68 // 
       
    69 // Connects to test object signal and verifies received data.
       
    70 // -----------------------------------------------------------------------------
       
    71 void Ut_SatAppEventProvider::testCreateEventHandler()
       
    72 {
       
    73     qDebug("Ut_SatAppEventProvider::testCreateEventHandler >");
       
    74     mEventHandler = new SatAppEventProvider;
       
    75     QVERIFY(mEventHandler);
       
    76     qDebug("Ut_SatAppEventProvider::testCreateEventHandler <");
       
    77 }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // Ut_SatAppEventProvider::testShowSsWaitNote_data
       
    81 // 
       
    82 // Connects to test object signal and verifies received data.
       
    83 // -----------------------------------------------------------------------------
       
    84 void Ut_SatAppEventProvider::testShowSsWaitNote_data()
       
    85 {
       
    86     qDebug("Ut_SatAppEventProvider::testShowSsWaitNote_data >");
       
    87     QTest::addColumn<QString>("text");
       
    88     QTest::addColumn<bool>("isSelfExplanatoryIcon");
       
    89     QTest::newRow("first") << "Show Ss Wait note First!" << false;
       
    90     QTest::newRow("second") << "Show Ss Wait note seconde!" << true;
       
    91     QTest::newRow("third") << "" << false;
       
    92     qDebug("Ut_SatAppEventProvider::testShowSsWaitNote_data <");
       
    93 }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // Ut_SatAppEventProvider::testProfileState
       
    97 // 
       
    98 // Connects to test object signal and verifies received data.
       
    99 // -----------------------------------------------------------------------------
       
   100 void Ut_SatAppEventProvider::testShowSsWaitNote()
       
   101 {
       
   102     qDebug("Ut_SatAppEventProvider::testShowSsWaitNote >");
       
   103     QVERIFY(mEventHandler);
       
   104     QFETCH(QString, text);
       
   105     QFETCH(bool, isSelfExplanatoryIcon);
       
   106     // text
       
   107     HBufC* hText = HBufC::New(text.length());
       
   108     TPtr aText( hText->Des() );
       
   109     aText.Copy( text.utf16() );
       
   110     CFbsBitmap* bitmap(NULL);
       
   111     TRAPD(err, mEventHandler->ShowSsWaitNoteL(aText,bitmap,
       
   112           isSelfExplanatoryIcon));
       
   113     delete hText;
       
   114     hText = 0;
       
   115     QCOMPARE(err, KErrNone);
       
   116     qDebug("Ut_SatAppEventProvider::testShowSsWaitNote <");
       
   117 }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // Ut_SatAppEventProvider::testProfileState
       
   121 // 
       
   122 // Connects to test object signal and verifies received data.
       
   123 // -----------------------------------------------------------------------------
       
   124 void Ut_SatAppEventProvider:: testStopShowWaitNote()
       
   125 {
       
   126     qDebug("Ut_SatAppEventProvider::testStopShowWaitNote >");
       
   127     QVERIFY(mEventHandler);
       
   128     mEventHandler->StopShowWaitNote();
       
   129     qDebug("Ut_SatAppEventProvider::testStopShowWaitNote <");
       
   130 }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // Ut_SatAppEventProvider::ShowWaitNoteWithoutDelayL
       
   134 // 
       
   135 // Connects to test object signal and verifies received data.
       
   136 // -----------------------------------------------------------------------------
       
   137 void Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay()
       
   138 {
       
   139     qDebug("Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay >");
       
   140     QVERIFY(mEventHandler);
       
   141     TRAPD(err,mEventHandler->ShowWaitNoteWithoutDelayL());
       
   142     QCOMPARE(err, KErrNone);
       
   143     qDebug("Ut_SatAppEventProvider::testShowWaitNoteWithoutDelay <");
       
   144 }
       
   145 
       
   146 // -----------------------------------------------------------------------------
       
   147 // Ut_SatAppEventProvider::testShowSsErrorNote
       
   148 // 
       
   149 // Connects to test object signal and verifies received data.
       
   150 // -----------------------------------------------------------------------------
       
   151 void Ut_SatAppEventProvider::testShowSsErrorNote()
       
   152 {
       
   153     qDebug("Ut_SatAppEventProvider::testShowSsErrorNote >");
       
   154     QVERIFY(mEventHandler);
       
   155     TRAPD(err, mEventHandler->ShowSsErrorNoteL());
       
   156     QCOMPARE(err, KErrNone);
       
   157     qDebug("Ut_SatAppEventProvider::testShowSsErrorNote <");
       
   158 }
       
   159     
       
   160 // End of file