Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/tests/test_eventgraphic.cpp
T
torsten 950d669538 Qt6 Migration: BUILD_RTI guards und CMake fixes
- BUILD_RTI conditional compilation für RTI Connext DDS dependencies
- Namespace fixes in core_dtc.h (Core:: → DDS::Core::)
- CMakeLists.txt: BUILD_RTI option und conditional dependencies
- Handler minelayer: namespace closing mit BUILD_RTI guard
- Build erfolgreich mit BUILD_RTI=OFF validiert

Signed-off-by: Torsten Wierschin <torsten.wierschin@life-maps.com>
2026-08-21 18:37:18 +02:00

59 lines
1.8 KiB
C++

#include "Lts/Common/LtsTimelineClassic/Event.h"
#include "Lts/Common/LtsTimelineClassic/EventGraphic.h"
#include <QPainter>
#include <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