hswidgetmodel/tsrc/t_hswidgetmodelexe/src/testwidgetfactory.cpp
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:  Tests for Exception class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "testwidgetmodel.h"
       
    20 #include "hswidgetfactory.h"
       
    21 #include "hsiwidgetprovider.h"
       
    22 #include "hswidget.h"
       
    23 
       
    24 #include <qglobal.h>
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 
       
    31 void TestWidgetModel::testCreateWidget()
       
    32 {
       
    33 
       
    34     HsWidget* widget = 0;
       
    35 
       
    36     HsWidgetFactory factory;
       
    37 
       
    38     HsWidgetToken token;
       
    39 #ifdef Q_OS_SYMBIAN 
       
    40     token.mLibrary = "C:/hsresources/testresources/plugins/widgetproviders/testwidgetprovider.dll";
       
    41 #else
       
    42     token.mLibrary = "plugins/widgetproviders/testwidgetprovider.dll";
       
    43 #endif
       
    44     token.mUri = "homescreen.nokia.com/widget/testwidget";
       
    45 
       
    46     widget = factory.createWidget(token);
       
    47     QVERIFY(widget);
       
    48     delete widget;
       
    49 
       
    50     token.mUri = "homescreen.nokia.com/widget/notfound";
       
    51 	widget = factory.createWidget(token);
       
    52 	QVERIFY(!widget);
       
    53     delete widget;
       
    54 
       
    55     token.mLibrary = "notfound";
       
    56     widget = factory.createWidget(token);
       
    57     QVERIFY(!widget);
       
    58     delete widget;
       
    59   
       
    60     HsPluginUnloader loader(0);
       
    61     QCoreApplication::processEvents(); // for code coverage to catch deleteLater 
       
    62 }
       
    63 
       
    64