phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneindicatorcontroller/unit_tests.cpp
changeset 76 cfea66083b62
parent 74 d1c62c765e48
equal deleted inserted replaced
74:d1c62c765e48 76:cfea66083b62
    41 
    41 
    42 #include <logsmodel.h>
    42 #include <logsmodel.h>
    43 #include "phoneindicatorcontroller.h"
    43 #include "phoneindicatorcontroller.h"
    44 #include "phoneindicators.h"
    44 #include "phoneindicators.h"
    45 #include "hbindicatorstubhelper.h"
    45 #include "hbindicatorstubhelper.h"
       
    46 #include "phoneuitestmain.h"
    46 
    47 
    47 
    48 
    48 extern bool m_logsModelCreated;
    49 extern bool m_logsModelCreated;
    49 extern bool m_serviceCreated;
    50 extern bool m_serviceCreated;
    50 extern bool m_aiwRequestCreated;
    51 extern bool m_aiwRequestCreated;
    51 extern bool m_aiwRequestSended;
    52 extern bool m_aiwRequestSended;
    52 extern int m_modelMaxSize;
    53 extern int m_modelMaxSize;
    53 extern bool m_bringToForegroundCalled;
    54 extern bool m_bringToForegroundCalled;
    54 
       
    55 #define PHONE_QT_INDICATOR_CONTROLLER_TEST_MAIN(TestObject) \
       
    56 int main(int argc, char *argv[]) \
       
    57 { \
       
    58     HbApplication app(argc, argv); \
       
    59     TestObject tc; \
       
    60     QResource::registerResource("../hbcore.rcc"); \
       
    61     int ret = QTest::qExec(&tc, argc, argv); \
       
    62     /* Core dump if HbIconLoader instance is not destroyed before the application instance. */ \
       
    63     /* HbIconLoader uses QCoreApplication::aboutToQuit() signal to destroy itself. */ \
       
    64     /* app.exec() where the signal is normally emitted is not called here. */ \
       
    65     /* So, invoking the signal explicitly. */ \
       
    66     QMetaObject::invokeMethod(&app, "aboutToQuit", Qt::DirectConnection); \
       
    67     return ret; \
       
    68 }
       
    69 
    55 
    70 class UT_PhoneIndicatorController : public QObject, public MockService
    56 class UT_PhoneIndicatorController : public QObject, public MockService
    71 {
    57 {
    72     Q_OBJECT
    58     Q_OBJECT
    73 public:
    59 public:
   237     QVERIFY(m_serviceCreated);
   223     QVERIFY(m_serviceCreated);
   238     QVERIFY(m_aiwRequestCreated);
   224     QVERIFY(m_aiwRequestCreated);
   239     QVERIFY(m_aiwRequestSended);
   225     QVERIFY(m_aiwRequestSended);
   240 }
   226 }
   241 
   227 
   242 PHONE_QT_INDICATOR_CONTROLLER_TEST_MAIN(UT_PhoneIndicatorController)
   228 PHONE_UITEST_MAIN(UT_PhoneIndicatorController)
   243 #include "unit_tests.moc"
   229 #include "unit_tests.moc"
   244 
   230