From c734ecdba1357a540ad9d589e284b90f333ade7e Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Fri, 17 Jul 2026 18:28:38 +0800 Subject: [PATCH] tests: make unknown-icon check robust across Qt builds QIcon::addFile() differs between Qt versions in whether entries for nonexistent files keep the icon non-null (Ubuntu CI failure). Assert on what matters: no usable pixmap or size is produced. --- tests/gtest/ui_icons_test.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/gtest/ui_icons_test.cpp b/tests/gtest/ui_icons_test.cpp index a96a0c489..c3f511c70 100644 --- a/tests/gtest/ui_icons_test.cpp +++ b/tests/gtest/ui_icons_test.cpp @@ -32,12 +32,17 @@ TEST(UIIcons, CreateLoadsAllSizes) EXPECT_FALSE(icon.pixmap(QSize(32, 32)).isNull()); } -TEST(UIIcons, CreateWithUnknownNameIsNull) +TEST(UIIcons, CreateWithUnknownNameYieldsNoUsableIcon) { QIcon icon = olive::icon::Create(QStringLiteral(":/style/olive-dark"), QStringLiteral("no-such-icon")); - EXPECT_TRUE(icon.isNull()); + + // QIcon::addFile() differs across Qt builds in whether entries for + // nonexistent files keep the icon "null". What matters is that no usable + // pixmap can be produced for an unknown icon name. EXPECT_TRUE(icon.availableSizes().isEmpty()); + EXPECT_TRUE(icon.pixmap(QSize(16, 16)).isNull()); + EXPECT_TRUE(icon.pixmap(32, 32, QIcon::Disabled).isNull()); } TEST(UIIcons, LoadAllPopulatesGlobalIcons)