┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2026-06-13 22:32:15 +0000
committerMéven Car <[email protected]>2026-06-14 06:21:16 +0000
commit655ded169bf5f3c7a925d01a15738333dc64a5df (patch)
tree7e96738afdb7539f840242368d3b6850541b0765 /src
parenta654e1af1031ffb8eacfdfe63640667abdb39a7e (diff)
dolphinmainwindowtest: assert the thumbnail, not a fresh preview, after rename
testThumbnailAfterRename waited for KFileItemModelRolesUpdater::previewJobFinished after renaming a.jpg to b.jpg. That signal is only emitted when a new preview is generated successfully (slotGotPreview), but a rename keeps the file's content and its already-correct thumbnail, so whether a fresh preview job runs at all is timing- and platform-dependent. On FreeBSD CI none is produced, so the wait timed out. Assert the actual outcome instead: the renamed item still shows a non-null preview pixmap. This passes whether the thumbnail is regenerated, inherited across the rename, or cache-served, and still fails if a rename ever drops the preview.
Diffstat (limited to 'src')
-rw-r--r--src/tests/dolphinmainwindowtest.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index 84271786c..534ac4654 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -32,6 +32,7 @@
#include <QDomDocument>
#include <QFileSystemWatcher>
#include <QKeySequence>
+#include <QPixmap>
#include <QScopedPointer>
#include <QSignalSpy>
#include <QStandardPaths>
@@ -1082,11 +1083,15 @@ void DolphinMainWindowTest::testThumbnailAfterRename()
QTest::keyClick(QApplication::focusWidget(), Qt::Key_B);
QTest::keyClick(QApplication::focusWidget(), Qt::Key_Enter);
QVERIFY(itemsChangedSpy.wait()); // Make sure that rename worked
-
- // Check that preview gets updated and filename is correct
- QVERIFY(previewUpdatedSpy.wait());
QVERIFY(!view->m_view->m_editingRole);
- QCOMPARE(view->m_model->fileItem(0).name(), "b.jpg");
+
+ // The renamed file must still show a thumbnail afterwards. Don't require a fresh preview
+ // job to run: a rename keeps the file's content and its already-correct thumbnail, so
+ // whether a new job is dispatched is timing- and platform-dependent.
+ const int renamedIndex = view->m_model->index(QUrl(testDir->url().toString() + "/b.jpg"));
+ QVERIFY(renamedIndex >= 0);
+ QTRY_VERIFY(!view->m_model->data(renamedIndex).value("iconPixmap").value<QPixmap>().isNull());
+ QCOMPARE(view->m_model->fileItem(renamedIndex).name(), "b.jpg");
QCOMPARE(view->m_model->count(), 1);
}