tests: Add tst_titlebar

At least for the ctor, which already helps to find bugs in
the .qml file
This commit is contained in:
Sergio Martins
2022-05-23 18:07:56 +01:00
parent 87e9cbc388
commit 0f55a2f87a
3 changed files with 32 additions and 1 deletions

View File

@@ -357,6 +357,7 @@ if(${PROJECT_NAME}_TESTS)
add_test(NAME tst_viewwrapper COMMAND tst_viewwrapper)
add_test(NAME tst_viewguard COMMAND tst_viewguard)
add_test(NAME tst_frame COMMAND tst_frame)
add_test(NAME tst_titlebar COMMAND tst_titlebar)
if(NOT ${PROJECT_NAME}_QTQUICK)
# tst_multisplitter depends on QWidget

View File

@@ -63,4 +63,7 @@ add_executable(tst_viewwrapper tst_viewwrapper.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_viewwrapper kddockwidgets)
add_executable(tst_frame controllers/tst_frame.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_frame kddockwidgets)
target_link_libraries(tst_frame kddockwidgets)
add_executable(tst_titlebar controllers/tst_titlebar.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_titlebar kddockwidgets)

View File

@@ -0,0 +1,27 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#include "../main.h"
#include "controllers/TitleBar.h"
#include "controllers/Frame.h"
#include "qtquick/Platform_qtquick.h"
#include <QQmlContext>
#include <QQmlEngine>
TEST_CASE("TitleBar Ctor")
{
auto frame = new Controllers::Frame(nullptr, {});
auto tb = new Controllers::TitleBar(frame);
delete tb;
delete frame;
}