Add test for LtsTimelineClassic EventDelegate.cpp

- Add test_eventdelegate.cpp with 3 tests
- Follow policy naming convention

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-19 15:08:44 +02:00
1 parent 6c668cfbfa
commit ca9d89c2ff
1 file changed
+52
@@ -0,0 +1,52 @@
#include "Lts/Common/LtsTimelineClassic/EventDelegate.h"
#include <QWidget>
#include <gtest/gtest.h>
namespace LtsTimelineClassic
{
class EventDelegateTest : public ::testing::Test
{
protected:
void SetUp() override {}
void TearDown() override {}
};
TEST(EventDelegateTest, ConstructorCreatesDelegate)
{
QWidget widget;
EventDelegate delegate(&widget);
EXPECT_NE(delegate.parent(), nullptr);
}
TEST(EventDelegateTest, SizeHintReturnsValidSize)
{
QWidget widget;
EventDelegate delegate(&widget);
QStyleOptionViewItem option;
QModelIndex index;
QSize size = delegate.sizeHint(option, index);
EXPECT_EQ(size.width(), 50);
EXPECT_EQ(size.height(), 20);
}
TEST(EventDelegateTest, SetKnownRangesStoresRanges)
{
QWidget widget;
EventDelegate delegate(&widget);
QVector<Range> ranges;
ranges.append(Range(0, 100));
ranges.append(Range(200, 300));
// setKnownRanges is a public method - we can call it
// The internal storage is private, so we just verify the call compiles and doesn't crash
EXPECT_NO_THROW(delegate.setKnownRanges(ranges));
}
} // namespace LtsTimelineClassic