aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-09-26 11:30:46 +0200
committerMitch Curtis <mitch.curtis@qt.io>2017-09-26 11:27:06 +0000
commit85341c7c983b23e34caa2453220c5d8cb71fe998 (patch)
tree05086446e8f1dec4624f6f54418c8783d2010cf7 /tests
parente57d85368f19d1d8fbcfe9b29ab9d59a20332995 (diff)
testbench: ensure that assets are reloaded properly
Clear the view's model, otherwise it will keep the old items around with the old assets, even after clearing the pixmap cache. Change-Id: If27400c0940448b337d1a4cd3ce0d6c99e2d9ddd Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/testbench/assetfixer.cpp1
-rw-r--r--tests/manual/testbench/testbench.qml27
2 files changed, 22 insertions, 6 deletions
diff --git a/tests/manual/testbench/assetfixer.cpp b/tests/manual/testbench/assetfixer.cpp
index 21a67573..1f914e71 100644
--- a/tests/manual/testbench/assetfixer.cpp
+++ b/tests/manual/testbench/assetfixer.cpp
@@ -515,6 +515,7 @@ void AssetFixer::clearImageCache()
// We can't seem to disable image caching on a per-Image basis (by the time the QQuickImages
// are available, the cache has already been filled), so we call this instead.
+ qCDebug(lcAssetFixer) << "Calling QQuickWindow::releaseResources() to clear pixmap cache";
window->releaseResources();
}
diff --git a/tests/manual/testbench/testbench.qml b/tests/manual/testbench/testbench.qml
index 43f4465e..b675e4cf 100644
--- a/tests/manual/testbench/testbench.qml
+++ b/tests/manual/testbench/testbench.qml
@@ -266,6 +266,10 @@ ApplicationWindow {
function reloadAssets() {
console.log(brief, "Reloading assets...")
+ // Clear the model, otherwise ListView will keep the old items around
+ // with the old assets, even after clearing the pixmap cache
+ listView.resettingModel = true
+ listView.model = null
window.Imagine.path = ""
assetReloadNextFrameTimer.start()
}
@@ -297,9 +301,14 @@ ApplicationWindow {
window.Imagine.path = Qt.binding(function() {
return settings.useCustomImaginePath && settings.imaginePath.length > 0 ? settings.imaginePath : undefined
})
+
infoToolTip.text = "Reloaded assets"
infoToolTip.timeout = 1500
infoToolTip.open()
+
+ listView.model = controlFolderListModel
+ listView.resettingModel = false
+
console.log(brief, "... reloaded assets.")
}
}
@@ -378,18 +387,24 @@ ApplicationWindow {
return paletteSettings.useCustomPalette && paletteColorString.length > 0 ? paletteColorString : undefined
}
+ FolderListModel {
+ id: controlFolderListModel
+ folder: "qrc:/controls"
+ showDirs: false
+ nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : []
+ }
+
ListView {
+ id: listView
anchors.fill: parent
spacing: 30
- visible: !busyIndicatorRow.visible
+ visible: !busyIndicatorRow.visible && !resettingModel
+
+ property bool resettingModel: false
ScrollBar.vertical: ScrollBar {}
- model: FolderListModel {
- folder: "qrc:/controls"
- showDirs: false
- nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : []
- }
+ model: controlFolderListModel
delegate: ColumnLayout {
id: rootDelegate
width: parent.width