summaryrefslogtreecommitdiff
diff options
-rw-r--r--shortcuts/ShortcutController.cpp1
-rw-r--r--tests/test_shortcut_controller.cpp12
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());
+}
+
}
}