logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp
changeset 11 64a47b97e1e1
parent 6 41c0a814d878
child 9 68f3171a5819
--- a/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp	Wed Jun 23 18:13:05 2010 +0300
+++ b/logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp	Tue Jul 06 14:16:36 2010 +0300
@@ -29,6 +29,8 @@
 #include <QApplication>
 #include <QTimer>
 #include <QGesture>
+#include <hblistview.h>
+#include <hblistviewitem.h>
 
 int actionCount = 0;
 Qt::Orientation windowOrientation = Qt::Vertical;
@@ -50,6 +52,9 @@
 HbActivityManager testActivityManager;
 Hb::ActivationReason testActivationReason = Hb::ActivationReasonNormal;
 QString testActivityId = "LogsViewMatches";
+QList<HbListViewItem*> testViewItems;
+bool testEnsureVisibleCalled = false;
+bool testScrollToCalled = false;
 
 void HbStubHelper::reset()
 {
@@ -63,10 +68,12 @@
     testActivationReason = Hb::ActivationReasonNormal;
     testActivityId = "LogsViewMatches";
     testActivities.clear();
+    qDeleteAll(testViewItems);
+    testViewItems.clear();
+    testScrollToCalled = false;
+    testEnsureVisibleCalled = false;
 }
 
-
-
 int HbStubHelper::widgetActionsCount()
 {
     return actionCount;
@@ -135,6 +142,21 @@
     testActivityId = activityId;
 }
 
+QList<HbListViewItem*>& HbStubHelper::listItems()
+{
+    return testViewItems;
+}
+
+bool HbStubHelper::listScrollToCalled()
+{
+    return testScrollToCalled;
+}
+
+bool HbStubHelper::listEnsureVisibleCalled()
+{
+    return testEnsureVisibleCalled;
+}
+
 // -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
@@ -331,7 +353,6 @@
 
 void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags)
 {
-    Q_UNUSED(animate)
     Q_UNUSED(flags)
     testView = view;
 }
@@ -404,3 +425,39 @@
     Q_UNUSED(colorRole);
     return testColor;
 }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void HbListView::scrollTo(const QModelIndex &index, ScrollHint hint)
+{
+    Q_UNUSED(index);
+    Q_UNUSED(hint);
+    testScrollToCalled = true;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+QList<HbAbstractViewItem *> HbAbstractItemView::visibleItems() const
+{
+    QList<HbAbstractViewItem*> visible;
+    foreach ( HbListViewItem* item, testViewItems ){
+        visible.append( item );
+    }
+    return visible;
+}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void HbScrollArea::ensureVisible(const QPointF &position, qreal xMargin, qreal yMargin)
+{
+    Q_UNUSED(position);
+    Q_UNUSED(xMargin);
+    Q_UNUSED(yMargin);
+    testEnsureVisibleCalled = true;
+}