37 HbAbstractViewItem *item = new MockViewItem; |
37 HbAbstractViewItem *item = new MockViewItem; |
38 return item; |
38 return item; |
39 } |
39 } |
40 }; |
40 }; |
41 |
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
42 void MenuStatesTest::testSlot() |
46 void MenuStatesTest::testSlot() |
43 { |
47 { |
44 mSlotActivated = true; |
48 mSlotActivated = true; |
45 } |
49 } |
46 |
50 |
47 |
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
48 void MenuStatesTest::cleanup() |
55 void MenuStatesTest::cleanup() |
49 { |
56 { |
50 qApp->processEvents(); |
57 qApp->processEvents(); |
51 } |
58 } |
52 |
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
53 void MenuStatesTest::HsSearchViewBuilder_construction() |
64 void MenuStatesTest::HsSearchViewBuilder_construction() |
54 { |
65 { |
55 HsSearchViewBuilder builder; |
66 HsSearchViewBuilder builder; |
56 QVERIFY(builder.mLoadedObjects.count()); |
67 QVERIFY(builder.mLoadedObjects.count()); |
57 } |
68 } |
58 |
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
59 void MenuStatesTest::HsSearchViewBuilder_uiObjects() |
74 void MenuStatesTest::HsSearchViewBuilder_uiObjects() |
60 { |
75 { |
61 HsSearchViewBuilder builder; |
76 HsSearchViewBuilder builder; |
62 QVERIFY(builder.searchListView()); |
77 QVERIFY(builder.searchListView()); |
63 QVERIFY(builder.searchPanel()); |
78 QVERIFY(builder.searchPanel()); |
64 QVERIFY(builder.searchView()); |
79 QVERIFY(builder.searchView()); |
65 QVERIFY(builder.searchViewLabel()); |
80 QVERIFY(builder.searchViewLabel()); |
66 } |
81 } |
67 |
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
68 void MenuStatesTest::HsSearchViewBuilder_setSearchLabledContext() |
87 void MenuStatesTest::HsSearchViewBuilder_setSearchLabledContext() |
69 { |
88 { |
70 HsSearchViewBuilder builder; |
89 HsSearchViewBuilder builder; |
71 builder.setSearchLabledContext(); |
90 builder.setSearchLabledContext(); |
72 QVERIFY(builder.mLabledContext); |
91 QVERIFY(builder.mLabledContext); |
73 } |
92 } |
74 |
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
75 void MenuStatesTest::HsSearchViewBuilder_loadViewEmptySection() |
98 void MenuStatesTest::HsSearchViewBuilder_loadViewEmptySection() |
76 { |
99 { |
77 HsSearchViewBuilder builder; |
100 HsSearchViewBuilder builder; |
78 int firstCount = builder.mLoadedObjects.count(); |
101 int firstCount = builder.mLoadedObjects.count(); |
79 builder.loadViewEmptySection(); |
102 builder.loadViewEmptySection(); |
80 QCOMPARE(firstCount, builder.mLoadedObjects.count()); |
103 QCOMPARE(firstCount, builder.mLoadedObjects.count()); |
81 } |
104 } |
82 |
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
83 void MenuStatesTest::HsSearchViewBuilder_loadViewListSection() |
110 void MenuStatesTest::HsSearchViewBuilder_loadViewListSection() |
84 { |
111 { |
85 HsSearchViewBuilder builder; |
112 HsSearchViewBuilder builder; |
86 int firstCount = builder.mLoadedObjects.count(); |
113 int firstCount = builder.mLoadedObjects.count(); |
87 builder.loadViewListSection(); |
114 builder.loadViewListSection(); |
88 QCOMPARE(firstCount, builder.mLoadedObjects.count()); |
115 QCOMPARE(firstCount, builder.mLoadedObjects.count()); |
89 } |
116 } |
90 |
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
91 void MenuStatesTest::HsSearchViewBuilder_searchViewConstruction() |
122 void MenuStatesTest::HsSearchViewBuilder_searchViewConstruction() |
92 { |
123 { |
93 HsMenuViewBuilder builder; |
124 HsMenuViewBuilder builder; |
94 HsMainWindowMock window; |
125 HsMainWindowMock window; |
95 |
126 |
98 QCOMPARE(search.mProxyModel->filterRole(), int(CaItemModel::TextRole)); |
129 QCOMPARE(search.mProxyModel->filterRole(), int(CaItemModel::TextRole)); |
99 QCOMPARE(search.mProxyModel->filterKeyColumn(), 0); |
130 QCOMPARE(search.mProxyModel->filterKeyColumn(), 0); |
100 QCOMPARE(search.mProxyModel->sortRole(), int(CaItemModel::TextRole)); |
131 QCOMPARE(search.mProxyModel->sortRole(), int(CaItemModel::TextRole)); |
101 } |
132 } |
102 |
133 |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
103 void MenuStatesTest::HsSearchViewBuilder_activatedProxySlot() |
138 void MenuStatesTest::HsSearchViewBuilder_activatedProxySlot() |
104 { |
139 { |
105 HsMenuViewBuilder builder; |
140 HsMenuViewBuilder builder; |
106 HsMainWindowMock window; |
141 HsMainWindowMock window; |
107 |
142 |
144 search.hideSearchPanel(); |
187 search.hideSearchPanel(); |
145 QVERIFY(!search.mSearchListView); |
188 QVERIFY(!search.mSearchListView); |
146 |
189 |
147 } |
190 } |
148 |
191 |
149 |
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
150 class MockInputContext: public QInputContext |
196 class MockInputContext: public QInputContext |
151 { |
197 { |
152 public: |
198 public: |
153 QEvent::Type mEventType; |
199 QEvent::Type mEventType; |
154 MockInputContext(): mEventType(QEvent::None) {} |
200 MockInputContext(): mEventType(QEvent::None) {} |
155 QString identifierName() { return qApp->inputContext()->identifierName();} |
201 QString identifierName() { return qApp->inputContext()->identifierName();} |
156 bool isComposing() const { return qApp->inputContext()->isComposing();} |
202 bool isComposing() const { return qApp->inputContext()->isComposing();} |
157 QString language() { return qApp->inputContext()->language();} |
203 QString language() { return qApp->inputContext()->language();} |
158 void reset() {;} |
204 void reset() {;} |
159 void setFocusWidget(QWidget* widget) {QInputContext::setFocusWidget(widget);} |
205 void setFocusWidget(QWidget* widget) {QInputContext::setFocusWidget(widget);} |
160 bool filterEvent(const QEvent* event) |
206 bool filterEvent(const QEvent* event) |
161 { |
207 { |
162 mEventType = event->type(); |
208 mEventType = event->type(); |
163 return true; |
209 return true; |
164 } |
210 } |
165 }; |
211 }; |
166 |
212 |
|
213 // --------------------------------------------------------------------------- |
|
214 // |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
167 void MenuStatesTest::HsSearchViewBuilder_hideVkb() |
217 void MenuStatesTest::HsSearchViewBuilder_hideVkb() |
168 { |
218 { |
169 HsMenuViewBuilder builder; |
219 HsMenuViewBuilder builder; |
170 HsMainWindowMock window; |
220 HsMainWindowMock window; |
171 |
221 |