]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/tests/placesitemmodeltest.cpp
[PlacesItemModelTest] Try to use an event loop instead of an hardcoded timeout
[dolphin.git] / src / tests / placesitemmodeltest.cpp
index c05ce6882754121ec110b048ebfe8109974a22a2..73204954b9ffbad71ec708d1f6f89437ffa559c5 100644 (file)
@@ -43,11 +43,6 @@ Q_DECLARE_METATYPE(KItemRange)
 #define KDE_ROOT_PATH "/"
 #endif
 
-namespace
-{
-    constexpr int TIMEOUT = 10000;
-}
-
 static QString bookmarksFile()
 {
     return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/user-places.xbel";
@@ -740,10 +735,13 @@ void PlacesItemModelTest::testRefresh()
     QVERIFY(item->text() != sameItem->text());
 
     // propagate change
+    QEventLoop eventLoop;
+    connect(m_model, &PlacesItemModel::sourceModelDataChanged, &eventLoop, &QEventLoop::quit);
     m_model->refresh();
+    eventLoop.exec();
 
     // item must be equal
-    QTRY_COMPARE_WITH_TIMEOUT(item->text(), sameItem->text(), TIMEOUT);
+    QCOMPARE(item->text(), sameItem->text());
 }
 
 void PlacesItemModelTest::testIcons_data()