2024-01-07 13:15:36 +01:00
|
|
|
#include "singletons/Resources.hpp"
|
2023-05-20 12:54:50 +02:00
|
|
|
#include "singletons/Settings.hpp"
|
|
|
|
|
2021-08-08 14:16:30 +02:00
|
|
|
#include <benchmark/benchmark.h>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QtConcurrent>
|
2023-05-26 14:54:23 +02:00
|
|
|
#include <QTemporaryDir>
|
2021-08-08 14:16:30 +02:00
|
|
|
|
2023-05-20 12:54:50 +02:00
|
|
|
using namespace chatterino;
|
|
|
|
|
2021-08-08 14:16:30 +02:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
2024-01-07 13:15:36 +01:00
|
|
|
initResources();
|
|
|
|
|
2021-08-08 14:16:30 +02:00
|
|
|
::benchmark::Initialize(&argc, argv);
|
|
|
|
|
2023-05-26 14:54:23 +02:00
|
|
|
// Ensure settings are initialized before any benchmarks are run
|
|
|
|
QTemporaryDir settingsDir;
|
|
|
|
settingsDir.setAutoRemove(false); // we'll remove it manually
|
|
|
|
chatterino::Settings settings(settingsDir.path());
|
2023-05-20 12:54:50 +02:00
|
|
|
|
2023-06-24 15:03:27 +02:00
|
|
|
QTimer::singleShot(0, [&]() {
|
2021-08-08 14:16:30 +02:00
|
|
|
::benchmark::RunSpecifiedBenchmarks();
|
|
|
|
|
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(0);
|
2021-08-08 14:16:30 +02:00
|
|
|
});
|
|
|
|
|
2023-06-24 15:03:27 +02:00
|
|
|
return QApplication::exec();
|
2021-08-08 14:16:30 +02:00
|
|
|
}
|