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,25 @@
#
# Unit tests for the NGLLogger module.
# One test executable per module, each registered with ctest.
#
if (NOT BUILD_TESTING)
return()
endif()
# --- NGLLogger: bootstrap + logger lookup (Log4Qt-independent; works in
# --- the Log4Qt-less (stub) build).
# --- MurmurHash2 has no export macro and the tree builds with hidden
# --- visibility, so its symbols are not exported from libNGLLogger - the
# --- module source is compiled directly into the test (same pattern as the
# --- LogView test in TetraIF/unit-test).
if (TARGET NGLLogger)
ADD_EXECUTABLE(ngllogger_unit_test
ngllogger_unit_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../MurmurHash2.cpp)
TARGET_LINK_LIBRARIES(ngllogger_unit_test
NGLLogger
Qt6::Core
Qt6::Test
)
ADD_TEST(NAME ngllogger_unit_test COMMAND $<TARGET_FILE:ngllogger_unit_test>)
endif()
@@ -0,0 +1,163 @@
#include <NGLLogger/NGLLoggerBootstrap.h>
#include <NGLLogger/NGLLogger.h>
#include <NGLLogger/MurmurHash2.h>
#include <QtTest/QTest>
#include <QtTest/QTestEventLoop>
class ngllogger_unit_test : public QObject
{
Q_OBJECT
private slots:
void initTestCase()
{
// Create the root logger once for the whole test process.
// Works in both the Log4Qt build and the Log4Qt-less (stub) build.
NGL::NGLLoggerBootstrap::createNGLRootLogger("log4cxx.props", false);
}
void A_LoggerHierarchyHelperSameNameReturnsSameInstance()
{
#ifndef HAVE_LOG4QT
// The instance cache (m_loggermap) is only populated in Log4Qt builds
// (NGLLogger constructor); the stub build creates a fresh logger per call.
QSKIP("requires the Log4Qt build (instance caching is a Log4Qt feature)");
#else
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
auto &b = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
QCOMPARE(&a, &b); // same instance for same name
#endif
}
void B_LoggerHierarchyHelperDifferentNamesReturnDifferentInstances()
{
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui.AES");
auto &b = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui.Dataview");
QVERIFY(&a != &b); // different instances for different names
}
void C_LoggerNameRoundTrip()
{
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
QCOMPARE(a.getLoggerName(), std::string("Gui"));
auto &b = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui.AES");
QCOMPARE(b.getLoggerName(), std::string("Gui.AES"));
}
void D_StdStringAndCharOverloadsReturnSameInstance()
{
#ifndef HAVE_LOG4QT
QSKIP("requires the Log4Qt build (instance caching is a Log4Qt feature)");
#else
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
auto &b = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger(std::string("Gui"));
QCOMPARE(&a, &b);
auto &c = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui.AES");
auto &d = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger(std::string("Gui.AES"));
QCOMPARE(&c, &d);
#endif
}
void E_NoSpaceFlag()
{
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
QVERIFY(a.noSpace()); // default true
a.setNoSpace(false);
QVERIFY(!a.noSpace());
a.setNoSpace(true);
QVERIFY(a.noSpace());
}
void F_LogLevelEnumOrdering()
{
QVERIFY(NGL::LogLevel::Trace < NGL::LogLevel::Debug);
QVERIFY(NGL::LogLevel::Debug < NGL::LogLevel::Info);
QVERIFY(NGL::LogLevel::Info < NGL::LogLevel::Warning);
QVERIFY(NGL::LogLevel::Warning < NGL::LogLevel::Error);
QVERIFY(NGL::LogLevel::Error < NGL::LogLevel::Fatal);
}
void G_PerLevelHelpersAgreeWithGeneric()
{
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
QCOMPARE(a.isTraceEnabled(), a.isLevelEnabled(NGL::LogLevel::Trace));
QCOMPARE(a.isDebugEnabled(), a.isLevelEnabled(NGL::LogLevel::Debug));
QCOMPARE(a.isInfoEnabled(), a.isLevelEnabled(NGL::LogLevel::Info));
QCOMPARE(a.isWarningEnabled(), a.isLevelEnabled(NGL::LogLevel::Warning));
QCOMPARE(a.isErrorEnabled(), a.isLevelEnabled(NGL::LogLevel::Error));
QCOMPARE(a.isFatalEnabled(), a.isLevelEnabled(NGL::LogLevel::Fatal));
}
void H_LevelEnabledIsUpwardClosed()
{
// For any two levels lo < hi: if lo enabled then hi enabled; if hi disabled then lo
// disabled. This holds regardless of the actual enabled level.
const auto levels = {
NGL::LogLevel::Trace, NGL::LogLevel::Debug, NGL::LogLevel::Info,
NGL::LogLevel::Warning, NGL::LogLevel::Error, NGL::LogLevel::Fatal
};
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Gui");
for (auto lo : levels)
for (auto hi : levels)
{
if (lo < hi)
{
if (a.isLevelEnabled(lo))
QVERIFY(a.isLevelEnabled(hi));
if (!a.isLevelEnabled(hi))
QVERIFY(!a.isLevelEnabled(lo));
}
}
}
void I_BootstrapCreateAndGet()
{
auto &a = NGL::NGLLoggerBootstrap::getNGLRootLogger();
auto &b = NGL::NGLLoggerBootstrap::getNGLRootLogger();
QCOMPARE(&a, &b); // get returns the created root logger
// create with ignore-already-created returns the existing root logger
auto &c = NGL::NGLLoggerBootstrap::createNGLRootLogger("log4cxx.props", true);
QCOMPARE(&a, &c);
}
void J_AlreadyCreatedError()
{
// Re-creating without ignore-already-created throws AlreadyCreatedError (root was
// created in initTestCase)
bool threw = false;
try
{
NGL::NGLLoggerBootstrap::createNGLRootLogger("log4cxx.props", false);
}
catch (const NGL::NGLLogger::AlreadyCreatedError &e)
{
Q_UNUSED(e);
threw = true;
}
QVERIFY(threw);
}
void K_NotCreatedError()
{
// Not tested here: requires a fresh process without prior bootstrap, and initTestCase
// already created the root logger
QSKIP("requires fresh process without prior bootstrap");
}
void L_MurmurHash2Determinism()
{
QCOMPARE(NGL::MurmurHash2("", 0, 0), 0u); // empty, seed 0
QCOMPARE(NGL::MurmurHash2("hello", 5, 0), NGL::MurmurHash2("hello", 5, 0));
}
void M_MurmurHash2Distinctness()
{
QVERIFY(NGL::MurmurHash2("hello", 5, 0) != NGL::MurmurHash2("hello", 5, 1)); //
// different seed
QVERIFY(NGL::MurmurHash2("abc", 3, 0) != NGL::MurmurHash2("abd", 3, 0)); //
// different input
}
};
QTEST_MAIN(ngllogger_unit_test)
#include "ngllogger_unit_test.moc"