hswidgetmodel/tsrc/t_hswidgetmodelexe/inc/testwidgetmodel.h
changeset 117 c63ee96dbe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hswidgetmodel/tsrc/t_hswidgetmodelexe/inc/testwidgetmodel.h	Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Main test class for hspluginmodel library.
+*
+*/
+
+
+#ifndef HOMESCREEN_TEST_TESTWIDGETMODEL_H
+#define HOMESCREEN_TEST_TESTWIDGETMODEL_H
+
+#include <QtTest/QtTest>
+#include "hswidget.h"
+
+#ifdef Q_OS_SYMBIAN
+#include <QDir>
+#endif
+
+
+
+
+
+class TestWidget : public HsWidget
+{
+    Q_OBJECT
+
+public:
+
+    TestWidget(QGraphicsItem* aParent = 0, Qt::WindowFlags aFlags = 0)
+        : HsWidget(aParent, aFlags) {}
+    
+protected:
+
+    StartResult onStart()
+    {
+        return mStartResult;
+    }   
+
+    SuspendResult onSuspend()
+    {
+        return mSuspendResult;
+    }
+
+    ResumeResult onResume()
+    {
+        return mResumeResult;
+    }
+
+    StopResult onStop()
+    {
+        return mStopResult;
+    }
+
+public:
+
+    void setFaultingState()
+    {
+        setFaulting();
+    }
+
+    void setFaultedState()
+    {
+        setFaulted();
+    }
+
+    void setFinishedState()
+    {
+        setFinished();
+    }
+
+public:
+
+    StartResult mStartResult;
+    SuspendResult mSuspendResult;
+    ResumeResult mResumeResult;
+    StopResult mStopResult;
+
+};
+
+class TestWidget2 : public HsWidget
+{
+    Q_OBJECT
+
+public:
+
+    TestWidget2(QGraphicsItem* aParent = 0, Qt::WindowFlags aFlags = 0)
+        : HsWidget(aParent, aFlags) {}
+    
+protected:
+
+    StartResult onStart()
+    {
+        return StartResultFinished;
+    }   
+
+    StopResult onStop()
+    {
+        return StopResultFinished;
+    }
+
+};
+
+class TestWidget3 : public HsWidget
+{
+    Q_OBJECT
+
+public:
+
+    TestWidget3(QGraphicsItem* aParent = 0, Qt::WindowFlags aFlags = 0)
+        : HsWidget(aParent, aFlags) {}
+    
+protected:
+
+    StartResult onStart()
+    {
+        return mStartResult;
+    }   
+   
+    StopResult onStop()
+    {
+        return mStopResult;
+    }
+
+public:
+
+    void setFaultingState()
+    {
+        setFaulting();
+    }
+
+    void setFaultedState()
+    {
+        setFaulted();
+    }
+
+    void setFinishedState()
+    {
+        setFinished();
+    }
+
+public:
+
+    StartResult mStartResult;    
+    StopResult mStopResult;
+
+};
+
+
+/**
+ * @test Test class for hswidgetmodel library.
+ */
+class TestWidgetModel : public QObject
+{
+	Q_OBJECT
+
+private slots:
+    
+    /**
+     * Sets dir for component model's test resources
+     */
+    void initTestCase()
+    {
+#ifdef Q_OS_SYMBIAN 
+        QDir::setCurrent("C:/hsresources/testresources/");
+#endif
+    }
+
+
+    /**
+     * hswidget.h
+     */
+    void testWidgetInterface();
+    void testWidgetConstructor();
+    void testWidgetPreferenceService();
+    void testWidgetStart_data();
+    void testWidgetStart();
+    void testWidgetSuspend_data();
+    void testWidgetSuspend();
+    void testWidgetResume_data();
+    void testWidgetResume();
+    void testWidgetStop_data();
+    void testWidgetStop();
+    void testWidgetSetFinished_data();
+    void testWidgetSetFinished();    
+    void testWidgetSetFaulted_data();
+    void testWidgetSetFaulted();
+    void testWidgetSetFaulting_data();
+    void testWidgetSetFaulting();
+        
+    /**
+    * testwidgetfactory.cpp
+    */
+   
+    void testCreateWidget();
+    
+    /**
+    * testwidgetprovidermanifest.cpp
+    */
+    void testWidgetProviderManifest();
+    void testWidgetManifests();
+
+
+};
+
+
+#endif // HOMESCREEN_TEST_TESTWIDGETMODEL_H