mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
1bc423d9c4
Use QTemporaryDir to create the test directory Add option to use httpbin over local docker Increase delay for opening a connection Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#include "common/NetworkManager.hpp"
|
|
#include "singletons/Settings.hpp"
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <QApplication>
|
|
#include <QJsonArray>
|
|
#include <QLoggingCategory>
|
|
#include <QtConcurrent>
|
|
#include <QTimer>
|
|
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
using namespace chatterino;
|
|
|
|
#define SUPPORT_QT_NETWORK_TESTS
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
#ifdef SUPPORT_QT_NETWORK_TESTS
|
|
QApplication app(argc, argv);
|
|
// make sure to always debug-log
|
|
QLoggingCategory::setFilterRules("*.debug=true");
|
|
|
|
chatterino::NetworkManager::init();
|
|
|
|
// Ensure settings are initialized before any tests are run
|
|
QTemporaryDir settingsDir;
|
|
settingsDir.setAutoRemove(false); // we'll remove it manually
|
|
qDebug() << "Settings directory:" << settingsDir.path();
|
|
chatterino::Settings settings(settingsDir.path());
|
|
|
|
QtConcurrent::run([&app, &settingsDir]() mutable {
|
|
auto res = RUN_ALL_TESTS();
|
|
|
|
chatterino::NetworkManager::deinit();
|
|
|
|
settingsDir.remove();
|
|
app.exit(res);
|
|
});
|
|
|
|
return app.exec();
|
|
#else
|
|
return RUN_ALL_TESTS();
|
|
#endif
|
|
}
|