diff -r 93b982ccede2 -r 5daf16870df6 tests/auto/qicon/tst_qicon.cpp --- a/tests/auto/qicon/tst_qicon.cpp Mon Jun 21 22:38:13 2010 +0100 +++ b/tests/auto/qicon/tst_qicon.cpp Thu Jul 22 16:41:55 2010 +0100 @@ -76,6 +76,7 @@ void svg(); void addFile(); void availableSizes(); + void name(); void streamAvailableSizes_data(); void streamAvailableSizes(); void fromTheme(); @@ -550,6 +551,28 @@ } } +void tst_QIcon::name() +{ + { + // No name if icon does not come from a theme + QIcon icon(":/image.png"); + QString name = icon.name(); + QVERIFY(name.isEmpty()); + } + + { + // Getting the name of an icon coming from a theme should work + QString searchPath = QLatin1String(":/icons"); + QIcon::setThemeSearchPaths(QStringList() << searchPath); + QString themeName("testtheme"); + QIcon::setThemeName(themeName); + + QIcon icon = QIcon::fromTheme("appointment-new"); + QString name = icon.name(); + QCOMPARE(name, QLatin1String("appointment-new")); + } +} + void tst_QIcon::streamAvailableSizes_data() { QTest::addColumn("icon");