homescreenapp/hsdomainmodel/tsrc/t_hsdomainmodel/src/t_hswidgetcomponentregistry.cpp
changeset 96 458d8c8d9580
equal deleted inserted replaced
92:6727c5d0afc7 96:458d8c8d9580
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Wallpaper test.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "t_hsdomainmodel.h"
       
    19 #include "hswidgetcomponentregistry.h"
       
    20 #include "hswidgetcomponent.h"
       
    21 #include "hswidgetcomponentdescriptor.h"
       
    22 #include "caentry.h"
       
    23 #include "hsapp_defs.h"
       
    24 /*!
       
    25 
       
    26 */
       
    27 void TestHsDomainModel::testWidgetComponentRegistry()
       
    28 {
       
    29     HsWidgetComponent* compo = HsWidgetComponentRegistry::instance()->component("mockwidgetplugin");
       
    30     QVERIFY(compo);
       
    31     QSignalSpy spy(compo,SIGNAL(aboutToUninstall()));
       
    32     HsWidgetComponentDescriptor widgetDescriptor;
       
    33     widgetDescriptor.setUri("mockwidgetplugin");
       
    34     // this deletes compo
       
    35     HsWidgetComponentRegistry::instance()->uninstallComponent(widgetDescriptor);
       
    36     QVERIFY(spy.count()==1);
       
    37     spy.clear();
       
    38     widgetDescriptor.setUri("notfoundwidget");
       
    39     HsWidgetComponentRegistry::instance()->uninstallComponent(widgetDescriptor);
       
    40     QVERIFY(spy.count()==0);
       
    41 }
       
    42 
       
    43 void TestHsDomainModel::testWidgetComponentRegistryOnEntryChanged()
       
    44 {
       
    45     HsWidgetComponent* compo = HsWidgetComponentRegistry::instance()->component("mockwidgetplugin");
       
    46     QVERIFY(compo);
       
    47     CaEntry caEntry;
       
    48     caEntry.setAttribute(Hs::widgetPathAttributeName, "mockwidgetplugin");
       
    49     HsWidgetComponentRegistry::instance()->onEntryChanged(caEntry, AddChangeType);
       
    50     HsWidgetComponentRegistry::instance()->onEntryChanged(caEntry, RemoveChangeType);
       
    51     caEntry.setFlags(MissingEntryFlag);
       
    52     HsWidgetComponentRegistry::instance()->onEntryChanged(caEntry, RemoveChangeType);
       
    53     HsWidgetComponentRegistry::instance()->onEntryChanged(caEntry, UpdateChangeType);
       
    54     // invalid.
       
    55     HsWidgetComponentRegistry::instance()->onEntryChanged(caEntry, (ChangeType) 100);
       
    56     
       
    57     // there isnt really a good way to verify results, just calling these functions...
       
    58     
       
    59 }