Add tests for LtsTimelineClassic Item, TimelineView, TimelineWidget, TimelineIndicator
- test_item.cpp: 3 tests for Item class - test_timelineview.cpp: 3 tests for TimelineView class - test_timelinewidget.cpp: 3 tests for TimelineWidget class - test_timelineindicator.cpp: 3 tests for TimelineIndicator class Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
4 files changed
+184
No files matched your search
@@ -0,0 +1,39 @@
|
|||||||
|
#include "Lts/Common/LtsTimelineClassic/Item.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
namespace LtsTimelineClassic
|
||||||
|
{
|
||||||
|
|
||||||
|
class ItemTest : public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void SetUp() override {}
|
||||||
|
|
||||||
|
void TearDown() override {}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(ItemTest, HeaderCompilesAndLinks)
|
||||||
|
{
|
||||||
|
// Verify header compiles without errors
|
||||||
|
EXPECT_TRUE(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(ItemTest, CanInstantiateItem)
|
||||||
|
{
|
||||||
|
// Basic instantiation test
|
||||||
|
QWidget parent;
|
||||||
|
Item item(&parent);
|
||||||
|
EXPECT_NO_THROW(item.update());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(ItemTest, ItemHasValidState)
|
||||||
|
{
|
||||||
|
QWidget parent;
|
||||||
|
Item item(&parent);
|
||||||
|
// Test basic properties
|
||||||
|
EXPECT_NO_THROW(item.setGeometry(0, 0, 100, 50));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LtsTimelineClassic
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#include "Lts/Common/LtsTimelineClassic/TimelineIndicator.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
namespace LtsTimelineClassic
|
||||||
|
{
|
||||||
|
|
||||||
|
class TimelineIndicatorTest : public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void SetUp() override
|
||||||
|
{
|
||||||
|
int argc = 1;
|
||||||
|
char* argv[] = {const_cast<char*>("test")};
|
||||||
|
qApp = new QApplication(argc, argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() override
|
||||||
|
{
|
||||||
|
delete qApp;
|
||||||
|
qApp = nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(TimelineIndicatorTest, ConstructorCreatesValidIndicator)
|
||||||
|
{
|
||||||
|
QWidget parent;
|
||||||
|
TimelineIndicator indicator(&parent);
|
||||||
|
EXPECT_NO_THROW(indicator.update());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TimelineIndicatorTest, SlotZoomChangesIndex)
|
||||||
|
{
|
||||||
|
QWidget parent;
|
||||||
|
TimelineIndicator indicator(&parent);
|
||||||
|
|
||||||
|
int initialIndex = indicator.m_cbZoomLevel->currentIndex();
|
||||||
|
indicator.slotZoom();
|
||||||
|
|
||||||
|
// Zoom out should decrease index (if not already at 0)
|
||||||
|
if (initialIndex > 0)
|
||||||
|
{
|
||||||
|
EXPECT_EQ(indicator.m_cbZoomLevel->currentIndex(), initialIndex - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EXPECT_EQ(indicator.m_cbZoomLevel->currentIndex(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TimelineIndicatorTest, SlotUnzoomChangesIndex)
|
||||||
|
{
|
||||||
|
QWidget parent;
|
||||||
|
TimelineIndicator indicator(&parent);
|
||||||
|
|
||||||
|
int initialIndex = indicator.m_cbZoomLevel->currentIndex();
|
||||||
|
int maxIndex = indicator.m_cbZoomLevel->count() - 1;
|
||||||
|
|
||||||
|
// Set to a lower index to allow unzoom
|
||||||
|
indicator.m_cbZoomLevel->setCurrentIndex(1);
|
||||||
|
indicator.slotUnzoom();
|
||||||
|
|
||||||
|
EXPECT_EQ(indicator.m_cbZoomLevel->currentIndex(), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LtsTimelineClassic
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include "Lts/Common/LtsTimelineClassic/TimelineView.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
namespace LtsTimelineClassic
|
||||||
|
{
|
||||||
|
|
||||||
|
class TimelineViewTest : public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void SetUp() override {}
|
||||||
|
|
||||||
|
void TearDown() override {}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(TimelineViewTest, HeaderCompilesAndLinks)
|
||||||
|
{
|
||||||
|
// Verify header compiles without errors
|
||||||
|
EXPECT_TRUE(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TimelineViewTest, CanInstantiateTimelineView)
|
||||||
|
{
|
||||||
|
// Basic instantiation test
|
||||||
|
QWidget parent;
|
||||||
|
TimelineView timelineView(&parent);
|
||||||
|
EXPECT_NO_THROW(timelineView.update());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TimelineViewTest, TimelineViewHasValidState)
|
||||||
|
{
|
||||||
|
QWidget parent;
|
||||||
|
TimelineView timelineView(&parent);
|
||||||
|
// Test basic properties
|
||||||
|
EXPECT_NO_THROW(timelineView.setGeometry(0, 0, 800, 600));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LtsTimelineClassic
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include "Lts/Common/LtsTimelineClassic/TimelineWidget.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
namespace LtsTimelineClassic
|
||||||
|
{
|
||||||
|
|
||||||
|
class TimelineWidgetTest : public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void SetUp() override {}
|
||||||
|
|
||||||
|
void TearDown() override {}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST(TimelineWidgetTest, HeaderCompilesAndLinks)
|
||||||
|
{
|
||||||
|
// Verify header compiles without errors
|
||||||
|
EXPECT_TRUE(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TimelineWidgetTest, CanInstantiateTimelineWidget)
|
||||||
|
{
|
||||||
|
// Basic instantiation test
|
||||||
|
QWidget parent;
|
||||||
|
TimelineWidget timelineWidget(&parent);
|
||||||
|
EXPECT_NO_THROW(timelineWidget.update());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TimelineWidgetTest, TimelineWidgetHasValidState)
|
||||||
|
{
|
||||||
|
QWidget parent;
|
||||||
|
TimelineWidget timelineWidget(&parent);
|
||||||
|
// Test basic properties
|
||||||
|
EXPECT_NO_THROW(timelineWidget.setGeometry(0, 0, 1024, 768));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace LtsTimelineClassic
|
||||||
Reference in new issue
Block a user