2024-01-15 21:28:44 +01:00
|
|
|
#include "common/network/NetworkManager.hpp"
|
2023-10-13 17:41:23 +02:00
|
|
|
#include "singletons/Resources.hpp"
|
2023-04-01 13:23:18 +02:00
|
|
|
#include "singletons/Settings.hpp"
|
2020-12-26 12:42:39 +01:00
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QApplication>
|
2020-12-26 12:42:39 +01:00
|
|
|
#include <QJsonArray>
|
2023-05-26 14:54:23 +02:00
|
|
|
#include <QLoggingCategory>
|
2020-12-26 12:42:39 +01:00
|
|
|
#include <QtConcurrent>
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QTimer>
|
2020-12-26 12:42:39 +01:00
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
using namespace chatterino;
|
|
|
|
|
2022-05-07 17:22:39 +02:00
|
|
|
#define SUPPORT_QT_NETWORK_TESTS
|
|
|
|
|
2020-12-26 12:42:39 +01:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
|
2022-05-07 17:22:39 +02:00
|
|
|
#ifdef SUPPORT_QT_NETWORK_TESTS
|
2020-12-26 12:42:39 +01:00
|
|
|
QApplication app(argc, argv);
|
2023-05-26 14:54:23 +02:00
|
|
|
// make sure to always debug-log
|
|
|
|
QLoggingCategory::setFilterRules("*.debug=true");
|
2020-12-26 12:42:39 +01:00
|
|
|
|
2023-10-13 17:41:23 +02:00
|
|
|
initResources();
|
|
|
|
|
2020-12-26 12:42:39 +01:00
|
|
|
chatterino::NetworkManager::init();
|
|
|
|
|
2023-04-01 13:23:18 +02:00
|
|
|
// Ensure settings are initialized before any tests are run
|
2023-05-26 14:54:23 +02:00
|
|
|
QTemporaryDir settingsDir;
|
|
|
|
settingsDir.setAutoRemove(false); // we'll remove it manually
|
|
|
|
qDebug() << "Settings directory:" << settingsDir.path();
|
|
|
|
chatterino::Settings settings(settingsDir.path());
|
2023-04-01 13:23:18 +02:00
|
|
|
|
2023-06-24 15:03:27 +02:00
|
|
|
QTimer::singleShot(0, [&]() {
|
2020-12-26 12:42:39 +01:00
|
|
|
auto res = RUN_ALL_TESTS();
|
|
|
|
|
|
|
|
chatterino::NetworkManager::deinit();
|
|
|
|
|
2023-05-26 14:54:23 +02:00
|
|
|
settingsDir.remove();
|
2023-07-29 11:49:44 +02:00
|
|
|
|
|
|
|
// Pick up the last events from the eventloop
|
|
|
|
// Using a loop to catch events queueing other events (e.g. deletions)
|
|
|
|
for (size_t i = 0; i < 32; i++)
|
|
|
|
{
|
|
|
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
|
|
|
QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
|
|
|
|
}
|
|
|
|
|
2023-06-24 15:03:27 +02:00
|
|
|
QApplication::exit(res);
|
2020-12-26 12:42:39 +01:00
|
|
|
});
|
2019-05-11 14:13:03 +02:00
|
|
|
|
2023-06-24 15:03:27 +02:00
|
|
|
return QApplication::exec();
|
2022-05-07 17:22:39 +02:00
|
|
|
#else
|
|
|
|
return RUN_ALL_TESTS();
|
|
|
|
#endif
|
2020-12-26 12:42:39 +01:00
|
|
|
}
|