Skip to content

Commit 7005558

Browse files
Add WaitForNotificationReady for Windows CI
tests/unit/test_tray.cpp: add <cstdlib> include and a new WaitForNotificationReady helper that calls WaitForTrayReady and, on Windows running in GitHub Actions (GITHUB_ACTIONS env var), pumps the tray loop multiple times with short sleeps to stabilize notification display. Replace direct WaitForTrayReady calls in the notification test with the new helper to reduce CI flakiness.
1 parent 6fdb6b6 commit 7005558

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tests/unit/test_tray.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <array>
66
#include <atomic>
77
#include <chrono>
8+
#include <cstdlib>
89
#include <ostream>
910
#include <string>
1011
#include <thread>
@@ -246,6 +247,18 @@ class TrayTest: public BaseTest { // NOSONAR(cpp:S3656) - fixture members must
246247
std::this_thread::sleep_for(std::chrono::milliseconds(5));
247248
}
248249
}
250+
251+
void WaitForNotificationReady() {
252+
WaitForTrayReady();
253+
#if defined(_WIN32)
254+
if (std::getenv("GITHUB_ACTIONS") != nullptr) {
255+
for (int i = 0; i < 40; i++) {
256+
tray_loop(0);
257+
std::this_thread::sleep_for(std::chrono::milliseconds(50));
258+
}
259+
}
260+
#endif
261+
}
249262
};
250263

251264
class TrayIconTest:
@@ -388,7 +401,7 @@ TEST_P(TrayNotificationIconTest, TestNotificationDisplay) {
388401

389402
tray_update(&testTray);
390403

391-
WaitForTrayReady();
404+
WaitForNotificationReady();
392405
EXPECT_TRUE(captureScreenshot(std::string("tray_notification_") + iconParam.name + "_icon"));
393406

394407
// Clear notification

0 commit comments

Comments
 (0)