diff -r 3ab5c078b490 -r c63ee96dbe5f hswidgetmodel/tsrc/t_hswidgetmodelexe/src/testwidgetfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hswidgetmodel/tsrc/t_hswidgetmodelexe/src/testwidgetfactory.cpp Thu Sep 16 12:11:40 2010 +0100 @@ -0,0 +1,64 @@ +/* +* 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 + + + + + + +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 +} + +