- Add test_eventgraphic.cpp with 3 tests - Follow policy naming convention Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
59 lines
1.3 KiB
C++
59 lines
1.3 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, Qt::red);
|
|
EventGraphic graphic(&event);
|
|
|
|
EXPECT_FALSE(graphic.isMultipleEvent());
|
|
EXPECT_EQ(graphic.eventList().size(), 1);
|
|
}
|
|
|
|
TEST(EventGraphicTest, AddEventMakesItMultiple)
|
|
{
|
|
Event event1(0, 100, Qt::red);
|
|
Event event2(50, 100, Qt::blue);
|
|
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, Qt::red);
|
|
Event event2(50, 100, Qt::blue);
|
|
Event event3(100, 100, Qt::green);
|
|
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
|