Restore CommonUnitTestsPlaceholder (defines the MockCoordTrans target)
MockCoordTrans is a Release 2 GROUP3 target: a header-only static library defined in Lts/Common/CommonUnitTestsPlaceholder/mocks. As a header-only lib it has no source file as a ninja edge input, so the build-closure keep set did not pull its dir in and the prune removed its CMakeLists (ninja: unknown target MockCoordTrans). Restore the dir and its add_subdirectory; the smoke tests inside stay behind their default-OFF options.
This commit is contained in:
1 parent
7c1c22637e
commit
c12287471c
6 files changed
+85
No files matched your search
@@ -5,6 +5,8 @@
|
||||
#
|
||||
|
||||
# Release 2 Common modules (S set: 15 modules)
|
||||
# Mock library for unit tests (CoordTrans mocks) — defines the MockCoordTrans target
|
||||
ADD_SUBDIRECTORY(CommonUnitTestsPlaceholder)
|
||||
ADD_SUBDIRECTORY(CodeGen)
|
||||
ADD_SUBDIRECTORY(LtsAppDescriptor)
|
||||
ADD_SUBDIRECTORY(LtsCommandLineParser)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(CommonUnitTestsPlaceholder)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
option(BUILD_SMOKE_TESTS "Build QtTest smoke tests" OFF)
|
||||
option(BUILD_GTEST_SMOKE "Build GTest smoke tests" OFF)
|
||||
|
||||
add_subdirectory(mocks)
|
||||
|
||||
if(BUILD_SMOKE_TESTS)
|
||||
if(NOT TARGET Qt6::Test)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Test)
|
||||
endif()
|
||||
add_executable(coordTransTests_smoke coordTransTests_smoke.cpp)
|
||||
target_link_libraries(coordTransTests_smoke PRIVATE Qt6::Test MockCoordTrans::MockCoordTrans)
|
||||
add_test(NAME coordTransTests_smoke COMMAND coordTransTests_smoke)
|
||||
endif()
|
||||
|
||||
if(BUILD_GTEST_SMOKE)
|
||||
find_package(GTest QUIET)
|
||||
if(NOT GTest_FOUND)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||
GIT_TAG release-1.12.1
|
||||
)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
endif()
|
||||
add_executable(coordTransTests_gtest coordTransTests_gtest.cpp)
|
||||
target_link_libraries(coordTransTests_gtest PRIVATE GTest::gtest_main MockCoordTrans::MockCoordTrans)
|
||||
add_test(NAME coordTransTests_gtest COMMAND coordTransTests_gtest)
|
||||
endif()
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// Stub GTest smoke test for coordTrans
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(CoordTransSmokeTest, StubTest) {
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// Stub QtTest smoke test for coordTrans
|
||||
#include <QTest>
|
||||
|
||||
class CoordTransSmokeTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void stubTest() {
|
||||
QVERIFY(true);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_APPLESS_MAIN(CoordTransSmokeTest)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
add_library(MockCoordTrans STATIC MockCoordTrans.h)
|
||||
target_include_directories(MockCoordTrans PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Export header-only semantics by providing an interface target
|
||||
add_library(MockCoordTrans::MockCoordTrans ALIAS MockCoordTrans)
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MockCoordTrans.h - Stub mock for CoordTrans functionality
|
||||
// This is a placeholder to allow builds without full CoordTrans implementation
|
||||
|
||||
#ifndef MOCK_COORD_TRANS_H
|
||||
#define MOCK_COORD_TRANS_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QPointF>
|
||||
|
||||
// Minimal stub to satisfy linker requirements
|
||||
namespace LtsCoordTrans {
|
||||
// Placeholder types
|
||||
struct UtmCoordinate {
|
||||
static UtmCoordinate fromMgrs(const QString&) { return UtmCoordinate(); }
|
||||
QPointF geographic() const { return QPointF(); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MOCK_COORD_TRANS_H
|
||||
Reference in new issue
Block a user