forked from qt-creator/qt-creator
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:
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user