1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
// SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
//
// SPDX-License-Identifier: MIT
#include "testobject.h"
using namespace QCoro;
TestContext::TestContext(QEventLoop &el) : mEventLoop(&el) {
mEventLoop->setProperty("testFinished", false);
mEventLoop->setProperty("shouldNotSuspend", false);
}
TestContext::TestContext(TestContext &&other) noexcept {
std::swap(mEventLoop, other.mEventLoop);
}
TestContext::~TestContext() {
if (mEventLoop) {
mEventLoop->setProperty("testFinished", true);
mEventLoop->quit();
}
}
TestContext &TestContext::operator=(TestContext &&other) noexcept {
std::swap(mEventLoop, other.mEventLoop);
return *this;
}
void TestContext::setShouldNotSuspend() {
mEventLoop->setProperty("shouldNotSuspend", true);
}
|