Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/tests/test_event.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

66 lines
1.5 KiB
C++

#include "Lts/Common/LtsTimelineClassic/Event.h"
#include <QColor>
#include <QJsonObject>
#include <gtest/gtest.h>
namespace LtsTimelineClassic
{
class EventTest : public ::testing::Test
{
protected:
void SetUp() override {}
void TearDown() override {}
};
TEST(EventTest, ConstructorInitializesMembers)
{
QStringList path = {"actuator", "subactuator"};
QJsonObject detailData;
detailData["key"] = "value";
QColor color(Qt::red);
Event event(1, 2, 1000, 2000, 3, 4, 5, path, nullptr, color, detailData);
EXPECT_EQ(event.uniqueId(), 1);
EXPECT_EQ(event.typeId(), 2);
EXPECT_EQ(event.startTime(), 1000);
EXPECT_EQ(event.endTime(), 2000);
EXPECT_EQ(event.playerId(), 3);
EXPECT_EQ(event.partyId(), 4);
EXPECT_EQ(event.equipmentId(), 5);
EXPECT_EQ(event.getActuator(), path);
EXPECT_EQ(event.getColor(), color);
}
TEST(EventTest, DurationCalculation)
{
Event event(1, 2, 1000, 3000, 0, 0, 0, QStringList(), nullptr, QColor(), QJsonObject());
qint64 duration = event.duration(true);
EXPECT_EQ(duration, 2000);
}
TEST(EventTest, VisibilityToggle)
{
Event event(1, 2, 1000, 2000, 0, 0, 0, QStringList(), nullptr, QColor(), QJsonObject());
EXPECT_TRUE(event.isVisible());
event.hide();
EXPECT_FALSE(event.isVisible());
event.show();
EXPECT_TRUE(event.isVisible());
event.setVisible(false);
EXPECT_FALSE(event.isVisible());
event.setVisible(true);
EXPECT_TRUE(event.isVisible());
}
} // namespace LtsTimelineClassic