diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-12-21 18:27:45 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-01-04 16:39:24 +0000 |
commit | 59c186de5f3cbf3f85cec0735fd05a9050aa617f (patch) | |
tree | 8413f95b3ff7c2b305ff6caa88c75ba9ab5c6cd6 /src/plugins/qmlprofiler | |
parent | 5dd4b7d8fe72e5580f5248cb22dd4849ed6ea48e (diff) | |
download | qt-creator-59c186de5f3cbf3f85cec0735fd05a9050aa617f.tar.gz |
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>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/pixmapcachemodel.cpp | 6 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/pixmapcachemodel.h | 1 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index 22375bb8c6..6ea4d5db2b 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -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() diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.h b/src/plugins/qmlprofiler/pixmapcachemodel.h index ccc7e70364..2427b6d3e9 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.h +++ b/src/plugins/qmlprofiler/pixmapcachemodel.h @@ -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: diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp index cc7beb7ec6..adfd168242 100644 --- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp @@ -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); |