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.
This commit is contained in:
@@ -32,12 +32,17 @@ TEST(UIIcons, CreateLoadsAllSizes)
|
|||||||
EXPECT_FALSE(icon.pixmap(QSize(32, 32)).isNull());
|
EXPECT_FALSE(icon.pixmap(QSize(32, 32)).isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UIIcons, CreateWithUnknownNameIsNull)
|
TEST(UIIcons, CreateWithUnknownNameYieldsNoUsableIcon)
|
||||||
{
|
{
|
||||||
QIcon icon = olive::icon::Create(QStringLiteral(":/style/olive-dark"),
|
QIcon icon = olive::icon::Create(QStringLiteral(":/style/olive-dark"),
|
||||||
QStringLiteral("no-such-icon"));
|
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.availableSizes().isEmpty());
|
||||||
|
EXPECT_TRUE(icon.pixmap(QSize(16, 16)).isNull());
|
||||||
|
EXPECT_TRUE(icon.pixmap(32, 32, QIcon::Disabled).isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(UIIcons, LoadAllPopulatesGlobalIcons)
|
TEST(UIIcons, LoadAllPopulatesGlobalIcons)
|
||||||
|
|||||||
Reference in New Issue
Block a user