calendarui/views/dayview/tsrc/unittests/unittest_calendaycontentscrollarea/hbinstance.h
changeset 70 a5ed90760192
equal deleted inserted replaced
64:1881ad52dc45 70:a5ed90760192
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Mocked classes for testing CalenDayContainer class
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef  HBINSTANCE_H
       
    19 #define  HBINSTANCE_H
       
    20 
       
    21 #include "hbmainwindow.h"
       
    22 #include <QList>
       
    23 
       
    24 /*!
       
    25  Mocked class HbInstance (simulating hbinstance in unittests)
       
    26  */
       
    27 class HbInstance
       
    28 {
       
    29 public:
       
    30 
       
    31     static HbInstance *instance()
       
    32     {
       
    33         return new HbInstance();
       
    34     }
       
    35 
       
    36     QList<HbMainWindow *> allMainWindows() const
       
    37     {
       
    38         return mMainWindows;
       
    39     }
       
    40 
       
    41     HbInstance()
       
    42     {
       
    43         HbMainWindow* window = new HbMainWindow();
       
    44         mMainWindows.append(window);
       
    45     }
       
    46 
       
    47     ~HbInstance()
       
    48     {
       
    49         for (int i = 0; i < mMainWindows.count(); i++) {
       
    50             delete mMainWindows[i];
       
    51         }
       
    52         mMainWindows.clear();
       
    53     }
       
    54 
       
    55     QList<HbMainWindow *> mMainWindows;
       
    56 };
       
    57 
       
    58 #endif // HBINSTANCE_H
       
    59 // End of File