Add tst_dropArea

Removed the requirement to have a parent, it's not really needed,
conceptually.
This commit is contained in:
Sergio Martins
2022-07-27 10:34:13 +01:00
parent 93b3f77969
commit 7b20eedf6d
4 changed files with 26 additions and 2 deletions

View File

@@ -458,6 +458,7 @@ if(KDDockWidgets_TESTS)
add_test(NAME tst_view COMMAND tst_view)
add_test(NAME tst_window COMMAND tst_window)
add_test(NAME tst_droparea COMMAND tst_droparea)
add_test(NAME tst_platform COMMAND tst_platform)
add_test(NAME tst_viewguard COMMAND tst_viewguard)
add_test(NAME tst_group COMMAND tst_group)

View File

@@ -64,11 +64,11 @@ DropArea::DropArea(View *parent, MainWindowOptions options, bool isMDIWrapper)
, m_dropIndicatorOverlay(createDropIndicatorOverlay(this))
, m_centralFrame(createCentralFrame(options))
{
Q_ASSERT(parent);
setRootItem(new Layouting::ItemBoxContainer(view()));
DockRegistry::self()->registerLayout(this);
setLayoutSize(parent->size());
if (parent)
setLayoutSize(parent->size());
// Initialize min size
updateSizeConstraints();

View File

@@ -69,6 +69,9 @@ target_link_libraries(tst_view kddockwidgets kdbindings)
add_executable(tst_window tst_window.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_window kddockwidgets kdbindings)
add_executable(tst_droparea tst_droparea.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_droparea kddockwidgets kdbindings)
add_executable(tst_platform tst_platform.cpp ${TESTING_RESOURCES})
target_link_libraries(tst_platform kddockwidgets kdbindings)

20
tests/tst_droparea.cpp Normal file
View File

@@ -0,0 +1,20 @@
/*
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/DropArea.h"
#include "Platform.h"
TEST_CASE("DropArea CTOR")
{
// Tests that ctor runs and doesn't leak
Controllers::DropArea da(nullptr, {});
}