#include "common/NetworkManager.hpp" #include "singletons/Settings.hpp" #include #include #include #include #include #include #include #include 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 }