logsui/logsapp/tsrc/ut_logsapp/stubs/hbstubs.cpp
changeset 19 e4c884866116
parent 16 c5af8598d22c
child 18 acd4e87b24b4
equal deleted inserted replaced
16:c5af8598d22c 19:e4c884866116
    32 #include <hblistview.h>
    32 #include <hblistview.h>
    33 #include <hblistviewitem.h>
    33 #include <hblistviewitem.h>
    34 #include <hbmessagebox.h>
    34 #include <hbmessagebox.h>
    35 #include <hbnotificationdialog.h>
    35 #include <hbnotificationdialog.h>
    36 #include <hbstringutil.h>
    36 #include <hbstringutil.h>
       
    37 #include "xqkeycapture.h"
       
    38 #include "tstasksettings.h"
    37 
    39 
    38 int actionCount = 0;
    40 int actionCount = 0;
    39 Qt::Orientation windowOrientation = Qt::Vertical;
    41 Qt::Orientation windowOrientation = Qt::Vertical;
    40 bool testMenuShown = false;
    42 bool testMenuShown = false;
    41 HbPopup::Placement testPopupShowPlacement = HbPopup::TopLeftCorner;
    43 HbPopup::Placement testPopupShowPlacement = HbPopup::TopLeftCorner;
    59 QList<HbListViewItem*> testViewItems;
    61 QList<HbListViewItem*> testViewItems;
    60 bool testEnsureVisibleCalled = false;
    62 bool testEnsureVisibleCalled = false;
    61 bool testScrollToCalled = false;
    63 bool testScrollToCalled = false;
    62 Qt::LayoutDirection testLayoutDirection = Qt::LeftToRight;
    64 Qt::LayoutDirection testLayoutDirection = Qt::LeftToRight;
    63 bool testConversionEnabled = false;
    65 bool testConversionEnabled = false;
       
    66 bool testScrollBarPolicySet = false;
       
    67 HbScrollArea::ScrollBarPolicy testScrollBarPolicy = HbScrollArea::ScrollBarAsNeeded;
       
    68 QWindowSurface* testWindowSurface = 0;
       
    69 QString testNotifDialogText;
       
    70 bool testIsTsTaskVisibilitySet = false;
       
    71 bool testTsTaskVisibility = false;
       
    72 
       
    73 class QWindowSurface{
       
    74 public:
       
    75     QWindowSurface(){}
       
    76     ~QWindowSurface(){}
       
    77 };
    64 
    78 
    65 void HbStubHelper::reset()
    79 void HbStubHelper::reset()
    66 {
    80 {
    67     actionCount = 0;
    81     actionCount = 0;
    68     testMenuShown = false;
    82     testMenuShown = false;
    78     testViewItems.clear();
    92     testViewItems.clear();
    79     testScrollToCalled = false;
    93     testScrollToCalled = false;
    80     testEnsureVisibleCalled = false;
    94     testEnsureVisibleCalled = false;
    81     testPopupShowPlacement = HbPopup::TopLeftCorner;
    95     testPopupShowPlacement = HbPopup::TopLeftCorner;
    82     testConversionEnabled = false;
    96     testConversionEnabled = false;
       
    97     testScrollBarPolicySet = false;
       
    98     delete testWindowSurface;
       
    99     testWindowSurface = 0;
       
   100     testIsTsTaskVisibilitySet = false;
       
   101     testTsTaskVisibility = false;
    83 }
   102 }
    84 
   103 
    85 int HbStubHelper::widgetActionsCount()
   104 int HbStubHelper::widgetActionsCount()
    86 {
   105 {
    87     return actionCount;
   106     return actionCount;
   173 void HbStubHelper::stringUtilDigitConversion(bool enabled)
   192 void HbStubHelper::stringUtilDigitConversion(bool enabled)
   174 {
   193 {
   175     testConversionEnabled = enabled;
   194     testConversionEnabled = enabled;
   176 }
   195 }
   177 
   196 
   178 QString testNotifDialogText;
   197 bool HbStubHelper::listScrollBarPolicySet()
       
   198 {
       
   199     return testScrollBarPolicySet;
       
   200 }
       
   201 
       
   202 void HbStubHelper::resetListScrolling()
       
   203 {
       
   204     testEnsureVisibleCalled = false;
       
   205     testScrollBarPolicySet = false;
       
   206     testScrollToCalled = false;
       
   207 }
       
   208 
       
   209 void HbStubHelper::createWindowSurface()
       
   210 {
       
   211     if ( !testWindowSurface ){
       
   212         testWindowSurface = new QWindowSurface;
       
   213     }
       
   214 }
       
   215 
       
   216 bool HbStubHelper::isTsTaskVisibilitySet()
       
   217 {
       
   218     return testIsTsTaskVisibilitySet;
       
   219 }
       
   220 
       
   221 bool HbStubHelper::tsTaskVisibility()
       
   222 {
       
   223     return testTsTaskVisibility;
       
   224 }
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 //
       
   228 // -----------------------------------------------------------------------------
       
   229 //
   179 void HbNotificationDialog::launchDialog(const QString &title, QGraphicsScene *scene)
   230 void HbNotificationDialog::launchDialog(const QString &title, QGraphicsScene *scene)
   180 {
   231 {
   181     Q_UNUSED(scene);
   232     Q_UNUSED(scene);
   182     testNotifDialogText = title;
   233     testNotifDialogText = title;
   183 }
   234 }
   195 void QCoreApplication::quit()
   246 void QCoreApplication::quit()
   196 {
   247 {
   197     testQuitCalled = true; 
   248     testQuitCalled = true; 
   198 }
   249 }
   199 
   250 
       
   251 // -----------------------------------------------------------------------------
       
   252 //
       
   253 // -----------------------------------------------------------------------------
       
   254 //
   200 QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int version) 
   255 QApplication::QApplication(QApplication::QS60MainApplicationFactory factory, int &argc, char **argv, int version) 
   201 : QCoreApplication(argc, argv)
   256 : QCoreApplication(argc, argv)
   202 {
   257 {
   203     
   258     
   204 }
   259 }
   216 Qt::LayoutDirection QApplication::layoutDirection()
   271 Qt::LayoutDirection QApplication::layoutDirection()
   217 {
   272 {
   218     return testLayoutDirection;
   273     return testLayoutDirection;
   219 }
   274 }
   220 
   275 
       
   276 // -----------------------------------------------------------------------------
       
   277 //
       
   278 // -----------------------------------------------------------------------------
       
   279 //
   221 bool QGraphicsWidget::close()
   280 bool QGraphicsWidget::close()
   222 {
   281 {
   223     testIsWidgetOpen = false;
   282     testIsWidgetOpen = false;
   224     return true;
   283     return true;
   225 }
   284 }
   226 
   285 
       
   286 // -----------------------------------------------------------------------------
       
   287 //
       
   288 // -----------------------------------------------------------------------------
       
   289 //
   227 void QWidget::setVisible(bool visible)
   290 void QWidget::setVisible(bool visible)
   228 {
   291 {
   229     Q_UNUSED(visible);
   292     Q_UNUSED(visible);
   230 }
   293 }
   231 
   294 
   232 void QWidget::raise()
   295 void QWidget::raise()
   233 {
   296 {
   234     testIsWidgetRaised = true;
   297     testIsWidgetRaised = true;
   235 }
   298 }
   236 
   299 
       
   300 QWindowSurface* QWidget::windowSurface() const
       
   301 {
       
   302     return testWindowSurface;
       
   303 }
       
   304 
       
   305 // -----------------------------------------------------------------------------
       
   306 //
       
   307 // -----------------------------------------------------------------------------
       
   308 //
   237 QPixmap QPixmap::grabWidget(QWidget *widget, const QRect &rect)
   309 QPixmap QPixmap::grabWidget(QWidget *widget, const QRect &rect)
   238 {
   310 {
   239     Q_UNUSED(widget);
   311     Q_UNUSED(widget);
   240     Q_UNUSED(rect);
   312     Q_UNUSED(rect);
   241     return QPixmap();
   313     return QPixmap();
   336 {
   408 {
   337     Q_UNUSED(position);
   409     Q_UNUSED(position);
   338     testPopupShowPlacement = placement;
   410     testPopupShowPlacement = placement;
   339 }
   411 }
   340 
   412 
       
   413 // -----------------------------------------------------------------------------
       
   414 //
       
   415 // -----------------------------------------------------------------------------
       
   416 //
   341 void HbDialog::open(QObject *receiver, const char *member)
   417 void HbDialog::open(QObject *receiver, const char *member)
   342 {
   418 {
   343    Q_UNUSED(receiver)
   419    Q_UNUSED(receiver)
   344    Q_UNUSED(member)
   420    Q_UNUSED(member)
   345    testDialogShown = true;
   421    testDialogShown = true;
   348 void HbDialog::open()
   424 void HbDialog::open()
   349 {
   425 {
   350    testDialogShown = true;
   426    testDialogShown = true;
   351 }
   427 }
   352 
   428 
       
   429 // -----------------------------------------------------------------------------
       
   430 //
       
   431 // -----------------------------------------------------------------------------
       
   432 //
   353 void HbMessageBox::question(const QString &questionText,
   433 void HbMessageBox::question(const QString &questionText,
   354                             QObject *receiver ,
   434                             QObject *receiver ,
   355                             const char *member,
   435                             const char *member,
   356                             HbMessageBox::StandardButtons buttons,
   436                             HbMessageBox::StandardButtons buttons,
   357                             QGraphicsWidget *headingWidget,
   437                             QGraphicsWidget *headingWidget,
   527 
   607 
   528 // -----------------------------------------------------------------------------
   608 // -----------------------------------------------------------------------------
   529 //
   609 //
   530 // -----------------------------------------------------------------------------
   610 // -----------------------------------------------------------------------------
   531 //
   611 //
       
   612 void HbScrollArea::setVerticalScrollBarPolicy(ScrollBarPolicy policy)
       
   613 {
       
   614     testScrollBarPolicySet = true;
       
   615     testScrollBarPolicy = policy;
       
   616 }
       
   617 
       
   618 HbScrollArea::ScrollBarPolicy HbScrollArea::verticalScrollBarPolicy() const
       
   619 {
       
   620     return testScrollBarPolicy;
       
   621 }
       
   622 
       
   623 // -----------------------------------------------------------------------------
       
   624 //
       
   625 // -----------------------------------------------------------------------------
       
   626 //
   532 QString HbStringUtil::convertDigitsTo( const QString str, const DigitType digitType )
   627 QString HbStringUtil::convertDigitsTo( const QString str, const DigitType digitType )
   533 {
   628 {
   534     Q_UNUSED(digitType);
   629     Q_UNUSED(digitType);
   535     if ( testConversionEnabled ){
   630     if ( testConversionEnabled ){
   536         return ( QString("conv") + str );
   631         return ( QString("conv") + str );
   537     }
   632     }
   538     return str;
   633     return str;
   539 }
   634 }
   540 
   635 
   541 bool QObject::eventFilter(QObject *obj, QEvent *event)
   636 // -----------------------------------------------------------------------------
   542 {
   637 //
   543     Q_UNUSED(obj)
   638 // -----------------------------------------------------------------------------
   544     Q_UNUSED(event)
   639 //
   545     return false;
   640 XQKeyCapture::XQKeyCapture()
   546 }
   641 {
   547 
   642     
   548 void QObject::installEventFilter(QObject *obj)
   643 }
   549 {
   644 
   550     Q_UNUSED(obj)
   645 XQKeyCapture::~XQKeyCapture()
   551 }
   646 {
       
   647     
       
   648 }
       
   649 
       
   650 bool XQKeyCapture::captureKey(Qt::Key aKey,
       
   651     Qt::KeyboardModifiers aModifiersMask,
       
   652     Qt::KeyboardModifiers aModifier)
       
   653 {
       
   654     Q_UNUSED(aModifiersMask);
       
   655     Q_UNUSED(aModifier);
       
   656     mKeys.append(aKey);
       
   657     return true;
       
   658 }
       
   659     
       
   660 bool XQKeyCapture::cancelCaptureKey(Qt::Key aKey,
       
   661     Qt::KeyboardModifiers aModifiersMask,
       
   662     Qt::KeyboardModifiers aModifier)
       
   663 {
       
   664     Q_UNUSED(aModifiersMask);
       
   665     Q_UNUSED(aModifier);
       
   666     int index = mKeys.indexOf(aKey);
       
   667     if ( index >= 0 ){
       
   668         mKeys.takeAt(index);
       
   669     }
       
   670     return true;
       
   671 }
       
   672 
       
   673 // -----------------------------------------------------------------------------
       
   674 //
       
   675 // -----------------------------------------------------------------------------
       
   676 //
       
   677 TsTaskSettings::TsTaskSettings()
       
   678 {
       
   679     
       
   680 }
       
   681 TsTaskSettings::~TsTaskSettings()
       
   682 {
       
   683     
       
   684 }
       
   685 
       
   686 bool TsTaskSettings::setVisibility(bool visible)
       
   687 {
       
   688     testTsTaskVisibility = visible;
       
   689     testIsTsTaskVisibilitySet = true;
       
   690     return true;
       
   691 }
       
   692