清理废弃模块并完善测试基础设施

This commit is contained in:
2026-07-17 23:49:45 +08:00
parent d0d1de4d00
commit 90262aaf6d
102 changed files with 1711 additions and 8175 deletions
+44
View File
@@ -0,0 +1,44 @@
#include "TestHarness.h"
#include <QCoreApplication>
#include <QStandardPaths>
#include <QTextStream>
#include <exception>
int main(int argc, char *argv[])
{
QStandardPaths::setTestModeEnabled(true);
QCoreApplication application(argc, argv);
QCoreApplication::setOrganizationName(QStringLiteral("QtDesktopPetInternalQA"));
QCoreApplication::setApplicationName(QStringLiteral("CoreLogicTests"));
QTextStream output(stdout);
QTextStream errors(stderr);
int failedCount = 0;
for (const Qa::TestCase &test : Qa::registry())
{
try
{
test.function();
output << "[PASS] " << QString::fromStdString(test.name) << Qt::endl;
}
catch (const std::exception &exception)
{
++failedCount;
errors << "[FAIL] " << QString::fromStdString(test.name)
<< ": " << exception.what() << Qt::endl;
}
catch (...)
{
++failedCount;
errors << "[FAIL] " << QString::fromStdString(test.name)
<< ": unknown exception" << Qt::endl;
}
}
output << "Executed " << Qa::registry().size() << " tests; "
<< failedCount << " failed." << Qt::endl;
return failedCount == 0 ? 0 : 1;
}