- Add test_eventlist.cpp with 3 tests for type aliases - Follow policy naming convention Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
69 lines
1.5 KiB
C++
69 lines
1.5 KiB
C++
#include "Lts/Common/LtsTimelineClassic/Event.h"
|
|
#include "Lts/Common/LtsTimelineClassic/EventGraphic.h"
|
|
#include "Lts/Common/LtsTimelineClassic/EventList.h"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
namespace LtsTimelineClassic
|
|
{
|
|
|
|
class EventListTest : public ::testing::Test
|
|
{
|
|
protected:
|
|
void SetUp() override {}
|
|
|
|
void TearDown() override {}
|
|
};
|
|
|
|
TEST(EventListTest, EventListTypedefWorks)
|
|
{
|
|
Event event1(0, 100, Qt::red);
|
|
Event event2(50, 100, Qt::blue);
|
|
|
|
EventList list;
|
|
list.append(&event1);
|
|
list.append(&event2);
|
|
|
|
EXPECT_EQ(list.size(), 2);
|
|
EXPECT_EQ(list[0], &event1);
|
|
EXPECT_EQ(list[1], &event2);
|
|
}
|
|
|
|
TEST(EventListTest, EventListIterationWorks)
|
|
{
|
|
Event event1(0, 100, Qt::red);
|
|
Event event2(50, 100, Qt::blue);
|
|
Event event3(100, 100, Qt::green);
|
|
|
|
EventList list;
|
|
list.append(&event1);
|
|
list.append(&event2);
|
|
list.append(&event3);
|
|
|
|
int count = 0;
|
|
for (Event* event : list)
|
|
{
|
|
EXPECT_NE(event, nullptr);
|
|
count++;
|
|
}
|
|
EXPECT_EQ(count, 3);
|
|
}
|
|
|
|
TEST(EventListTest, EventGraphicListTypedefWorks)
|
|
{
|
|
Event event1(0, 100, Qt::red);
|
|
Event event2(50, 100, Qt::blue);
|
|
|
|
EventGraphic graphic1(&event1);
|
|
EventGraphic graphic2(&event2);
|
|
|
|
EventGraphicList graphicList;
|
|
graphicList.append(&graphic1);
|
|
graphicList.append(&graphic2);
|
|
|
|
EXPECT_EQ(graphicList.size(), 2);
|
|
EXPECT_EQ(graphicList[0], &graphic1);
|
|
EXPECT_EQ(graphicList[1], &graphic2);
|
|
}
|
|
|
|
} // namespace LtsTimelineClassic
|