Qt6 Migration: BUILD_RTI guards und CMake fixes

- BUILD_RTI conditional compilation für RTI Connext DDS dependencies
- Namespace fixes in core_dtc.h (Core:: → DDS::Core::)
- CMakeLists.txt: BUILD_RTI option und conditional dependencies
- Handler minelayer: namespace closing mit BUILD_RTI guard
- Build erfolgreich mit BUILD_RTI=OFF validiert

Signed-off-by: Torsten Wierschin <torsten.wierschin@life-maps.com>
This commit is contained in:
torsten committed 2026-08-21 18:37:18 +02:00
1 parent c599be63e3
commit 950d669538
422 files changed
+1013 -599

No files matched your search

@@ -30,6 +30,12 @@ if(BUILD_TESTING)
add_executable(migration_tests ${EXISTING_SOURCES})
# Enable Qt Meta-Object Compiler for tests with Q_OBJECT
set_target_properties(migration_tests PROPERTIES AUTOMOC ON)
# Exclude tests for non-existent or commented-out components
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_lts_app_descriptor_editor\\.cpp")
target_compile_features(migration_tests PRIVATE cxx_std_23)
target_include_directories(migration_tests PRIVATE
@@ -37,18 +43,25 @@ if(BUILD_TESTING)
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/include
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/DDS
${CMAKE_BINARY_DIR}/Lts/Common
${CMAKE_BINARY_DIR}/Lts/Common/CodeGen
${CMAKE_BINARY_DIR}/Lts/Common/LtsTimeline
)
# Link against Qt6 components
# Link against Qt6 components and LtsTimelineClassic (provides export header)
target_link_libraries(migration_tests PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
Qt6::Test
GTest::gtest_main
LtsTimelineClassic
)
# Ensure LtsTimelineClassic is built before tests (generates export header)
add_dependencies(migration_tests LtsTimelineClassic)
# Grantlee tests require BUILD_GRANTLEE=ON
if(BUILD_GRANTLEE)
target_link_libraries(migration_tests PRIVATE codegen_grantlee)
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimelineClassic/AbstractTimelineModel.h"
#include "Lts/Common/LtsTimelineClassic/AbstractTimelineModel.h"
#include <gtest/gtest.h>
@@ -4,6 +4,7 @@
*/
#include <gtest/gtest.h>
#include "AssetManagement/asm_dtc.h"
// Test that the header compiles and provides expected forward declarations
TEST(AsmDtcTest, HeaderCompilesSuccessfully)
@@ -9,15 +9,15 @@
TEST(AsmEnumsTest, SymbolAppearanceEnumValues)
{
EXPECT_EQ(AssetManagement::SymbolAppearance::Solid, 0);
EXPECT_EQ(AssetManagement::SymbolAppearance::Dashed, 1);
EXPECT_EQ(AssetManagement::SymbolAppearance::Dotted, 2);
EXPECT_EQ(static_cast<int>(AssetManagement::SymbolAppearance::Solid), 0);
EXPECT_EQ(static_cast<int>(AssetManagement::SymbolAppearance::Dashed), 1);
EXPECT_EQ(static_cast<int>(AssetManagement::SymbolAppearance::Dotted), 2);
}
TEST(AsmEnumsTest, SymbolVisibilityEnumValues)
{
EXPECT_EQ(AssetManagement::SymbolVisibility::Visible, 0);
EXPECT_EQ(AssetManagement::SymbolVisibility::Hidden, 1);
EXPECT_EQ(static_cast<int>(AssetManagement::SymbolVisibility::Visible), 0);
EXPECT_EQ(static_cast<int>(AssetManagement::SymbolVisibility::Hidden), 1);
}
TEST(AsmEnumsTest, UnitSymbolPositionDefaultValues)
@@ -37,7 +37,7 @@ TEST(EventTest, ConstructorInitializesMembers)
TEST(EventTest, DurationCalculation)
{
Event event(1, 2, 1000, 3000, 0, 0, 0, QStringList(), nullptr, QColor());
Event event(1, 2, 1000, 3000, 0, 0, 0, QStringList(), nullptr, QColor(), QJsonObject());
qint64 duration = event.duration(true);
@@ -46,7 +46,7 @@ TEST(EventTest, DurationCalculation)
TEST(EventTest, VisibilityToggle)
{
Event event;
Event event(1, 2, 1000, 2000, 0, 0, 0, QStringList(), nullptr, QColor(), QJsonObject());
EXPECT_TRUE(event.isVisible());
@@ -18,7 +18,7 @@ class EventGraphicTest : public ::testing::Test
TEST(EventGraphicTest, ConstructorCreatesEventGraphic)
{
Event event(0, 100, Qt::red);
Event event(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
EventGraphic graphic(&event);
EXPECT_FALSE(graphic.isMultipleEvent());
@@ -27,8 +27,8 @@ TEST(EventGraphicTest, ConstructorCreatesEventGraphic)
TEST(EventGraphicTest, AddEventMakesItMultiple)
{
Event event1(0, 100, Qt::red);
Event event2(50, 100, Qt::blue);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
EventGraphic graphic(&event1);
EXPECT_FALSE(graphic.isMultipleEvent());
@@ -41,9 +41,9 @@ TEST(EventGraphicTest, AddEventMakesItMultiple)
TEST(EventGraphicTest, AddEventListMakesItMultiple)
{
Event event1(0, 100, Qt::red);
Event event2(50, 100, Qt::blue);
Event event3(100, 100, Qt::green);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
Event event3(100, 100, 100, 200, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::green, QJsonObject());
EventGraphic graphic(&event1);
QVector<Event*> additionalEvents;
@@ -17,8 +17,8 @@ class EventListTest : public ::testing::Test
TEST(EventListTest, EventListTypedefWorks)
{
Event event1(0, 100, Qt::red);
Event event2(50, 100, Qt::blue);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
EventList list;
list.append(&event1);
@@ -31,9 +31,9 @@ TEST(EventListTest, EventListTypedefWorks)
TEST(EventListTest, EventListIterationWorks)
{
Event event1(0, 100, Qt::red);
Event event2(50, 100, Qt::blue);
Event event3(100, 100, Qt::green);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
Event event3(100, 100, 100, 200, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::green, QJsonObject());
EventList list;
list.append(&event1);
@@ -51,8 +51,8 @@ TEST(EventListTest, EventListIterationWorks)
TEST(EventListTest, EventGraphicListTypedefWorks)
{
Event event1(0, 100, Qt::red);
Event event2(50, 100, Qt::blue);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(50, 100, 50, 150, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
EventGraphic graphic1(&event1);
EventGraphic graphic2(&event2);
@@ -58,8 +58,8 @@ TEST(EventToolsTest, DrawMarkLinesDoesNotCrash)
EventTools::setValues(0, 1000, 0, 500);
EventTools::setSection(0, 1000);
Event event1(0, 100, Qt::red);
Event event2(500, 100, Qt::blue);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
Event event2(500, 100, 500, 600, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::blue, QJsonObject());
EventList eventList;
eventList.append(&event1);
@@ -76,7 +76,7 @@ TEST(EventToolsTest, DrawEventsDoesNotCrash)
EventTools::setValues(0, 1000, 0, 500);
EventTools::setSection(0, 1000);
Event event1(0, 100, Qt::red);
Event event1(0, 100, 0, 100, 0, 0, 0, QStringList(), Event::EventPaintFunc(), Qt::red, QJsonObject());
EventGraphic graphic1(&event1);
EventGraphicList graphicList;
@@ -23,17 +23,22 @@ TEST(ItemTest, HeaderCompilesAndLinks)
TEST(ItemTest, CanInstantiateItem)
{
// Basic instantiation test
QWidget parent;
Item item(&parent);
EXPECT_NO_THROW(item.update());
Item item("TestItem", "test-id");
EXPECT_EQ(item.getName(), "TestItem");
EXPECT_EQ(item.getIdentifier(), "test-id");
}
TEST(ItemTest, ItemHasValidState)
{
QWidget parent;
Item item(&parent);
// Test basic properties
EXPECT_NO_THROW(item.setGeometry(0, 0, 100, 50));
Item parent("Parent");
Item child("Child");
// Test parent-child relationship
child.setParent(&parent);
EXPECT_EQ(child.getParent(), &parent);
// Test child count
EXPECT_EQ(parent.childCount(), 0);
}
} // namespace LtsTimelineClassic
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(json_keys.hTest, CompilationStub)
TEST(json_keys_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(json_keys.hTest, Qt6ApiCompatibility)
TEST(json_keys_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(json_keys.hTest, BasicFunctionality)
TEST(json_keys_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -1,4 +1,4 @@
#include "lts_app_descriptor.h"
#include "Lts/Common/LtsAppDescriptor/lts_app_descriptor.h"
#include <QJsonArray>
#include <QJsonObject>
@@ -24,7 +24,7 @@ void TestLtsAppDescriptor::testPluginInfoCreation()
PluginInfo pluginInfo;
pluginInfo.iid = "test.plugin.iid";
pluginInfo.type = PluginInfo::PluginType::GUI;
pluginInfo.flags = PluginInfo::Flag::None;
pluginInfo.flags = PluginInfo::Flag::UNKNOWN;
QCOMPARE(pluginInfo.iid, QString("test.plugin.iid"));
QCOMPARE(pluginInfo.type, PluginInfo::PluginType::GUI);
@@ -33,21 +33,21 @@ void TestLtsAppDescriptor::testPluginInfoCreation()
void TestLtsAppDescriptor::testPluginInfoFlagOperations()
{
PluginInfo pluginInfo;
pluginInfo.flags = PluginInfo::Flag::None;
pluginInfo.flags = PluginInfo::Flag::UNKNOWN;
addOptionToPlugin(pluginInfo, PluginInfo::Flag::Mandatory);
QVERIFY(pluginInfo.flags & PluginInfo::Flag::Mandatory);
pluginInfo.flags |= PluginInfo::Flag::ACTIONS;
QVERIFY(pluginInfo.flags & PluginInfo::Flag::ACTIONS);
addOptionToPlugin(pluginInfo, PluginInfo::Flag::Autostart);
QVERIFY(pluginInfo.flags & PluginInfo::Flag::Mandatory);
QVERIFY(pluginInfo.flags & PluginInfo::Flag::Autostart);
pluginInfo.flags |= PluginInfo::Flag::MAIN;
QVERIFY(pluginInfo.flags & PluginInfo::Flag::ACTIONS);
QVERIFY(pluginInfo.flags & PluginInfo::Flag::MAIN);
}
void TestLtsAppDescriptor::testAppDescriptionDefaultConstruction()
{
AppDescription appDesc;
QVERIFY(appDesc.plugins.isEmpty());
QVERIFY(appDesc.lastErrors.isEmpty());
QVERIFY(appDesc.pluginInfos.isEmpty());
QVERIFY(appDesc.appName.isEmpty());
}
} // namespace LtsAppDescriptor
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(lts_comport_querry.hTest, CompilationStub)
TEST(lts_comport_querry_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(lts_comport_querry.hTest, Qt6ApiCompatibility)
TEST(lts_comport_querry_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(lts_comport_querry.hTest, BasicFunctionality)
TEST(lts_comport_querry_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -9,17 +9,17 @@ namespace Common
} // namespace Common
} // namespace Lts
TEST(lts_multi_monitor_export.hMigrationTest, CompilationStub)
TEST(lts_multi_monitor_export_headerMigrationTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(lts_multi_monitor_export.hMigrationTest, Qt6ApiCompatibility)
TEST(lts_multi_monitor_export_headerMigrationTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(lts_multi_monitor_export.hMigrationTest, BasicFunctionality)
TEST(lts_multi_monitor_export_headerMigrationTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(lts_notification_export.hTest, CompilationStub)
TEST(lts_notification_export_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(lts_notification_export.hTest, Qt6ApiCompatibility)
TEST(lts_notification_export_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(lts_notification_export.hTest, BasicFunctionality)
TEST(lts_notification_export_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(lts_plugin_manager_export.hTest, CompilationStub)
TEST(lts_plugin_manager_export_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(lts_plugin_manager_export.hTest, Qt6ApiCompatibility)
TEST(lts_plugin_manager_export_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(lts_plugin_manager_export.hTest, BasicFunctionality)
TEST(lts_plugin_manager_export_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(lts_projection_workstation_export.hTest, CompilationStub)
TEST(lts_projection_workstation_export_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(lts_projection_workstation_export.hTest, Qt6ApiCompatibility)
TEST(lts_projection_workstation_export_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(lts_projection_workstation_export.hTest, BasicFunctionality)
TEST(lts_projection_workstation_export_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_lock_handler.h"
#include "Lts/Common/LtsSession/lts_session_lock_handler.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsSession/lts_session_manager.h"
#include "Lts/Common/LtsSession/lts_session_manager.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_header_view.h"
#include "Lts/Common/LtsTimeline/timeline_header_view.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_header_view_mouse_handler.h"
#include "Lts/Common/LtsTimeline/timeline_header_view_mouse_handler.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/item.h"
#include "Lts/Common/LtsTimeline/item.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/item_delegate.h"
#include "Lts/Common/LtsTimeline/item_delegate.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_model.h"
#include "Lts/Common/LtsTimeline/timeline_model.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_utils.h"
#include "Lts/Common/LtsTimeline/timeline_utils.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_view.h"
#include "Lts/Common/LtsTimeline/timeline_view.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_view_drag_handler.h"
#include "Lts/Common/LtsTimeline/timeline_view_drag_handler.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_view_resize_handler.h"
#include "Lts/Common/LtsTimeline/timeline_view_resize_handler.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_view_selection_handler.h"
#include "Lts/Common/LtsTimeline/timeline_view_selection_handler.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_view_track_handler.h"
#include "Lts/Common/LtsTimeline/timeline_view_track_handler.h"
#include <gtest/gtest.h>
@@ -1,4 +1,4 @@
#include "qt6-after/qt6-migrated-legatus/Lts/Common/LtsTimeline/timeline_widget.h"
#include "Lts/Common/LtsTimeline/timeline_widget.h"
#include <gtest/gtest.h>
@@ -8,6 +8,7 @@
*/
#include <gtest/gtest.h>
#include <QString>
// Test that the test framework is working
TEST(MigrationStubs, TestFrameworkWorks)
@@ -103,7 +104,7 @@ TEST(MigrationStubs, ComponentMonitorDtcCompiles)
TEST(MigrationStubs, CoreDtcCompiles)
{
using namespace Core::Interface;
using namespace DDS::Core::Interface;
EXPECT_TRUE(true);
}
@@ -1,5 +1,6 @@
#include "Lts/Common/LtsTimelineClassic/Event.h"
#include "Lts/Common/LtsTimelineClassic/EventGraphic.h"
#include "Lts/Common/LtsTimelineClassic/EventTools.h"
#include "Lts/Common/LtsTimelineClassic/PassiveEventContainer.h"
#include <QPainter>
@@ -28,8 +29,8 @@ TEST(PassiveEventContainerTest, SetEventList)
{
PassiveEventContainer container(false);
Event event1(0, 100, Qt::red);
Event event2(500, 100, Qt::blue);
Event event1(1, 100, 0, 1000, -1, -1, -1, QStringList() << "path1", nullptr, Qt::red, QJsonObject(), -1, LtsUtils::QPoint3D());
Event event2(2, 100, 500, 1500, -1, -1, -1, QStringList() << "path2", nullptr, Qt::blue, QJsonObject(), -1, LtsUtils::QPoint3D());
EventGraphic graphic1(&event1);
EventGraphic graphic2(&event2);
@@ -47,7 +48,7 @@ TEST(PassiveEventContainerTest, PaintDoesNotCrash)
{
PassiveEventContainer container(false);
Event event1(0, 100, Qt::red);
Event event1(1, 100, 0, 1000, -1, -1, -1, QStringList() << "path1", nullptr, Qt::red, QJsonObject(), -1, LtsUtils::QPoint3D());
EventGraphic graphic1(&event1);
EventGraphicList list;
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(temporary_pointer_vector.hTest, CompilationStub)
TEST(temporary_pointer_vector_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(temporary_pointer_vector.hTest, Qt6ApiCompatibility)
TEST(temporary_pointer_vector_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(temporary_pointer_vector.hTest, BasicFunctionality)
TEST(temporary_pointer_vector_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}
@@ -1,11 +1,30 @@
#include "Lts/Common/LtsTimelineClassic/Event.h"
#include "Lts/Common/LtsTimelineClassic/TestTimelineModel.h"
#include <QColor>
#include <QJsonObject>
#include <QStringList>
#include <gtest/gtest.h>
namespace LtsTimelineClassic
{
// Helper to create test Event with minimal parameters
static Event* createTestEvent()
{
return new Event(1, // uniqueId
1, // typeId
0, // startTime
1000, // endTime
1, // playerId
1, // partyId
1, // equipmentId
QStringList{"test"}, // path
Event::drawCustomEventGraphicRect, // paintFunc
QColor(Qt::red), // paintColor
QJsonObject()); // detailData
}
class TestTimelineModelTest : public ::testing::Test
{
protected:
@@ -26,7 +45,7 @@ TEST(TestTimelineModelTest, AddTestEventIncreasesRowCount)
TestTimelineModel model;
int initialCount = model.rowCount();
Event* event = new Event();
Event* event = createTestEvent();
model.addTestEvent(event);
EXPECT_EQ(model.rowCount(), initialCount + 1);
@@ -37,9 +56,9 @@ TEST(TestTimelineModelTest, MultipleEventsCanBeAdded)
TestTimelineModel model;
int initialCount = model.rowCount();
Event* event1 = new Event();
Event* event2 = new Event();
Event* event3 = new Event();
Event* event1 = createTestEvent();
Event* event2 = createTestEvent();
Event* event3 = createTestEvent();
model.addTestEvent(event1);
model.addTestEvent(event2);
@@ -11,16 +11,21 @@ class TimelineHeaderViewTest : public ::testing::Test
protected:
void SetUp() override
{
int argc = 1;
char* argv[] = {const_cast<char*>("test")};
qApp = new QApplication(argc, argv);
static int argc = 1;
static char* argv[] = {const_cast<char*>("test")};
if (!qApp)
{
m_app = std::make_unique<QApplication>(argc, argv);
}
}
void TearDown() override
{
delete qApp;
qApp = nullptr;
m_app.reset();
}
private:
std::unique_ptr<QApplication> m_app;
};
TEST(TimelineHeaderViewTest, ConstructorCreatesValidHeader)
@@ -11,16 +11,21 @@ class TimelineIndicatorTest : public ::testing::Test
protected:
void SetUp() override
{
int argc = 1;
char* argv[] = {const_cast<char*>("test")};
qApp = new QApplication(argc, argv);
static int argc = 1;
static char* argv[] = {const_cast<char*>("test")};
if (!qApp)
{
m_app = std::make_unique<QApplication>(argc, argv);
}
}
void TearDown() override
{
delete qApp;
qApp = nullptr;
m_app.reset();
}
private:
std::unique_ptr<QApplication> m_app;
};
TEST(TimelineIndicatorTest, ConstructorCreatesValidIndicator)
@@ -35,17 +40,17 @@ TEST(TimelineIndicatorTest, SlotZoomChangesIndex)
QWidget parent;
TimelineIndicator indicator(&parent);
int initialIndex = indicator.m_cbZoomLevel->currentIndex();
int initialIndex = indicator.zoomLevelComboBox()->currentIndex();
indicator.slotZoom();
// Zoom out should decrease index (if not already at 0)
if (initialIndex > 0)
{
EXPECT_EQ(indicator.m_cbZoomLevel->currentIndex(), initialIndex - 1);
EXPECT_EQ(indicator.zoomLevelComboBox()->currentIndex(), initialIndex - 1);
}
else
{
EXPECT_EQ(indicator.m_cbZoomLevel->currentIndex(), 0);
EXPECT_EQ(indicator.zoomLevelComboBox()->currentIndex(), 0);
}
}
@@ -54,14 +59,14 @@ TEST(TimelineIndicatorTest, SlotUnzoomChangesIndex)
QWidget parent;
TimelineIndicator indicator(&parent);
int initialIndex = indicator.m_cbZoomLevel->currentIndex();
int maxIndex = indicator.m_cbZoomLevel->count() - 1;
int initialIndex = indicator.zoomLevelComboBox()->currentIndex();
int maxIndex = indicator.zoomLevelComboBox()->count() - 1;
// Set to a lower index to allow unzoom
indicator.m_cbZoomLevel->setCurrentIndex(1);
indicator.zoomLevelComboBox()->setCurrentIndex(1);
indicator.slotUnzoom();
EXPECT_EQ(indicator.m_cbZoomLevel->currentIndex(), 2);
EXPECT_EQ(indicator.zoomLevelComboBox()->currentIndex(), 2);
}
} // namespace LtsTimelineClassic
@@ -1,16 +1,16 @@
#include <gtest/gtest.h>
TEST(track_entry.hTest, CompilationStub)
TEST(track_entry_headerTest, CompilationStub)
{
EXPECT_TRUE(true);
}
TEST(track_entry.hTest, Qt6ApiCompatibility)
TEST(track_entry_headerTest, Qt6ApiCompatibility)
{
EXPECT_TRUE(true);
}
TEST(track_entry.hTest, BasicFunctionality)
TEST(track_entry_headerTest, BasicFunctionality)
{
EXPECT_TRUE(true);
}