mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
[PlacesItemModelTest] Try to use an event loop instead of an hardcoded timeout
Increasing the timeout from 5 to 10 seconds didn't work. Let's see if an eventloop does the job.
This commit is contained in:
parent
c9dd3478be
commit
c527dc2172
|
@ -68,6 +68,7 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
|
|||
|
||||
connect(m_sourceModel, &KFilePlacesModel::rowsInserted, this, &PlacesItemModel::onSourceModelRowsInserted);
|
||||
connect(m_sourceModel, &KFilePlacesModel::rowsAboutToBeRemoved, this, &PlacesItemModel::onSourceModelRowsAboutToBeRemoved);
|
||||
connect(m_sourceModel, &KFilePlacesModel::dataChanged, this, &PlacesItemModel::sourceModelDataChanged);
|
||||
connect(m_sourceModel, &KFilePlacesModel::dataChanged, this, &PlacesItemModel::onSourceModelDataChanged);
|
||||
connect(m_sourceModel, &KFilePlacesModel::rowsAboutToBeMoved, this, &PlacesItemModel::onSourceModelRowsAboutToBeMoved);
|
||||
connect(m_sourceModel, &KFilePlacesModel::rowsMoved, this, &PlacesItemModel::onSourceModelRowsMoved);
|
||||
|
|
|
@ -145,6 +145,7 @@ signals:
|
|||
void storageSetupDone(int index, bool success);
|
||||
void storageTearDownRequested(const QString& mountPath);
|
||||
void storageTearDownExternallyRequested(const QString& mountPath);
|
||||
void sourceModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
|
||||
|
||||
protected:
|
||||
void onItemInserted(int index) override;
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue