This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-remoteproxy/tests/nymea-remoteproxy-tests.cpp
2018-08-02 14:57:49 +02:00

58 lines
1.1 KiB
C++

#include "nymea-remoteproxy-tests.h"
#include "engine.h"
#include "loggingcategories.h"
RemoteProxyTests::RemoteProxyTests(QObject *parent) :
QObject(parent)
{
}
void RemoteProxyTests::cleanUpEngine()
{
if (Engine::exists()) {
Engine::instance()->destroy();
QVERIFY(!Engine::exists());
}
}
void RemoteProxyTests::restartEngine()
{
cleanUpEngine();
QVERIFY(Engine::instance() != nullptr);
QVERIFY(Engine::exists());
}
void RemoteProxyTests::initTestCase()
{
qCDebug(dcApplication()) << "Init test case.";
restartEngine();
}
void RemoteProxyTests::cleanupTestCase()
{
qCDebug(dcApplication()) << "Clean up test case.";
cleanUpEngine();
}
void RemoteProxyTests::startStopServer()
{
cleanUpEngine();
QVERIFY(Engine::instance() != nullptr);
QVERIFY(Engine::exists());
Engine::instance()->start();
QVERIFY(Engine::instance()->running());
Engine::instance()->stop();
QVERIFY(!Engine::instance()->running());
Engine::instance()->destroy();
QVERIFY(!Engine::exists());
}
QTEST_MAIN(RemoteProxyTests)