- 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>
76 lines
2.1 KiB
C++
76 lines
2.1 KiB
C++
#include "Lts/Common/LtsTimelineClassic/Event.h"
|
|
#include "Lts/Common/LtsTimelineClassic/EventGraphic.h"
|
|
#include "Lts/Common/LtsTimelineClassic/EventTools.h"
|
|
#include "Lts/Common/LtsTimelineClassic/PassiveEventContainer.h"
|
|
|
|
#include <QtGui/QPainter>
|
|
#include <QtGui/QPixmap>
|
|
#include <QStyleOptionViewItem>
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace LtsTimelineClassic
|
|
{
|
|
|
|
class PassiveEventContainerTest : public ::testing::Test
|
|
{
|
|
protected:
|
|
void SetUp() override {}
|
|
|
|
void TearDown() override {}
|
|
};
|
|
|
|
TEST(PassiveEventContainerTest, CreateContainer)
|
|
{
|
|
PassiveEventContainer container(false);
|
|
EXPECT_TRUE(container.getEventGraphicList().isEmpty());
|
|
}
|
|
|
|
TEST(PassiveEventContainerTest, SetEventList)
|
|
{
|
|
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);
|
|
|
|
container.setEventList(list);
|
|
|
|
EXPECT_EQ(container.getEventGraphicList().size(), 2);
|
|
}
|
|
|
|
TEST(PassiveEventContainerTest, PaintDoesNotCrash)
|
|
{
|
|
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);
|
|
container.setEventList(list);
|
|
|
|
EventTools::setValues(0, 1000, 0, 500);
|
|
EventTools::setSection(0, 1000);
|
|
|
|
QPixmap pixmap(800, 600);
|
|
QPainter painter(&pixmap);
|
|
|
|
QStyleOptionViewItem option;
|
|
option.rect = QRect(0, 0, 800, 50);
|
|
option.features = QStyleOptionViewItem::ViewItemFeature::None;
|
|
|
|
LineMap lineMap;
|
|
lineMap.insert(100, 1000);
|
|
|
|
QVector<Range> knownRanges;
|
|
|
|
EXPECT_NO_THROW(container.paint(&painter, option, lineMap, knownRanges));
|
|
}
|
|
|
|
} // namespace LtsTimelineClassic
|