--- a/satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp Tue Jul 06 14:53:02 2010 +0300
+++ b/satui/satapp/tsrc/ut_satapp/src/ut_satappmainhandler.cpp Wed Aug 18 10:19:22 2010 +0300
@@ -17,15 +17,20 @@
#include <hbmainwindow.h>
+#include <centralrepository.h>
+#include <ProfileEngineSDKCRKeys.h>
#include "ut_satappmainhandler.h"
//test class
#include "satappmainhandler.h"
+#include "satappconstant.h"
// -----------------------------------------------------------------------------
// Ut_SatAppMainHandler::Ut_SatAppMainHandler
// -----------------------------------------------------------------------------
//
-Ut_SatAppMainHandler::Ut_SatAppMainHandler(QObject *parent):QObject(parent)
+Ut_SatAppMainHandler::Ut_SatAppMainHandler(
+ HbMainWindow* mainWindow, QObject *parent)
+ :QObject(parent), mMainWindow(mainWindow)
{
qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler >");
qDebug("Ut_SatAppMainHandler::Ut_SatAppMainHandler <");
@@ -69,18 +74,52 @@
}
// -----------------------------------------------------------------------------
-// Ut_SatAppMainHandler::testProfileState
+// Ut_SatAppMainHandler::testCreateMainHandler
//
// Connects to test object signal and verifies received data.
// -----------------------------------------------------------------------------
void Ut_SatAppMainHandler::testCreateMainHandler()
{
- qDebug("Ut_SatAppMainHandler::testProfileState >");
- HbMainWindow* window = new HbMainWindow();
- QVERIFY(window);
- mMainHandler = new SatAppMainHandler(*window);
+ qDebug("Ut_SatAppMainHandler::testCreateMainHandler >");
+ mMainHandler = new SatAppMainHandler(*mMainWindow);
QVERIFY(mMainHandler);
- qDebug("Ut_SatAppMainHandler::testProfileState <");
+ qDebug("Ut_SatAppMainHandler::testCreateMainHandler <");
}
+// -----------------------------------------------------------------------------
+// Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode
+//
+// Connects to test object signal and verifies received data.
+// -----------------------------------------------------------------------------
+void Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode()
+{
+ qDebug("Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode >");
+ cleanupTestCase();
+ TInt profileId(0);
+ CRepository* cr (NULL);
+ TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine));
+ if ( KErrNone == err )
+ {
+ // Get the ID of the currently active profile:
+ TInt error = cr->Get(KProEngActiveProfile, profileId);
+ qDebug("Ut_SatAppMainHandler::SatAppMainHandler get active \
+ profile error=%d, profileId=%d", error, profileId);
+ if( KErrNone != error){
+ delete cr;
+ return;
+ }
+ error = cr->Set(KProEngActiveProfile,
+ KSatActiveProfileOffline);
+ qDebug("Ut_SatAppMainHandler::SatAppMainHandler set active \
+ profile error=%d",error);
+ mMainHandler = new SatAppMainHandler(*mMainWindow);
+ QVERIFY(mMainHandler);
+ error = cr->Set(KProEngActiveProfile, profileId);
+ qDebug("Ut_SatAppMainHandler::SatAppMainHandler set active \
+ profile error=%d",error);
+ delete cr;
+ }
+
+ qDebug("Ut_SatAppMainHandler::testCreateMainHandler_OfflineMode <");
+}
// End of file