phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneuicommandcontroller/unit_tests.cpp
changeset 76 cfea66083b62
parent 50 377c906a8701
child 78 baacf668fe89
equal deleted inserted replaced
74:d1c62c765e48 76:cfea66083b62
    27 #include "phonebubblewrapper.h"
    27 #include "phonebubblewrapper.h"
    28 #include "phoneuicommandcontroller.h"
    28 #include "phoneuicommandcontroller.h"
    29 #include "phoneresourceids.h"
    29 #include "phoneresourceids.h"
    30 #include "phoneresourceadapter.h"
    30 #include "phoneresourceadapter.h"
    31 #include "phoneuiqtbuttonscontroller.h"
    31 #include "phoneuiqtbuttonscontroller.h"
       
    32 #include "phonetestmain.h"
    32 
    33 
    33 extern bool m_setActions;
    34 extern bool m_setActions;
    34 extern bool m_setInvalidCommand;
    35 extern bool m_setInvalidCommand;
    35 extern QList<HbAction*> m_menuActions;
    36 extern QList<HbAction*> m_menuActions;
    36 extern bool m_setInvalidButtonCommands;
    37 extern bool m_setInvalidButtonCommands;
    37 extern bool m_setInvalidToolBarCommands;
    38 extern bool m_setInvalidToolBarCommands;
    38 extern bool m_setCustomToolBarCommands;
    39 extern bool m_setCustomToolBarCommands;
    39 extern int m_phoneButtonFlags;
    40 extern int m_phoneButtonFlags;
    40 
       
    41 #define PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestObject) \
       
    42 int main(int argc, char *argv[]) \
       
    43     { \
       
    44         HbApplication app(argc, argv); \
       
    45         TestObject tc; \
       
    46         QResource::registerResource("../hbcore.rcc"); \
       
    47         int ret = QTest::qExec(&tc, argc, argv); \
       
    48         /* Core dump if HbIconLoader instance is not destroyed before the application instance. */ \
       
    49         /* HbIconLoader uses QCoreApplication::aboutToQuit() signal to destroy itself. */ \
       
    50         /* app.exec() where the signal is normally emitted is not called here. */ \
       
    51         /* So, invoking the signal explicitly. */ \
       
    52         QMetaObject::invokeMethod(&app, "aboutToQuit", Qt::DirectConnection); \
       
    53         return ret; \
       
    54     }
       
    55 
    41 
    56 
    42 
    57 class TestPhoneUiCommandController : public QObject, public PhoneUIQtViewIF, public BubbleManagerIF
    43 class TestPhoneUiCommandController : public QObject, public PhoneUIQtViewIF, public BubbleManagerIF
    58 {
    44 {
    59     Q_OBJECT
    45     Q_OBJECT
    93     void clearDialpad() {};
    79     void clearDialpad() {};
    94     void bringToForeground() {};
    80     void bringToForeground() {};
    95     void setMenuActions(const QList<PhoneAction*>& ) { m_setMenuActionsCalled = true;};
    81     void setMenuActions(const QList<PhoneAction*>& ) { m_setMenuActionsCalled = true;};
    96     void shutdownPhoneApp() {};
    82     void shutdownPhoneApp() {};
    97     void setBackButtonVisible(bool ) {};
    83     void setBackButtonVisible(bool ) {};
    98     HbMenu &menuReference(){return m_menu;};
    84     HbMenu &menuReference(){ HbMenu* menu = NULL; return *menu;};
    99     void captureKey(Qt::Key , bool ) {};
    85     void captureKey(Qt::Key , bool ) {};
   100     
    86     
   101     // From BubbleManagerIF
    87     // From BubbleManagerIF
   102     void startChanges () { m_startChangesCalled=true; };
    88     void startChanges () { m_startChangesCalled=true; };
   103     void endChanges () { m_endChangesCalled=true; };
    89     void endChanges () { m_endChangesCalled=true; };
   198     bool m_clearAndHideDialpadCalled;
   184     bool m_clearAndHideDialpadCalled;
   199     bool m_ExpandConferenceCalled;
   185     bool m_ExpandConferenceCalled;
   200     bool m_setMenuActionsCalled;
   186     bool m_setMenuActionsCalled;
   201     bool m_isDialpadVisible;
   187     bool m_isDialpadVisible;
   202     QString m_dialpadText;
   188     QString m_dialpadText;
   203     HbMenu m_menu;
       
   204 
       
   205 };
   189 };
   206 
   190 
   207 TestPhoneUiCommandController::TestPhoneUiCommandController ()
   191 TestPhoneUiCommandController::TestPhoneUiCommandController ()
   208 {
   192 {
   209 }
   193 }
   824             callId);
   808             callId);
   825     
   809     
   826     QVERIFY(4==actions.count());
   810     QVERIFY(4==actions.count());
   827 }
   811 }
   828 
   812 
   829 PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestPhoneUiCommandController)
   813 PHONE_TEST_MAIN(TestPhoneUiCommandController)
   830 #include "unit_tests.moc"
   814 #include "unit_tests.moc"