|
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: |
|
15 * |
|
16 */ |
|
17 #include "t_searchstateprovider.h" |
|
18 #include "searchsettingsstate.h" |
|
19 |
|
20 // --------------------------------------------------------------------------- |
|
21 //SearchStateProviderTest::testsettingsStateConstruction() |
|
22 // --------------------------------------------------------------------------- |
|
23 // |
|
24 void SearchStateProviderTest::testsettingsStateConstruction() |
|
25 { |
|
26 // HbMainWindow* wind = mainWindow(); |
|
27 SearchSettingsState* settingsState = new SearchSettingsState(); |
|
28 |
|
29 QVERIFY(settingsState != NULL); |
|
30 QVERIFY(settingsState->mWidget); |
|
31 |
|
32 delete settingsState; |
|
33 |
|
34 } |
|
35 // --------------------------------------------------------------------------- |
|
36 //SearchStateProviderTest::testsettingsStateOnEntryAndExitSignalled() |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 void SearchStateProviderTest::testsettingsStateOnEntryAndExitSignalled() |
|
40 { |
|
41 // HbMainWindow* wind = mainWindow(); |
|
42 |
|
43 SearchSettingsState* settingsState = new SearchSettingsState(); |
|
44 |
|
45 QEvent *event = new QEvent(QEvent::None); |
|
46 settingsState->onEntry(event); |
|
47 |
|
48 settingsState->onExit(event); |
|
49 |
|
50 delete settingsState; |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 //SearchStateProviderTest::testhandleBackEvent() |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void SearchStateProviderTest::testhandleBackEvent() |
|
58 { |
|
59 SearchSettingsState* settingsState = new SearchSettingsState(); |
|
60 |
|
61 QSignalSpy spy(settingsState, SIGNAL(backEventTriggered())); |
|
62 settingsState->handleBackEvent(true); |
|
63 QCOMPARE(spy.count(), 1); |
|
64 |
|
65 delete settingsState; |
|
66 } |
|
67 // --------------------------------------------------------------------------- |
|
68 //SearchStateProviderTest::test_selectedcategory() |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 void SearchStateProviderTest::testgetItemCategory() |
|
72 { |
|
73 SearchSettingsState* settingsState = new SearchSettingsState(); |
|
74 |
|
75 QSignalSpy spy(settingsState, |
|
76 SIGNAL(publishSelectedCategory(int, bool))); |
|
77 settingsState->getItemCategory(1, true); |
|
78 settingsState->getItemCategory(1, false); |
|
79 settingsState->getItemCategory(6, true); |
|
80 settingsState->getItemCategory(6, true); |
|
81 QCOMPARE(spy.count(), 4); |
|
82 delete settingsState; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 //SearchStateProviderTest::testisInternetOn() |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 void SearchStateProviderTest::testisInternetOn() |
|
90 { |
|
91 SearchSettingsState* settingsState = new SearchSettingsState(); |
|
92 QSignalSpy spy(settingsState, |
|
93 SIGNAL(customizeGoButton(bool))); |
|
94 |
|
95 settingsState->isInternetOn(); |
|
96 |
|
97 QCOMPARE(spy.count(), 1); |
|
98 delete settingsState; |
|
99 } |