┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests/kitemlistcontrollerexpandtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/kitemlistcontrollerexpandtest.cpp')
-rw-r--r--src/tests/kitemlistcontrollerexpandtest.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/tests/kitemlistcontrollerexpandtest.cpp b/src/tests/kitemlistcontrollerexpandtest.cpp
index 8f16251b4..cb84fb693 100644
--- a/src/tests/kitemlistcontrollerexpandtest.cpp
+++ b/src/tests/kitemlistcontrollerexpandtest.cpp
@@ -152,11 +152,8 @@ void KItemListControllerExpandTest::testDirExpand()
// expand selected folders
QTest::keyClick(m_container, Qt::Key_Right);
- QVERIFY(QTest::qWaitFor(
- [this]() {
- return m_spyDirectoryLoadingCompleted->count() == 3;
- },
- 100));
+ QVERIFY(m_spyDirectoryLoadingCompleted->wait());
+ QCOMPARE(m_spyDirectoryLoadingCompleted->count(), 3);
QCOMPARE(m_model->count(), 8);
QCOMPARE(m_selectionManager->currentItem(), 6);
QCOMPARE(m_selectionManager->selectedItems().count(), 2);
@@ -179,11 +176,11 @@ void KItemListControllerExpandTest::testDirExpand()
// expand the three folders
QTest::keyClick(m_container, Qt::Key_Right);
- QVERIFY(QTest::qWaitFor(
- [this]() {
- return m_spyDirectoryLoadingCompleted->count() == 6;
- },
- 300));
+ // Key_Right expands all 3 selected folders, each triggering one directoryLoadingCompleted.
+ // spy->wait() unblocks on a single emission, so loop until all 3 have arrived.
+ while (m_spyDirectoryLoadingCompleted->count() < 6) {
+ QVERIFY(m_spyDirectoryLoadingCompleted->wait());
+ }
QCOMPARE(m_model->count(), 18);
QCOMPARE(m_selectionManager->currentItem(), 12);
@@ -216,11 +213,10 @@ void KItemListControllerExpandTest::testDirExpand()
// expand the three folders with shift modifier
QTest::keyClick(m_container, Qt::Key_Right, Qt::ShiftModifier);
- QVERIFY(QTest::qWaitFor(
- [this]() {
- return m_spyDirectoryLoadingCompleted->count() == 9;
- },
- 100));
+ // Same as above: 3 folders expand in parallel, one signal each — loop until all 3 arrive.
+ while (m_spyDirectoryLoadingCompleted->count() < 9) {
+ QVERIFY(m_spyDirectoryLoadingCompleted->wait());
+ }
QCOMPARE(m_model->count(), 18);
QCOMPARE(m_selectionManager->currentItem(), 12);