Commit 59c186de authored by Ulf Hermann's avatar Ulf Hermann

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's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 5dd4b7d8
...@@ -419,6 +419,12 @@ PixmapCacheModel::CacheState PixmapCacheModel::cacheState(int index) const ...@@ -419,6 +419,12 @@ PixmapCacheModel::CacheState PixmapCacheModel::cacheState(int index) const
return m_pixmaps[item.urlIndex].sizes[item.sizeIndex].cacheState; 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 #endif // WITH_TESTS
void PixmapCacheModel::computeMaxCacheSize() void PixmapCacheModel::computeMaxCacheSize()
......
...@@ -116,6 +116,7 @@ public: ...@@ -116,6 +116,7 @@ public:
#ifdef WITH_TESTS #ifdef WITH_TESTS
LoadState loadState(int index) const; LoadState loadState(int index) const;
CacheState cacheState(int index) const; CacheState cacheState(int index) const;
QString fileName(int index) const;
#endif #endif
private: private:
......
...@@ -281,8 +281,7 @@ void PixmapCacheModelTest::testColor() ...@@ -281,8 +281,7 @@ void PixmapCacheModelTest::testColor()
else else
QCOMPARE(model.color(i), row1Color); QCOMPARE(model.color(i), row1Color);
} else { } else {
const QmlEventType &type = manager.qmlModel()->eventTypes()[model.typeId(i)]; QRgb &pixmapColor = (model.fileName(i) == QString("blah.png")) ?
QRgb &pixmapColor = (type.location().filename() == QString("blah.png")) ?
blahColor : dingsColor; blahColor : dingsColor;
if (pixmapColor == 0) if (pixmapColor == 0)
pixmapColor = model.color(i); pixmapColor = model.color(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment