hswidgetmodel/tsrc/t_hswidgetmodelexe/inc/testwidgetmodel.h
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Main test class for hspluginmodel library.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HOMESCREEN_TEST_TESTWIDGETMODEL_H
       
    20 #define HOMESCREEN_TEST_TESTWIDGETMODEL_H
       
    21 
       
    22 #include <QtTest/QtTest>
       
    23 #include "hswidget.h"
       
    24 
       
    25 #ifdef Q_OS_SYMBIAN
       
    26 #include <QDir>
       
    27 #endif
       
    28 
       
    29 
       
    30 
       
    31 
       
    32 
       
    33 class TestWidget : public HsWidget
       
    34 {
       
    35     Q_OBJECT
       
    36 
       
    37 public:
       
    38 
       
    39     TestWidget(QGraphicsItem* aParent = 0, Qt::WindowFlags aFlags = 0)
       
    40         : HsWidget(aParent, aFlags) {}
       
    41     
       
    42 protected:
       
    43 
       
    44     StartResult onStart()
       
    45     {
       
    46         return mStartResult;
       
    47     }   
       
    48 
       
    49     SuspendResult onSuspend()
       
    50     {
       
    51         return mSuspendResult;
       
    52     }
       
    53 
       
    54     ResumeResult onResume()
       
    55     {
       
    56         return mResumeResult;
       
    57     }
       
    58 
       
    59     StopResult onStop()
       
    60     {
       
    61         return mStopResult;
       
    62     }
       
    63 
       
    64 public:
       
    65 
       
    66     void setFaultingState()
       
    67     {
       
    68         setFaulting();
       
    69     }
       
    70 
       
    71     void setFaultedState()
       
    72     {
       
    73         setFaulted();
       
    74     }
       
    75 
       
    76     void setFinishedState()
       
    77     {
       
    78         setFinished();
       
    79     }
       
    80 
       
    81 public:
       
    82 
       
    83     StartResult mStartResult;
       
    84     SuspendResult mSuspendResult;
       
    85     ResumeResult mResumeResult;
       
    86     StopResult mStopResult;
       
    87 
       
    88 };
       
    89 
       
    90 class TestWidget2 : public HsWidget
       
    91 {
       
    92     Q_OBJECT
       
    93 
       
    94 public:
       
    95 
       
    96     TestWidget2(QGraphicsItem* aParent = 0, Qt::WindowFlags aFlags = 0)
       
    97         : HsWidget(aParent, aFlags) {}
       
    98     
       
    99 protected:
       
   100 
       
   101     StartResult onStart()
       
   102     {
       
   103         return StartResultFinished;
       
   104     }   
       
   105 
       
   106     StopResult onStop()
       
   107     {
       
   108         return StopResultFinished;
       
   109     }
       
   110 
       
   111 };
       
   112 
       
   113 class TestWidget3 : public HsWidget
       
   114 {
       
   115     Q_OBJECT
       
   116 
       
   117 public:
       
   118 
       
   119     TestWidget3(QGraphicsItem* aParent = 0, Qt::WindowFlags aFlags = 0)
       
   120         : HsWidget(aParent, aFlags) {}
       
   121     
       
   122 protected:
       
   123 
       
   124     StartResult onStart()
       
   125     {
       
   126         return mStartResult;
       
   127     }   
       
   128    
       
   129     StopResult onStop()
       
   130     {
       
   131         return mStopResult;
       
   132     }
       
   133 
       
   134 public:
       
   135 
       
   136     void setFaultingState()
       
   137     {
       
   138         setFaulting();
       
   139     }
       
   140 
       
   141     void setFaultedState()
       
   142     {
       
   143         setFaulted();
       
   144     }
       
   145 
       
   146     void setFinishedState()
       
   147     {
       
   148         setFinished();
       
   149     }
       
   150 
       
   151 public:
       
   152 
       
   153     StartResult mStartResult;    
       
   154     StopResult mStopResult;
       
   155 
       
   156 };
       
   157 
       
   158 
       
   159 /**
       
   160  * @test Test class for hswidgetmodel library.
       
   161  */
       
   162 class TestWidgetModel : public QObject
       
   163 {
       
   164 	Q_OBJECT
       
   165 
       
   166 private slots:
       
   167     
       
   168     /**
       
   169      * Sets dir for component model's test resources
       
   170      */
       
   171     void initTestCase()
       
   172     {
       
   173 #ifdef Q_OS_SYMBIAN 
       
   174         QDir::setCurrent("C:/hsresources/testresources/");
       
   175 #endif
       
   176     }
       
   177 
       
   178 
       
   179     /**
       
   180      * hswidget.h
       
   181      */
       
   182     void testWidgetInterface();
       
   183     void testWidgetConstructor();
       
   184     void testWidgetPreferenceService();
       
   185     void testWidgetStart_data();
       
   186     void testWidgetStart();
       
   187     void testWidgetSuspend_data();
       
   188     void testWidgetSuspend();
       
   189     void testWidgetResume_data();
       
   190     void testWidgetResume();
       
   191     void testWidgetStop_data();
       
   192     void testWidgetStop();
       
   193     void testWidgetSetFinished_data();
       
   194     void testWidgetSetFinished();    
       
   195     void testWidgetSetFaulted_data();
       
   196     void testWidgetSetFaulted();
       
   197     void testWidgetSetFaulting_data();
       
   198     void testWidgetSetFaulting();
       
   199         
       
   200     /**
       
   201     * testwidgetfactory.cpp
       
   202     */
       
   203    
       
   204     void testCreateWidget();
       
   205     
       
   206     /**
       
   207     * testwidgetprovidermanifest.cpp
       
   208     */
       
   209     void testWidgetProviderManifest();
       
   210     void testWidgetManifests();
       
   211 
       
   212 
       
   213 };
       
   214 
       
   215 
       
   216 #endif // HOMESCREEN_TEST_TESTWIDGETMODEL_H