QmlProfiler: Resolve pixmap file name via pixmapcache model in test

This tests that the file name is correctly stored in the model and it
removes the detour via the model manager.

Change-Id: Icc592b6383edcb18bfe31a81eb7ae0736a4f5508
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2016-12-21 18:27:45 +01:00
parent 5dd4b7d8fe
commit 59c186de5f
3 changed files with 8 additions and 2 deletions

View File

@@ -419,6 +419,12 @@ PixmapCacheModel::CacheState PixmapCacheModel::cacheState(int index) const
return m_pixmaps[item.urlIndex].sizes[item.sizeIndex].cacheState;
}
QString PixmapCacheModel::fileName(int index) const
{
const PixmapCacheItem &item = m_data[index];
return (item.urlIndex == -1) ? QString() : m_pixmaps[item.urlIndex].url;
}
#endif // WITH_TESTS
void PixmapCacheModel::computeMaxCacheSize()

View File

@@ -116,6 +116,7 @@ public:
#ifdef WITH_TESTS
LoadState loadState(int index) const;
CacheState cacheState(int index) const;
QString fileName(int index) const;
#endif
private:

View File

@@ -281,8 +281,7 @@ void PixmapCacheModelTest::testColor()
else
QCOMPARE(model.color(i), row1Color);
} else {
const QmlEventType &type = manager.qmlModel()->eventTypes()[model.typeId(i)];
QRgb &pixmapColor = (type.location().filename() == QString("blah.png")) ?
QRgb &pixmapColor = (model.fileName(i) == QString("blah.png")) ?
blahColor : dingsColor;
if (pixmapColor == 0)
pixmapColor = model.color(i);