From 654aa56973320852e438439d3677041f8af6b3d8 Mon Sep 17 00:00:00 2001 From: Patrick Winters <19wintersp@gmail.com> Date: Tue, 7 May 2024 17:33:36 +0100 Subject: [PATCH] fix: close button to close wake calculator --- src/plugin/wake/WakeCalculatorDisplay.cpp | 5 +++++ test/plugin/wake/WakeCalculatorDisplayTest.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/plugin/wake/WakeCalculatorDisplay.cpp b/src/plugin/wake/WakeCalculatorDisplay.cpp index f656a4f0..4ae34af8 100644 --- a/src/plugin/wake/WakeCalculatorDisplay.cpp +++ b/src/plugin/wake/WakeCalculatorDisplay.cpp @@ -91,6 +91,11 @@ namespace UKControllerPlugin::Wake { this->contentCollapsed = !this->contentCollapsed; return; } + + if (objectDescription == "closeButton") { + this->visible = false; + return; + } } void WakeCalculatorDisplay::Move(RECT position, std::string objectDescription) diff --git a/test/plugin/wake/WakeCalculatorDisplayTest.cpp b/test/plugin/wake/WakeCalculatorDisplayTest.cpp index 8bb5df8a..ea6dcc84 100644 --- a/test/plugin/wake/WakeCalculatorDisplayTest.cpp +++ b/test/plugin/wake/WakeCalculatorDisplayTest.cpp @@ -54,6 +54,16 @@ namespace UKControllerPluginTest::Wake { EXPECT_FALSE(display.IsCollapsed()); } + TEST_F(WakeCalculatorDisplayTest, ItCanBeClosedByClickButton) + { + if (!display.IsVisible()) { + display.Toggle(); + } + EXPECT_TRUE(display.IsVisible()); + display.LeftClick(radarScreen, 1, "closeButton", {1, 2}, {}); + EXPECT_FALSE(display.IsVisible()); + } + TEST_F(WakeCalculatorDisplayTest, ItHasADefaultPosition) { const auto position = display.Position();