Merge lp:~azzar1/unity/category-expension into lp:~unity-team/unity/libunity-7.0-breakage
- category-expension
- Merge into libunity-7.0-breakage
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Michal Hruby | ||||
Proposed branch: | lp:~azzar1/unity/category-expension | ||||
Merge into: | lp:~unity-team/unity/libunity-7.0-breakage | ||||
Prerequisite: | lp:~nick-dedekind/unity/smart-scopes.static-resultview-focus | ||||
Diff against target: |
583 lines (+324/-65) 8 files modified
UnityCore/Scope.cpp (+0/-5) dash/PlacesGroup.h (+2/-2) dash/ScopeView.cpp (+19/-17) tests/MockResults.h (+62/-0) tests/test_mock_scope.h (+11/-6) tests/test_scope_bar.cpp (+0/-3) tests/test_scope_proxy.cpp (+0/-2) tests/test_scopeview.cpp (+230/-30) |
||||
To merge this branch: | bzr merge lp:~azzar1/unity/category-expension | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Nick Dedekind (community) | Approve | ||
Review via email: mp+161984@code.launchpad.net |
Commit message
Fix category expansion.
Description of the change
== Problem ==
Category header expansion is misbehaving.
== Notes ==
Bug 1174485 is hard to reproduce with a fast internet connection, btw all the tests pass. There could be not handled corner cases but should be ok for the moment.
== Tests ==
Unit tests added.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3136
http://
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild:
http://
Nick Dedekind (nick-dedekind) wrote : | # |
LGTM.
Tests run successfully. Tested UI behaviour.
There are many errors output by DeeSequenceModel when running the ScopeView tests, but it doesn't seem to affect the tests. Would be nice to get rid of these.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
Michal Hruby (mhr3) wrote : | # |
Preview Diff
1 | === modified file 'UnityCore/Scope.cpp' |
2 | --- UnityCore/Scope.cpp 2013-03-27 19:45:52 +0000 |
3 | +++ UnityCore/Scope.cpp 2013-05-02 18:31:27 +0000 |
4 | @@ -66,7 +66,6 @@ |
5 | Scope::Impl::~Impl() |
6 | { |
7 | for_each(property_connections.begin(), property_connections.end(), [](ConnectionPtr const& con) { con->disconnect(); }); |
8 | - property_connections.clear(); |
9 | } |
10 | |
11 | void Scope::Impl::Init() |
12 | @@ -93,10 +92,6 @@ |
13 | property_connections.push_back(utils::ConnectProperties(owner_->query_pattern, proxy_->query_pattern)); |
14 | property_connections.push_back(utils::ConnectProperties(owner_->shortcut, proxy_->shortcut)); |
15 | property_connections.push_back(utils::ConnectProperties(owner_->visible, proxy_->visible)); |
16 | - |
17 | - property_connections.push_back(utils::ConnectProperties(owner_->results, proxy_->results)); |
18 | - property_connections.push_back(utils::ConnectProperties(owner_->filters, proxy_->filters)); |
19 | - property_connections.push_back(utils::ConnectProperties(owner_->categories, proxy_->categories)); |
20 | } |
21 | } |
22 | |
23 | |
24 | === modified file 'dash/PlacesGroup.h' |
25 | --- dash/PlacesGroup.h 2013-05-02 18:31:27 +0000 |
26 | +++ dash/PlacesGroup.h 2013-05-02 18:31:27 +0000 |
27 | @@ -76,8 +76,8 @@ |
28 | |
29 | void SetCounts(unsigned n_total_items); |
30 | |
31 | - void SetExpanded(bool is_expanded); |
32 | - bool GetExpanded() const; |
33 | + virtual void SetExpanded(bool is_expanded); |
34 | + virtual bool GetExpanded() const; |
35 | |
36 | void PushExpanded(); |
37 | void PopExpanded(); |
38 | |
39 | === modified file 'dash/ScopeView.cpp' |
40 | --- dash/ScopeView.cpp 2013-05-02 18:31:27 +0000 |
41 | +++ dash/ScopeView.cpp 2013-05-02 18:31:27 +0000 |
42 | @@ -303,6 +303,8 @@ |
43 | if (!categories) |
44 | return; |
45 | |
46 | + QueueCategoryCountsCheck(); |
47 | + |
48 | category_added_connection = categories->category_added.connect(sigc::mem_fun(this, &ScopeView::OnCategoryAdded)); |
49 | category_changed_connection = categories->category_changed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryChanged)); |
50 | category_removed_connection = categories->category_removed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryRemoved)); |
51 | @@ -714,7 +716,7 @@ |
52 | |
53 | void ScopeView::CheckNoResults(glib::HintsMap const& hints) |
54 | { |
55 | - gint count = scope_->results()->count(); |
56 | + gint count = scope_->results() ? scope_->results()->count() : 0; |
57 | |
58 | if (count == 0 && !no_results_active_ && !search_string_.empty()) |
59 | { |
60 | @@ -774,38 +776,34 @@ |
61 | |
62 | PushResultFocus("count check"); |
63 | |
64 | - for (auto iter = category_order_.begin(); iter != category_order_.end(); ++iter) |
65 | + for (auto category_index : category_order_) |
66 | { |
67 | - unsigned int category_index = *iter; |
68 | if (category_views_.size() <= category_index) |
69 | continue; |
70 | |
71 | - PlacesGroup::Ptr group = category_views_[category_index]; |
72 | + PlacesGroup::Ptr const& group = category_views_[category_index]; |
73 | |
74 | group->SetCounts(counts_[group]); |
75 | group->SetVisible(counts_[group] > 0); |
76 | |
77 | if (counts_[group] > 0) |
78 | { |
79 | - number_of_displayed_categories++; |
80 | + ++number_of_displayed_categories; |
81 | new_expanded_group = group; |
82 | } |
83 | } |
84 | |
85 | - if (new_expanded_group && get_search_string().empty()) |
86 | - { |
87 | - // only expand the category if we have only one with results. |
88 | - if (number_of_displayed_categories <= 2) |
89 | - new_expanded_group->SetExpanded(true); |
90 | - if (last_expanded_group_ && last_expanded_group_ != new_expanded_group) |
91 | - last_expanded_group_->SetExpanded(false); |
92 | - } |
93 | - else if (last_expanded_group_) |
94 | - { |
95 | - last_expanded_group_->SetExpanded(false); |
96 | + if (last_expanded_group_ and last_expanded_group_ != new_expanded_group) { |
97 | + last_expanded_group_->PopExpanded(); |
98 | + last_expanded_group_ = nullptr; |
99 | } |
100 | |
101 | - last_expanded_group_ = new_expanded_group; |
102 | + if (new_expanded_group and number_of_displayed_categories <= 2) |
103 | + { |
104 | + new_expanded_group->PushExpanded(); |
105 | + new_expanded_group->SetExpanded(true); |
106 | + last_expanded_group_ = new_expanded_group; |
107 | + } |
108 | |
109 | PopResultFocus("count check"); |
110 | } |
111 | @@ -823,6 +821,10 @@ |
112 | |
113 | bool ScopeView::PerformSearch(std::string const& search_query, SearchCallback const& callback) |
114 | { |
115 | + if (search_string_ != search_query) |
116 | + for (auto const& group : category_views_) |
117 | + group->SetExpanded(false); |
118 | + |
119 | search_string_ = search_query; |
120 | if (scope_) |
121 | { |
122 | |
123 | === added file 'tests/MockResults.h' |
124 | --- tests/MockResults.h 1970-01-01 00:00:00 +0000 |
125 | +++ tests/MockResults.h 2013-05-02 18:31:27 +0000 |
126 | @@ -0,0 +1,62 @@ |
127 | +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
128 | +/* |
129 | + * Copyright (C) 2013 Canonical Ltd |
130 | + * |
131 | + * This program is free software: you can redistribute it and/or modify |
132 | + * it under the terms of the GNU General Public License version 3 as |
133 | + * published by the Free Software Foundation. |
134 | + * |
135 | + * This program is distributed in the hope that it will be useful, |
136 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
137 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
138 | + * GNU General Public License for more details. |
139 | + * |
140 | + * You should have received a copy of the GNU General Public License |
141 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
142 | + * |
143 | + * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> |
144 | + */ |
145 | + |
146 | +#ifndef UNITY_MOCK_RESULTS_H |
147 | +#define UNITY_MOCK_RESULTS_H |
148 | + |
149 | +#include "UnityCore/Results.h" |
150 | + |
151 | +namespace unity { |
152 | +namespace dash { |
153 | + |
154 | +struct MockResults : public Results |
155 | +{ |
156 | + MockResults(unsigned int count) |
157 | + : Results(LOCAL) |
158 | + , model_(dee_sequence_model_new()) |
159 | + { |
160 | + dee_model_set_schema(model_, "s", "s", "u", "u", "s", "s", "s", "s", "a{sv}", nullptr); |
161 | + AddResults(count); |
162 | + |
163 | + SetModel(model_); |
164 | + } |
165 | + |
166 | + void AddResults(unsigned count) |
167 | + { |
168 | + GVariantBuilder b; |
169 | + g_variant_builder_init(&b, G_VARIANT_TYPE("a{sv}")); |
170 | + GVariant *hints = g_variant_builder_end(&b); |
171 | + |
172 | + for(unsigned i = 0; i < count; ++i) |
173 | + { |
174 | + dee_model_append(model_, "uri", "icon_hint", |
175 | + 0, 0, "mimetype", |
176 | + "title", "comment", "dnd_uri", hints); |
177 | + } |
178 | + |
179 | + g_variant_unref(hints); |
180 | + } |
181 | + |
182 | + glib::Object<DeeModel> model_; |
183 | +}; |
184 | + |
185 | +} |
186 | +} |
187 | + |
188 | +#endif |
189 | \ No newline at end of file |
190 | |
191 | === modified file 'tests/test_mock_scope.h' |
192 | --- tests/test_mock_scope.h 2013-03-15 10:54:33 +0000 |
193 | +++ tests/test_mock_scope.h 2013-05-02 18:31:27 +0000 |
194 | @@ -29,6 +29,8 @@ |
195 | |
196 | #include <unity-protocol.h> |
197 | |
198 | +#include "MockResults.h" |
199 | + |
200 | namespace unity |
201 | { |
202 | namespace dash |
203 | @@ -44,8 +46,9 @@ |
204 | class MockScopeProxy : public ScopeProxyInterface |
205 | { |
206 | public: |
207 | - MockScopeProxy(std::string const& _name, std::string const& _icon_hint) |
208 | - : connected_(true) |
209 | + MockScopeProxy(std::string const& _name, std::string const& _icon_hint, unsigned count_results) |
210 | + : connected_(true) |
211 | + , results_(std::make_shared<MockResults>(count_results)) |
212 | { |
213 | connected.SetGetterFunction([this] () { return connected_; }); |
214 | name.SetGetterFunction([_name] () { return _name; }); |
215 | @@ -96,12 +99,13 @@ |
216 | |
217 | virtual Results::Ptr GetResultsForCategory(unsigned category) const |
218 | { |
219 | - return Results::Ptr(); |
220 | + return results_; |
221 | } |
222 | |
223 | protected: |
224 | glib::SourceManager source_manager; |
225 | bool connected_; |
226 | + MockResults::Ptr results_; |
227 | }; |
228 | |
229 | class MockScopeData : public ScopeData |
230 | @@ -124,12 +128,13 @@ |
231 | |
232 | MockScope(ScopeData::Ptr const& scope_data, |
233 | std::string const& name = "", |
234 | - std::string const& icon_hint = "") |
235 | + std::string const& icon_hint = "", |
236 | + unsigned result_count = 0) |
237 | : Scope(scope_data) |
238 | { |
239 | - proxy_func = [name, icon_hint]() |
240 | + proxy_func = [name, icon_hint, result_count]() |
241 | { |
242 | - return ScopeProxyInterface::Ptr(new MockScopeProxy(name, icon_hint)); |
243 | + return ScopeProxyInterface::Ptr(new MockScopeProxy(name, icon_hint, result_count)); |
244 | }; |
245 | |
246 | Init(); |
247 | |
248 | === modified file 'tests/test_scope_bar.cpp' |
249 | --- tests/test_scope_bar.cpp 2013-02-21 10:47:14 +0000 |
250 | +++ tests/test_scope_bar.cpp 2013-05-02 18:31:27 +0000 |
251 | @@ -25,9 +25,6 @@ |
252 | #include "unity-shared/UnitySettings.h" |
253 | #include "test_mock_scope.h" |
254 | |
255 | -using namespace unity; |
256 | -using namespace unity::dash; |
257 | - |
258 | namespace unity |
259 | { |
260 | namespace dash |
261 | |
262 | === modified file 'tests/test_scope_proxy.cpp' |
263 | --- tests/test_scope_proxy.cpp 2013-03-15 10:54:33 +0000 |
264 | +++ tests/test_scope_proxy.cpp 2013-05-02 18:31:27 +0000 |
265 | @@ -30,8 +30,6 @@ |
266 | #include "RadioOptionFilter.h" |
267 | |
268 | using namespace std; |
269 | -using namespace unity; |
270 | -using namespace unity::dash; |
271 | |
272 | namespace unity |
273 | { |
274 | |
275 | === modified file 'tests/test_scopeview.cpp' |
276 | --- tests/test_scopeview.cpp 2013-03-13 11:18:48 +0000 |
277 | +++ tests/test_scopeview.cpp 2013-05-02 18:31:27 +0000 |
278 | @@ -26,35 +26,40 @@ |
279 | #include <UnityCore/Category.h> |
280 | |
281 | #include "MockCategories.h" |
282 | - |
283 | -using namespace unity; |
284 | -using namespace unity::dash; |
285 | +#include "test_mock_scope.h" |
286 | +#include "test_utils.h" |
287 | |
288 | namespace unity |
289 | { |
290 | namespace dash |
291 | { |
292 | |
293 | -class TestScopeView : public ::testing::Test |
294 | +struct TestScopeView : public ::testing::Test |
295 | { |
296 | -public: |
297 | - |
298 | - class FakePlacesGroup : public PlacesGroup |
299 | + struct FakePlacesGroup : public PlacesGroup |
300 | { |
301 | - public: |
302 | - FakePlacesGroup():PlacesGroup(dash::Style::Instance()) {} |
303 | + FakePlacesGroup() |
304 | + : PlacesGroup(dash::Style::Instance()) |
305 | + , is_expanded_(false) |
306 | + {} |
307 | + |
308 | + bool GetExpanded() const override { return is_expanded_; } |
309 | + void SetExpanded(bool is_expanded) override { is_expanded_ = is_expanded; expanded.emit(this); } |
310 | |
311 | using PlacesGroup::_using_filters_background; |
312 | + bool is_expanded_; |
313 | }; |
314 | |
315 | - class FakeScopeView : public ScopeView |
316 | + struct FakeScopeView : public ScopeView |
317 | { |
318 | - public: |
319 | - FakeScopeView():ScopeView(Scope::Ptr(), nullptr) {} |
320 | - |
321 | - using ScopeView::OnCategoryAdded; |
322 | - |
323 | - virtual PlacesGroup::Ptr CreatePlacesGroup(Category const& category) |
324 | + FakeScopeView(MockScope::Ptr const& scope) |
325 | + : ScopeView(scope, nullptr) |
326 | + {} |
327 | + |
328 | + using ScopeView::OnResultAdded; |
329 | + using ScopeView::search_string_; |
330 | + |
331 | + PlacesGroup::Ptr CreatePlacesGroup(Category const& category) override |
332 | { |
333 | FakePlacesGroup* group = new FakePlacesGroup(); |
334 | fake_groups_.push_back(group); |
335 | @@ -65,39 +70,234 @@ |
336 | }; |
337 | |
338 | TestScopeView() |
339 | - : scope_view_(new FakeScopeView()) |
340 | - , categories_(5) |
341 | - { |
342 | - } |
343 | + : scope_data_(std::make_shared<MockScopeData>("")) |
344 | + , scope_(std::make_shared<MockScope>(scope_data_, "", "", 10)) |
345 | + , scope_view_(new FakeScopeView(scope_)) |
346 | + {} |
347 | |
348 | unity::Settings settings; |
349 | dash::Style style; |
350 | + MockScopeData::Ptr scope_data_; |
351 | + MockScope::Ptr scope_; |
352 | std::unique_ptr<FakeScopeView> scope_view_; |
353 | - MockCategories categories_; |
354 | }; |
355 | |
356 | TEST_F(TestScopeView, TestCategoryInsert) |
357 | { |
358 | - scope_view_->OnCategoryAdded(categories_.RowAtIndex(0)); |
359 | - scope_view_->OnCategoryAdded(categories_.RowAtIndex(1)); |
360 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(2); |
361 | + scope_->categories.changed.emit(categories); |
362 | |
363 | EXPECT_EQ(scope_view_->GetOrderedCategoryViews().size(), 2); |
364 | } |
365 | |
366 | TEST_F(TestScopeView, TestFilterExpansion) |
367 | { |
368 | - scope_view_->OnCategoryAdded(categories_.RowAtIndex(0)); |
369 | - scope_view_->OnCategoryAdded(categories_.RowAtIndex(1)); |
370 | - scope_view_->OnCategoryAdded(categories_.RowAtIndex(2)); |
371 | - scope_view_->OnCategoryAdded(categories_.RowAtIndex(3)); |
372 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(4); |
373 | + scope_->categories.changed.emit(categories); |
374 | |
375 | EXPECT_EQ(scope_view_->fake_groups_.size(), 4); |
376 | |
377 | scope_view_->filters_expanded = true; |
378 | - for (unsigned i = 0; i < scope_view_->fake_groups_.size(); i++) |
379 | - { |
380 | + for (unsigned i = 0; i < scope_view_->fake_groups_.size(); ++i) |
381 | EXPECT_EQ(scope_view_->fake_groups_[i]->_using_filters_background, true); |
382 | - } |
383 | +} |
384 | + |
385 | +TEST_F(TestScopeView, TestCategoryExpansion_OneCategory_EmptySearchString) |
386 | +{ |
387 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(1); |
388 | + scope_view_->search_string_ = ""; |
389 | + |
390 | + scope_->categories.changed.emit(categories); |
391 | + Utils::WaitForTimeoutMSec(500); |
392 | + |
393 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 1); |
394 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
395 | +} |
396 | + |
397 | +TEST_F(TestScopeView, TestCategoryExpansion_OneCategory_FilledSearchString) |
398 | +{ |
399 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(1); |
400 | + scope_view_->search_string_ = "Ubuntu"; |
401 | + |
402 | + scope_->categories.changed.emit(categories); |
403 | + Utils::WaitForTimeoutMSec(500); |
404 | + |
405 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 1); |
406 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
407 | +} |
408 | + |
409 | +TEST_F(TestScopeView, TestCategoryExpansion_TwoCategory_EmptySearchString) |
410 | +{ |
411 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(2); |
412 | + scope_view_->search_string_ = ""; |
413 | + |
414 | + scope_->categories.changed.emit(categories); |
415 | + Utils::WaitForTimeoutMSec(500); |
416 | + |
417 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 2); |
418 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
419 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
420 | +} |
421 | + |
422 | +TEST_F(TestScopeView, TestCategoryExpansion_TwoCategory_FilledSearchString) |
423 | +{ |
424 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(2); |
425 | + scope_view_->search_string_ = "Ubuntu"; |
426 | + |
427 | + scope_->categories.changed.emit(categories); |
428 | + Utils::WaitForTimeoutMSec(500); |
429 | + |
430 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 2); |
431 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
432 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
433 | +} |
434 | + |
435 | +TEST_F(TestScopeView, TestCategoryExpansion_ThreeCategory_EmptySearchString) |
436 | +{ |
437 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(3); |
438 | + scope_view_->search_string_ = ""; |
439 | + |
440 | + scope_->categories.changed.emit(categories); |
441 | + Utils::WaitForTimeoutMSec(500); |
442 | + |
443 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 3); |
444 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
445 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
446 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
447 | +} |
448 | + |
449 | +TEST_F(TestScopeView, TestCategoryExpansion_ThreeCategory_FilledSearchString) |
450 | +{ |
451 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(3); |
452 | + scope_view_->search_string_ = "Ubuntu"; |
453 | + |
454 | + scope_->categories.changed.emit(categories); |
455 | + Utils::WaitForTimeoutMSec(500); |
456 | + |
457 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 3); |
458 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
459 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
460 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
461 | +} |
462 | + |
463 | +TEST_F(TestScopeView, TestCategoryExpansion_TwoCategory_OnResultAdded_EmptySearchString) |
464 | +{ |
465 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(2); |
466 | + |
467 | + scope_->categories.changed.emit(categories); |
468 | + Utils::WaitForTimeoutMSec(500); |
469 | + |
470 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 2); |
471 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
472 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
473 | + |
474 | + /* XXX: we should emit the signal not call the callback */ |
475 | + MockResults added_results(2); |
476 | + |
477 | + scope_view_->fake_groups_[0]->SetExpanded(true); |
478 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
479 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
480 | + |
481 | + scope_view_->OnResultAdded(added_results.RowAtIndex(0)); |
482 | + Utils::WaitForTimeoutMSec(500); |
483 | + |
484 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
485 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
486 | +} |
487 | + |
488 | +TEST_F(TestScopeView, TestCategoryExpansion_TwoCategory_OnResultAdded_FilledSearchString) |
489 | +{ |
490 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(2); |
491 | + scope_view_->search_string_ = "Ubuntu"; |
492 | + |
493 | + scope_->categories.changed.emit(categories); |
494 | + Utils::WaitForTimeoutMSec(500); |
495 | + |
496 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 2); |
497 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
498 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
499 | + |
500 | + /* XXX: we should emit the signal not call the callback */ |
501 | + MockResults added_results(2); |
502 | + |
503 | + scope_view_->fake_groups_[0]->SetExpanded(true); |
504 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
505 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
506 | + |
507 | + scope_view_->OnResultAdded(added_results.RowAtIndex(0)); |
508 | + Utils::WaitForTimeoutMSec(500); |
509 | + |
510 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
511 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[1]->GetExpanded(); }); |
512 | +} |
513 | + |
514 | +TEST_F(TestScopeView, TestCategoryExpansion_ThreeCategory_OnResultAdded_EmptySearchString) |
515 | +{ |
516 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(3); |
517 | + |
518 | + scope_->categories.changed.emit(categories); |
519 | + Utils::WaitForTimeoutMSec(500); |
520 | + |
521 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 3); |
522 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
523 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
524 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
525 | + |
526 | + /* XXX: we should emit the signal not call the callback */ |
527 | + MockResults added_results(2); |
528 | + scope_view_->OnResultAdded(added_results.RowAtIndex(0)); |
529 | + Utils::WaitForTimeoutMSec(500); |
530 | + |
531 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
532 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
533 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
534 | + |
535 | + scope_view_->fake_groups_[0]->SetExpanded(true); |
536 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
537 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
538 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
539 | + |
540 | + scope_view_->OnResultAdded(added_results.RowAtIndex(1)); |
541 | + Utils::WaitForTimeoutMSec(500); |
542 | + |
543 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
544 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
545 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
546 | +} |
547 | + |
548 | +TEST_F(TestScopeView, TestCategoryExpansion_ThreeCategory_OnResultAdded_FilledSearchString) |
549 | +{ |
550 | + MockCategories::Ptr categories = std::make_shared<MockCategories>(3); |
551 | + scope_view_->search_string_ = "Ubuntu"; |
552 | + |
553 | + scope_->categories.changed.emit(categories); |
554 | + Utils::WaitForTimeoutMSec(500); |
555 | + |
556 | + EXPECT_EQ(scope_view_->fake_groups_.size(), 3); |
557 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
558 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
559 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
560 | + |
561 | + /* XXX: we should emit the signal not call the callback */ |
562 | + MockResults added_results(2); |
563 | + scope_view_->OnResultAdded(added_results.RowAtIndex(0)); |
564 | + Utils::WaitForTimeoutMSec(500); |
565 | + |
566 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[0]->GetExpanded(); }); |
567 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
568 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
569 | + |
570 | + scope_view_->fake_groups_[0]->SetExpanded(true); |
571 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
572 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
573 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
574 | + |
575 | + scope_view_->OnResultAdded(added_results.RowAtIndex(1)); |
576 | + Utils::WaitForTimeoutMSec(500); |
577 | + |
578 | + Utils::WaitUntil([this] () { return scope_view_->fake_groups_[0]->GetExpanded(); }); |
579 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[1]->GetExpanded(); }); |
580 | + Utils::WaitUntil([this] () { return not scope_view_->fake_groups_[2]->GetExpanded(); }); |
581 | } |
582 | |
583 | } |
FAILED: Continuous integration, rev:3135 /code.launchpad .net/~andyrock/ unity/category- expension/ +merge/ 161984/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity-team- unity-libunity- 7.0-breakage- ci/72/ jenkins. qa.ubuntu. com/job/ unity-team- unity-libunity- 7.0-breakage- raring- amd64-ci/ 72/console
Executed test runs:
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity-team- unity-libunity- 7.0-breakage- ci/72/rebuild
http://