logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp
changeset 8 6c9acdc6adc0
parent 6 41c0a814d878
child 9 68f3171a5819
equal deleted inserted replaced
6:41c0a814d878 8:6c9acdc6adc0
    27 #include <hbactivitymanager.h>
    27 #include <hbactivitymanager.h>
    28 #include <QCoreApplication>
    28 #include <QCoreApplication>
    29 #include <QApplication>
    29 #include <QApplication>
    30 #include <QTimer>
    30 #include <QTimer>
    31 #include <QGesture>
    31 #include <QGesture>
       
    32 #include <hblistview.h>
       
    33 #include <hblistviewitem.h>
    32 
    34 
    33 int actionCount = 0;
    35 int actionCount = 0;
    34 Qt::Orientation windowOrientation = Qt::Vertical;
    36 Qt::Orientation windowOrientation = Qt::Vertical;
    35 bool testMenuShown = false;
    37 bool testMenuShown = false;
    36 bool testDialogShown = false;
    38 bool testDialogShown = false;
    48 QList<HbView *> testViews;
    50 QList<HbView *> testViews;
    49 QList<QVariantHash> testActivities;
    51 QList<QVariantHash> testActivities;
    50 HbActivityManager testActivityManager;
    52 HbActivityManager testActivityManager;
    51 Hb::ActivationReason testActivationReason = Hb::ActivationReasonNormal;
    53 Hb::ActivationReason testActivationReason = Hb::ActivationReasonNormal;
    52 QString testActivityId = "LogsViewMatches";
    54 QString testActivityId = "LogsViewMatches";
       
    55 QList<HbListViewItem*> testViewItems;
       
    56 bool testEnsureVisibleCalled = false;
       
    57 bool testScrollToCalled = false;
    53 
    58 
    54 void HbStubHelper::reset()
    59 void HbStubHelper::reset()
    55 {
    60 {
    56     actionCount = 0;
    61     actionCount = 0;
    57     testMenuShown = false;
    62     testMenuShown = false;
    61     testDialogShown = false;
    66     testDialogShown = false;
    62     testColor = Qt::white;
    67     testColor = Qt::white;
    63     testActivationReason = Hb::ActivationReasonNormal;
    68     testActivationReason = Hb::ActivationReasonNormal;
    64     testActivityId = "LogsViewMatches";
    69     testActivityId = "LogsViewMatches";
    65     testActivities.clear();
    70     testActivities.clear();
    66 }
    71     qDeleteAll(testViewItems);
    67 
    72     testViewItems.clear();
    68 
    73     testScrollToCalled = false;
       
    74     testEnsureVisibleCalled = false;
       
    75 }
    69 
    76 
    70 int HbStubHelper::widgetActionsCount()
    77 int HbStubHelper::widgetActionsCount()
    71 {
    78 {
    72     return actionCount;
    79     return actionCount;
    73 }
    80 }
   131 }
   138 }
   132 
   139 
   133 void HbStubHelper::setActivityId(QString activityId)
   140 void HbStubHelper::setActivityId(QString activityId)
   134 {
   141 {
   135     testActivityId = activityId;
   142     testActivityId = activityId;
       
   143 }
       
   144 
       
   145 QList<HbListViewItem*>& HbStubHelper::listItems()
       
   146 {
       
   147     return testViewItems;
       
   148 }
       
   149 
       
   150 bool HbStubHelper::listScrollToCalled()
       
   151 {
       
   152     return testScrollToCalled;
       
   153 }
       
   154 
       
   155 bool HbStubHelper::listEnsureVisibleCalled()
       
   156 {
       
   157     return testEnsureVisibleCalled;
   136 }
   158 }
   137 
   159 
   138 // -----------------------------------------------------------------------------
   160 // -----------------------------------------------------------------------------
   139 //
   161 //
   140 // -----------------------------------------------------------------------------
   162 // -----------------------------------------------------------------------------
   329     testViews.append( static_cast<HbView*>(widget) );
   351     testViews.append( static_cast<HbView*>(widget) );
   330 }
   352 }
   331 
   353 
   332 void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags)
   354 void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags)
   333 {
   355 {
   334     Q_UNUSED(animate)
       
   335     Q_UNUSED(flags)
   356     Q_UNUSED(flags)
   336     testView = view;
   357     testView = view;
   337 }
   358 }
   338 
   359 
   339 QList<HbView *> HbMainWindow::views() const
   360 QList<HbView *> HbMainWindow::views() const
   402 QColor HbColorScheme::color( const QString &colorRole )
   423 QColor HbColorScheme::color( const QString &colorRole )
   403 {
   424 {
   404     Q_UNUSED(colorRole);
   425     Q_UNUSED(colorRole);
   405     return testColor;
   426     return testColor;
   406 }
   427 }
       
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 //
       
   431 // -----------------------------------------------------------------------------
       
   432 //
       
   433 void HbListView::scrollTo(const QModelIndex &index, ScrollHint hint)
       
   434 {
       
   435     Q_UNUSED(index);
       
   436     Q_UNUSED(hint);
       
   437     testScrollToCalled = true;
       
   438 }
       
   439 
       
   440 // -----------------------------------------------------------------------------
       
   441 //
       
   442 // -----------------------------------------------------------------------------
       
   443 //
       
   444 QList<HbAbstractViewItem *> HbAbstractItemView::visibleItems() const
       
   445 {
       
   446     QList<HbAbstractViewItem*> visible;
       
   447     foreach ( HbListViewItem* item, testViewItems ){
       
   448         visible.append( item );
       
   449     }
       
   450     return visible;
       
   451 }
       
   452 
       
   453 // -----------------------------------------------------------------------------
       
   454 //
       
   455 // -----------------------------------------------------------------------------
       
   456 //
       
   457 void HbScrollArea::ensureVisible(const QPointF &position, qreal xMargin, qreal yMargin)
       
   458 {
       
   459     Q_UNUSED(position);
       
   460     Q_UNUSED(xMargin);
       
   461     Q_UNUSED(yMargin);
       
   462     testEnsureVisibleCalled = true;
       
   463 }