Added test case and setting Test configuration
This commit is contained in:
1 parent
f815271486
commit
a86f9b5bac
48 files changed
+423
-168
No files matched your search
@@ -63,7 +63,28 @@ if(BUILD_TESTING)
|
||||
|
||||
# Exclude tests for non-existent or commented-out components
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_lts_app_descriptor_editor\\.cpp")
|
||||
# test_lts_app_descriptor.cpp utilise QTEST_MAIN (framework QtTest) : il fournit
|
||||
# son propre main(), qui prend le pas sur GTest::gtest_main et fait echouer la
|
||||
# decouverte des tests. Un binaire QtTest et un binaire gtest ne se melangent pas.
|
||||
# A rebatir comme executable QtTest autonome si sa couverture est souhaitee.
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_lts_app_descriptor\\.cpp")
|
||||
# test_GrantleeParserSmoke.cpp est un doublon-souche : il inclut
|
||||
# Lts/Common/CodeGen/GrantleeParserSmoke.h, qui n'a jamais existe, et ne contient
|
||||
# que des EXPECT_TRUE(true). Le vrai smoke test est l'executable autonome
|
||||
# grantlee_parser_smoke (Lts/Common/CodeGen/tests/GrantleeParserSmoke.cpp,
|
||||
# add_test NAME GrantleeParserSmoke). Aucune couverture perdue.
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_GrantleeParserSmoke\\.cpp")
|
||||
|
||||
# test_migration_stubs.cpp valide les en-tetes STUB (namespace DDS::Core::Interface,
|
||||
# DDS::DTC, ...) qui n'existent que si BUILD_RTI=OFF. Avec BUILD_RTI=ON les stubs
|
||||
# sont contournes au profit des vrais en-tetes : ce test ne peut pas compiler.
|
||||
if(BUILD_RTI)
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_migration_stubs\\.cpp")
|
||||
# test_build_rti_guards.cpp affirme EXPECT_FALSE(rti_available) : il valide
|
||||
# le repli BUILD_RTI=OFF et echoue par construction quand RTI est actif.
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_build_rti_guards\\.cpp")
|
||||
endif()
|
||||
|
||||
# Exclude Grantlee-related tests when BUILD_GRANTLEE is OFF
|
||||
if(NOT BUILD_GRANTLEE)
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_.*Grantlee.*\\.cpp")
|
||||
@@ -91,7 +112,27 @@ if(BUILD_TESTING)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Le CMakeLists racine pose -DQT_NO_CAST_FROM_ASCII (CMakeLists.txt:546) pour
|
||||
# interdire les conversions implicites const char* -> QString dans le code de
|
||||
# production. Plusieurs tests (test_qt6_api_migrations, test_qt6_compatibility)
|
||||
# ont justement pour objet d'exercer ces conversions : les reecrire en
|
||||
# QStringLiteral changerait ce qu'ils verifient. On leve donc le garde pour ce
|
||||
# repertoire de tests uniquement ; le code de production reste protege.
|
||||
get_directory_property(_migtest_defs COMPILE_DEFINITIONS)
|
||||
if(_migtest_defs)
|
||||
list(REMOVE_ITEM _migtest_defs QT_NO_CAST_FROM_ASCII)
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${_migtest_defs}")
|
||||
endif()
|
||||
|
||||
# main() maison : cree la QApplication requise par les tests de widgets
|
||||
list(APPEND EXISTING_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/gtest_qt_main.cpp")
|
||||
|
||||
add_executable(migration_tests ${EXISTING_SOURCES})
|
||||
|
||||
# test_export_headers.cpp verifie la presence d'en-tetes generes : il doit
|
||||
# connaitre le nom reel du repertoire de build (il supposait "build").
|
||||
target_compile_definitions(migration_tests PRIVATE
|
||||
MIGRATION_TESTS_BUILD_DIR="${CMAKE_BINARY_DIR}")
|
||||
|
||||
# Enable Qt Meta-Object Compiler for tests with Q_OBJECT
|
||||
set_target_properties(migration_tests PROPERTIES AUTOMOC ON)
|
||||
@@ -99,17 +140,49 @@ if(BUILD_TESTING)
|
||||
target_compile_features(migration_tests PRIVATE cxx_std_23)
|
||||
|
||||
target_include_directories(migration_tests PRIVATE
|
||||
# CMAKE_SOURCE_DIR vaut deja .../qt6-after/qt6-migrated-legatus : les
|
||||
# variantes prefixees une seconde fois pointaient dans le vide (les deux
|
||||
# premieres doublonnaient d'ailleurs les lignes ci-dessus).
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/include
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/DDS
|
||||
${CMAKE_SOURCE_DIR}/DDS
|
||||
# En-tetes generes, inclus sous forme qualifiee par service
|
||||
# (ex. <ProjectDataManagement/pdm_types.h>, <AlarmManagement/alm_dtc.h>).
|
||||
${CMAKE_SOURCE_DIR}/Lts
|
||||
${CMAKE_BINARY_DIR}/Lts
|
||||
${CMAKE_BINARY_DIR}/Lts/Services
|
||||
${CMAKE_BINARY_DIR}/Lts/Proxies
|
||||
${CMAKE_BINARY_DIR}/Lts/DDS
|
||||
${CMAKE_BINARY_DIR}/Lts/Common
|
||||
${CMAKE_BINARY_DIR}/Lts/Common/CodeGen
|
||||
${CMAKE_BINARY_DIR}/Lts/Common/LtsTimeline
|
||||
${CMAKE_BINARY_DIR}/Lts/Common/LtsTimelineClassic
|
||||
)
|
||||
|
||||
# Les en-tetes *_export.h generes sont inclus sous forme nue
|
||||
# (ex. <ismshared_export.h>) et vivent chacun dans le repertoire de build
|
||||
# de leur cible : une centaine de repertoires. On les collecte au lieu de
|
||||
# les enumerer. GLOB est evalue a la configuration, apres generate_export_header.
|
||||
file(GLOB_RECURSE _migtest_export_headers "${CMAKE_BINARY_DIR}/*_export.h")
|
||||
set(_migtest_export_dirs "")
|
||||
foreach(_h IN LISTS _migtest_export_headers)
|
||||
get_filename_component(_d "${_h}" DIRECTORY)
|
||||
list(APPEND _migtest_export_dirs "${_d}")
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES _migtest_export_dirs)
|
||||
list(LENGTH _migtest_export_dirs _migtest_export_count)
|
||||
message(STATUS "Migration tests: ${_migtest_export_count} repertoires d'en-tetes _export.h")
|
||||
target_include_directories(migration_tests PRIVATE ${_migtest_export_dirs})
|
||||
|
||||
# NGLLogger exporte Z/src/NGLLogger en PUBLIC : c'est le repertoire de
|
||||
# NGLLoggerBootstrap.h, inclus par Lts/Common/LtsTimelineClassic/Event.h.
|
||||
if(TARGET NGLLogger)
|
||||
target_link_libraries(migration_tests PRIVATE NGLLogger)
|
||||
else()
|
||||
message(WARNING "migration_tests: cible NGLLogger absente, "
|
||||
"les tests LtsTimelineClassic ne compileront pas")
|
||||
endif()
|
||||
|
||||
# Link against Qt6 components
|
||||
if(QT6_GUI_AVAILABLE)
|
||||
target_link_libraries(migration_tests PRIVATE
|
||||
@@ -117,7 +190,7 @@ if(QT6_GUI_AVAILABLE)
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
Qt6::Test
|
||||
GTest::gtest_main
|
||||
GTest::gtest # pas gtest_main : le main() est dans gtest_qt_main.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -132,8 +205,21 @@ endif()
|
||||
# Grantlee tests require BUILD_GRANTLEE=ON
|
||||
if(BUILD_GRANTLEE)
|
||||
target_link_libraries(migration_tests PRIVATE codegen_grantlee)
|
||||
# KF6::TextTemplate porte les INTERFACE_INCLUDE_DIRECTORIES de
|
||||
# <ktexttemplate/template.h>, inclus par GeneratorGrantleeBase.h.
|
||||
# Le FIND_PACKAGE de Lts/Common/CodeGen cree une cible importee limitee
|
||||
# a ce repertoire : il faut la re-chercher ici pour l'avoir dans ce scope.
|
||||
find_package(KF6TextTemplate QUIET)
|
||||
if(TARGET KF6::TextTemplate)
|
||||
target_link_libraries(migration_tests PRIVATE KF6::TextTemplate)
|
||||
else()
|
||||
message(WARNING "migration_tests: KF6::TextTemplate introuvable, "
|
||||
"les tests Grantlee ne compileront pas")
|
||||
endif()
|
||||
# CMAKE_SOURCE_DIR vaut deja .../qt6-after/qt6-migrated-legatus :
|
||||
# le prefixe repete donnait un chemin inexistant.
|
||||
target_include_directories(migration_tests PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/Lts/Common/CodeGen
|
||||
${CMAKE_SOURCE_DIR}/Lts/Common/CodeGen
|
||||
)
|
||||
message(STATUS "Migration tests: Grantlee support enabled")
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @file gtest_qt_main.cpp
|
||||
* @brief Point d'entree de migration_tests.
|
||||
*
|
||||
* GTest::gtest_main fournit un main() qui ne cree aucune QApplication. Or les tests
|
||||
* de widgets (EventDelegate, TimelineView, ...) en instancient, et Qt abandonne avec
|
||||
* "QWidget: Must construct a QApplication before a QWidget". On fournit donc notre
|
||||
* propre main() : QApplication d'abord, gtest ensuite.
|
||||
*
|
||||
* En environnement sans affichage, lancer avec QT_QPA_PLATFORM=offscreen.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
NGL::NGLLoggerBootstrap::createNGLRootLogger(QString(), true, QString(), /*quiet=*/true);
|
||||
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@@ -17,9 +17,9 @@ class EventTest : public ::testing::Test
|
||||
|
||||
TEST(EventTest, ConstructorInitializesMembers)
|
||||
{
|
||||
QStringList path = {"actuator", "subactuator"};
|
||||
QStringList path = {QStringLiteral("actuator"), QStringLiteral("subactuator")};
|
||||
QJsonObject detailData;
|
||||
detailData["key"] = "value";
|
||||
detailData[QStringLiteral("key")] = QStringLiteral("value");
|
||||
QColor color(Qt::red);
|
||||
|
||||
Event event(1, 2, 1000, 2000, 3, 4, 5, path, nullptr, color, detailData);
|
||||
|
||||
@@ -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"},
|
||||
|
||||
@@ -23,15 +23,15 @@ TEST(ItemTest, HeaderCompilesAndLinks)
|
||||
TEST(ItemTest, CanInstantiateItem)
|
||||
{
|
||||
// Basic instantiation test
|
||||
Item item("TestItem", "test-id");
|
||||
EXPECT_EQ(item.getName(), "TestItem");
|
||||
EXPECT_EQ(item.getIdentifier(), "test-id");
|
||||
Item item(QStringLiteral("TestItem"), QStringLiteral("test-id"));
|
||||
EXPECT_EQ(item.getName(), QStringLiteral("TestItem"));
|
||||
EXPECT_EQ(item.getIdentifier(), QStringLiteral("test-id"));
|
||||
}
|
||||
|
||||
TEST(ItemTest, ItemHasValidState)
|
||||
{
|
||||
Item parent("Parent");
|
||||
Item child("Child");
|
||||
Item parent(QStringLiteral("Parent"));
|
||||
Item child(QStringLiteral("Child"));
|
||||
|
||||
// Test parent-child relationship
|
||||
child.setParent(&parent);
|
||||
|
||||
@@ -22,11 +22,11 @@ class TestLtsAppDescriptor : public QObject
|
||||
void TestLtsAppDescriptor::testPluginInfoCreation()
|
||||
{
|
||||
PluginInfo pluginInfo;
|
||||
pluginInfo.iid = "test.plugin.iid";
|
||||
pluginInfo.iid = QStringLiteral("test.plugin.iid");
|
||||
pluginInfo.type = PluginInfo::PluginType::GUI;
|
||||
pluginInfo.flags = PluginInfo::Flag::UNKNOWN;
|
||||
|
||||
QCOMPARE(pluginInfo.iid, QString("test.plugin.iid"));
|
||||
QCOMPARE(pluginInfo.iid, QStringLiteral("test.plugin.iid"));
|
||||
QCOMPARE(pluginInfo.type, PluginInfo::PluginType::GUI);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,18 +17,16 @@
|
||||
#include <QtGui/QWheelEvent>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// Ensure QApplication is initialized for widget tests
|
||||
static bool appInitialized = false;
|
||||
|
||||
// La QApplication est desormais creee par le main() de la suite (gtest_qt_main.cpp).
|
||||
//
|
||||
// Ce fichier en creait une seconde, en statique locale : Qt n'admet qu'une instance,
|
||||
// et celle-ci etait detruite par exit() APRES celle du main(), d'ou un SIGSEGV dans
|
||||
// ~QGuiApplication a l'extinction du processus. On se contente donc de verifier
|
||||
// qu'une instance existe.
|
||||
static void ensureAppInitialized()
|
||||
{
|
||||
if (!appInitialized)
|
||||
{
|
||||
static int argc = 1;
|
||||
static char* argv[] = {(char*)"test_ltswidgets_qt6", nullptr};
|
||||
static QApplication app(argc, argv);
|
||||
appInitialized = true;
|
||||
}
|
||||
ASSERT_NE(QCoreApplication::instance(), nullptr)
|
||||
<< "QApplication absente : elle doit etre creee par gtest_qt_main.cpp";
|
||||
}
|
||||
|
||||
// Test 1: QRandomGenerator bounded generation (used in lts_tab_widget.cpp)
|
||||
@@ -90,9 +88,9 @@ TEST(LtsWidgetsQt6, QComboBoxCurrentTextChangedSignal)
|
||||
ensureAppInitialized();
|
||||
|
||||
QComboBox comboBox;
|
||||
comboBox.addItem("Option1");
|
||||
comboBox.addItem("Option2");
|
||||
comboBox.addItem("Option3");
|
||||
comboBox.addItem(QStringLiteral("Option1"));
|
||||
comboBox.addItem(QStringLiteral("Option2"));
|
||||
comboBox.addItem(QStringLiteral("Option3"));
|
||||
|
||||
bool signalReceived = false;
|
||||
QString receivedText;
|
||||
@@ -105,7 +103,7 @@ TEST(LtsWidgetsQt6, QComboBoxCurrentTextChangedSignal)
|
||||
comboBox.setCurrentIndex(1);
|
||||
|
||||
EXPECT_TRUE(signalReceived);
|
||||
EXPECT_EQ(receivedText, "Option2");
|
||||
EXPECT_EQ(receivedText, QStringLiteral("Option2"));
|
||||
}
|
||||
|
||||
// Test 5: QComboBox activated signal with int parameter (Qt6)
|
||||
@@ -115,9 +113,9 @@ TEST(LtsWidgetsQt6, QComboBoxActivatedIntSignal)
|
||||
ensureAppInitialized();
|
||||
|
||||
QComboBox comboBox;
|
||||
comboBox.addItem("First");
|
||||
comboBox.addItem("Second");
|
||||
comboBox.addItem("Third");
|
||||
comboBox.addItem(QStringLiteral("First"));
|
||||
comboBox.addItem(QStringLiteral("Second"));
|
||||
comboBox.addItem(QStringLiteral("Third"));
|
||||
|
||||
bool signalReceived = false;
|
||||
int receivedIndex = -1;
|
||||
@@ -145,7 +143,7 @@ TEST(LtsWidgetsQt6, QStyleOptionInitFrom)
|
||||
{
|
||||
ensureAppInitialized();
|
||||
|
||||
QPushButton button("Test");
|
||||
QPushButton button(QStringLiteral("Test"));
|
||||
button.resize(100, 30);
|
||||
button.setEnabled(true);
|
||||
|
||||
@@ -163,8 +161,8 @@ TEST(LtsWidgetsQt6, QStyleOptionInitFromMultipleWidgets)
|
||||
{
|
||||
ensureAppInitialized();
|
||||
|
||||
QPushButton button1("Btn1");
|
||||
QPushButton button2("Btn2");
|
||||
QPushButton button1(QStringLiteral("Btn1"));
|
||||
QPushButton button2(QStringLiteral("Btn2"));
|
||||
button1.setEnabled(true);
|
||||
button2.setEnabled(false);
|
||||
|
||||
|
||||
@@ -27,17 +27,14 @@ TEST(PassiveEventContainerTest, CreateContainer)
|
||||
|
||||
TEST(PassiveEventContainerTest, SetEventList)
|
||||
{
|
||||
Event event1(1, 100, 0, 1000, -1, -1, -1, QStringList() << QStringLiteral("path1"), nullptr, Qt::red, QJsonObject(), -1, LtsUtils::QPoint3D());
|
||||
Event event2(2, 100, 500, 1500, -1, -1, -1, QStringList() << QStringLiteral("path2"), nullptr, Qt::blue, QJsonObject(), -1, LtsUtils::QPoint3D());
|
||||
|
||||
PassiveEventContainer container(false);
|
||||
|
||||
Event event1(1, 100, 0, 1000, -1, -1, -1, QStringList() << "path1", nullptr, Qt::red, QJsonObject(), -1, LtsUtils::QPoint3D());
|
||||
Event event2(2, 100, 500, 1500, -1, -1, -1, QStringList() << "path2", nullptr, Qt::blue, QJsonObject(), -1, LtsUtils::QPoint3D());
|
||||
|
||||
EventGraphic graphic1(&event1);
|
||||
EventGraphic graphic2(&event2);
|
||||
|
||||
EventGraphicList list;
|
||||
list.append(&graphic1);
|
||||
list.append(&graphic2);
|
||||
list.append(new EventGraphic(&event1));
|
||||
list.append(new EventGraphic(&event2));
|
||||
|
||||
container.setEventList(list);
|
||||
|
||||
@@ -46,13 +43,12 @@ TEST(PassiveEventContainerTest, SetEventList)
|
||||
|
||||
TEST(PassiveEventContainerTest, PaintDoesNotCrash)
|
||||
{
|
||||
Event event1(1, 100, 0, 1000, -1, -1, -1, QStringList() << QStringLiteral("path1"), nullptr, Qt::red, QJsonObject(), -1, LtsUtils::QPoint3D());
|
||||
|
||||
PassiveEventContainer container(false);
|
||||
|
||||
Event event1(1, 100, 0, 1000, -1, -1, -1, QStringList() << "path1", nullptr, Qt::red, QJsonObject(), -1, LtsUtils::QPoint3D());
|
||||
EventGraphic graphic1(&event1);
|
||||
|
||||
EventGraphicList list;
|
||||
list.append(&graphic1);
|
||||
list.append(new EventGraphic(&event1));
|
||||
container.setEventList(list);
|
||||
|
||||
EventTools::setValues(0, 1000, 0, 500);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This test verifies that the migrated header compiles correctly with Qt6/C++23.
|
||||
*/
|
||||
|
||||
#include "include/ProjectDataManagement/pdm_dtc.h"
|
||||
#include "ProjectDataManagement/pdm_dtc.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace LtsTimelineClassic
|
||||
{
|
||||
|
||||
// Helper to create test Event with minimal parameters
|
||||
static Event* createTestEvent()
|
||||
static Event* createTestEvent(const QString& actuator = QStringLiteral("test"))
|
||||
{
|
||||
return new Event(1, // uniqueId
|
||||
1, // typeId
|
||||
@@ -19,7 +19,7 @@ static Event* createTestEvent()
|
||||
1, // playerId
|
||||
1, // partyId
|
||||
1, // equipmentId
|
||||
QStringList{"test"}, // path
|
||||
QStringList{actuator}, // path
|
||||
Event::drawCustomEventGraphicRect, // paintFunc
|
||||
QColor(Qt::red), // paintColor
|
||||
QJsonObject()); // detailData
|
||||
@@ -56,9 +56,9 @@ TEST(TestTimelineModelTest, MultipleEventsCanBeAdded)
|
||||
TestTimelineModel model;
|
||||
int initialCount = model.rowCount();
|
||||
|
||||
Event* event1 = createTestEvent();
|
||||
Event* event2 = createTestEvent();
|
||||
Event* event3 = createTestEvent();
|
||||
Event* event1 = createTestEvent(QStringLiteral("actuator1"));
|
||||
Event* event2 = createTestEvent(QStringLiteral("actuator2"));
|
||||
Event* event3 = createTestEvent(QStringLiteral("actuator3"));
|
||||
|
||||
model.addTestEvent(event1);
|
||||
model.addTestEvent(event2);
|
||||
|
||||
Reference in new issue
Block a user