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: XENT-MV |
|
13 * |
|
14 * Description: unit tests for the CpThemeControl class from themeplugin |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtTest/QtTest> |
|
19 #include <QSignalSpy> |
|
20 |
|
21 #include <hbinstance.h> |
|
22 #include <hbtheme.h> |
|
23 |
|
24 #include "cpthemechanger.h" |
|
25 #include "cpthemecontrol.h" |
|
26 #include "cpthemeinfo.h" |
|
27 #include "cpthemeutil.h" |
|
28 |
|
29 class TestCpThemeControl : public QObject |
|
30 { |
|
31 Q_OBJECT |
|
32 |
|
33 private slots: |
|
34 |
|
35 void testConstructor(); |
|
36 void testThemeListView(); |
|
37 void testCurrentThemeName(); |
|
38 void testCurrentThemeIcon(); |
|
39 |
|
40 private: |
|
41 CpThemeChanger* mThemeChanger; |
|
42 }; |
|
43 |
|
44 |
|
45 |
|
46 // verify that the constructor works and that the |
|
47 // defaults are sane. |
|
48 void TestCpThemeControl::testConstructor() |
|
49 { |
|
50 CpThemeControl * control = new CpThemeControl(); |
|
51 |
|
52 QVERIFY(control !=0 ); |
|
53 QVERIFY(!control->currentThemeName().isEmpty()); |
|
54 QVERIFY(!control->currentThemeIcon().iconName().isEmpty()); |
|
55 |
|
56 delete control; |
|
57 } |
|
58 |
|
59 // verify that the themeListView doesn't return NULL (or crash) |
|
60 void TestCpThemeControl::testThemeListView() |
|
61 { |
|
62 CpThemeControl control; |
|
63 |
|
64 QVERIFY(control.themeListView() != 0); |
|
65 } |
|
66 |
|
67 // test that we get back a non-empty QString |
|
68 void TestCpThemeControl::testCurrentThemeName() |
|
69 { |
|
70 CpThemeControl control; |
|
71 |
|
72 QVERIFY( (control.currentThemeName() == hbInstance->theme()->name()) |
|
73 || (control.currentThemeName() == QString("hbdefault"))); |
|
74 } |
|
75 |
|
76 // test that we get a non-empty string for current theme icon |
|
77 void TestCpThemeControl::testCurrentThemeIcon() |
|
78 { |
|
79 CpThemeControl control; |
|
80 |
|
81 QVERIFY(!control.currentThemeIcon().isNull() && !control.currentThemeIcon().iconName().isEmpty()); |
|
82 } |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 QTEST_MAIN(TestCpThemeControl) |
|
89 #include "unittest_cpthemecontrol.moc" |
|