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]
skip = ./build-*,.git
skip = ./build-*,.git,*.svg,rc_assets.py
interactive = 3
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)
if("${CMAKE_CXX_FLAGS} ${${compileflags}}" MATCHES "-fsanitize")
set(sanitizers_enabled TRUE)
set(sanitizers_enabled TRUE)
else()
set(sanitizers_enabled FALSE)
set(sanitizers_enabled FALSE)
endif()
# cannot enable this for clang + sanitizers
if (NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# 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_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
if(NOT sanitizers_enabled OR NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# 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_MODULE_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
endif()
endif()

View File

@@ -9,6 +9,11 @@
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>
/**
@@ -77,3 +82,5 @@ public:
MyTitleBar_CSS::~MyTitleBar_CSS()
{
}
#endif

View File

@@ -15,15 +15,22 @@ import os
__all__ = ['KDDockWidgets']
def setupLibraryPath():
package_dir = os.path.abspath(os.path.dirname(__file__))
if sys.platform != 'win32':
return
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
os.add_dll_directory(package_dir)
return
from shiboken2 import shiboken2
from PySide@PYSIDE_MAJOR_VERSION@ import QtCore
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
try:
@@ -36,15 +43,3 @@ except Exception:
raise
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})
if(WIN32)
set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
set(TEST_LIBRARY_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE "\\" "/" TEST_LIBRARYPATH "${TEST_LIBRARYPATH}")
list(JOIN TEST_PYTHONPATH "\\;" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH "\\;" TEST_LIBRARYPATH)
else()
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
set(TEST_LIBRARY_VAR "LD_LIBRARY_PATH")
list(JOIN TEST_PYTHONPATH ":" TEST_PYTHONPATH)
list(JOIN TEST_LIBRARYPATH ":" TEST_LIBRARYPATH)
endif()
set(PYTHON_ENV_COMMON "PYTHONPATH=${TEST_PYTHONPATH};${TEST_LIBRARY_VAR}=${TEST_LIBRARYPATH}")
file(GLOB TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tst_*.py)
foreach(test_file ${TEST_FILES})
get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
get_filename_component(test_name ${test_file} NAME_WE)
add_test(${test_name} ${Python3_EXECUTABLE} ${test_file})
set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "${PYTHON_ENV_COMMON}")
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):
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 importlib
import inspect
@@ -16,4 +26,5 @@ class TestImportModules(unittest.TestCase):
self.assertIn(symbol, moduleSymbols)
if __name__ == '__main__':
TstConfig.initLibraryPath()
unittest.main()

View File

@@ -205,7 +205,7 @@ public:
///@brief By default equivalent to QWidget::normalGeometry()
/// 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.
/// @sa QTBUG-95478
virtual QRect normalGeometry() const;

View File

@@ -212,7 +212,7 @@ void TabWidgetWidget::showContextMenu(QPoint pos)
return;
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)
return;

View File

@@ -27,9 +27,9 @@ using namespace KDDockWidgets;
using namespace KDDockWidgets::Testing;
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)