logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp
changeset 21 2f0af9ba7665
parent 18 acd4e87b24b4
equal deleted inserted replaced
18:acd4e87b24b4 21:2f0af9ba7665
    22 #include "hbstubs_helper.h"
    22 #include "hbstubs_helper.h"
    23 #include <hbdialog.h>
    23 #include <hbdialog.h>
    24 #include <hbapplication.h>
    24 #include <hbapplication.h>
    25 #include <hbcolorscheme.h>
    25 #include <hbcolorscheme.h>
    26 #include <hbview.h>
    26 #include <hbview.h>
    27 #include <hbactivitymanager.h>
       
    28 #include <QCoreApplication>
    27 #include <QCoreApplication>
    29 #include <QApplication>
    28 #include <QApplication>
    30 #include <QTimer>
    29 #include <QTimer>
    31 #include <QGesture>
    30 #include <QGesture>
    32 #include <hblistview.h>
    31 #include <hblistview.h>
    52 Qt::GestureState testState = Qt::NoGesture;
    51 Qt::GestureState testState = Qt::NoGesture;
    53 bool testIsWidgetOpen = false;
    52 bool testIsWidgetOpen = false;
    54 bool testIsWidgetRaised = false;
    53 bool testIsWidgetRaised = false;
    55 QColor testColor = Qt::white;
    54 QColor testColor = Qt::white;
    56 QList<HbView *> testViews;
    55 QList<HbView *> testViews;
    57 QList<QVariantHash> testActivities;
       
    58 HbActivityManager testActivityManager;
       
    59 Hb::ActivationReason testActivationReason = Hb::ActivationReasonNormal;
       
    60 QString testActivityId = "LogsViewMatches";
       
    61 QList<HbListViewItem*> testViewItems;
    56 QList<HbListViewItem*> testViewItems;
    62 bool testEnsureVisibleCalled = false;
    57 bool testEnsureVisibleCalled = false;
    63 bool testScrollToCalled = false;
    58 bool testScrollToCalled = false;
    64 Qt::LayoutDirection testLayoutDirection = Qt::LeftToRight;
    59 Qt::LayoutDirection testLayoutDirection = Qt::LeftToRight;
    65 bool testConversionEnabled = false;
    60 bool testConversionEnabled = false;
    83     testSingleShotTimer = false;
    78     testSingleShotTimer = false;
    84     testQuitCalled = false;
    79     testQuitCalled = false;
    85     testIsWidgetRaised = false;
    80     testIsWidgetRaised = false;
    86     testDialogShown = false;
    81     testDialogShown = false;
    87     testColor = Qt::white;
    82     testColor = Qt::white;
    88     testActivationReason = Hb::ActivationReasonNormal;
       
    89     testActivityId = "LogsViewMatches";
       
    90     testActivities.clear();
       
    91     qDeleteAll(testViewItems);
    83     qDeleteAll(testViewItems);
    92     testViewItems.clear();
    84     testViewItems.clear();
    93     testScrollToCalled = false;
    85     testScrollToCalled = false;
    94     testEnsureVisibleCalled = false;
    86     testEnsureVisibleCalled = false;
    95     testPopupShowPlacement = HbPopup::TopLeftCorner;
    87     testPopupShowPlacement = HbPopup::TopLeftCorner;
   162 void HbStubHelper::setColorScheme(QColor col)
   154 void HbStubHelper::setColorScheme(QColor col)
   163 {
   155 {
   164     testColor = col;
   156     testColor = col;
   165 }
   157 }
   166 
   158 
   167 void HbStubHelper::setActivityReason(Hb::ActivationReason reason)
       
   168 {
       
   169     testActivationReason = reason;
       
   170 }
       
   171 
       
   172 void HbStubHelper::setActivityId(QString activityId)
       
   173 {
       
   174     testActivityId = activityId;
       
   175 }
       
   176 
       
   177 QList<HbListViewItem*>& HbStubHelper::listItems()
   159 QList<HbListViewItem*>& HbStubHelper::listItems()
   178 {
   160 {
   179     return testViewItems;
   161     return testViewItems;
   180 }
   162 }
   181 
   163 
   315 
   297 
   316 // -----------------------------------------------------------------------------
   298 // -----------------------------------------------------------------------------
   317 //
   299 //
   318 // -----------------------------------------------------------------------------
   300 // -----------------------------------------------------------------------------
   319 //
   301 //
   320 HbActivityManager::HbActivityManager(QObject *parent) : QObject(parent)
       
   321 {
       
   322     
       
   323 }
       
   324 HbActivityManager::~HbActivityManager()
       
   325 {
       
   326     
       
   327 }
       
   328     
       
   329 bool HbActivityManager::addActivity(const QString &activityId, const QVariant &data, const QVariantHash &parameters)
       
   330 {
       
   331     testActivities.append(parameters);
       
   332     return true;
       
   333 }
       
   334 
       
   335 bool HbActivityManager::removeActivity(const QString &activityId)
       
   336 {
       
   337     if ( !testActivities.isEmpty() ){
       
   338         testActivities.takeFirst();
       
   339     }
       
   340     return true;
       
   341 }
       
   342 QList<QVariantHash> HbActivityManager::activities() const
       
   343 {
       
   344     return testActivities;
       
   345 }
       
   346 
       
   347 bool HbActivityManager::waitActivity()
       
   348 {
       
   349     return true;
       
   350 }
       
   351 
       
   352 // -----------------------------------------------------------------------------
       
   353 //
       
   354 // -----------------------------------------------------------------------------
       
   355 //
       
   356 HbApplication::HbApplication(int &argc, char *argv[], Hb::ApplicationFlags flags) :
   302 HbApplication::HbApplication(int &argc, char *argv[], Hb::ApplicationFlags flags) :
   357     QApplication(0, argc, argv, 0), mTestFlags(flags)
   303     QApplication(0, argc, argv, 0), mTestFlags(flags)
   358 {
   304 {
   359 }
   305 }
   360 
   306 
   363 }
   309 }
   364     
   310     
   365 void HbApplication::quit()
   311 void HbApplication::quit()
   366 { 
   312 { 
   367     testQuitCalled = true; 
   313     testQuitCalled = true; 
   368 }
       
   369 
       
   370 HbActivityManager *HbApplication::activityManager()
       
   371 {
       
   372     return &testActivityManager;
       
   373 }
       
   374 
       
   375 Hb::ActivationReason HbApplication::activateReason() const
       
   376 {
       
   377     return testActivationReason;
       
   378 }
       
   379 QVariantHash HbApplication::activateParams() const
       
   380 {
       
   381     return QVariantHash();
       
   382 }
       
   383 QString HbApplication::activateId() const
       
   384 {
       
   385     return testActivityId;
       
   386 }
       
   387 QVariant HbApplication::activateData()
       
   388 {
       
   389     return QVariant();
       
   390 }
   314 }
   391     
   315     
   392 // -----------------------------------------------------------------------------
   316 // -----------------------------------------------------------------------------
   393 //
   317 //
   394 // -----------------------------------------------------------------------------
   318 // -----------------------------------------------------------------------------