phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneuicommandcontroller/unit_tests.cpp
changeset 76 cfea66083b62
parent 50 377c906a8701
child 78 baacf668fe89
--- a/phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneuicommandcontroller/unit_tests.cpp	Fri Sep 17 17:09:12 2010 +0300
+++ b/phoneapp/phoneuiqtviewadapter/tsrc/ut_phoneuicommandcontroller/unit_tests.cpp	Mon Oct 04 16:06:10 2010 +0300
@@ -29,6 +29,7 @@
 #include "phoneresourceids.h"
 #include "phoneresourceadapter.h"
 #include "phoneuiqtbuttonscontroller.h"
+#include "phonetestmain.h"
 
 extern bool m_setActions;
 extern bool m_setInvalidCommand;
@@ -38,21 +39,6 @@
 extern bool m_setCustomToolBarCommands;
 extern int m_phoneButtonFlags;
 
-#define PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestObject) \
-int main(int argc, char *argv[]) \
-    { \
-        HbApplication app(argc, argv); \
-        TestObject tc; \
-        QResource::registerResource("../hbcore.rcc"); \
-        int ret = QTest::qExec(&tc, argc, argv); \
-        /* Core dump if HbIconLoader instance is not destroyed before the application instance. */ \
-        /* HbIconLoader uses QCoreApplication::aboutToQuit() signal to destroy itself. */ \
-        /* app.exec() where the signal is normally emitted is not called here. */ \
-        /* So, invoking the signal explicitly. */ \
-        QMetaObject::invokeMethod(&app, "aboutToQuit", Qt::DirectConnection); \
-        return ret; \
-    }
-
 
 class TestPhoneUiCommandController : public QObject, public PhoneUIQtViewIF, public BubbleManagerIF
 {
@@ -95,7 +81,7 @@
     void setMenuActions(const QList<PhoneAction*>& ) { m_setMenuActionsCalled = true;};
     void shutdownPhoneApp() {};
     void setBackButtonVisible(bool ) {};
-    HbMenu &menuReference(){return m_menu;};
+    HbMenu &menuReference(){ HbMenu* menu = NULL; return *menu;};
     void captureKey(Qt::Key , bool ) {};
     
     // From BubbleManagerIF
@@ -200,8 +186,6 @@
     bool m_setMenuActionsCalled;
     bool m_isDialpadVisible;
     QString m_dialpadText;
-    HbMenu m_menu;
-
 };
 
 TestPhoneUiCommandController::TestPhoneUiCommandController ()
@@ -826,5 +810,5 @@
     QVERIFY(4==actions.count());
 }
 
-PHONE_QT_VIEW_ADAPTER_TEST_MAIN(TestPhoneUiCommandController)
+PHONE_TEST_MAIN(TestPhoneUiCommandController)
 #include "unit_tests.moc"