hswidgetmodel/tsrc/t_hswidgetmodelexe/src/testwidgetfactory.cpp
author Jaakko Haukipuro (Nokia-MS/Oulu) <Jaakko.Haukipuro@nokia.com>
Thu, 16 Sep 2010 12:11:40 +0100
changeset 117 c63ee96dbe5f
permissions -rw-r--r--
Missing activityfw and taskswitcher components - fix for Bug 3670

/*
* 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:  Tests for Exception class.
*
*/


#include "testwidgetmodel.h"
#include "hswidgetfactory.h"
#include "hsiwidgetprovider.h"
#include "hswidget.h"

#include <qglobal.h>






void TestWidgetModel::testCreateWidget()
{

    HsWidget* widget = 0;

    HsWidgetFactory factory;

    HsWidgetToken token;
#ifdef Q_OS_SYMBIAN 
    token.mLibrary = "C:/hsresources/testresources/plugins/widgetproviders/testwidgetprovider.dll";
#else
    token.mLibrary = "plugins/widgetproviders/testwidgetprovider.dll";
#endif
    token.mUri = "homescreen.nokia.com/widget/testwidget";

    widget = factory.createWidget(token);
    QVERIFY(widget);
    delete widget;

    token.mUri = "homescreen.nokia.com/widget/notfound";
	widget = factory.createWidget(token);
	QVERIFY(!widget);
    delete widget;

    token.mLibrary = "notfound";
    widget = factory.createWidget(token);
    QVERIFY(!widget);
    delete widget;
  
    HsPluginUnloader loader(0);
    QCoreApplication::processEvents(); // for code coverage to catch deleteLater 
}