Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/tests/test_eventgraphic.cpp
torstenandCopilot 7a6be7474e Qt6 migration: Fix BUILD_RTI=OFF build errors in TrainingAreaBase
- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document

C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+

Build status: BUILD_RTI=OFF successful (0 errors, warnings only)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-23 20:49:23 +02:00

59 lines
1.8 KiB
C++

#include "Lts/Common/LtsTimelineClassic/Event.h"
#include "Lts/Common/LtsTimelineClassic/EventGraphic.h"
#include <QtGui/QPainter>
#include <QtCore/QRect>
#include <gtest/gtest.h>
namespace LtsTimelineClassic
{
class EventGraphicTest : public ::testing::Test
{
protected:
void SetUp() override {}
void TearDown() override {}
};
TEST(EventGraphicTest, ConstructorCreatesEventGraphic)
{
Event event(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
EventGraphic graphic(&event);
EXPECT_FALSE(graphic.isMultipleEvent());
EXPECT_EQ(graphic.eventList().size(), 1);
}
TEST(EventGraphicTest, AddEventMakesItMultiple)
{
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
EventGraphic graphic(&event1);
EXPECT_FALSE(graphic.isMultipleEvent());
graphic.addEvent(&event2);
EXPECT_TRUE(graphic.isMultipleEvent());
EXPECT_EQ(graphic.eventList().size(), 2);
}
TEST(EventGraphicTest, AddEventListMakesItMultiple)
{
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
Event event3(100, 100, 100, 200, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::green, QJsonObject());
EventGraphic graphic(&event1);
QVector<Event*> additionalEvents;
additionalEvents.append(&event2);
additionalEvents.append(&event3);
graphic.addEventList(additionalEvents);
EXPECT_TRUE(graphic.isMultipleEvent());
EXPECT_EQ(graphic.eventList().size(), 3);
}
} // namespace LtsTimelineClassic