logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp
changeset 25 76a2435edfd4
parent 24 0ba2181d7c28
equal deleted inserted replaced
24:0ba2181d7c28 25:76a2435edfd4
    22 #include "hbstubs_helper.h"
    22 #include "hbstubs_helper.h"
    23 #include <hbmessagebox.h>
    23 #include <hbmessagebox.h>
    24 #include <hbapplication.h>
    24 #include <hbapplication.h>
    25 #include <QCoreApplication>
    25 #include <QCoreApplication>
    26 #include <QTimer>
    26 #include <QTimer>
       
    27 #include <QGesture>
    27 
    28 
    28 int actionCount = 0;
    29 int actionCount = 0;
    29 Qt::Orientation windowOrientation = Qt::Vertical;
    30 Qt::Orientation windowOrientation = Qt::Vertical;
    30 bool logsMenuShown = false;
    31 bool logsMenuShown = false;
    31 HbMainWindow* testWindow = 0;
    32 HbMainWindow* testWindow = 0;
    33 int testViewCount = 0;
    34 int testViewCount = 0;
    34 HbAction* testSoftkeyAction = 0;
    35 HbAction* testSoftkeyAction = 0;
    35 QString selectedActionString = "none";
    36 QString selectedActionString = "none";
    36 bool testSingleShotTimer = false;
    37 bool testSingleShotTimer = false;
    37 bool testQuitCalled = false;
    38 bool testQuitCalled = false;
       
    39 Qt::GestureState testState = Qt::NoGesture;
    38 
    40 
    39 void HbStubHelper::reset()
    41 void HbStubHelper::reset()
    40 {
    42 {
    41     actionCount = 0;
    43     actionCount = 0;
    42     logsMenuShown = false;
    44     logsMenuShown = false;
    62 bool HbStubHelper::quitCalled()
    64 bool HbStubHelper::quitCalled()
    63 {
    65 {
    64     return testQuitCalled;
    66     return testQuitCalled;
    65 }
    67 }
    66 
    68 
       
    69 void HbStubHelper::setGestureState(int state)
       
    70 {
       
    71     testState = static_cast<Qt::GestureState> (state);
       
    72 }
       
    73 
       
    74 
       
    75 Qt::GestureState QGesture::state() const
       
    76 {
       
    77     return testState;
       
    78 }
       
    79 
    67 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
    68 //
    81 //
    69 // -----------------------------------------------------------------------------
    82 // -----------------------------------------------------------------------------
    70 //
    83 //
    71 HbApplication::HbApplication(int &/*argc*/, char */*argv*/[]) 
    84 HbApplication::HbApplication(int &/*argc*/, char */*argv*/[]) 
   126 HbMainWindow::~HbMainWindow()
   139 HbMainWindow::~HbMainWindow()
   127 {
   140 {
   128     testWindow = 0;
   141     testWindow = 0;
   129 }
   142 }
   130     
   143     
   131 void HbMainWindow::setOrientation(Qt::Orientation orientation)
   144 void HbMainWindow::setOrientation(Qt::Orientation orientation, bool animate)
   132 {
   145 {
       
   146 		Q_UNUSED(animate)
   133     windowOrientation = orientation; 
   147     windowOrientation = orientation; 
   134 }
   148 }
   135 
   149 
   136 Qt::Orientation HbMainWindow::orientation() const
   150 Qt::Orientation HbMainWindow::orientation() const
   137 {
   151 {
   167 {
   181 {
   168     Q_UNUSED(widget)
   182     Q_UNUSED(widget)
   169     testViewCount++;
   183     testViewCount++;
   170 }
   184 }
   171 
   185 
   172 void HbMainWindow::setCurrentView(HbView *view, bool animate)
   186 void HbMainWindow::setCurrentView(HbView *view, bool animate, Hb::ViewSwitchFlags flags)
   173 {
   187 {
   174     Q_UNUSED(animate)
   188     Q_UNUSED(animate)
       
   189     Q_UNUSED(flags)
   175     testView = view;
   190     testView = view;
   176 }
   191 }
   177 
   192 
   178 int HbMainWindow::viewCount() const
   193 int HbMainWindow::viewCount() const
   179 {
   194 {
   214 void HbMessageBox::setText(const QString &string)
   229 void HbMessageBox::setText(const QString &string)
   215 {
   230 {
   216     
   231     
   217     if (string == "Ok") {
   232     if (string == "Ok") {
   218     	selectedActionString = "primary";
   233     	selectedActionString = "primary";
   219     	} else if (string == "Cancel") {
   234     } else if (string == "Cancel") {
   220     	selectedActionString = "secondary";
   235     	selectedActionString = "secondary";
   221     }
   236     }
   222    
   237    
   223 }
   238 }
   224 
   239 
   225 
   240 
   226 HbAction *HbDialog::exec()
   241 HbAction *HbDialog::exec()
   227 {
   242 {
   228    if (selectedActionString == "primary")	{
   243     if (selectedActionString == "primary")	{
   229    	  return primaryAction();
   244         return primaryAction();
   230    	} else {
   245     } else {
   231    	return 0;
   246         return 0;
   232     }
   247     }
   233 }
   248 }
   234 
   249 
   235 void QTimer::singleShot(int msec, QObject *receiver, const char *member)
   250 void QTimer::singleShot(int msec, QObject *receiver, const char *member)
   236 {
   251 {