diff options
| author | Sami Jaktholm <sjakthol@outlook.com> | 2014-04-05 23:09:17 +0300 |
|---|---|---|
| committer | Sami Jaktholm <sjakthol@outlook.com> | 2014-04-05 23:09:17 +0300 |
| commit | a5a8ee7032d73dad5ce7253526eef20d8cf7edf6 (patch) | |
| tree | 1707d279286e79bd0645c1ed844b9b3c4d7050bb | |
| parent | 47cb1545895247db7d394757c33685f4d42707fe (diff) | |
Shortcuts: Listen and react to view close requests.
Fixes LP: #1297842 (bzr r3764.2.1)
| -rw-r--r-- | shortcuts/ShortcutController.cpp | 1 | ||||
| -rw-r--r-- | tests/test_shortcut_controller.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/shortcuts/ShortcutController.cpp b/shortcuts/ShortcutController.cpp index 5f56bf99d..cdf6d69f8 100644 --- a/shortcuts/ShortcutController.cpp +++ b/shortcuts/ShortcutController.cpp @@ -157,6 +157,7 @@ void Controller::ConstructView() view_->SetModel(modeller_->GetCurrentModel()); view_->background_color = WindowManager::Default().average_color(); view_->closable = first_run(); + view_->request_close.connect(sigc::mem_fun(this, &Controller::Hide)); if (!view_window_) { diff --git a/tests/test_shortcut_controller.cpp b/tests/test_shortcut_controller.cpp index 5a0498493..90931d6f6 100644 --- a/tests/test_shortcut_controller.cpp +++ b/tests/test_shortcut_controller.cpp @@ -219,5 +219,17 @@ TEST_F(TestShortcutController, UnsetFirstRunOnHide) EXPECT_FALSE(controller_.view_->closable()); } +TEST_F(TestShortcutController, CloseRequestIsHandled) +{ + controller_.first_run = true; + controller_.ConstructView(); + controller_.Show(); + controller_.OnShowTimer(); + tick_source_.tick(100 * 1000); + controller_.view_->request_close.emit(); + + EXPECT_FALSE(controller_.Visible()); +} + } } |
