|
1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QStateMachine> |
|
19 |
|
20 #include <HbInstance> |
|
21 #include <HbMainWindow> |
|
22 |
|
23 #include "t_hshomescreenstateplugin.h" |
|
24 #include "hsbackuprestorestate.h" |
|
25 #include "hsscene.h" |
|
26 #include "hsdatabase.h" |
|
27 #include "hsgui.h" |
|
28 |
|
29 void HomeScreenStatePluginTest::testLoadBackupRestoreStateConstructors() |
|
30 { |
|
31 HsBackupRestoreState *brs = new HsBackupRestoreState; |
|
32 delete brs; |
|
33 } |
|
34 |
|
35 void HomeScreenStatePluginTest::testLoadBackupRestoreStateOnEntryExit() |
|
36 { |
|
37 HbInstance::instance(); |
|
38 HbMainWindow mainWindow; |
|
39 mainWindow.show(); |
|
40 QCoreApplication::sendPostedEvents(); |
|
41 |
|
42 QStateMachine *sm = new QStateMachine; |
|
43 HsBackupRestoreState *brs = new HsBackupRestoreState; |
|
44 |
|
45 sm->addState(brs); |
|
46 sm->setInitialState(brs); |
|
47 |
|
48 |
|
49 QFinalState *fs = new QFinalState; |
|
50 sm->addState(fs); |
|
51 |
|
52 brs->addTransition(this, SIGNAL(finishStateMachine()), fs); |
|
53 |
|
54 sm->start(); |
|
55 QCoreApplication::sendPostedEvents(); |
|
56 emit finishStateMachine(); |
|
57 |
|
58 sm->stop(); |
|
59 // main window deleted -> HsGui must be deleted also |
|
60 delete HsGui::takeInstance(); |
|
61 delete sm; |
|
62 } |