|
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: Main test class for hsutils library. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "t_hsapplication.h" |
|
20 #include "hshomescreen.h" |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // --------------------------------------------------------------------------- |
|
24 // |
|
25 void t_hsapplication::testCreateHomescreen() |
|
26 { |
|
27 HsHomeScreen hs; |
|
28 QVERIFY(hs.mRuntime); |
|
29 } |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 void t_hsapplication::testHomescreenStart() |
|
35 { |
|
36 |
|
37 { |
|
38 HsHomeScreen hs; |
|
39 QSignalSpy spy(&hs,SIGNAL(exit())); |
|
40 hs.start(); |
|
41 qApp->processEvents(); |
|
42 QVERIFY(spy.count() == 0); |
|
43 } |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 void t_hsapplication::testHomescreenStop() |
|
50 { |
|
51 { |
|
52 //Improves coverage test: return at the beginning of the stop() |
|
53 HsHomeScreen hs; |
|
54 hs.stop(); |
|
55 } |
|
56 |
|
57 { |
|
58 HsHomeScreen hs; |
|
59 hs.start(); |
|
60 qApp->processEvents(); |
|
61 hs.stop(); |
|
62 } |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void t_hsapplication::testOnRuntimeStarted() |
|
69 { |
|
70 HsHomeScreen hs; |
|
71 hs.onRuntimeStarted(); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 void t_hsapplication::testOnRuntimeStopped() |
|
78 { |
|
79 HsHomeScreen hs; |
|
80 QSignalSpy spy(&hs,SIGNAL(exit())); |
|
81 hs.onRuntimeStopped(); |
|
82 QVERIFY(spy.count() == 1); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void t_hsapplication::testEventFilter() |
|
89 { |
|
90 HsHomeScreen hs; |
|
91 QVERIFY(!hs.eventFilter(0,&QEvent(QEvent::ActionAdded))); |
|
92 |
|
93 QEvent *e = new QEvent(QEvent::Close); |
|
94 QVERIFY(hs.eventFilter(0,e)); |
|
95 delete e; |
|
96 } |