Compare commits

...

6 Commits

Author SHA1 Message Date
Renato Araujo Oliveira Filho
db9babbdca Fixed module import for python 3.8 2021-09-29 13:36:16 -07:00
Allen Winter
463dd2261e various - spelling fixes 2021-09-28 16:45:44 -04:00
Allen Winter
4dd66969af examples/dockwidgets/MyTitleBar_CSS.h - add multiple include guard 2021-09-28 16:36:55 -04:00
Allen Winter
2c98003219 CMakeLists.txt,python/tests/CMakeLists.txt - minor coding style 2021-09-28 16:28:51 -04:00
Allen Winter
dd853a8f72 python/tests/ - add copyright+license header 2021-09-28 16:24:35 -04:00
Allen Winter
88d5e6b29d Merge pull request #242 from KDAB/python-unittest
Fixed import module for windows and python 3.7
2021-09-28 16:03:40 -04:00
10 changed files with 71 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
[codespell] [codespell]
skip = ./build-*,.git skip = ./build-*,.git,*.svg,rc_assets.py
interactive = 3 interactive = 3
ignore-words-list = overlay,overlayed ignore-words-list = overlay,overlayed

View File

@@ -207,16 +207,16 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) OR
string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags) string(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" compileflags)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize") if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE) set(sanitizers_enabled TRUE)
else() else()
set(sanitizers_enabled FALSE) set(sanitizers_enabled FALSE)
endif() endif()
# cannot enable this for clang + sanitizers # cannot enable this for clang + sanitizers
if (NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# Do not allow undefined symbols, even in non-symbolic shared libraries # Do not allow undefined symbols, even in non-symbolic shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif() endif()
endif() endif()

View File

@@ -9,13 +9,18 @@
Contact KDAB at <info@kdab.com> for commercial licensing options. Contact KDAB at <info@kdab.com> for commercial licensing options.
*/ */
#ifndef EXAMPLETITLEBAR_CSS_H
#define EXAMPLETITLEBAR_CSS_H
#pragma once
#include <kddockwidgets/private/widgets/TitleBarWidget_p.h> #include <kddockwidgets/private/widgets/TitleBarWidget_p.h>
/** /**
* @brief Shows how to implement a custom titlebar which uses "Qt StyleSheets". * @brief Shows how to implement a custom titlebar which uses "Qt StyleSheets".
* *
* Derive from KDDockWidgets::DefaultWidgetFactory and override the two createTitleBar() methods. * Derive from KDDockWidgets::DefaultWidgetFactory and override the two createTitleBar() methods.
* *
* To try it out, modify examples/dockwidgets/MyFrameworkWidgetFactory.cpp to return a MyTitleBar_CSS instance. * To try it out, modify examples/dockwidgets/MyFrameworkWidgetFactory.cpp to return a MyTitleBar_CSS instance.
* Run the example with: ./bin/kddockwidgets_example -p * Run the example with: ./bin/kddockwidgets_example -p
* *
@@ -77,3 +82,5 @@ public:
MyTitleBar_CSS::~MyTitleBar_CSS() MyTitleBar_CSS::~MyTitleBar_CSS()
{ {
} }
#endif

View File

@@ -15,15 +15,22 @@ import os
__all__ = ['KDDockWidgets'] __all__ = ['KDDockWidgets']
def setupLibraryPath(): def setupLibraryPath():
package_dir = os.path.abspath(os.path.dirname(__file__))
if sys.platform != 'win32': if sys.platform != 'win32':
return return
if sys.version_info[0] == 3 and sys.version_info[1] >= 8: from shiboken2 import shiboken2
os.add_dll_directory(package_dir) from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
return
os.environ['PATH'] = os.fspath(package_dir) + os.pathsep + os.environ['PATH'] extra_dll_dirs = [ os.path.abspath(os.path.dirname(shiboken2.__file__)),
os.path.abspath(os.path.dirname(QtCore.__file__)),
os.path.abspath(os.path.dirname(__file__)) ]
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
for dll_dir in extra_dll_dirs:
os.add_dll_directory(dll_dir)
for dll_dir in extra_dll_dirs:
os.environ['PATH'] = os.fspath(dll_dir) + os.pathsep + os.environ['PATH']
# Preload PySide libraries to avoid missing libraries while loading KDDockWidgets # Preload PySide libraries to avoid missing libraries while loading KDDockWidgets
try: try:
@@ -36,15 +43,3 @@ except Exception:
raise raise
setupLibraryPath() setupLibraryPath()
#
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2020-2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo Oliveira Filho <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#

View File

@@ -18,23 +18,23 @@ set(TEST_PYTHONPATH
set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) set(TEST_LIBRARYPATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
if(WIN32) if(WIN32)
set(TEST_LIBRARY_VAR "PATH") set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}") string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}") string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH) list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH) list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
else() else()
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH") set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH) list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH) list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
endif() endif()
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}") set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py) file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
foreach(test_file ${TEST_FILES}) foreach(test_file ${TEST_FILES})
get_filename_component(test_name ${test_file} NAME_WE) get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file}) add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}") set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
endforeach() endforeach()

View File

@@ -1,2 +1,19 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import os
import sys
class TstConfig(object): class TstConfig(object):
bindingsNamespace = "@PYTHON_BINDING_NAMESPACE@" bindingsNamespace = "@PYTHON_BINDING_NAMESPACE@"
def initLibraryPath():
if sys.platform == 'win32' and sys.version_info[0] == 3 and sys.version_info[1] >= 8:
os.add_dll_directory("@CMAKE_RUNTIME_OUTPUT_DIRECTORY@")

View File

@@ -1,3 +1,13 @@
# This file is part of KDDockWidgets.
#
# SPDX-FileCopyrightText: 2021 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
# Author: Renato Araujo <renato.araujo@kdab.com>
#
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
#
# Contact KDAB at <info@kdab.com> for commercial licensing options.
#
import unittest import unittest
import importlib import importlib
import inspect import inspect
@@ -16,4 +26,5 @@ class TestImportModules(unittest.TestCase):
self.assertIn(symbol, moduleSymbols) self.assertIn(symbol, moduleSymbols)
if __name__ == '__main__': if __name__ == '__main__':
TstConfig.initLibraryPath()
unittest.main() unittest.main()

View File

@@ -205,7 +205,7 @@ public:
///@brief By default equivalent to QWidget::normalGeometry() ///@brief By default equivalent to QWidget::normalGeometry()
/// Derived classes can implement something different here, to workaround window manager issues with Qt::Tool /// Derived classes can implement something different here, to workaround window manager issues with Qt::Tool
/// Also useful for QtQuick to eventually perserve normal geometry uppon save/restore of a maximized window. As /// Also useful for QtQuick to eventually preserve normal geometry upon save/restore of a maximized window. As
/// QWindow has no notion of normal geometry, so we need to implement it here. /// QWindow has no notion of normal geometry, so we need to implement it here.
/// @sa QTBUG-95478 /// @sa QTBUG-95478
virtual QRect normalGeometry() const; virtual QRect normalGeometry() const;

View File

@@ -212,7 +212,7 @@ void TabWidgetWidget::showContextMenu(QPoint pos)
return; return;
QTabBar *tabBar = QTabWidget::tabBar(); QTabBar *tabBar = QTabWidget::tabBar();
// We dont want context menu if there is only one tab // We don't want context menu if there is only one tab
if (tabBar->count() <= 1) if (tabBar->count() <= 1)
return; return;

View File

@@ -27,9 +27,9 @@ using namespace KDDockWidgets;
using namespace KDDockWidgets::Testing; using namespace KDDockWidgets::Testing;
using namespace KDDockWidgets::Testing::Operations; using namespace KDDockWidgets::Testing::Operations;
static QString operationTypeStr(OperationType ot) static QString operationTypeStr(OperationType optype)
{ {
return QMetaEnum::fromType<OperationType>().valueToKey(ot); return QMetaEnum::fromType<OperationType>().valueToKey(optype);
} }
OperationBase::OperationBase(KDDockWidgets::Testing::Operations::OperationType type, Fuzzer *fuzzer) OperationBase::OperationBase(KDDockWidgets::Testing::Operations::OperationType type, Fuzzer *fuzzer)