Merge lp:~sjakthol/unity/fix-1297842 into lp:unity

Proposed by Sami Jaktholm
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3771
Proposed branch: lp:~sjakthol/unity/fix-1297842
Merge into: lp:unity
Diff against target: 33 lines (+13/-0)
2 files modified
shortcuts/ShortcutController.cpp (+1/-0)
tests/test_shortcut_controller.cpp (+12/-0)
To merge this branch: bzr merge lp:~sjakthol/unity/fix-1297842
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+214410@code.launchpad.net

Commit message

Shortcuts: Listen and react to view close requests.

Description of the change

Test case:
1. Run 'rm ~/.cache/unity/first_run.stamp'
2. Restart unity
3. Try closing the shortcut overlay from the cross at the top left corner.

For me it was a bit tricky to test as the overlay didn't appear at all (apparently it required 773 pixels of vertical space and I only had 768 to spare).

I assume that the actual hiding of the overlay is already covered by tests and thus the included unit test only ensures ShortcutController reacts to the request_close signal.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Cool, looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shortcuts/ShortcutController.cpp'
2--- shortcuts/ShortcutController.cpp 2014-03-10 23:44:54 +0000
3+++ shortcuts/ShortcutController.cpp 2014-04-05 20:19:09 +0000
4@@ -157,6 +157,7 @@
5 view_->SetModel(modeller_->GetCurrentModel());
6 view_->background_color = WindowManager::Default().average_color();
7 view_->closable = first_run();
8+ view_->request_close.connect(sigc::mem_fun(this, &Controller::Hide));
9
10 if (!view_window_)
11 {
12
13=== modified file 'tests/test_shortcut_controller.cpp'
14--- tests/test_shortcut_controller.cpp 2014-03-21 04:40:12 +0000
15+++ tests/test_shortcut_controller.cpp 2014-04-05 20:19:09 +0000
16@@ -219,5 +219,17 @@
17 EXPECT_FALSE(controller_.view_->closable());
18 }
19
20+TEST_F(TestShortcutController, CloseRequestIsHandled)
21+{
22+ controller_.first_run = true;
23+ controller_.ConstructView();
24+ controller_.Show();
25+ controller_.OnShowTimer();
26+ tick_source_.tick(100 * 1000);
27+ controller_.view_->request_close.emit();
28+
29+ EXPECT_FALSE(controller_.Visible());
30+}
31+
32 }
33 }