calendarui/views/dayview/tsrc/unittests/unittest_calendayitemview/hbinstance.h
changeset 57 bb2d3e476f29
parent 45 b6db4fd4947b
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
    16 */
    16 */
    17 
    17 
    18 #ifndef  HBMAINWINDOW_H
    18 #ifndef  HBMAINWINDOW_H
    19 #define  HBMAINWINDOW_H
    19 #define  HBMAINWINDOW_H
    20 
    20 
    21 #include <QObject>
    21 #include <HbView>
    22 #include <QtGlobal>
       
    23 #include <QRectF>
       
    24 
    22 
    25 // Test variables
    23 // Test variables
    26 extern QRectF gTestWindowRect;
    24 extern QRectF gTestWindowRect;
    27 extern Qt::Orientation gTestOrientation;
    25 extern Qt::Orientation gTestOrientation;
    28 
    26 
    29 
       
    30 
       
    31 /*!
    27 /*!
    32  Mocked class HbMainWindow (simulating window in unittests)
    28  Mocked class HbMainWindow (simulating window in unittests)
    33  */
    29  */
    34 class HbMainWindow
    30 class HbMainWindow : public QObject
    35 : public QObject
    31 {   
    36 {
       
    37     Q_OBJECT
    32     Q_OBJECT
    38 public:
    33 public:
    39     HbMainWindow(QObject *parent = 0) : QObject(parent){
    34     HbMainWindow() {
    40         Q_UNUSED(parent);
    35         mView = new HbView();
    41     }
    36     }
    42     
    37     
    43     ~HbMainWindow() {
    38     ~HbMainWindow() {
       
    39         if (mView) {
       
    40             delete mView;
       
    41             mView = 0;
       
    42         }
    44     }
    43     }
    45     
    44     
    46     QRectF layoutRect() const {
    45     QRectF layoutRect() const {
    47         return gTestWindowRect;
    46         return gTestWindowRect;
    48     }
    47     }
    49     
    48     
    50     Qt::Orientation orientation() const {
    49     Qt::Orientation orientation() const {
    51         return gTestOrientation;
    50         return gTestOrientation;
    52     }
    51     }
    53 signals:
    52     
    54     void orientationChanged(Qt::Orientation);
    53     HbView *HbMainWindow::currentView() const {
       
    54         return mView;
       
    55     }
       
    56 
       
    57     HbView *mView;
    55 };
    58 };
    56 
    59 
    57 #endif // HBMAINWINDOW_H
    60 #endif // HBMAINWINDOW_H
    58 
    61 
    59 #ifndef  HBINSTANCE_H
    62 #ifndef  HBINSTANCE_H