- Add test_eventdelegate.cpp with 3 tests - Follow policy naming convention Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#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
|