From 7cb2e40edc969e870563490365dfdd0cfd16a805 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 15 Oct 2020 16:05:51 +0200 Subject: Don`t block main thread when displaying all files removed dialog Fixes: #8170 --- test/testallfilesdeleted.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'test/testallfilesdeleted.cpp') diff --git a/test/testallfilesdeleted.cpp b/test/testallfilesdeleted.cpp index e5505fb0f..4a4580a62 100644 --- a/test/testallfilesdeleted.cpp +++ b/test/testallfilesdeleted.cpp @@ -58,11 +58,11 @@ private slots: auto initialState = fakeFolder.currentLocalState(); int aboutToRemoveAllFilesCalled = 0; QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles, - [&](SyncFileItem::Direction dir, bool *cancel) { + [&](SyncFileItem::Direction dir, std::function callback) { QCOMPARE(aboutToRemoveAllFilesCalled, 0); aboutToRemoveAllFilesCalled++; QCOMPARE(dir, deleteOnRemote ? SyncFileItem::Down : SyncFileItem::Up); - *cancel = true; + callback(true); fakeFolder.syncEngine().journal()->clearFileTable(); // That's what Folder is doing }); @@ -99,11 +99,11 @@ private slots: int aboutToRemoveAllFilesCalled = 0; QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles, - [&](SyncFileItem::Direction dir, bool *cancel) { + [&](SyncFileItem::Direction dir, std::function callback) { QCOMPARE(aboutToRemoveAllFilesCalled, 0); aboutToRemoveAllFilesCalled++; QCOMPARE(dir, deleteOnRemote ? SyncFileItem::Down : SyncFileItem::Up); - *cancel = false; + callback(false); }); auto &modifier = deleteOnRemote ? fakeFolder.remoteModifier() : fakeFolder.localModifier(); @@ -158,11 +158,11 @@ private slots: int aboutToRemoveAllFilesCalled = 0; QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles, - [&](SyncFileItem::Direction dir, bool *cancel) { + [&](SyncFileItem::Direction dir, std::function callback) { QCOMPARE(aboutToRemoveAllFilesCalled, 0); aboutToRemoveAllFilesCalled++; QCOMPARE(dir, SyncFileItem::Down); - *cancel = false; + callback(false); }); // Some small changes @@ -277,7 +277,7 @@ private slots: int aboutToRemoveAllFilesCalled = 0; QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles, - [&](SyncFileItem::Direction , bool *) { + [&](SyncFileItem::Direction , std::function ) { aboutToRemoveAllFilesCalled++; QFAIL("should not be called"); }); @@ -302,7 +302,7 @@ private slots: int aboutToRemoveAllFilesCalled = 0; QObject::connect(&fakeFolder.syncEngine(), &SyncEngine::aboutToRemoveAllFiles, - [&](SyncFileItem::Direction , bool *) { + [&](SyncFileItem::Direction , std::function) { aboutToRemoveAllFilesCalled++; QFAIL("should not be called"); }); -- cgit v1.2.3