|
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 WidgetBase class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "testwidgetmodel.h" |
|
20 #include "hswidgetprovidermanifest.h" |
|
21 #include "hsiwidgetprovider.h" |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 void TestWidgetModel::testWidgetProviderManifest() |
|
29 { |
|
30 |
|
31 HsWidgetProviderManifest manifest1; |
|
32 manifest1.loadFromXml("notfound.manifest"); |
|
33 QVERIFY(manifest1.widgets().count() == 0); |
|
34 |
|
35 HsWidgetProviderManifest manifest2; |
|
36 manifest2.loadFromXml("notwellformedwidget.manifest"); |
|
37 QVERIFY(manifest2.widgets().count() == 0); |
|
38 |
|
39 HsWidgetProviderManifest manifest3; |
|
40 manifest3.loadFromXml("invalidwidget.manifest"); |
|
41 QVERIFY(manifest3.widgets().count() == 0); |
|
42 |
|
43 HsWidgetProviderManifest manifest4; |
|
44 manifest4.loadFromXml("validwidget.manifest"); |
|
45 |
|
46 QVERIFY(manifest4.loadOnQuery() == false); |
|
47 QVERIFY(manifest4.widgets().count() > 0); |
|
48 QList<HsWidgetToken> widgets = manifest4.widgets(); |
|
49 QCOMPARE(widgets.at(0).mLibrary, widgets.at(1).mLibrary); |
|
50 QVERIFY(widgets.at(0).mUri == "homescreen.nokia.com/widget/testwidget"); |
|
51 |
|
52 HsWidgetProviderManifest manifest5; |
|
53 manifest5.loadFromXml("validwidget2.manifest"); |
|
54 QVERIFY(manifest5.loadOnQuery() == true); |
|
55 QVERIFY(manifest5.widgets().count() > 0); |
|
56 QList<HsWidgetToken> widgets5 = manifest5.widgets(); |
|
57 QVERIFY(widgets5.at(0).mLibrary == "testwidgetprovider.dll"); |
|
58 QVERIFY(widgets5.at(0).mUri == "homescreen.nokia.com/widget/testwidget"); |
|
59 |
|
60 } |
|
61 |
|
62 void TestWidgetModel::testWidgetManifests() |
|
63 { |
|
64 HsWidgetProviderManifest manifest; |
|
65 manifest.loadFromXml("validwidget.manifest"); |
|
66 QList<HsWidgetToken> widgets = manifest.widgets(); |
|
67 QVERIFY(widgets.count() == 2); |
|
68 } |
|
69 |
|
70 |