Added test case and setting Test configuration

This commit is contained in:
berrux-dev committed 2026-09-11 13:41:20 +02:00
1 parent f815271486
commit a86f9b5bac
48 files changed
+423 -168

No files matched your search

@@ -7,6 +7,11 @@
* so we test header existence and structure rather than macro expansion.
*/
#ifndef MIGRATION_TESTS_BUILD_DIR
// Repertoire de build reel, fourni par tests/CMakeLists.txt.
#define MIGRATION_TESTS_BUILD_DIR "build"
#endif
#include <fstream>
#include <gtest/gtest.h>
#include <string>
@@ -33,28 +38,28 @@ std::string readFile(const std::string& path)
// Test 1: nglwidgets_export.h exists
TEST(ExportHeaders, NglWidgetsExportExists)
{
std::string path = "build/Z/src/nglwidgets/nglwidgets_export.h";
std::string path = MIGRATION_TESTS_BUILD_DIR "/Z/src/nglwidgets/nglwidgets_export.h";
EXPECT_TRUE(fileExists(path)) << "Export header not found: " << path;
}
// Test 2: qtsingleapplication_export.h exists
TEST(ExportHeaders, QtSingleApplicationExportExists)
{
std::string path = "build/Z/src/QtSingleApplication/qtsingleapplication_export.h";
std::string path = MIGRATION_TESTS_BUILD_DIR "/Z/src/QtSingleApplication/qtsingleapplication_export.h";
EXPECT_TRUE(fileExists(path)) << "Export header not found: " << path;
}
// Test 3: ltssessiondata_export.h exists
TEST(ExportHeaders, LtsSessionDataExportExists)
{
std::string path = "build/Lts/Common/LtsSession/ltssessiondata_export.h";
std::string path = MIGRATION_TESTS_BUILD_DIR "/Lts/Common/LtsSession/ltssessiondata_export.h";
EXPECT_TRUE(fileExists(path)) << "Export header not found: " << path;
}
// Test 4: svcgmpserver_export.h exists
TEST(ExportHeaders, SvcGmpServerExportExists)
{
std::string path = "build/Lts/Services/GuezMinelayerProcessing/svcgmpserver_export.h";
std::string path = MIGRATION_TESTS_BUILD_DIR "/Lts/Services/GuezMinelayerProcessing/svcgmpserver_export.h";
EXPECT_TRUE(fileExists(path)) << "Export header not found: " << path;
}
@@ -62,8 +67,8 @@ TEST(ExportHeaders, SvcGmpServerExportExists)
TEST(ExportHeaders, HaveIncludeGuards)
{
std::vector<std::string> headers = {
"build/Z/src/nglwidgets/nglwidgets_export.h", "build/Z/src/QtSingleApplication/qtsingleapplication_export.h",
"build/Lts/Common/LtsSession/ltssessiondata_export.h", "build/Lts/Proxies/ProjectDataManagement/pdm_export.h"};
MIGRATION_TESTS_BUILD_DIR "/Z/src/nglwidgets/nglwidgets_export.h", MIGRATION_TESTS_BUILD_DIR "/Z/src/QtSingleApplication/qtsingleapplication_export.h",
MIGRATION_TESTS_BUILD_DIR "/Lts/Common/LtsSession/ltssessiondata_export.h", MIGRATION_TESTS_BUILD_DIR "/Lts/Proxies/ProjectDataManagement/pdm_export.h"};
for (const auto& header : headers)
{
@@ -85,7 +90,7 @@ TEST(ExportHeaders, MacroNamingConvention)
{
// Check that export headers follow CMake naming convention
std::string adlerPath =
"qt-migration-legatus/qt6-after/qt6-migrated-legatus/build/Lts/Plugins/AdlerJson/adler_export.h";
MIGRATION_TESTS_BUILD_DIR "/Lts/Plugins/AdlerJson/adler_export.h";
std::string content = readFile(adlerPath);
if (!content.empty())
@@ -100,7 +105,7 @@ TEST(ExportHeaders, MacroNamingConvention)
TEST(ExportHeaders, ExportAndNoExportMacros)
{
std::vector<std::pair<std::string, std::string>> expectedMacros = {
{"qt-migration-legatus/qt6-after/qt6-migrated-legatus/build/Lts/Plugins/AdlerJson/adler_export.h", "ADLER"},
{MIGRATION_TESTS_BUILD_DIR "/Lts/Plugins/AdlerJson/adler_export.h", "ADLER"},
{"qt-migration-legatus/qt6-after/qt6-migrated-legatus/build/Lts/Services/PresentationManagement/"
"svcprecommon_export.h",
"SVCPRECOMMON"},