Restore in-scope files missing from the merge and scope-aware CMakeLists

The merge from story/release-validation-scope only carried files that
existed at the common base or on that branch. In-scope files added on
story/release-2-cleanup after the base (per-module unit-test dirs, the
Release 2 driver and rpmbuild script) were missing, breaking
ADD_SUBDIRECTORY(unit-test) references.

- Restore the 33 missing in-scope files from story/release-2-cleanup.
- Lts/Common/CMakeLists.txt and LtsUtilsGui/CMakeLists.txt: take the
  story/release-2-cleanup versions (the validation versions still
  reference out-of-scope subdirectories: httq, LtsRestClient,
  LtsWebSocket, ConnectDialog, StyleManager).
This commit is contained in:
berrux-dev committed 2026-11-16 19:04:24 +01:00
1 parent cfe15c72c4
commit 262fd226f9
35 files changed
+6856 -16

No files matched your search

@@ -0,0 +1,19 @@
#
# Unit tests for the DDS Core module.
# One test executable per module, each registered with ctest.
#
if (NOT BUILD_TESTING)
return()
endif()
# --- DDS Core: generated function-reply objects and the CORE logger facade
if (TARGET ddscore)
ADD_EXECUTABLE(ddscore_unit_test ddscore_unit_test.cpp)
TARGET_LINK_LIBRARIES(ddscore_unit_test
ddscore
NGLLogger
Qt6::Core
Qt6::Test
)
ADD_TEST(NAME ddscore_unit_test COMMAND $<TARGET_FILE:ddscore_unit_test>)
endif()
@@ -0,0 +1,169 @@
//
// Unit tests for the ddscore module (Lts/DDS/Core): FunctionReplyObject
// (the module's pure data/logic class) and the CORE.* logger helper.
//
#include <QtCore/QCoreApplication>
#include <QtCore/QString>
#include <Core/function_reply_object.h>
#include <Core/logger.h>
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <QtTest/QTest>
#include <string>
#include <vector>
class ddscore_unit_test : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void functionReplyObjectDefault();
void functionReplyObjectFromIdAndString();
void functionReplyObjectFromStringOnly();
void functionReplyObjectNullString();
void functionReplyObjectWithArgs();
void functionReplyObjectWithArgsAndAdditionalInfo();
void functionReplyObjectRvalueArgs();
void argOverloads();
void setters();
void formattedWithoutPlaceholders();
void formattedExtraArgsIgnored();
void translatedMatchesFormatted();
void uniqueIdRoundtrip();
void coreGetLoggerName();
};
void ddscore_unit_test::initTestCase()
{
NGL::NGLLoggerBootstrap::createNGLRootLogger("log4cxx.props", false);
}
void ddscore_unit_test::functionReplyObjectDefault()
{
Core::FunctionReplyObject reply;
QCOMPARE(reply.id(), -1);
QVERIFY(!reply.error());
QCOMPARE(reply.str(), std::string());
QCOMPARE(reply.additionalInfo(), std::string());
QCOMPARE(reply.args().size(), 0u);
QCOMPARE(reply.uniqueId(), int64_t(0));
}
void ddscore_unit_test::functionReplyObjectFromIdAndString()
{
Core::FunctionReplyObject reply(42, "error %1");
QCOMPARE(reply.id(), 42);
QVERIFY(reply.error());
QCOMPARE(reply.str(), std::string("error %1"));
}
void ddscore_unit_test::functionReplyObjectFromStringOnly()
{
Core::FunctionReplyObject reply("plain error");
QCOMPARE(reply.id(), -1);
QVERIFY(reply.error());
QCOMPARE(reply.str(), std::string("plain error"));
}
void ddscore_unit_test::functionReplyObjectNullString()
{
Core::FunctionReplyObject reply(7, static_cast<const char *>(nullptr));
QCOMPARE(reply.id(), 7);
QVERIFY(!reply.error());
QCOMPARE(reply.str(), std::string());
}
void ddscore_unit_test::functionReplyObjectWithArgs()
{
Core::FunctionReplyObject reply(5, "%1/%2", std::vector<std::string>{"a", "b"});
QCOMPARE(reply.id(), 5);
QCOMPARE(reply.str(), std::string("%1/%2"));
const std::vector<std::string> expectedArgs = {"a", "b"};
QCOMPARE(reply.args(), expectedArgs);
QCOMPARE(reply(), std::string("a/b"));
}
void ddscore_unit_test::functionReplyObjectWithArgsAndAdditionalInfo()
{
Core::FunctionReplyObject reply(5, "failed: %1", std::vector<std::string>{"x"}, "context");
QCOMPARE(reply.id(), 5);
QCOMPARE(reply.str(), std::string("failed: %1"));
QCOMPARE(reply.additionalInfo(), std::string("context"));
QCOMPARE(reply(), std::string("failed: x"));
}
void ddscore_unit_test::functionReplyObjectRvalueArgs()
{
Core::FunctionReplyObject reply(
9, std::string("moved %1"), std::vector<std::string>{"v"}, std::string("info"));
QCOMPARE(reply.id(), 9);
QCOMPARE(reply.str(), std::string("moved %1"));
QCOMPARE(reply.additionalInfo(), std::string("info"));
QCOMPARE(reply(), std::string("moved v"));
}
void ddscore_unit_test::argOverloads()
{
Core::FunctionReplyObject reply(1, "v=%1 s=%2 q=%3");
reply.arg(7).arg(std::string("hello")).arg(QStringLiteral("qt"));
const std::vector<std::string> expectedArgs = {"7", "hello", "qt"};
QCOMPARE(reply.args(), expectedArgs);
QCOMPARE(reply(), std::string("v=7 s=hello q=qt"));
}
void ddscore_unit_test::setters()
{
Core::FunctionReplyObject reply;
reply.setId(11);
reply.setStr("updated %1");
reply.setAdditionalInfo("note");
QCOMPARE(reply.id(), 11);
QCOMPARE(reply.str(), std::string("updated %1"));
QVERIFY(reply.error());
QCOMPARE(reply.additionalInfo(), std::string("note"));
}
void ddscore_unit_test::formattedWithoutPlaceholders()
{
Core::FunctionReplyObject reply(1, "no placeholder");
reply.arg(QStringLiteral("ignored"));
QCOMPARE(reply(), std::string("no placeholder"));
}
void ddscore_unit_test::formattedExtraArgsIgnored()
{
Core::FunctionReplyObject reply(1, "only %1");
reply.arg(QStringLiteral("a")).arg(QStringLiteral("b"));
QCOMPARE(reply(), std::string("only a"));
}
void ddscore_unit_test::translatedMatchesFormatted()
{
// No translator is installed, so QCoreApplication::translate returns the
// source string and translated() must equal the plain formatted result.
Core::FunctionReplyObject reply(1, "translated %1", std::vector<std::string>{"t"});
QCOMPARE(reply.translated().toStdString(), std::string("translated t"));
QCOMPARE(reply.translated().toStdString(), reply());
}
void ddscore_unit_test::uniqueIdRoundtrip()
{
Core::FunctionReplyObject reply;
reply.setUniqueId(123456);
QCOMPARE(reply.uniqueId(), int64_t(123456));
}
void ddscore_unit_test::coreGetLoggerName()
{
// Core::getLogger prefixes the requested name with the "CORE." namespace.
NGL::INGLLogger &logger = Core::getLogger("UnitTest");
QCOMPARE(logger.getLoggerName(), std::string("CORE.UnitTest"));
}
QTEST_MAIN(ddscore_unit_test)
#include "ddscore_unit_test.moc"