From 81d3fca0d6530f9a8f4a74f2bb09f3e25b11ee14 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 13 Mar 2025 12:49:07 +0100 Subject: [PATCH] Do not print a warning when querying the dashboard server for a running program Before, the dashboard client was printing a warning when no program was running and the `commandRunning` call was made. However, not having a program running is an absolutely valid result of that command, so it should not produce a warning about an unexpected answer. --- src/ur/dashboard_client.cpp | 3 ++- tests/test_dashboard_client.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ur/dashboard_client.cpp b/src/ur/dashboard_client.cpp index b05b54509..3aecb1f86 100644 --- a/src/ur/dashboard_client.cpp +++ b/src/ur/dashboard_client.cpp @@ -322,7 +322,8 @@ bool DashboardClient::commandQuit() bool DashboardClient::commandRunning() { assertVersion("5.0.0", "1.6", "running"); - return sendRequest("running", "Program running: true"); + std::string const response = sendAndReceive("running"); + return std::regex_match(response, std::regex("Program running: true")); } bool DashboardClient::commandIsProgramSaved() diff --git a/tests/test_dashboard_client.cpp b/tests/test_dashboard_client.cpp index 5990e461c..d0798c458 100644 --- a/tests/test_dashboard_client.cpp +++ b/tests/test_dashboard_client.cpp @@ -89,7 +89,9 @@ TEST_F(DashboardClientTest, run_program) EXPECT_TRUE(dashboard_client_->commandPlay()); EXPECT_TRUE(dashboard_client_->commandPause()); EXPECT_TRUE(dashboard_client_->commandPlay()); + EXPECT_TRUE(dashboard_client_->commandRunning()); EXPECT_TRUE(dashboard_client_->commandStop()); + EXPECT_FALSE(dashboard_client_->commandRunning()); EXPECT_TRUE(dashboard_client_->commandPowerOff()); dashboard_client_->commandClosePopup(); // Necessary for CB3 test }