90
|
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 |
|
|
19 |
#include "t_hsdomainmodel.h"
|
|
20 |
#include "hswidgetcomponent.h"
|
|
21 |
|
|
22 |
#include "caentry.h"
|
|
23 |
#include "hsapp_defs.h"
|
|
24 |
/*!
|
|
25 |
|
|
26 |
*/
|
|
27 |
void TestHsDomainModel::testWidgetComponent()
|
|
28 |
{
|
|
29 |
QScopedPointer<HsWidgetComponent> compo(new HsWidgetComponent("mockwidgetplugin"));
|
|
30 |
QVERIFY(!compo.isNull());
|
|
31 |
QString path = compo->rootPath();
|
|
32 |
QVERIFY(!compo->isAvailable()); // is not in ca store
|
|
33 |
QVERIFY(compo->uri() == "mockwidgetplugin");
|
|
34 |
compo->uninstallTranslator();
|
|
35 |
}
|
|
36 |
|
|
37 |
|
|
38 |
void TestHsDomainModel::testWidgetComponentEmits()
|
|
39 |
{
|
|
40 |
|
|
41 |
QScopedPointer<HsWidgetComponent> compo(new HsWidgetComponent("mockwidgetplugin"));
|
|
42 |
|
|
43 |
QSignalSpy aboutToUninstallSpy(compo.data(),SIGNAL(aboutToUninstall()));
|
|
44 |
QSignalSpy uninstalledSpy(compo.data(),SIGNAL(uninstalled()));
|
|
45 |
QSignalSpy unavailableSpy(compo.data(),SIGNAL(unavailable()));
|
|
46 |
QSignalSpy availableSpy(compo.data(),SIGNAL(available()));
|
|
47 |
QSignalSpy updatedSpy(compo.data(),SIGNAL(updated()));
|
|
48 |
|
|
49 |
compo->emitAboutToUninstall();
|
|
50 |
QVERIFY(aboutToUninstallSpy.count() == 1);
|
|
51 |
// should not emit again
|
|
52 |
compo->emitAboutToUninstall();
|
|
53 |
QVERIFY(aboutToUninstallSpy.count() == 1);
|
|
54 |
|
|
55 |
compo->emitUninstalled();
|
|
56 |
QVERIFY(uninstalledSpy.count() == 1);
|
|
57 |
// should not emit again
|
|
58 |
compo->emitUninstalled();
|
|
59 |
QVERIFY(uninstalledSpy.count() == 1);
|
|
60 |
|
|
61 |
compo->emitUnavailable();
|
|
62 |
QVERIFY(unavailableSpy.count() == 1);
|
|
63 |
// should not emit again
|
|
64 |
compo->emitUnavailable();
|
|
65 |
QVERIFY(unavailableSpy.count() == 1);
|
|
66 |
|
|
67 |
compo->emitAvailable();
|
|
68 |
QVERIFY(availableSpy.count() == 1);
|
|
69 |
// should not emit again
|
|
70 |
compo->emitAvailable();
|
|
71 |
QVERIFY(availableSpy.count() == 1);
|
|
72 |
|
|
73 |
compo->emitAboutToUninstall();
|
|
74 |
compo->emitUpdated();
|
|
75 |
QVERIFY(updatedSpy.count() == 1);
|
|
76 |
// should not emit again
|
|
77 |
compo->emitUpdated();
|
|
78 |
QVERIFY(updatedSpy.count() == 1);
|
|
79 |
}
|