From fb4cc9c755ec79af997a97cddee0af0014adaa54 Mon Sep 17 00:00:00 2001 From: tmoonlight Date: Mon, 26 Oct 2026 01:13:54 +0800 Subject: [PATCH] Stabilize tray icon resource reclamation check --- tests/desktop/tray_unread_icon_test.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/desktop/tray_unread_icon_test.cpp b/tests/desktop/tray_unread_icon_test.cpp index 56b539f3..47812912 100644 --- a/tests/desktop/tray_unread_icon_test.cpp +++ b/tests/desktop/tray_unread_icon_test.cpp @@ -60,8 +60,10 @@ TEST(TrayUnreadIcon, ReleasesIconsAndHandlesInvalidInputs) { const auto before = ::GetGuiResources(::GetCurrentProcess(), GR_GDIOBJECTS); const auto user_before = ::GetGuiResources(::GetCurrentProcess(), GR_USEROBJECTS); for (int i = 0; i < 200; ++i) ASSERT_TRUE(create_tray_unread_icon(original, 24)); - EXPECT_EQ(::GetGuiResources(::GetCurrentProcess(), GR_GDIOBJECTS), before); - EXPECT_EQ(::GetGuiResources(::GetCurrentProcess(), GR_USEROBJECTS), user_before); + // Process-wide graphics caches can release older objects during this loop. + // A decrease is harmless; leaked per-icon objects would grow after 200 calls. + EXPECT_LE(::GetGuiResources(::GetCurrentProcess(), GR_GDIOBJECTS), before); + EXPECT_LE(::GetGuiResources(::GetCurrentProcess(), GR_USEROBJECTS), user_before); } TEST(TrayUnreadIcon, CanSetClearAndShutDownNativeTray) {