- 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>
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
#include "Lts/Common/LtsTimelineClassic/Event.h"
|
|
|
|
#include <QtGui/QColor>
|
|
#include <QtCore/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
|