diff options
Diffstat (limited to 'sources/pyside2/tests/QtWidgets')
142 files changed, 0 insertions, 9359 deletions
diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt deleted file mode 100644 index 6d8645918..000000000 --- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt +++ /dev/null @@ -1,142 +0,0 @@ -#Keep this in alphabetical sort - -PYSIDE_TEST(action_clear.py) -PYSIDE_TEST(add_action_test.py) -PYSIDE_TEST(api2_test.py) -PYSIDE_TEST(application_test.py) -PYSIDE_TEST(bug_172.py) -PYSIDE_TEST(bug_243.py) -PYSIDE_TEST(bug_307.py) -PYSIDE_TEST(bug_324.py) -PYSIDE_TEST(bug_338.py) -PYSIDE_TEST(bug_363.py) -PYSIDE_TEST(bug_389.py) -PYSIDE_TEST(bug_400.py) -PYSIDE_TEST(bug_416.py) -PYSIDE_TEST(bug_429.py) -PYSIDE_TEST(bug_430.py) -PYSIDE_TEST(bug_433.py) -PYSIDE_TEST(bug_467.py) -PYSIDE_TEST(bug_493.py) -PYSIDE_TEST(bug_512.py) -PYSIDE_TEST(bug_525.py) -PYSIDE_TEST(bug_546.py) -PYSIDE_TEST(bug_547.py) -PYSIDE_TEST(bug_549.py) -PYSIDE_TEST(bug_569.py) -PYSIDE_TEST(bug_575.py) -PYSIDE_TEST(bug_576.py) -PYSIDE_TEST(bug_585.py) -PYSIDE_TEST(bug_589.py) -PYSIDE_TEST(bug_632.py) -PYSIDE_TEST(bug_635.py) -PYSIDE_TEST(bug_640.py) -PYSIDE_TEST(bug_653.py) -PYSIDE_TEST(bug_662.py) -PYSIDE_TEST(bug_667.py) -PYSIDE_TEST(bug_668.py) -PYSIDE_TEST(bug_674.py) -PYSIDE_TEST(bug_675.py) -PYSIDE_TEST(bug_688.py) -PYSIDE_TEST(bug_693.py) -PYSIDE_TEST(bug_696.py) -PYSIDE_TEST(bug_711.py) -PYSIDE_TEST(bug_714.py) -PYSIDE_TEST(bug_722.py) -PYSIDE_TEST(bug_728.py) -PYSIDE_TEST(bug_736.py) -PYSIDE_TEST(bug_750.py) -PYSIDE_TEST(bug_778.py) -PYSIDE_TEST(bug_785.py) -PYSIDE_TEST(bug_793.py) -PYSIDE_TEST(bug_811.py) -PYSIDE_TEST(bug_834.py) -PYSIDE_TEST(bug_836.py) -PYSIDE_TEST(bug_844.py) -PYSIDE_TEST(bug_854.py) -PYSIDE_TEST(bug_860.py) -PYSIDE_TEST(bug_862.py) -PYSIDE_TEST(bug_871.py) -PYSIDE_TEST(bug_879.py) -PYSIDE_TEST(bug_919.py) -PYSIDE_TEST(bug_921.py) -PYSIDE_TEST(bug_941.py) -PYSIDE_TEST(bug_964.py) -PYSIDE_TEST(bug_967.py) -PYSIDE_TEST(bug_972.py) -PYSIDE_TEST(bug_979.py) -PYSIDE_TEST(bug_988.py) -PYSIDE_TEST(bug_998.py) -PYSIDE_TEST(bug_1002.py) -PYSIDE_TEST(bug_1006.py) -PYSIDE_TEST(bug_1048.py) -PYSIDE_TEST(bug_1077.py) -PYSIDE_TEST(customproxywidget_test.py) -PYSIDE_TEST(event_filter_test.py) -PYSIDE_TEST(grandparent_method_test.py) -PYSIDE_TEST(hashabletype_test.py) -PYSIDE_TEST(keep_reference_test.py) -PYSIDE_TEST(missing_symbols_test.py) -PYSIDE_TEST(paint_event_test.py) -PYSIDE_TEST(parent_method_test.py) -PYSIDE_TEST(private_mangle_test.py) -PYSIDE_TEST(python_properties_test.py) -PYSIDE_TEST(qabstracttextdocumentlayout_test.py) -PYSIDE_TEST(qaction_test.py) -PYSIDE_TEST(qapp_issue_585.py) -PYSIDE_TEST(qapp_test.py) -PYSIDE_TEST(qapplication_test.py) -PYSIDE_TEST(qapplication_exit_segfault_test.py) -PYSIDE_TEST(qapplication_singleton_test.py) -PYSIDE_TEST(qbrush_test.py) -PYSIDE_TEST(qdynamic_signal.py) -# TODO: This passes, but requires manual button clicking (at least on mac) -#PYSIDE_TEST(qfontdialog_test.py) -PYSIDE_TEST(qformlayout_test.py) -PYSIDE_TEST(qgraphicsitem_test.py) -PYSIDE_TEST(qgraphicsitem_isblocked_test.py) -PYSIDE_TEST(qgraphicsobjectreimpl_test.py) -PYSIDE_TEST(qgraphicsproxywidget_test.py) -PYSIDE_TEST(qgraphicsscene_test.py) -PYSIDE_TEST(qimage_test.py) -PYSIDE_TEST(qinputdialog_get_test.py) -PYSIDE_TEST(qkeysequenceedit_test.py) -PYSIDE_TEST(qlabel_test.py) -PYSIDE_TEST(qlayout_ref_test.py) -PYSIDE_TEST(qlayout_test.py) -PYSIDE_TEST(qlcdnumber_test.py) -PYSIDE_TEST(qlistwidget_test.py) -PYSIDE_TEST(qlistwidgetitem_test.py) -PYSIDE_TEST(qmainwindow_test.py) -PYSIDE_TEST(qmenu_test.py) -PYSIDE_TEST(qmenuadd_test.py) -PYSIDE_TEST(qobject_mi_test.py) -PYSIDE_TEST(qpen_test.py) -PYSIDE_TEST(qpicture_test.py) -PYSIDE_TEST(qpixmap_constructor.py) -PYSIDE_TEST(qpushbutton_test.py) -PYSIDE_TEST(qshortcut_test.py) -PYSIDE_TEST(qsplitter_test.py) -PYSIDE_TEST(qstandarditemmodel_test.py) -PYSIDE_TEST(qstring_qkeysequence_test.py) -PYSIDE_TEST(qstyle_test.py) -PYSIDE_TEST(qtableview_test.py) -PYSIDE_TEST(qtabwidget_test.py) -PYSIDE_TEST(qtabwidgetclear_test.py) -PYSIDE_TEST(qtextedit_test.py) -PYSIDE_TEST(qtextedit_signal_test.py) -PYSIDE_TEST(qtreeview_test.py) -PYSIDE_TEST(qtreewidget_test.py) -PYSIDE_TEST(qtoolbar_test.py) -PYSIDE_TEST(qtoolbox_test.py) -PYSIDE_TEST(qvariant_test.py) -PYSIDE_TEST(qwidget_setlayout_test.py) -PYSIDE_TEST(qwidget_test.py) -PYSIDE_TEST(qcolormap_test.py) -PYSIDE_TEST(reference_count_test.py) -PYSIDE_TEST(signature_test.py) -PYSIDE_TEST(standardpixmap_test.py) -PYSIDE_TEST(test_module_template.py) -PYSIDE_TEST(virtual_protected_inheritance_test.py) -PYSIDE_TEST(virtual_pure_override_test.py) -PYSIDE_TEST(wrong_return_test.py) diff --git a/sources/pyside2/tests/QtWidgets/action_clear.py b/sources/pyside2/tests/QtWidgets/action_clear.py deleted file mode 100644 index e7bd882bc..000000000 --- a/sources/pyside2/tests/QtWidgets/action_clear.py +++ /dev/null @@ -1,74 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import QMenu, QWidget, QMenuBar, QToolBar -import weakref - -import unittest -from helper import UsesQApplication - - -class TestQActionLifeCycle(UsesQApplication): - def actionDestroyed(self, act): - self._actionDestroyed = True - - def testMenu(self): - self._actionDestroyed = False - w = QWidget() - menu = QMenu(w) - act = menu.addAction("MENU") - _ref = weakref.ref(act, self.actionDestroyed) - act = None - self.assertFalse(self._actionDestroyed) - menu.clear() - self.assertTrue(self._actionDestroyed) - - def testMenuBar(self): - self._actionDestroyed = False - w = QWidget() - menuBar = QMenuBar(w) - act = menuBar.addAction("MENU") - _ref = weakref.ref(act, self.actionDestroyed) - act = None - self.assertFalse(self._actionDestroyed) - menuBar.clear() - self.assertTrue(self._actionDestroyed) - - def testToolBar(self): - self._actionDestroyed = False - w = QWidget() - toolBar = QToolBar(w) - act = toolBar.addAction("MENU") - _ref = weakref.ref(act, self.actionDestroyed) - act = None - self.assertFalse(self._actionDestroyed) - toolBar.clear() - self.assertTrue(self._actionDestroyed) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/add_action_test.py b/sources/pyside2/tests/QtWidgets/add_action_test.py deleted file mode 100644 index 852bcc130..000000000 --- a/sources/pyside2/tests/QtWidgets/add_action_test.py +++ /dev/null @@ -1,71 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Tests for QMenuBar.addAction(identifier, callback) calls''' - -import unittest - -from PySide2.QtCore import SLOT -from PySide2.QtWidgets import QMenuBar, QAction, QPushButton - -from helper import UsesQApplication - - -class AddActionTest(UsesQApplication): - '''QMenuBar addAction''' - - def tearDown(self): - try: - del self.called - except AttributeError: - pass - super(AddActionTest, self).tearDown() - - def _callback(self): - self.called = True - - def testBasic(self): - '''QMenuBar.addAction(id, callback)''' - menubar = QMenuBar() - action = menubar.addAction("Accounts", self._callback) - action.activate(QAction.Trigger) - self.assertTrue(self.called) - - def testWithCppSlot(self): - '''QMenuBar.addAction(id, object, slot)''' - menubar = QMenuBar() - widget = QPushButton() - widget.setCheckable(True) - widget.setChecked(False) - action = menubar.addAction("Accounts", widget, SLOT("toggle()")) - action.activate(QAction.Trigger) - self.assertTrue(widget.isChecked()) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/api2_test.py b/sources/pyside2/tests/QtWidgets/api2_test.py deleted file mode 100644 index 90ad4eb00..000000000 --- a/sources/pyside2/tests/QtWidgets/api2_test.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for PySide API2 support''' - - -import unittest -import sys - -from PySide2.QtGui import QIntValidator, QValidator -from PySide2.QtWidgets import QWidget, QSpinBox, QApplication - -from helper import UsesQApplication - -class WidgetValidatorQInt(QWidget, QIntValidator): - def __init__(self, parent=None): - QWidget.__init__(self, parent) - QIntValidator.__init__(self, parent) - -class WidgetValidatorQSpinBox(QSpinBox): - def __init__(self, parent=None): - QSpinBox.__init__(self, parent) - - def fixup(self, text): - print("It was called!") - -class DoubleQObjectInheritanceTest(UsesQApplication): - - def testDouble(self): - '''Double inheritance from QObject classes''' - - obj = WidgetValidatorQInt() - - #QIntValidator methods - state, string, number = obj.validate('Test', 0) - self.assertEqual(state, QValidator.Invalid) - state, string, number = obj.validate('33', 0) - self.assertEqual(state, QValidator.Acceptable) - - def testQSpinBox(self): - obj = WidgetValidatorQSpinBox() - - obj.setRange(1, 10) - obj.setValue(0) - self.assertEqual(obj.value(), 1) - -class QClipboardTest(UsesQApplication): - - def testQClipboard(self): - #skip this test on MacOS because the clipboard is not available during the ssh session - #this cause problems in the buildbot - if sys.platform == 'darwin': - return - clip = QApplication.clipboard() - clip.setText("Testing this thing!") - - text, subtype = clip.text("") - self.assertEqual(subtype, "plain") - self.assertEqual(text, "Testing this thing!") - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/application_test.py b/sources/pyside2/tests/QtWidgets/application_test.py deleted file mode 100644 index 0b8f73cd6..000000000 --- a/sources/pyside2/tests/QtWidgets/application_test.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from testbinding import TestObject -from PySide2.QtWidgets import QApplication -from PySide2 import __all__ as all - -class QApplicationInstance(unittest.TestCase): - - def appDestroyed(self): - self.assertTrue(False) - - def testInstanceObject(self): - self.assertEqual(type(qApp), type(None)) - TestObject.createApp() - app1 = QApplication.instance() - app2 = QApplication.instance() - app1.setObjectName("MyApp") - self.assertEqual(app1, app2) - self.assertEqual(app2.objectName(), app1.objectName()) - if len(all) > 3: - # an import triggers qApp initialization - __import__("PySide2." + all[-1]) - self.assertEqual(app1, qApp) - app1.destroyed.connect(self.appDestroyed) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_1002.py b/sources/pyside2/tests/QtWidgets/bug_1002.py deleted file mode 100644 index e4f5bf75d..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_1002.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys -from PySide2.QtWidgets import QWidget, QPushButton - -from helper import UsesQApplication - -class TestBug1002 (UsesQApplication): - def testReturnWindow(self): - widget = QWidget() - button = QPushButton(widget) - self.assertEqual(sys.getrefcount(widget), 2) - window = button.window() - self.assertEqual(sys.getrefcount(widget), 3) - self.assertEqual(sys.getrefcount(window), 3) - - del widget - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_1006.py b/sources/pyside2/tests/QtWidgets/bug_1006.py deleted file mode 100644 index 49dc22cfd..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_1006.py +++ /dev/null @@ -1,111 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import weakref -import sys - -from PySide2.QtCore import Qt -from PySide2.QtWidgets import QDialog, QLabel, QGridLayout, QHBoxLayout, QWidget - -from helper import TimedQApplication - -class LabelWindow(QDialog): - def __init__(self, parent): - super(LabelWindow, self).__init__(parent) - - self.test_layout = QGridLayout() - label = QLabel("Label") - self.test_layout.addWidget(label, 0, 0) - self.setLayout(self.test_layout) - self._destroyCalled = False - - - def replace(self, unit): - old_item = self.test_layout.itemAtPosition(0, 0) - old_label = old_item.widget() - ref = weakref.ref(old_item, self._destroyed) - - self.test_layout.removeWidget(old_label) - unit.assertRaises(RuntimeError, old_item.widget) - del old_item - - label = QLabel("Label New") - old_label.deleteLater() - label.setAlignment(Qt.AlignCenter) - self.test_layout.addWidget(label, 0, 0) - - def _destroyed(self, obj): - self._destroyCalled = True - -class TestBug1006 (TimedQApplication): - - def testLayoutItemLifeTime(self): - window = LabelWindow(None) - window.replace(self) - self.assertTrue(window._destroyCalled) - self.app.exec_() - - def testParentLayout(self): - def createLayout(): - label = QLabel() - layout = QHBoxLayout() - layout.addWidget(label) - - widget = QWidget() - widget.setLayout(layout) - return (layout, widget) - (layout, widget) = createLayout() - item = layout.itemAt(0) - self.assertTrue(isinstance(item.widget(), QWidget)) - - def testRemoveOrphanWidget(self): - widget = QLabel() - layout = QHBoxLayout() - layout.addWidget(widget) - self.assertEqual(sys.getrefcount(widget), 3) - - layout.removeWidget(widget) - widget.setObjectName("MyWidget") - self.assertEqual(sys.getrefcount(widget), 2) - - def testRemoveChildWidget(self): - parent = QLabel() - widget = QLabel(parent) - self.assertEqual(sys.getrefcount(widget), 3) - - layout = QHBoxLayout() - layout.addWidget(widget) - self.assertEqual(sys.getrefcount(widget), 3) - - layout.removeWidget(widget) - widget.setObjectName("MyWidget") - self.assertEqual(sys.getrefcount(widget), 3) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_1048.py b/sources/pyside2/tests/QtWidgets/bug_1048.py deleted file mode 100644 index 2042a99c4..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_1048.py +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2 import QtWidgets - -a = QtWidgets.QApplication([]) - -w = QtWidgets.QWidget() -l = QtWidgets.QGridLayout(w) - -l.itemAtPosition(0, 0) diff --git a/sources/pyside2/tests/QtWidgets/bug_1077.py b/sources/pyside2/tests/QtWidgets/bug_1077.py deleted file mode 100644 index 7943e5550..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_1077.py +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' unit test for BUG #1077 ''' - -from PySide2 import QtCore, QtGui, QtWidgets -import time - -class Highlighter(QtGui.QSyntaxHighlighter): - def __init__(self, parent, mode): - QtGui.QSyntaxHighlighter.__init__(self, parent) - self.tstamp = time.time() - -if __name__ == "__main__": - app = QtWidgets.QApplication([]) - python = QtWidgets.QTextEdit() - python.setWindowTitle("python") - hl = Highlighter(python.document(), "python") - python.show() - text = hl.document() diff --git a/sources/pyside2/tests/QtWidgets/bug_172.py b/sources/pyside2/tests/QtWidgets/bug_172.py deleted file mode 100644 index 5b0822555..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_172.py +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import * - -if __name__ == '__main__': - app = QApplication([]) - - wdg = QWidget() - - hbox = QHBoxLayout() - - vbox = QVBoxLayout() - vbox.addLayout(hbox) - - wdg.setLayout(vbox) diff --git a/sources/pyside2/tests/QtWidgets/bug_243.py b/sources/pyside2/tests/QtWidgets/bug_243.py deleted file mode 100644 index 7ce0a468e..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_243.py +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 243: http://bugs.openbossa.org/show_bug.cgi?id=243''' - -import unittest -import sys - -from PySide2.QtWidgets import QApplication, QMainWindow, QLayout - -class QAppPresence(unittest.TestCase): - - def testBug(self): - app = QApplication(sys.argv) - window = QMainWindow() - l = window.layout() - self.assertTrue(isinstance(l, QLayout)) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_307.py b/sources/pyside2/tests/QtWidgets/bug_307.py deleted file mode 100644 index 0a0e9faa5..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_307.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import colorsys - -from PySide2.QtCore import SIGNAL -from PySide2.QtWidgets import QPushButton, QApplication - - -class Test (QApplication) : - def __init__(self, argv) : - super(Test, self).__init__(argv) - self._called = False - - def called(self): - self._called = True - - -class QApplicationSignalsTest(unittest.TestCase): - def testQuit(self): - app = Test([]) - button = QPushButton("BUTTON") - app.connect(button, SIGNAL("clicked()"), app.called) - button.click() - self.assertTrue(app._called) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_324.py b/sources/pyside2/tests/QtWidgets/bug_324.py deleted file mode 100644 index fbaf43738..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_324.py +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 324: http://bugs.openbossa.org/show_bug.cgi?id=324''' - -import unittest -import sys -import signal -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class QBug( QObject ): - def __init__(self, parent = None): - QObject.__init__(self, parent) - - def check(self): - self.done.emit("abc") - - done = Signal(str) - -class Bug324(unittest.TestCase): - - def on_done(self, val): - self.value = val - - def testBug(self): - app = QApplication([]) - bug = QBug() - self.value = '' - bug.done.connect(self.on_done) - bug.check() - self.assertEqual(self.value, 'abc') - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_338.py b/sources/pyside2/tests/QtWidgets/bug_338.py deleted file mode 100644 index e51cb1523..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_338.py +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 338: http://bugs.openbossa.org/show_bug.cgi?id=338''' - -import sys -import unittest - -from PySide2 import QtCore, QtWidgets - -class DiagramItem(QtWidgets.QGraphicsPolygonItem): - def __init__(self, parent=None, scene=None): - super(DiagramItem, self).__init__(parent, scene) - - def itemChange(self, change, value): - return value - - -class BugTest(unittest.TestCase): - def test(self): - app = QtWidgets.QApplication(sys.argv) - scene = QtWidgets.QGraphicsScene() - item = DiagramItem() - item2 = DiagramItem() - #this cause segfault - scene.addItem(item) - scene.addItem(item2) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_363.py b/sources/pyside2/tests/QtWidgets/bug_363.py deleted file mode 100644 index 642c719e7..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_363.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 363: http://bugs.openbossa.org/show_bug.cgi?id=363''' - -import sys -import unittest - -from helper import UsesQApplication -from PySide2 import QtCore, QtWidgets - -# Check for desktop object lifetime -class BugTest(UsesQApplication): - def mySlot(self): - pass - - # test if it is possible to connect with a desktop object after storing that on an auxiliar variable - def testCase1(self): - desktop = QtWidgets.QApplication.desktop() - desktop.resized[int].connect(self.mySlot) - self.assertTrue(True) - - # test if it is possible to connect with a desktop object without storing that on an auxiliar variable - def testCase2(self): - QtWidgets.QApplication.desktop().resized[int].connect(self.mySlot) - self.assertTrue(True) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_389.py b/sources/pyside2/tests/QtWidgets/bug_389.py deleted file mode 100644 index d29b6d523..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_389.py +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 389: http://bugs.openbossa.org/show_bug.cgi?id=389''' - -import sys -import unittest -from helper import UsesQApplication -from PySide2 import QtCore, QtGui, QtWidgets - -class BugTest(UsesQApplication): - def testCase(self): - s = QtWidgets.QWidget().style() - i = s.standardIcon(QtWidgets.QStyle.SP_TitleBarMinButton) - self.assertEqual(type(i), QtGui.QIcon) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_400.py b/sources/pyside2/tests/QtWidgets/bug_400.py deleted file mode 100644 index 64e0231d9..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_400.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 400: http://bugs.openbossa.org/show_bug.cgi?id=400''' - -import unittest -from helper import UsesQApplication -from PySide2.QtWidgets import QTreeWidgetItemIterator, QTreeWidgetItem, QTreeWidget - -class BugTest(UsesQApplication): - def testCase(self): - treeWidget = QTreeWidget() - treeWidget.setColumnCount(1) - items = [] - for i in range(10): - items.append(QTreeWidgetItem(None, ["item: %i" % i])) - - treeWidget.insertTopLevelItems(0, items); - _iter = QTreeWidgetItemIterator(treeWidget) - index = 0 - while(_iter.value()): - item = _iter.value() - self.assertTrue(item is items[index]) - index += 1 - _iter += 1 - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_416.py b/sources/pyside2/tests/QtWidgets/bug_416.py deleted file mode 100644 index ea8a7c14d..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_416.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from helper import TimedQApplication -from PySide2.QtCore import QSignalTransition, QState, Qt, QStateMachine -from PySide2.QtWidgets import QCheckBox - -class CheckedTransition(QSignalTransition): - def __init__(self, check): - QSignalTransition.__init__(self, check.stateChanged[int]) - self.eventTested = False - - def eventTest(self, event): - self.eventTested = True - if not QSignalTransition.eventTest(self, event): - return False - return event.arguments()[0] == Qt.Checked - -class TestBug(TimedQApplication): - def testCase(self): - check = QCheckBox() - check.setTristate(True) - - s1 = QState() - s2 = QState() - - t1 = CheckedTransition(check) - t1.setTargetState(s2) - s1.addTransition(t1) - - machine = QStateMachine() - machine.addState(s1) - machine.addState(s2) - machine.setInitialState(s1) - machine.start() - - check.stateChanged[int].emit(1) - check.show() - self.app.exec_() - self.assertTrue(t1.eventTested) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_429.py b/sources/pyside2/tests/QtWidgets/bug_429.py deleted file mode 100644 index dea855f30..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_429.py +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * -import sys - -app = QApplication(sys.argv) -scene = QGraphicsScene() -label = QLabel("hello world") -label.show() -QTimer.singleShot(0, label.close) -exit(app.exec_()) diff --git a/sources/pyside2/tests/QtWidgets/bug_430.py b/sources/pyside2/tests/QtWidgets/bug_430.py deleted file mode 100644 index 89f6f795d..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_430.py +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class ListModel(QAbstractListModel): - def rowCount(self, parent = QModelIndex()): - return 0 - -app = QApplication([]) -model = ListModel() -v = QListView() -v.setModel(model) -QTimer.singleShot(0, v.close) -app.exec_() diff --git a/sources/pyside2/tests/QtWidgets/bug_433.py b/sources/pyside2/tests/QtWidgets/bug_433.py deleted file mode 100644 index a214b2cce..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_433.py +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys - -from PySide2 import QtCore, QtWidgets - -class Test(QtWidgets.QGraphicsView): - def __init__(self, parent=None): - super(Test, self).__init__(parent) - self.s = QtWidgets.QGraphicsScene() - self.setScene(self.s) - -a = QtWidgets.QApplication(sys.argv) -t = Test() -t.show() -QtCore.QTimer.singleShot(0, t.close) -sys.exit(a.exec_()) diff --git a/sources/pyside2/tests/QtWidgets/bug_467.py b/sources/pyside2/tests/QtWidgets/bug_467.py deleted file mode 100644 index 0a207f1a7..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_467.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 367: http://bugs.openbossa.org/show_bug.cgi?id=467''' - -import unittest -from helper import UsesQApplication -from PySide2.QtWidgets import QMainWindow, QApplication - -class MyWidget(QMainWindow): - def __init__(self, parent = None): - QMainWindow.__init__(self, parent) - - -class BugTest(UsesQApplication): - def testCase(self): - w = MyWidget() - widgets = QApplication.allWidgets() - self.assertTrue(w in widgets) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_493.py b/sources/pyside2/tests/QtWidgets/bug_493.py deleted file mode 100644 index 19cbb0023..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_493.py +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import Qt, QEvent -from PySide2.QtGui import QKeyEvent, QKeySequence -from PySide2.QtWidgets import QApplication -import unittest - - -class TestBug493(unittest.TestCase): - - def testIt(self): - # We need a qapp otherwise Qt will crash when trying to detect the - # current platform - app = QApplication([]) - ev1 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Delete, Qt.NoModifier) - ev2 = QKeyEvent(QEvent.KeyRelease, Qt.Key_Copy, Qt.NoModifier) - ks = QKeySequence.Delete - - self.assertTrue(ev1.matches(ks)) - self.assertFalse(ev2.matches(ks)) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_512.py b/sources/pyside2/tests/QtWidgets/bug_512.py deleted file mode 100644 index 4815c2d86..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_512.py +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 512: http://bugs.openbossa.org/show_bug.cgi?id=512''' - -import unittest -from helper import UsesQApplication -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class BugTest(UsesQApplication): - def testCase(self): - w = QWidget(None) - lbl = QLabel("Hello", w); - g = QGridLayout() - g.addWidget(lbl, 0, 0) - w.setLayout(g) - w.show() - - t = g.getItemPosition(0) - self.assertEqual(type(t), tuple) - self.assertEqual(t, (0,0,1,1)) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_525.py b/sources/pyside2/tests/QtWidgets/bug_525.py deleted file mode 100644 index 842a4406f..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_525.py +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import QApplication -from PySide2.QtWidgets import QMenu - -class M2(QMenu): - def __init__(self,parent=None): - super(M2,self).__init__(parent) - self.setTitle(self.tr("M2")) - -class TestMenuDerivedClass(unittest.TestCase): - def aboutToShowHandler(self): - pass - - def testConnectSignal(self): - app = QApplication([]) - m2 = M2() - # Test if the aboutToShow signal was translated to correct type - m2.aboutToShow.connect(self.aboutToShowHandler) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_546.py b/sources/pyside2/tests/QtWidgets/bug_546.py deleted file mode 100644 index a56406cc3..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_546.py +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import * - -class TestBug546(unittest.TestCase): - - """Test to check a crash at exit""" - def testIt(self): - app = QApplication([]) - textEdit = QPlainTextEdit() - completer = QCompleter(("foo", "bar"), textEdit) - completer.setWidget(textEdit) - -if __name__=='__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_547.py b/sources/pyside2/tests/QtWidgets/bug_547.py deleted file mode 100644 index ac2000716..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_547.py +++ /dev/null @@ -1,85 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -""" Unittest for bug #547 """ -""" http://bugs.openbossa.org/show_bug.cgi?id=547 """ - -import sys -import unittest - -from PySide2 import QtWidgets - -class MyMainWindow(unittest.TestCase): - app = QtWidgets.QApplication(sys.argv) - def testCase1(self): - self._tree = QtWidgets.QTreeWidget() - self._tree.setColumnCount(2) - self._i1 = None - self._i11 = None - - self._updateTree() - self.assertEqual(sys.getrefcount(self._i1), 3) - self.assertEqual(sys.getrefcount(self._i11), 3) - - self._i11.parent().setExpanded(True) - self._i11.setExpanded(True) - - self._updateTree() - self.assertEqual(sys.getrefcount(self._i1), 3) - self.assertEqual(sys.getrefcount(self._i11), 3) - - def testCase2(self): - self._tree = QtWidgets.QTreeWidget() - self._tree.setColumnCount(2) - self._i1 = None - self._i11 = None - - self._updateTree() - self.assertEqual(sys.getrefcount(self._i1), 3) - self.assertEqual(sys.getrefcount(self._i11), 3) - - self._i11.parent().setExpanded(True) - self._i11.setExpanded(True) - - self.assertEqual(sys.getrefcount(self._i1), 3) - self.assertEqual(sys.getrefcount(self._i11), 3) - - def _updateTree(self): - self._tree.clear() - if self._i1 and self._i11: - self.assertEqual(sys.getrefcount(self._i1), 2) - self.assertEqual(sys.getrefcount(self._i11), 2) - - self._i1 = QtWidgets.QTreeWidgetItem(self._tree, ['1', ]) - self.assertEqual(sys.getrefcount(self._i1), 3) - self._i11 = QtWidgets.QTreeWidgetItem(self._i1, ['11', ]) - self.assertEqual(sys.getrefcount(self._i11), 3) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_549.py b/sources/pyside2/tests/QtWidgets/bug_549.py deleted file mode 100644 index 0e2afc653..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_549.py +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import * - -class TestBug549(unittest.TestCase): - def testBug(self): - app = QApplication([]) - w = QGraphicsWidget() - w.setContentsMargins(1, 2, 3, 4) - self.assertEqual(w.getContentsMargins(), (1, 2, 3, 4)) - w.setWindowFrameMargins(5, 6, 7, 8) - self.assertEqual(w.getWindowFrameMargins(), (5, 6, 7, 8)) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_569.py b/sources/pyside2/tests/QtWidgets/bug_569.py deleted file mode 100644 index 4e3d07c35..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_569.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * -import unittest - - -class TestBug569(unittest.TestCase): - - def testIt(self): - types = (QTableWidgetItem, QListWidgetItem, QTreeWidgetItem) - for t in types: - a = t() - a.__lt__ = lambda other : True - b = t() - b.__lt__ = lambda other : False - self.assertTrue(a < b) - self.assertFalse(b < a) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_575.py b/sources/pyside2/tests/QtWidgets/bug_575.py deleted file mode 100644 index 4996c6986..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_575.py +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -""" Unittest for bug #575 """ -""" http://bugs.openbossa.org/show_bug.cgi?id=575 """ - -from PySide2.QtWidgets import QApplication, QPlainTextEdit, QTextEdit -import sys -import unittest - -class Bug575(unittest.TestCase): - def testPropertyValues(self): - app = QApplication(sys.argv) - textEdit = QPlainTextEdit() - textEdit.insertPlainText("PySide INdT") - selection = QTextEdit.ExtraSelection() - selection.cursor = textEdit.textCursor() - selection.cursor.setPosition(2) - self.assertEqual(selection.cursor.position(), 2) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_576.py b/sources/pyside2/tests/QtWidgets/bug_576.py deleted file mode 100644 index b0b044499..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_576.py +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -""" Unittest for bug #576 """ -""" http://bugs.openbossa.org/show_bug.cgi?id=576 """ - -import sys -import unittest - -from PySide2 import QtCore, QtWidgets - -class Bug576(unittest.TestCase): - def onButtonDestroyed(self, button): - self._destroyed = True - self.assertTrue(isinstance(button, QtWidgets.QPushButton)) - - def testWidgetParent(self): - self._destroyed = False - app = QtWidgets.QApplication(sys.argv) - w = QtWidgets.QWidget() - - b = QtWidgets.QPushButton("test") - b.destroyed[QtCore.QObject].connect(self.onButtonDestroyed) - self.assertEqual(sys.getrefcount(b), 2) - b.setParent(w) - self.assertEqual(sys.getrefcount(b), 3) - b.parent() - self.assertEqual(sys.getrefcount(b), 3) - b.setParent(None) - self.assertEqual(sys.getrefcount(b), 2) - del b - self.assertTrue(self._destroyed) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_585.py b/sources/pyside2/tests/QtWidgets/bug_585.py deleted file mode 100644 index 1c5eb75f1..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_585.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test bug 585: http://bugs.openbossa.org/show_bug.cgi?id=585''' - -import sys -import unittest - -from PySide2 import QtCore, QtWidgets - -class Bug585(unittest.TestCase): - def testCase(self): - app = QtWidgets.QApplication([]) - self._tree = QtWidgets.QTreeWidget() - self._tree.setColumnCount(2) - i1 = QtWidgets.QTreeWidgetItem(self._tree, ['1', ]) - i2 = QtWidgets.QTreeWidgetItem(self._tree, ['2', ]) - refCount = sys.getrefcount(i1) - - # this function return None - # because the topLevelItem does not has a parent item - # but still have a TreeWidget as a parent - self._tree.topLevelItem(0).parent() - - self.assertEqual(refCount, sys.getrefcount(i1)) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_589.py b/sources/pyside2/tests/QtWidgets/bug_589.py deleted file mode 100644 index c75a12f7f..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_589.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -# trimmed down diagramscene.py to demonstrate crash in sizeHint() - -import sys -from PySide2 import QtCore, QtWidgets -import unittest - -class CustomWidget(QtWidgets.QGraphicsProxyWidget): - def itemChange(self, eventType, value): - QtWidgets.QGraphicsProxyWidget.itemChange(self, eventType, value) - -class Bug589(unittest.TestCase): - def testCase(self): - widget = QtWidgets.QGraphicsProxyWidget() - custom = CustomWidget() - custom.setParentItem(widget) - -if __name__ == "__main__": - app = QtWidgets.QApplication(sys.argv) - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_632.py b/sources/pyside2/tests/QtWidgets/bug_632.py deleted file mode 100644 index e60416102..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_632.py +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -from PySide2.QtWidgets import QLineEdit, QApplication -import unittest - - -class Bug589(unittest.TestCase): - def testWrongSignature(self): - text = QLineEdit("PySide bug 632") - a = b = c = d = 0 - self.assertRaises(TypeError, text.getTextMargins, (a, b, c, d)) - - def testTupleReturn(self): - text = QLineEdit("PySide bug 632") - text.setTextMargins(10, 20, 30, 40) - (a, b, c, d) = text.getTextMargins() - self.assertTrue((a, b, c, d), (10, 20, 30, 40)) - -if __name__ == "__main__": - app = QApplication(sys.argv) - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_635.py b/sources/pyside2/tests/QtWidgets/bug_635.py deleted file mode 100644 index 59f27fa22..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_635.py +++ /dev/null @@ -1,57 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 635: http://bugs.openbossa.org/show_bug.cgi?id=635''' - -import unittest -from PySide2.QtGui import QIcon -from PySide2.QtWidgets import QApplication, QToolBar -import sys - -class testQToolBar(unittest.TestCase): - def callback(self): - self._called = True - - def testAddAction(self): - bar = QToolBar() - self._called = False - a = bar.addAction("act1", self.callback) - a.trigger() - self.assertTrue(self._called) - - def testAddActionWithIcon(self): - bar = QToolBar() - self._called = False - icon = QIcon() - a = bar.addAction(icon, "act1", self.callback) - a.trigger() - self.assertTrue(self._called) - -if __name__ == '__main__': - app = QApplication(sys.argv) - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_640.py b/sources/pyside2/tests/QtWidgets/bug_640.py deleted file mode 100644 index 9e63a1d7f..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_640.py +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -from PySide2.QtWidgets import * -import unittest - -class Bug640(unittest.TestCase): - def testIt(self): - option = QStyleOptionGraphicsItem() - a = option.state # crash!? - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_653.py b/sources/pyside2/tests/QtWidgets/bug_653.py deleted file mode 100644 index e1b2ed416..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_653.py +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class TestBug653(unittest.TestCase): - """Crash after calling QWizardPage.wizard()""" - def testIt(self): - app = QApplication([]) - - wizard = QWizard() - page = QWizardPage() - wizard.addPage(page) - page.wizard() # crash here if the bug still exists due to a circular dependency - wizard.show() - -if __name__ == "__main__": - unittest.main()
\ No newline at end of file diff --git a/sources/pyside2/tests/QtWidgets/bug_662.py b/sources/pyside2/tests/QtWidgets/bug_662.py deleted file mode 100644 index a5cc650c1..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_662.py +++ /dev/null @@ -1,57 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 662: http://bugs.openbossa.org/show_bug.cgi?id=662''' - -import unittest -from PySide2.QtGui import QTextCharFormat -from PySide2.QtWidgets import QTextEdit, QApplication -import sys - -class testQTextBlock(unittest.TestCase): - def tesIterator(self): - edit = QTextEdit() - cursor = edit.textCursor() - fmt = QTextCharFormat() - frags = [] - for i in range(10): - fmt.setFontPointSize(i+10) - frags.append("block%d"%i) - cursor.insertText(frags[i], fmt) - - doc = edit.document() - block = doc.begin() - - index = 0 - for i in block: - self.assertEqual(i.fragment().text(), frags[index]) - index += 1 - -if __name__ == '__main__': - app = QApplication(sys.argv) - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_667.py b/sources/pyside2/tests/QtWidgets/bug_667.py deleted file mode 100644 index e2b472299..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_667.py +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys - -from PySide2.QtCore import QTimer, QPointF -from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsEllipseItem - -class Ball(QGraphicsEllipseItem): - def __init__(self, d, parent=None): - super(Ball, self).__init__(0, 0, d, d, parent) - self.vel = QPointF(0,0) #commenting this out prevents the crash - -class Foo(QGraphicsView): - def __init__(self): - super(Foo, self).__init__(None) - self.scene = QGraphicsScene(self.rect()) - self.setScene(self.scene) - self.scene.addItem(Ball(10)) - - -if __name__ == "__main__": - app = QApplication(sys.argv) - w = Foo() - w.show() - w.raise_() - QTimer.singleShot(0, w.close) - sys.exit(app.exec_()) diff --git a/sources/pyside2/tests/QtWidgets/bug_668.py b/sources/pyside2/tests/QtWidgets/bug_668.py deleted file mode 100644 index 05cffa39d..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_668.py +++ /dev/null @@ -1,52 +0,0 @@ -# coding: utf-8 - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -import sys - -class A(QMainWindow): - def __init__(self, parent=None): - super(A, self).__init__(parent) - a = QFileSystemModel(self) - a.setRootPath(QDir.homePath()) - - v = QTreeView(self) - v.setModel(a) - self.setCentralWidget(v) - # Test index() method (see PYSIDE-570, PYSIDE-331) - index = a.index(0, 0, QModelIndex()) - -app = QApplication([]) -m = A() -m.show() -QTimer.singleShot(0, m.close) -app.exec_() diff --git a/sources/pyside2/tests/QtWidgets/bug_674.py b/sources/pyside2/tests/QtWidgets/bug_674.py deleted file mode 100644 index 40fd19206..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_674.py +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * -import unittest -import sys - -class TestBug679(unittest.TestCase): - '''QGraphicsScene::clear() is missing''' - def testIt(self): - app = QApplication([]) - - scene = QGraphicsScene() - hello = scene.addText("Hello") - scene.addText("World") - - self.assertEqual(sys.getrefcount(hello), 3) - scene.clear() - self.assertEqual(sys.getrefcount(hello), 2) - self.assertEqual(len(scene.items()), 0) - self.assertRaises(RuntimeError, hello.isVisible) # the C++ object was deleted - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_675.py b/sources/pyside2/tests/QtWidgets/bug_675.py deleted file mode 100644 index 93489064b..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_675.py +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -app = QApplication([]) - -scene = QGraphicsScene() - -# don't segfault due to lack of keepReferenceCall -textEdit = scene.addWidget(QTextEdit()) - -layout = QGraphicsLinearLayout() -layout.addItem(textEdit) - -view = QGraphicsView(scene) -view.show() diff --git a/sources/pyside2/tests/QtWidgets/bug_688.py b/sources/pyside2/tests/QtWidgets/bug_688.py deleted file mode 100644 index 2bab2050a..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_688.py +++ /dev/null @@ -1,116 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test bug 688: http://bugs.openbossa.org/show_bug.cgi?id=688''' - -import unittest -from helper import UsesQApplication -from PySide2.QtGui import QTextFrame, QTextCursor, QTextCharFormat, QFont, QTextFrameFormat -from PySide2.QtWidgets import QTextEdit - -class BugTest(UsesQApplication): - def testCase(self): - editor = QTextEdit() - cursor = QTextCursor(editor.textCursor()) - cursor.movePosition(QTextCursor.Start) - - mainFrame = cursor.currentFrame() - - plainCharFormat = QTextCharFormat() - boldCharFormat = QTextCharFormat() - boldCharFormat.setFontWeight(QFont.Bold); - cursor.insertText(""" - Text documents are represented by the - QTextDocument class, rather than by QString objects. - Each QTextDocument object contains information about - the document's internal representation, its structure, - and keeps track of modifications to provide undo/redo - facilities. This approach allows features such as the - layout management to be delegated to specialized - classes, but also provides a focus for the framework.""", - plainCharFormat) - - frameFormat = QTextFrameFormat() - frameFormat.setMargin(32) - frameFormat.setPadding(8) - frameFormat.setBorder(4) - cursor.insertFrame(frameFormat) - - cursor.insertText(""" - Documents are either converted from external sources - or created from scratch using Qt. The creation process - can done by an editor widget, such as QTextEdit, or by - explicit calls to the Scribe API.""", - boldCharFormat) - - cursor = mainFrame.lastCursorPosition() - cursor.insertText(""" - There are two complementary ways to visualize the - contents of a document: as a linear buffer that is - used by editors to modify the contents, and as an - object hierarchy containing structural information - that is useful to layout engines. In the hierarchical - model, the objects generally correspond to visual - elements such as frames, tables, and lists. At a lower - level, these elements describe properties such as the - style of text used and its alignment. The linear - representation of the document is used for editing and - manipulation of the document's contents.""", - plainCharFormat) - - - frame = cursor.currentFrame() - - items = [] - - #test iterator - for i in frame: - items.append(i) - - #test __iadd__ - b = frame.begin() - i = 0 - while not b.atEnd(): - self.assertEqual(b, items[i]) - self.assertTrue(b.parentFrame(), items[i].parentFrame()) - b.__iadd__(1) - i += 1 - - #test __isub__ - b = frame.end() - i = 0 - while i > 0: - self.assertEqual(b, items[i]) - self.assertTrue(b.parentFrame(), items[i].parentFrame()) - b.__isub__(1) - i -= 1 - - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_693.py b/sources/pyside2/tests/QtWidgets/bug_693.py deleted file mode 100644 index 31b0262c4..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_693.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * -import unittest - -class MyModel (QAbstractListModel): - - stupidLine = QLine(0, 0, 10, 10) - - def rowCount(self, parent): - return 1 - - def data(self, index, role): - return self.stupidLine - -class TestBug693(unittest.TestCase): - def testIt(self): - app = QApplication([]) - model = MyModel() - view = QListView() - view.setModel(model) - view.show() - - # This must NOT throw the exception: - # RuntimeError: Internal C++ object (PySide2.QtCore.QLine) already deleted. - MyModel.stupidLine.isNull() - - - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_696.py b/sources/pyside2/tests/QtWidgets/bug_696.py deleted file mode 100644 index 93703758e..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_696.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -import unittest - -from helper import UsesQApplication -from PySide2.QtWidgets import QMainWindow, QMenu, QApplication - -class MainWindow(QMainWindow): - def __init__(self, *args): - self._menu = QMenu(self.dontexist) # attribute called with invalid C++ object - -class MainWindow2(QMainWindow): - def __init__(self): - self.show() - -class Bug696(UsesQApplication): - def testContructorInitialization(self): - self.assertRaises(AttributeError, MainWindow) - - def testContructorInitializationAndCPPFunction(self): - self.assertRaises(RuntimeError, MainWindow2) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_711.py b/sources/pyside2/tests/QtWidgets/bug_711.py deleted file mode 100644 index 073d4e3c8..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_711.py +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import QToolBar, QApplication, QAction, QToolButton - -try: - xrange -except NameError: - xrange = range # py3k - -class TestLabelPixmap(unittest.TestCase): - def testReference(self): - toolbar = QToolBar() - - for i in xrange(20): - toolbar.addAction(QAction("Action %d" % i, None)) - - buttons = toolbar.findChildren(QToolButton, "") - toolbar.clear() - - for b in buttons: - self.assertRaises(RuntimeError, b.objectName) - -if __name__ == '__main__': - app = QApplication([]) - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_714.py b/sources/pyside2/tests/QtWidgets/bug_714.py deleted file mode 100644 index 345207ff9..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_714.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys -from PySide2.QtGui import QPixmap -from PySide2.QtWidgets import QLabel, QApplication - -class TestLabelPixmap(unittest.TestCase): - def testReference(self): - l = QLabel() - p = QPixmap() - l.setPixmap(p) # doesn't increment pixmap ref because this makes a copy - self.assertEqual(sys.getrefcount(p), 2) - - p = l.pixmap() - # this used to increment the reference because this is - # an internal pointer, but not anymore since we don't create - # a copy - # self.assertEqual(sys.getrefcount(p), 3) - self.assertEqual(sys.getrefcount(p), 2) - - p2 = l.pixmap() - self.assertEqual(p, p2) - -if __name__ == '__main__': - app = QApplication([]) - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_722.py b/sources/pyside2/tests/QtWidgets/bug_722.py deleted file mode 100644 index ddabd4ee8..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_722.py +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import UsesQApplication - -from PySide2.QtWidgets import QDoubleSpinBox, QGraphicsBlurEffect - -class TestSignalConnection(UsesQApplication): - def testFloatSignal(self): - foo1 = QDoubleSpinBox() - foo2 = QDoubleSpinBox() - foo1.valueChanged[float].connect(foo2.setValue) - foo2.valueChanged[float].connect(foo1.setValue) - foo1.setValue(0.42) - self.assertEqual(foo1.value(), foo2.value()) - - def testQRealSignal(self): - foo1 = QDoubleSpinBox() - effect = QGraphicsBlurEffect() - effect.blurRadiusChanged['qreal'].connect(foo1.setValue) # check if qreal is a valid type - effect.setBlurRadius(0.42) - self.assertAlmostEqual(foo1.value(), effect.blurRadius()) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_728.py b/sources/pyside2/tests/QtWidgets/bug_728.py deleted file mode 100644 index 59269d72c..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_728.py +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import * -from PySide2.QtCore import * - -# Periodically check for the file dialog to appear and close it -dialog = None -def timerHandler(): - global dialog - if dialog is not None: - dialog.reject() - else: - for widget in QApplication.topLevelWidgets(): - if isinstance(widget, QDialog) and widget.isVisible(): - dialog = widget - -app = QApplication([]) -QTimer.singleShot(30000, app.quit) # emergency -timer = QTimer() -timer.setInterval(50) -timer.timeout.connect(timerHandler) -timer.start() - -# This test for a dead lock in QFileDialog.getOpenFileNames, the test fail with a timeout if the dead lock exists. -QFileDialog.getOpenFileNames(None, "caption", QDir.homePath(), None, "", QFileDialog.DontUseNativeDialog) diff --git a/sources/pyside2/tests/QtWidgets/bug_736.py b/sources/pyside2/tests/QtWidgets/bug_736.py deleted file mode 100644 index 31ce80e57..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_736.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class TestBug736 (unittest.TestCase): - - def testIt(self): - app = QApplication([]) - slider = QSlider(Qt.Horizontal) - slider2 = QSlider(Qt.Horizontal) - - slider2.setMaximum(10) - slider.valueChanged[int].connect(slider2.setMaximum) - slider.valueChanged[int].emit(100) - self.assertEqual(slider2.maximum(), 100) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_750.py b/sources/pyside2/tests/QtWidgets/bug_750.py deleted file mode 100644 index 334f11e90..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_750.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import UsesQApplication - -from PySide2.QtCore import QTimer -from PySide2.QtGui import QPainter, QFont, QFontInfo -from PySide2.QtWidgets import QWidget, qApp - -class MyWidget(QWidget): - def paintEvent(self, e): - p = QPainter(self) - self._info = p.fontInfo() - self._app.quit() - - -class TestQPainter(UsesQApplication): - def testFontInfo(self): - w = MyWidget() - w._app = self.app - w._info = None - QTimer.singleShot(300, w.show) - self.app.exec_() - self.assertTrue(w._info) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_778.py b/sources/pyside2/tests/QtWidgets/bug_778.py deleted file mode 100644 index b03be3c92..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_778.py +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import UsesQApplication - -from PySide2.QtWidgets import QTreeWidget, QTreeWidgetItem, QTreeWidgetItemIterator - -class QTreeWidgetItemIteratorTest(UsesQApplication): - def testWidgetIterator(self): - treeWidget = QTreeWidget() - treeWidget.setColumnCount(1) - items = [] - for i in range(10): - items.append(QTreeWidgetItem(None, ['item: %d' % i])) - treeWidget.insertTopLevelItems(0, items) - - index = 0 - for it in QTreeWidgetItemIterator(treeWidget): - self.assertEqual(it.value().text(0), 'item: %d' % index) - index += 1 - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_785.py b/sources/pyside2/tests/QtWidgets/bug_785.py deleted file mode 100644 index 312b17996..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_785.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys - -import unittest -from PySide2.QtCore import QItemSelection -from PySide2.QtGui import QStandardItemModel, QStandardItem -from PySide2.QtWidgets import QApplication -class Bug324(unittest.TestCase): - def testOperators(self): - model = QStandardItemModel() - for i in range(100): - model.appendRow(QStandardItem("Item: %d"%i)) - - first = model.index(0, 0) - second = model.index(10, 0) - third = model.index(20, 0) - fourth = model.index(30, 0) - - sel = QItemSelection(first, second) - sel2 = QItemSelection() - sel2.select(third, fourth) - - sel3 = sel + sel2 #check operator + - self.assertEqual(len(sel3), 2) - sel4 = sel - sel4 += sel2 #check operator += - self.assertEqual(len(sel4), 2) - self.assertEqual(sel4, sel3) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_793.py b/sources/pyside2/tests/QtWidgets/bug_793.py deleted file mode 100644 index 3d63cae2e..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_793.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys -from PySide2.QtCore import QTimer -from PySide2.QtWidgets import QWidget, QApplication - -class TestW1(QWidget): - def __init__(self, parent = None): - super(TestW1, self).__init__(parent) - TestW2(parent, self) - -class TestW2(QWidget): - def __init__(self, ancestor, parent = None): - super(TestW2, self).__init__(parent) - self.ancestor_ref = ancestor - -class Test(QWidget): - def __init__(self): - super(Test, self).__init__() - TestW1(self) - -class TestQApplicationDestrcutor(unittest.TestCase): - def testDestructor(self): - w = Test() - w.show() - QTimer.singleShot(0, w.close) - -if __name__ == '__main__': - app = QApplication(sys.argv) - unittest.main() - sys.exit(app.exec_()) diff --git a/sources/pyside2/tests/QtWidgets/bug_811.py b/sources/pyside2/tests/QtWidgets/bug_811.py deleted file mode 100644 index 4715c1a97..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_811.py +++ /dev/null @@ -1,61 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys -import weakref - -from helper import UsesQApplication - -from PySide2.QtGui import QTextBlockUserData, QTextCursor -from PySide2.QtWidgets import QTextEdit - -class TestUserData(QTextBlockUserData): - def __init__(self, data): - super(TestUserData, self).__init__() - self.data = data - -class TestUserDataRefCount(UsesQApplication): - def testRefcount(self): - textedit = QTextEdit() - textedit.setReadOnly(True) - doc = textedit.document() - cursor = QTextCursor(doc) - cursor.insertText("PySide Rocks") - ud = TestUserData({"Life": 42}) - self.assertEqual(sys.getrefcount(ud), 2) - cursor.block().setUserData(ud) - self.assertEqual(sys.getrefcount(ud), 3) - ud2 = cursor.block().userData() - self.assertEqual(sys.getrefcount(ud), 4) - self.udata = weakref.ref(ud, None) - del ud, ud2 - self.assertEqual(sys.getrefcount(self.udata()), 2) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_834.py b/sources/pyside2/tests/QtWidgets/bug_834.py deleted file mode 100644 index 129da321c..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_834.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2 import QtCore, QtWidgets - -class Window(QtWidgets.QMainWindow): - def childEvent(self, event): - super(Window, self).childEvent(event) - -app = QtWidgets.QApplication([]) -window = Window() - -dock1 = QtWidgets.QDockWidget() -dock2 = QtWidgets.QDockWidget() -window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock1) -window.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock2) -window.tabifyDockWidget(dock1, dock2) - -window.show() -QtCore.QTimer.singleShot(0, window.close) -app.exec_() diff --git a/sources/pyside2/tests/QtWidgets/bug_836.py b/sources/pyside2/tests/QtWidgets/bug_836.py deleted file mode 100644 index 69e23e2dc..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_836.py +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class Mixin1(object): - pass - -class Mixin2(object): - pass - -class Mixin3(object): - pass - -class MainWindow(Mixin1, Mixin2, Mixin3, QFrame): - def __init__(self): - super(MainWindow, self).__init__() - -def main(): - app = QApplication([]) - # if it doesn't crash it should pass - w = MainWindow() - w.show() - QTimer.singleShot(0, w.close) - app.exec_() - -if __name__ == "__main__": - main() - - diff --git a/sources/pyside2/tests/QtWidgets/bug_844.py b/sources/pyside2/tests/QtWidgets/bug_844.py deleted file mode 100644 index 822863294..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_844.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import * -from PySide2.QtCore import * - -class QtKeyPressListener(QObject): - def __init__(self, obj): - QObject.__init__(self) - obj.installEventFilter(self) - - def eventFilter(self, obj, event): - # This used to crash here due to a misbehaviour of type discovery! - return QObject.eventFilter(self, obj, event) - -app = QApplication([]) -key_listener = QtKeyPressListener(app) -w = QLabel('Hello') -w.show() -QTimer.singleShot(0, w.close) -app.exec_() diff --git a/sources/pyside2/tests/QtWidgets/bug_854.py b/sources/pyside2/tests/QtWidgets/bug_854.py deleted file mode 100644 index 080faf3c5..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_854.py +++ /dev/null @@ -1,68 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import QTableView, QVBoxLayout, QApplication -from PySide2.QtCore import QAbstractItemModel - -from helper import UsesQApplication -import unittest - - -class VirtualList(QAbstractItemModel): - def __getitem__(self, index): - self._getItemCalled = True - pass - - def rowCount(self, parent): - return 5000 - - def columnCount(self, parent): - return 3 - - def index(self, row, column, parent): - return self.createIndex(row, column) - - def parent(self, index): - return QModelIndex() - - def data(self, index, role): - return "(%i, %i)" % (index.row(), index.column()) - - -class TestQAbstractItemModel(UsesQApplication): - def testSetModel(self): - model = VirtualList() - model._getItemCalled = False - table = QTableView() - table.setModel(model) - table.show() - self.assertFalse(model._getItemCalled) - -if __name__ == "__main__": - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_860.py b/sources/pyside2/tests/QtWidgets/bug_860.py deleted file mode 100644 index 6cacfb21f..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_860.py +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -import unittest - -from PySide2.QtCore import QSignalMapper -from PySide2.QtWidgets import QCheckBox - -from helper import UsesQApplication - -class MultipleSlotTest(UsesQApplication): - def cb_changed(self, i): - self._changed = True - - def cb_changedVoid(self): - self._changed = True - - def testSignalMapper(self): - checkboxMapper = QSignalMapper() - box = QCheckBox('check me') - box.stateChanged.connect(checkboxMapper.map) - - checkboxMapper.setMapping(box, box.text()) - checkboxMapper.mapped[str].connect(self.cb_changed) - self._changed = False - box.setChecked(True) - self.assertTrue(self._changed) - - def testSimpleSignal(self): - box = QCheckBox('check me') - box.stateChanged[int].connect(self.cb_changedVoid) - self._changed = False - box.setChecked(True) - self.assertTrue(self._changed) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_862.py b/sources/pyside2/tests/QtWidgets/bug_862.py deleted file mode 100644 index ac0325536..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_862.py +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtCore import QObject -from PySide2.QtWidgets import * -import PySide2.QtCore -import unittest - -class MyQObject(QObject): - def __init__(self): - QObject.__init__(self) - -class MyQWidget(QWidget): - def __init__(self): - QWidget.__init__(self) - -class MyQGraphicsObject(QGraphicsObject): - def __init__(self): - QGraphicsObject.__init__(self) - -class MyQGraphicsItem(QGraphicsItem): - def __init__(self): - QGraphicsItem.__init__(self) - -class TestRepr (unittest.TestCase): - - def testIt(self): - - app = QApplication([]) - - self.assertEqual("<__main__.MyQObject object at ", repr(MyQObject())[:30]) - self.assertEqual("<__main__.MyQWidget object at ", repr(MyQWidget())[:30]) - self.assertEqual("<__main__.MyQGraphicsObject(0x", repr(MyQGraphicsObject())[:30]) - self.assertEqual("<__main__.MyQGraphicsItem(0x", repr(MyQGraphicsItem())[:28]) - - self.assertEqual("<PySide2.QtCore.QObject object at ", repr(QObject())[:34]) - self.assertEqual("<PySide2.QtCore.QObject object at ", repr(PySide2.QtCore.QObject())[:34]) - self.assertEqual("<PySide2.QtWidgets.QWidget object at ", repr(QWidget())[:37]) - self.assertEqual("<PySide2.QtWidgets.QGraphicsWidget(0x", repr(QGraphicsWidget())[:37]) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_871.py b/sources/pyside2/tests/QtWidgets/bug_871.py deleted file mode 100644 index 8905291ef..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_871.py +++ /dev/null @@ -1,70 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from helper import UsesQApplication -from PySide2.QtGui import QValidator, QIntValidator -from PySide2.QtWidgets import QLineEdit - -'''Bug #871 - http://bugs.pyside.org/show_bug.cgi?id=871''' - - -class BlankIntValidator(QIntValidator): - def validate(self,input,pos): - if input == '': - return QValidator.Acceptable, input, pos - else: - return QIntValidator.validate(self,input,pos) - - -class Bug871Test(UsesQApplication): - def testWithoutValidator(self): - edit = QLineEdit() - self.assertEqual(edit.text(), '') - edit.insert('1') - self.assertEqual(edit.text(), '1') - edit.insert('a') - self.assertEqual(edit.text(), '1a') - edit.insert('2') - self.assertEqual(edit.text(), '1a2') - - def testWithIntValidator(self): - edit = QLineEdit() - edit.setValidator(BlankIntValidator(edit)) - self.assertEqual(edit.text(), '') - edit.insert('1') - self.assertEqual(edit.text(), '1') - edit.insert('a') - self.assertEqual(edit.text(), '1') - edit.insert('2') - self.assertEqual(edit.text(), '12') - - -if __name__ == "__main__": - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/bug_879.py b/sources/pyside2/tests/QtWidgets/bug_879.py deleted file mode 100644 index 59eb979aa..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_879.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtCore import QCoreApplication, QTimer, QEvent, Qt -from PySide2.QtWidgets import QApplication, QSpinBox -from PySide2.QtGui import QKeyEvent - -class MySpinBox(QSpinBox): - - def validate(self,text,pos): - return QSpinBox.validate(self,text,pos) - -class TestBug879 (unittest.TestCase): - - def testIt(self): - app = QApplication([]) - self.box = MySpinBox() - self.box.show() - - QTimer.singleShot(0, self.sendKbdEvent) - QTimer.singleShot(100, app.quit) - app.exec_() - - self.assertEqual(self.box.text(), '0') - - def sendKbdEvent(self): - ev = QKeyEvent(QEvent.KeyPress, Qt.Key_A, Qt.NoModifier, 'a') - QCoreApplication.sendEvent(self.box, ev) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_919.py b/sources/pyside2/tests/QtWidgets/bug_919.py deleted file mode 100644 index d1cd460ec..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_919.py +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import TimedQApplication -from PySide2.QtCore import Signal, QTimer -from PySide2.QtGui import QPainter -from PySide2.QtWidgets import QPushButton, QStyleOptionButton, QApplication, QStyle - -class MyWidget(QPushButton): - def __init__(self, parent = None): - QPushButton.__init__(self, parent) - self._painted = False - - def _emitPainted(self): - self.paintReceived.emit() - - def paintEvent(self, e): - p = QPainter(self) - style = QApplication.style() - option = QStyleOptionButton() - style.drawControl(QStyle.CE_PushButton, option, p) - self._painted = True - QTimer.singleShot(0, self._emitPainted) - - paintReceived = Signal() - -class TestBug919(TimedQApplication): - def setUp(self): - TimedQApplication.setUp(self, 2000) - - def testFontInfo(self): - w = MyWidget() - w.paintReceived.connect(self.app.quit) - w.show() - self.app.exec_() - self.assertTrue(w._painted) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_921.py b/sources/pyside2/tests/QtWidgets/bug_921.py deleted file mode 100644 index 3e24129d8..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_921.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2 import QtCore, QtWidgets - -from helper import TimedQApplication - -class Signaller(QtCore.QObject): - s1 = QtCore.Signal() - s2 = QtCore.Signal() - s3 = QtCore.Signal() - -class Window(object): - - def __init__(self, s): - self._window = QtWidgets.QMainWindow() - self._window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) - self._window.setWindowTitle("Demo!") - - self._s = s - self._s.s1.connect(self._on_signal) - self._s.s2.connect(self._on_signal) - - def show(self): - self._window.show() - - def _on_signal(self): - self._window.setWindowTitle("Signaled!") - -class TestTimedApp(TimedQApplication): - def testSignals(self): - s = Signaller() - w = Window(s) - w.show() - - def midleFunction(): - def internalFunction(): - pass - s.s3.connect(internalFunction) - - midleFunction() - self.app.exec_() - del w - - s.s1.emit() - s.s2.emit() - s.s3.emit() - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_941.py b/sources/pyside2/tests/QtWidgets/bug_941.py deleted file mode 100644 index 562be9a3b..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_941.py +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -def foo(a, b): - pass - -class TestBug941 (unittest.TestCase): - - def testIt(self): - app = QApplication([]) - view = QHeaderView(Qt.Horizontal) - self.assertTrue(view.sortIndicatorChanged.connect(foo)) - view.sortIndicatorChanged.emit(0, Qt.Vertical) # this can't raise an exception! - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_964.py b/sources/pyside2/tests/QtWidgets/bug_964.py deleted file mode 100644 index 9c7af6c53..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_964.py +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtCore import * -from PySide2.QtGui import * -from PySide2.QtWidgets import * - -class TestBug964 (unittest.TestCase): - - def testIt(self): - app = QApplication([]) - model = QStringListModel(["1", "2"]) - view = QListView() - view.setModel(model) - view.setCurrentIndex(model.index(0,0)) - newCursor = view.moveCursor(QAbstractItemView.MoveDown, Qt.NoModifier) - self.assertEqual(newCursor.row(), 1) - self.assertEqual(newCursor.column(), 0) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_967.py b/sources/pyside2/tests/QtWidgets/bug_967.py deleted file mode 100644 index 643041100..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_967.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import * - -class TestBug967 (unittest.TestCase): - - def callback(self, arg): - self.arg = arg - - def testIt(self): - self.arg = None - app = QApplication([]) - obj = QComboBox() - obj.currentIndexChanged.connect(self.callback) - obj.currentIndexChanged.emit(5) - self.assertEqual(self.arg, 5) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_972.py b/sources/pyside2/tests/QtWidgets/bug_972.py deleted file mode 100644 index adc472403..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_972.py +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtCore import QSizeF -from PySide2.QtWidgets import QGraphicsProxyWidget, QSizePolicy, QPushButton, QGraphicsScene, QGraphicsView - -from helper import TimedQApplication - -def createItem(minimum, preferred, maximum, name): - w = QGraphicsProxyWidget() - - w.setWidget(QPushButton(name)) - w.setMinimumSize(minimum) - w.setPreferredSize(preferred) - w.setMaximumSize(maximum) - w.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) - - return w - -class TestBug972 (TimedQApplication): - - # Test if the function QGraphicsProxyWidget.setWidget have the correct behavior - def testIt(self): - scene = QGraphicsScene() - - minSize = QSizeF(30, 100) - prefSize = QSizeF(210, 100) - maxSize = QSizeF(300, 100) - - a = createItem(minSize, prefSize, maxSize, "A") - b = createItem(minSize, prefSize, maxSize, "B") - c = createItem(minSize, prefSize, maxSize, "C") - d = createItem(minSize, prefSize, maxSize, "D") - - view = QGraphicsView(scene) - view.show() - self.app.exec_() - - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_979.py b/sources/pyside2/tests/QtWidgets/bug_979.py deleted file mode 100644 index 4bc0c966e..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_979.py +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import QDialog -from import_test import PysideImportTest2 - -class PysideImportTest1(QDialog, PysideImportTest2): - pass - -if __name__ == '__main__': - quit() - diff --git a/sources/pyside2/tests/QtWidgets/bug_988.py b/sources/pyside2/tests/QtWidgets/bug_988.py deleted file mode 100644 index e74edac82..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_988.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import * - -class TestBug988 (unittest.TestCase): - - def callback(self, arg): - self.arg = arg - - def testIt(self): - self.arg = None - app = QApplication([]) - obj = QTabWidget() - obj.currentChanged.connect(self.callback) - obj.currentChanged.emit(5) - self.assertEqual(self.arg, 5) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/bug_998.py b/sources/pyside2/tests/QtWidgets/bug_998.py deleted file mode 100644 index 8e0c96e5f..000000000 --- a/sources/pyside2/tests/QtWidgets/bug_998.py +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import QApplication - -class TestBug998 (unittest.TestCase): - def testNoFocusWindow(self): - widget = QApplication.focusWidget() - self.assertTrue(widget == None) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/customproxywidget_test.py b/sources/pyside2/tests/QtWidgets/customproxywidget_test.py deleted file mode 100644 index 183f33404..000000000 --- a/sources/pyside2/tests/QtWidgets/customproxywidget_test.py +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import UsesQApplication -from PySide2.QtCore import Qt, QTimer -from PySide2.QtGui import QPainter -from PySide2.QtWidgets import QLabel -from PySide2.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsProxyWidget - -class CustomProxy(QGraphicsProxyWidget): - def __init__(self, parent=None, wFlags=0): - QGraphicsProxyWidget.__init__(self, parent, wFlags) - -class CustomProxyWidgetTest(UsesQApplication): - def testCustomProxyWidget(self): - scene = QGraphicsScene() - - proxy = CustomProxy(None, Qt.Window) - widget = QLabel('Widget') - proxy.setWidget(widget) - proxy.setCacheMode(QGraphicsItem.DeviceCoordinateCache) - scene.addItem(proxy) - scene.setSceneRect(scene.itemsBoundingRect()) - - view = QGraphicsView(scene) - view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform) - view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate) - view.show() - - timer = QTimer.singleShot(100, self.app.quit) - self.app.exec_() - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/event_filter_test.py b/sources/pyside2/tests/QtWidgets/event_filter_test.py deleted file mode 100644 index 30ba91ec4..000000000 --- a/sources/pyside2/tests/QtWidgets/event_filter_test.py +++ /dev/null @@ -1,67 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys - -from helper import UsesQApplication -from PySide2.QtCore import QObject, QEvent -from PySide2.QtWidgets import QWidget - -class MyFilter(QObject): - def eventFilter(self, obj, event): - if event.type() == QEvent.KeyPress: - pass - return QObject.eventFilter(self, obj, event) - - -class EventFilter(UsesQApplication): - def testRefCount(self): - o = QObject() - filt = MyFilter() - o.installEventFilter(filt) - self.assertEqual(sys.getrefcount(o), 2) - - o.installEventFilter(filt) - self.assertEqual(sys.getrefcount(o), 2) - - o.removeEventFilter(filt) - self.assertEqual(sys.getrefcount(o), 2) - - def testObjectDestructorOrder(self): - w = QWidget() - filt = MyFilter() - filt.app = self.app - w.installEventFilter(filt) - w.show() - w.close() - w = None - self.assertTrue(True) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/grandparent_method_test.py b/sources/pyside2/tests/QtWidgets/grandparent_method_test.py deleted file mode 100644 index a4ad1f5e4..000000000 --- a/sources/pyside2/tests/QtWidgets/grandparent_method_test.py +++ /dev/null @@ -1,50 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Tests for calling methods further than the direct parent''' - -import unittest - -from PySide2.QtWidgets import QPushButton, QWidget - -from helper import UsesQApplication - -class Dummy(QPushButton): - - def show(self): - QWidget.show(self) - self.called = True - -class GrandParentMethod(UsesQApplication): - def testMethod(self): - obj = Dummy() - obj.show() - self.assertTrue(obj.called) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/hashabletype_test.py b/sources/pyside2/tests/QtWidgets/hashabletype_test.py deleted file mode 100644 index c8ee3947d..000000000 --- a/sources/pyside2/tests/QtWidgets/hashabletype_test.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for __hash__''' - -import unittest - -from PySide2.QtWidgets import QTreeWidgetItem -from helper import UsesQApplication - -class HashableTest(UsesQApplication): - - def testQTreeWidgetItemHash(self): - h = {} - obj = QTreeWidgetItem() - h[obj] = 2 - self.assertTrue(h.get(obj), 2) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/import_test.py b/sources/pyside2/tests/QtWidgets/import_test.py deleted file mode 100644 index 0b60241f0..000000000 --- a/sources/pyside2/tests/QtWidgets/import_test.py +++ /dev/null @@ -1,2 +0,0 @@ -class PysideImportTest2(object): - pass diff --git a/sources/pyside2/tests/QtWidgets/keep_reference_test.py b/sources/pyside2/tests/QtWidgets/keep_reference_test.py deleted file mode 100644 index 094e4231c..000000000 --- a/sources/pyside2/tests/QtWidgets/keep_reference_test.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from sys import getrefcount -from helper import UsesQApplication -from PySide2.QtCore import * -from PySide2.QtWidgets import QTableView - -class TestModel(QAbstractTableModel): - def __init__(self, parent=None): - QAbstractTableModel.__init__(self, parent) - def rowCount(self, parent): - return 0 - def columnCount(self, parent): - return 0 - def data(self, index, role): - return None - -class KeepReferenceTest(UsesQApplication): - - def testModelWithoutParent(self): - view = QTableView() - model = TestModel() - view.setModel(model) - samemodel = view.model() - self.assertEqual(model, samemodel) - - def testModelWithParent(self): - view = QTableView() - model = TestModel(None) - view.setModel(model) - samemodel = view.model() - self.assertEqual(model, samemodel) - - def testReferenceCounting(self): - '''Tests reference count of model object referred by view objects.''' - model1 = TestModel() - refcount1 = getrefcount(model1) - view1 = QTableView() - view1.setModel(model1) - self.assertEqual(getrefcount(view1.model()), refcount1 + 1) - - view2 = QTableView() - view2.setModel(model1) - self.assertEqual(getrefcount(view2.model()), refcount1 + 2) - - model2 = TestModel() - view2.setModel(model2) - self.assertEqual(getrefcount(view1.model()), refcount1 + 1) - - def testReferenceCountingWhenDeletingReferrer(self): - '''Tests reference count of model object referred by deceased view object.''' - model = TestModel() - refcount1 = getrefcount(model) - view = QTableView() - view.setModel(model) - self.assertEqual(getrefcount(view.model()), refcount1 + 1) - - del view - self.assertEqual(getrefcount(model), refcount1) - - def testReferreedObjectSurvivalAfterContextEnd(self): - '''Model object assigned to a view object must survive after getting out of context.''' - def createModelAndSetToView(view): - model = TestModel() - model.setObjectName('created model') - view.setModel(model) - view = QTableView() - createModelAndSetToView(view) - model = view.model() - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/missing_symbols_test.py b/sources/pyside2/tests/QtWidgets/missing_symbols_test.py deleted file mode 100644 index de243c4b2..000000000 --- a/sources/pyside2/tests/QtWidgets/missing_symbols_test.py +++ /dev/null @@ -1,57 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''(Very) Simple test case for missing names from QtGui and QtWidgets''' - -import unittest -from PySide2 import QtGui -from PySide2 import QtWidgets - -class MissingClasses(unittest.TestCase): - def testQDrag(self): # Bug 222 - getattr(QtGui, 'QDrag') - - def testQDropEvent(self): # Bug 255 - getattr(QtGui, 'QDropEvent') - -class MissingMembers(unittest.TestCase): - - def testQFontMetricsSize(self): # Bug 223 - QtGui.QFontMetrics.size - - def testQLayoutSetSpacing(self): # Bug 231 - QtWidgets.QLayout.setSpacing - - def testQImageLoad(self): # Bug 257 - QtGui.QImage.load - - def testQStandardItemModelinsertRow(self): # Bug 227 - QtGui.QStandardItemModel.insertRow - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/paint_event_test.py b/sources/pyside2/tests/QtWidgets/paint_event_test.py deleted file mode 100644 index 6f1b75f2f..000000000 --- a/sources/pyside2/tests/QtWidgets/paint_event_test.py +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test paint event override in python''' - -import unittest - -from PySide2.QtCore import QTimerEvent -from PySide2.QtWidgets import QApplication, QWidget - -from helper import UsesQApplication - -class MyWidget(QWidget): - '''Sample widget''' - - def __init__(self, app=None): - #Creates a new widget - if app is None: - app = QApplication([]) - - super(MyWidget, self).__init__() - self.app = app - self.runs = 0 - self.max_runs = 5 - self.paint_event_called = False - - def timerEvent(self, event): - #Timer event method - self.runs += 1 - - if self.runs == self.max_runs: - self.app.quit() - - if not isinstance(event, QTimerEvent): - raise TypeError('Invalid event type. Must be QTimerEvent') - - def paintEvent(self, event): - #Empty paint event method - # XXX: should be using super here, but somehow PyQt4 - # complains about paintEvent not present in super - QWidget.paintEvent(self, event) - self.paint_event_called = True - - -class PaintEventOverride(UsesQApplication): - '''Test case for overriding QWidget.paintEvent''' - - qapplication = True - - def setUp(self): - #Acquire resources - super(PaintEventOverride, self).setUp() - self.widget = MyWidget(self.app) - - def tearDown(self): - #Release resources - del self.widget - super(PaintEventOverride, self).tearDown() - - def testPaintEvent(self): - #Test QWidget.paintEvent override - timer_id = self.widget.startTimer(100) - self.widget.show() - self.app.exec_() - - self.widget.killTimer(timer_id) - - self.assertTrue(self.widget.paint_event_called) - self.assertEqual(self.widget.runs, 5) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/parent_method_test.py b/sources/pyside2/tests/QtWidgets/parent_method_test.py deleted file mode 100644 index 65a8d713d..000000000 --- a/sources/pyside2/tests/QtWidgets/parent_method_test.py +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtCore import QObject, QTimer, QThread -from PySide2.QtWidgets import * - -class Foo(QTableView): - def __init__(self, parent=None): - QTableView.__init__(self, parent) - -from helper import UsesQApplication - -class TestParentType(UsesQApplication): - - def testParentType(self): - # Test the problem with calling QObject.parent from a QWidget - # when the parent is a python class derived from a QWidget-derived - # class. The method was returning the last C++ class in the hierarchy - parent = Foo() - w2 = QWidget(parent) - self.assertTrue(isinstance(w2.parentWidget(), Foo)) - self.assertTrue(isinstance(w2.parent(), Foo)) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/private_mangle_test.py b/sources/pyside2/tests/QtWidgets/private_mangle_test.py deleted file mode 100644 index 31a870691..000000000 --- a/sources/pyside2/tests/QtWidgets/private_mangle_test.py +++ /dev/null @@ -1,121 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of Qt for Python. -## -## $QT_BEGIN_LICENSE:LGPL$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 3 as published by the Free Software -## Foundation and appearing in the file LICENSE.LGPL3 included in the -## packaging of this file. Please review the following information to -## ensure the GNU Lesser General Public License version 3 requirements -## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 2.0 or (at your option) the GNU General -## Public license version 3 or any later version approved by the KDE Free -## Qt Foundation. The licenses are as published by the Free Software -## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-2.0.html and -## https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -""" -This is the example from https://bugreports.qt.io/browse/PYSIDE-772 -with no interaction as a unittest. -""" - -import unittest -from PySide2.QtCore import Signal -from PySide2.QtWidgets import QApplication, QWidget -from PySide2 import QtWidgets - -class Harness(QWidget): - clicked = Signal() - - def __init__(self): - QWidget.__init__(self) - self.clicked.connect(self.method) - self.clicked.connect(self._method) - self.clicked.connect(self.__method) - - def method(self): # Public method - self.method_result = self.sender() - - def _method(self): # Private method - self.method__result = self.sender() - - def __method(self): # Name mangled method - self.method___result = self.sender() - - -class _Under(QWidget): - clicked = Signal() - - def __init__(self): - QWidget.__init__(self) - self.clicked.connect(self.method) - self.clicked.connect(self._method) - self.clicked.connect(self.__method) - - def method(self): # Public method - self.method_result = self.sender() - - def _method(self): # Private method - self.method__result = self.sender() - - def __method(self): # Name mangled method - self.method___result = self.sender() - - -class TestMangle(unittest.TestCase): - - def setUp(self): - QApplication() - - def tearDown(self): - del QtWidgets.qApp - - def testPrivateMangle(self): - harness = Harness() - harness.clicked.emit() - self.assertEqual(harness.method_result, harness) - self.assertEqual(harness.method__result, harness) - self.assertEqual(harness.method___result, harness) - self.assertTrue("method" in type(harness).__dict__) - self.assertTrue("_method" in type(harness).__dict__) - self.assertFalse("__method" in type(harness).__dict__) - self.assertTrue("_Harness__method" in type(harness).__dict__) - - def testPrivateMangleUnder(self): - harness = _Under() - harness.clicked.emit() - self.assertEqual(harness.method_result, harness) - self.assertEqual(harness.method__result, harness) - self.assertEqual(harness.method___result, harness) - # make sure that we skipped over the underscore in "_Under" - self.assertTrue("method" in type(harness).__dict__) - self.assertTrue("_method" in type(harness).__dict__) - self.assertFalse("__method" in type(harness).__dict__) - self.assertTrue("_Under__method" in type(harness).__dict__) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/python_properties_test.py b/sources/pyside2/tests/QtWidgets/python_properties_test.py deleted file mode 100644 index f4e46f2bd..000000000 --- a/sources/pyside2/tests/QtWidgets/python_properties_test.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2 import QtCore, QtWidgets - -class Properties(unittest.TestCase): - - def testStaticProperty(self): - self.assertEqual(QtWidgets.QGraphicsItem.UserType, 65536) - - def testInstanceProperty(self): - p = QtWidgets.QStyleOptionViewItem() - self.assertTrue(isinstance(p.locale, QtCore.QLocale)) - - # PSYIDE-304, can assign to a "const QWidget *" field - p.widget = None - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py deleted file mode 100644 index c253ee7d4..000000000 --- a/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py +++ /dev/null @@ -1,75 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import py3kcompat as py3k - -from PySide2.QtCore import QSizeF, QTimer -from PySide2.QtGui import QTextFormat, QTextCharFormat, QPyTextObject -from PySide2.QtWidgets import QTextEdit -from helper import UsesQApplication - -class Foo(QPyTextObject): - called = False - - def intrinsicSize(self, doc, posInDocument, format): - Foo.called = True - return QSizeF(10, 10) - - def drawObject(self, painter, rect, doc, posInDocument, format): - pass - -class QAbstractTextDocumentLayoutTest(UsesQApplication): - - objectType = QTextFormat.UserObject + 1 - - def foo(self): - fmt = QTextCharFormat() - fmt.setObjectType(QAbstractTextDocumentLayoutTest.objectType) - - cursor = self.textEdit.textCursor() - cursor.insertText(py3k.unichr(0xfffc), fmt) - self.textEdit.setTextCursor(cursor) - self.textEdit.close() - - def testIt(self): - - self.textEdit = QTextEdit() - self.textEdit.show() - - interface = Foo() - self.textEdit.document().documentLayout().registerHandler(QAbstractTextDocumentLayoutTest.objectType, interface) - - QTimer.singleShot(0, self.foo) - self.app.exec_() - - self.assertTrue(Foo.called) - -if __name__ == "__main__": - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qaction_test.py b/sources/pyside2/tests/QtWidgets/qaction_test.py deleted file mode 100644 index 7e391c5f7..000000000 --- a/sources/pyside2/tests/QtWidgets/qaction_test.py +++ /dev/null @@ -1,69 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QAction, QWidget -from helper import UsesQApplication - -class QPainterDrawText(UsesQApplication): - - def _cb(self): - self._called = True - - def testSignal(self): - o = QWidget() - act = QAction(o) - self._called = False - act.triggered.connect(self._cb) - act.trigger() - self.assertTrue(self._called) - - def testNewCtor(self): - o = QWidget() - self._called = False - myAction = QAction("&Quit", o, triggered=self._cb) - myAction.trigger() - self.assertTrue(self._called) - - -class SetShortcutTest(UsesQApplication): - - def testSetShortcut(self): - # Somehow an exception was leaking from the constructor - # and appearing in setShortcut. - o = QWidget() - action = QAction('aaaa', o) - shortcut = 'Ctrl+N' - action.setShortcut(shortcut) - s2 = action.shortcut() - self.assertEqual(s2, shortcut) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qapp_issue_585.py b/sources/pyside2/tests/QtWidgets/qapp_issue_585.py deleted file mode 100644 index f124ee6a6..000000000 --- a/sources/pyside2/tests/QtWidgets/qapp_issue_585.py +++ /dev/null @@ -1,68 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -""" -The bug was caused by this commit: -"Support the qApp macro correctly, final version incl. debug" -e30e0c161b2b4d50484314bf006e9e5e8ff6b380 -2017-10-27 - -The bug was first solved by this commit: -"Fix qApp macro refcount" -b811c874dedd14fd8b072bc73761d39255216073 -2018-03-21 - -This test triggers the refcounting bug of qApp, issue PYSIDE-585. -Finally, the real patch included more changes, because another error -was in the ordering of shutdown calls. It was found using the following -Python configuration: - - In Python 3.6 create a directory 'debug' and cd into it. - - ../configure --with-pydebug --prefix=$HOME/pydebug/ --enable-shared - -Then a lot more refcounting errors show up, which are due to a bug in -the code position of the shutdown procedure. -The reason for the initial refcount bug was that the shutdown code is once -more often called than the creation of the qApp wrapper. -Finally, it was easiest and more intuitive to simply make the refcount of -qApp_content equal to that of Py_None, which is also not supposed to be -garbage-collected. - -For some reason, the test does not work as a unittest because it creates -no crash. We leave it this way. -""" - -from PySide2.QtCore import QTimer -from PySide2 import QtWidgets - -app_instance = QtWidgets.QApplication([]) -# If the following line is commented, application doesn't crash on exit anymore. -app_instance2 = app_instance -QTimer.singleShot(0, qApp.quit) -app_instance.exec_() diff --git a/sources/pyside2/tests/QtWidgets/qapp_test.py b/sources/pyside2/tests/QtWidgets/qapp_test.py deleted file mode 100644 index 0bd919318..000000000 --- a/sources/pyside2/tests/QtWidgets/qapp_test.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test the presence of qApp Macro''' - -import unittest - -from PySide2.QtWidgets import * - -class QAppPresence(unittest.TestCase): - - def testQApp(self): - #QtGui.qApp variable is instance of QApplication - self.assertTrue(isinstance(qApp, QApplication)) - -def main(): - app = QApplication([]) - unittest.main() - -if __name__ == '__main__': - main() diff --git a/sources/pyside2/tests/QtWidgets/qapplication_exit_segfault_test.py b/sources/pyside2/tests/QtWidgets/qapplication_exit_segfault_test.py deleted file mode 100644 index f74ced668..000000000 --- a/sources/pyside2/tests/QtWidgets/qapplication_exit_segfault_test.py +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys - -from PySide2.QtWidgets import QApplication, QPushButton, QWidget, QSpinBox - -class QApplicationDelete(unittest.TestCase): - '''Test for segfault when deleting a QApplication before a QWidget''' - - def testQPushButton(self): - #QApplication deleted before QPushButton - a = QApplication([]) - b = QPushButton('aaaa') - del a - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qapplication_singleton_test.py b/sources/pyside2/tests/QtWidgets/qapplication_singleton_test.py deleted file mode 100644 index e79e303f0..000000000 --- a/sources/pyside2/tests/QtWidgets/qapplication_singleton_test.py +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QApplication - -class TestSingleton(unittest.TestCase): - def testBasic(self): - a = QApplication([]) - self.assertRaises(RuntimeError, QApplication, []) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qapplication_test.py b/sources/pyside2/tests/QtWidgets/qapplication_test.py deleted file mode 100644 index b29aba6ac..000000000 --- a/sources/pyside2/tests/QtWidgets/qapplication_test.py +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QApplication - -class TestQApplication(unittest.TestCase): - def testNoArguments(self): - app = QApplication() - self.assertIsInstance(app, QApplication) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qbrush_test.py b/sources/pyside2/tests/QtWidgets/qbrush_test.py deleted file mode 100644 index 7c49e9b86..000000000 --- a/sources/pyside2/tests/QtWidgets/qbrush_test.py +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QBrush''' - -import unittest - -from PySide2.QtCore import Qt -from PySide2.QtGui import QColor, QBrush -from PySide2.QtWidgets import QApplication - -from helper import UsesQApplication - -class Constructor(UsesQApplication): - '''Test case for constructor of QBrush''' - - def testQColor(self): - #QBrush(QColor) constructor - color = QColor('black') - obj = QBrush(color) - self.assertEqual(obj.color(), color) - - obj = QBrush(Qt.blue) - self.assertEqual(obj.color(), Qt.blue) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qcolormap_test.py b/sources/pyside2/tests/QtWidgets/qcolormap_test.py deleted file mode 100644 index 12c624c35..000000000 --- a/sources/pyside2/tests/QtWidgets/qcolormap_test.py +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QColormap -from helper import UsesQApplication - - -class QColormapTest(UsesQApplication): - - def testQColormap(self): - qc = QColormap.instance() - self.assertEqual(qc.size(), -1) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qdynamic_signal.py b/sources/pyside2/tests/QtWidgets/qdynamic_signal.py deleted file mode 100644 index b8ea7af3f..000000000 --- a/sources/pyside2/tests/QtWidgets/qdynamic_signal.py +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtCore import QObject -from PySide2.QtWidgets import QInputDialog - -from helper import UsesQApplication - -class DynamicSignalTest(UsesQApplication): - - def cb(self, obj): - self._called = True - - def testQDialog(self): - dlg = QInputDialog() - dlg.setInputMode(QInputDialog.TextInput) - lst = dlg.children() - self.assertTrue(len(lst)) - obj = lst[0] - self._called = False - obj.destroyed[QObject].connect(self.cb) - obj = None - del dlg - self.assertTrue(self._called) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qfontdialog_test.py b/sources/pyside2/tests/QtWidgets/qfontdialog_test.py deleted file mode 100644 index 09e9b7173..000000000 --- a/sources/pyside2/tests/QtWidgets/qfontdialog_test.py +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys - -from PySide2 import QtCore -from PySide2 import QtGui -from PySide2 import QtWidgets - -from helper import TimedQApplication - -class TestFontDialog(TimedQApplication): - - def testGetFont(self): - QtWidgets.QFontDialog.getFont() - - def testGetFontQDialog(self): - QtWidgets.QFontDialog.getFont(QtGui.QFont("FreeSans",10)) - - def testGetFontQDialogQString(self): - QtWidgets.QFontDialog.getFont(QtGui.QFont("FreeSans",10), None, "Select font") - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qformlayout_test.py b/sources/pyside2/tests/QtWidgets/qformlayout_test.py deleted file mode 100644 index f42a75cee..000000000 --- a/sources/pyside2/tests/QtWidgets/qformlayout_test.py +++ /dev/null @@ -1,84 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import QFormLayout, QWidget - -from helper import UsesQApplication - -class QFormLayoutTest(UsesQApplication): - - def testGetItemPosition(self): - formlayout = QFormLayout() - row, role = formlayout.getItemPosition(0) - self.assertTrue(isinstance(row, int)) - self.assertTrue(isinstance(role, QFormLayout.ItemRole)) - self.assertEqual(row, -1) - - widget = QWidget() - formlayout.addRow(widget) - row, role = formlayout.getItemPosition(0) - self.assertTrue(isinstance(row, int)) - self.assertTrue(isinstance(role, QFormLayout.ItemRole)) - self.assertEqual(row, 0) - self.assertEqual(role, QFormLayout.SpanningRole) - - def testGetWidgetPosition(self): - formlayout = QFormLayout() - widget = QWidget() - row, role = formlayout.getWidgetPosition(widget) - self.assertTrue(isinstance(row, int)) - self.assertTrue(isinstance(role, QFormLayout.ItemRole)) - self.assertEqual(row, -1) - - formlayout.addRow(widget) - row, role = formlayout.getWidgetPosition(widget) - self.assertTrue(isinstance(row, int)) - self.assertTrue(isinstance(role, QFormLayout.ItemRole)) - self.assertEqual(row, 0) - self.assertEqual(role, QFormLayout.SpanningRole) - - def testGetLayoutPosition(self): - formlayout = QFormLayout() - layout = QFormLayout() - row, role = formlayout.getLayoutPosition(layout) - self.assertTrue(isinstance(row, int)) - self.assertTrue(isinstance(role, QFormLayout.ItemRole)) - self.assertEqual(row, -1) - - formlayout.addRow(layout) - row, role = formlayout.getLayoutPosition(layout) - self.assertTrue(isinstance(row, int)) - self.assertTrue(isinstance(role, QFormLayout.ItemRole)) - self.assertEqual(row, 0) - self.assertEqual(role, QFormLayout.SpanningRole) - - -if __name__ == "__main__": - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py deleted file mode 100644 index 345ea7c45..000000000 --- a/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2 import QtCore -from PySide2 import QtGui -from PySide2 import QtWidgets -from helper import UsesQApplication - -class Item(QtWidgets.QGraphicsItem): - - def __init__(self): - QtWidgets.QGraphicsItem.__init__(self) - - def boundingRect(self): - return QtCore.QRectF(0, 0, 100, 100) - - def paint(self, painter, option, widget): - painter.setBrush(QtGui.QColor(255, 255, 255)) - painter.drawRect(0, 0, 100, 100) - - -class QGraphicsViewIsBlockedTest(UsesQApplication): - - def testIsBlockedByModalPanel(self): - (first, second) = Item().isBlockedByModalPanel() - self.assertFalse(first) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsitem_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsitem_test.py deleted file mode 100644 index 8e9931d42..000000000 --- a/sources/pyside2/tests/QtWidgets/qgraphicsitem_test.py +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test cases related to QGraphicsItem and subclasses''' - -import unittest - -from PySide2.QtGui import QPolygonF, QColor, QBrush -from PySide2.QtWidgets import QGraphicsScene - -from helper import UsesQApplication - -class QColorOnSetBrush(UsesQApplication): - '''Test case for passing a QColor directly to setBrush''' - - def setUp(self): - #Acquire resources - super(QColorOnSetBrush, self).setUp() - - self.scene = QGraphicsScene() - poly = QPolygonF() - self.item = self.scene.addPolygon(poly) - self.color = QColor('black') - - def tearDown(self): - #Release resources - del self.color - del self.item - del self.scene - super(QColorOnSetBrush, self).tearDown() - - def testQColor(self): - #QGraphicsAbstractShapeItem.setBrush(QColor) - self.item.setBrush(self.color) - self.assertEqual(QBrush(self.color), self.item.brush()) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py deleted file mode 100644 index 97a8bc5b6..000000000 --- a/sources/pyside2/tests/QtWidgets/qgraphicsobjectreimpl_test.py +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test cases related to QGraphicsItem and subclasses''' - -import unittest - -from PySide2.QtWidgets import QGraphicsObject, QGraphicsWidget -from PySide2.QtCore import QRectF - -from helper import UsesQApplication - -class GObjA(QGraphicsObject): - def paint(self, *args): - pass - - def boundingRect(self): - return QRectF() - - def itemChange(self, *args): - return QGraphicsObject.itemChange(self, *args) - -class GObjB(QGraphicsObject): - def paint(self, *args): - pass - - def boundingRect(self): - return QRectF() - -class QGraphicsObjectReimpl(UsesQApplication): - '''Test case for reimplementing QGraphicsObject''' - - def testReimplementationTypes(self): - w = QGraphicsWidget() - - # PYSIDE-86: - # This case failed because GObjA was reimplementing - # the method itemChange() from QGraphicsItem, - # and then the QVariant was not associated with - # a QGraphicsItem but a QObjectItem because the base - # class was a QObject. - gobjA = GObjA() - gobjA.setParentItem(w) - self.assertIs(type(w), type(gobjA.parentItem())) - - gobjB = GObjB() - gobjB.setParentItem(w) - self.assertIs(type(w), type(gobjB.parentItem())) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsproxywidget_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsproxywidget_test.py deleted file mode 100644 index 0e5cd8bfe..000000000 --- a/sources/pyside2/tests/QtWidgets/qgraphicsproxywidget_test.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import UsesQApplication -from PySide2.QtCore import Qt, QTimer -from PySide2.QtGui import QPainter -from PySide2.QtWidgets import QLabel -from PySide2.QtWidgets import QGraphicsScene, QGraphicsView, QGraphicsItem, QGraphicsProxyWidget - -class QGraphicsProxyWidgetTest(UsesQApplication): - def testQGraphicsProxyWidget(self): - scene = QGraphicsScene() - - proxy = QGraphicsProxyWidget(None, Qt.Window) - widget = QLabel('Widget') - proxy.setWidget(widget) - proxy.setCacheMode(QGraphicsItem.DeviceCoordinateCache) - scene.addItem(proxy) - scene.setSceneRect(scene.itemsBoundingRect()) - - view = QGraphicsView(scene) - view.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform) - view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate) - view.show() - - timer = QTimer.singleShot(100, self.app.quit) - self.app.exec_() - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsscene_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsscene_test.py deleted file mode 100644 index 80a09dc57..000000000 --- a/sources/pyside2/tests/QtWidgets/qgraphicsscene_test.py +++ /dev/null @@ -1,218 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Basic test cases for QGraphicsScene''' - -import unittest -import gc - -from PySide2.QtCore import QPointF -from PySide2.QtGui import QPolygonF, QPixmap, QPainterPath, QTransform, QWindow -from PySide2.QtWidgets import QApplication, QPushButton -from PySide2.QtWidgets import QGraphicsScene -from PySide2.QtWidgets import QGraphicsEllipseItem, QGraphicsLineItem -from PySide2.QtWidgets import QGraphicsPathItem, QGraphicsPixmapItem -from PySide2.QtWidgets import QGraphicsPolygonItem, QGraphicsRectItem -from PySide2.QtWidgets import QGraphicsSimpleTextItem, QGraphicsTextItem -from PySide2.QtWidgets import QGraphicsProxyWidget, QGraphicsView - -from helper import UsesQApplication - -class Constructor(unittest.TestCase): - '''QGraphicsScene constructor''' - - def testConstructor(self): - #QGraphicsScene constructor - obj = QGraphicsScene() - self.assertTrue(isinstance(obj, QGraphicsScene)) - -# Test for PYSIDE-868: Test whether painter.device() can be accessed -# correctly. This was crashing when the underlying QPaintDevice was a -# QWidget due to handling multiple inheritance incorrectly. -class CustomScene(QGraphicsScene): - def __init__(self, parent = None): - super(CustomScene, self).__init__(parent) - self.dpi = 0 - - def drawBackground(self, painter, rect): - self.dpi = painter.device().physicalDpiX() - - def drawForeground(self, painter, rect): - self.dpi = painter.device().physicalDpiX() - -class ConstructorWithRect(unittest.TestCase): - '''QGraphicsScene qrect constructor and related sizes''' - - def setUp(self): - #Acquire resources - # PyQt4 doesn't accept a QRect as argument to constructor - self.scene = QGraphicsScene(0, 200, 150, 175) - - def tearDown(self): - #Release resources - del self.scene - - def testHeight(self): - #QGraphicsScene.height() - self.assertEqual(self.scene.height(), 175) - - def testWidth(self): - #QGraphicsScene.width() - self.assertEqual(self.scene.width(), 150) - - -class AddItem(UsesQApplication): - '''Tests for QGraphicsScene.add*''' - - qapplication = True - - def setUp(self): - #Acquire resources - super(AddItem, self).setUp() - self.scene = QGraphicsScene() - # While the scene does not inherits from QWidget, requires - # an application to make the internals work. - - def tearDown(self): - #Release resources - del self.scene - super(AddItem, self).tearDown() - - def testEllipse(self): - #QGraphicsScene.addEllipse - item = self.scene.addEllipse(100, 100, 100, 100) - self.assertTrue(isinstance(item, QGraphicsEllipseItem)) - - def testLine(self): - #QGraphicsScene.addLine - item = self.scene.addLine(100, 100, 200, 200) - self.assertTrue(isinstance(item, QGraphicsLineItem)) - - def testPath(self): - #QGraphicsScene.addPath - item = self.scene.addPath(QPainterPath()) - self.assertTrue(isinstance(item, QGraphicsPathItem)) - - def testPixmap(self): - #QGraphicsScene.addPixmap - item = self.scene.addPixmap(QPixmap()) - self.assertTrue(isinstance(item, QGraphicsPixmapItem)) - - def testPolygon(self): - #QGraphicsScene.addPolygon - points = [QPointF(0, 0), QPointF(100, 100), QPointF(0, 100)] - item = self.scene.addPolygon(QPolygonF(points)) - self.assertTrue(isinstance(item, QGraphicsPolygonItem)) - - def testRect(self): - #QGraphicsScene.addRect - item = self.scene.addRect(100, 100, 100, 100) - self.assertTrue(isinstance(item, QGraphicsRectItem)) - - def testSimpleText(self): - #QGraphicsScene.addSimpleText - item = self.scene.addSimpleText('Monty Python 42') - self.assertTrue(isinstance(item, QGraphicsSimpleTextItem)) - - def testText(self): - #QGraphicsScene.addText - item = self.scene.addText('Monty Python 42') - self.assertTrue(isinstance(item, QGraphicsTextItem)) - - def testWidget(self): - #QGraphicsScene.addWidget - # XXX: printing some X11 error when using under PyQt4 - item = self.scene.addWidget(QPushButton()) - self.assertTrue(isinstance(item, QGraphicsProxyWidget)) - - -class ItemRetrieve(UsesQApplication): - '''Tests for QGraphicsScene item retrieval methods''' - - qapplication = True - - def setUp(self): - #Acquire resources - super(ItemRetrieve, self).setUp() - self.scene = QGraphicsScene() - - self.topleft = QGraphicsRectItem(0, 0, 100, 100) - self.topright = QGraphicsRectItem(100, 0, 100, 100) - self.bottomleft = QGraphicsRectItem(0, 100, 100, 100) - self.bottomright = QGraphicsRectItem(100, 100, 100, 100) - - self.items = [self.topleft, self.topright, self.bottomleft, - self.bottomright] - - for item in self.items: - self.scene.addItem(item) - - def tearDown(self): - #Release resources - del self.scene - super(ItemRetrieve, self).tearDown() - - def testItems(self): - #QGraphicsScene.items() - items = self.scene.items() - for i in items: - self.assertTrue(i in self.items) - - def testItemAt(self): - #QGraphicsScene.itemAt() - self.assertEqual(self.scene.itemAt(50, 50, QTransform()), self.topleft) - self.assertEqual(self.scene.itemAt(150, 50, QTransform()), self.topright) - self.assertEqual(self.scene.itemAt(50, 150, QTransform()), self.bottomleft) - self.assertEqual(self.scene.itemAt(150, 150, QTransform()), self.bottomright) - -class TestGraphicsGroup(UsesQApplication): - def testIt(self): - scene = QGraphicsScene() - i1 = QGraphicsRectItem() - scene.addItem(i1) - i2 = QGraphicsRectItem(i1) - i3 = QGraphicsRectItem() - i4 = QGraphicsRectItem() - group = scene.createItemGroup((i2, i3, i4)) - scene.removeItem(i1) - del i1 # this shouldn't delete i2 - self.assertEqual(i2.scene(), scene) - scene.destroyItemGroup(group) - self.assertRaises(RuntimeError, group.type) - - def testCustomScene(self): # For PYSIDE-868, see above - scene = CustomScene() - view = QGraphicsView(scene) - view.show() - while scene.dpi == 0: - QApplication.instance().processEvents() - view.hide() - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qimage_test.py b/sources/pyside2/tests/QtWidgets/qimage_test.py deleted file mode 100644 index 07f59c8e0..000000000 --- a/sources/pyside2/tests/QtWidgets/qimage_test.py +++ /dev/null @@ -1,308 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QImage''' - -import unittest -import py3kcompat as py3k -from PySide2.QtGui import * -from PySide2.QtWidgets import * -from helper import UsesQApplication, adjust_filename - -xpm = [ - "27 22 206 2", - " c None", - ". c #FEFEFE", - "+ c #FFFFFF", - "@ c #F9F9F9", - "# c #ECECEC", - "$ c #D5D5D5", - "% c #A0A0A0", - "& c #767676", - "* c #525252", - "= c #484848", - "- c #4E4E4E", - "; c #555555", - "> c #545454", - ", c #5A5A5A", - "' c #4B4B4B", - ") c #4A4A4A", - "! c #4F4F4F", - "~ c #585858", - "{ c #515151", - "] c #4C4C4C", - "^ c #B1B1B1", - "/ c #FCFCFC", - "( c #FDFDFD", - "_ c #C1C1C1", - ": c #848484", - "< c #616161", - "[ c #5E5E5E", - "} c #CECECE", - "| c #E2E2E2", - "1 c #E4E4E4", - "2 c #DFDFDF", - "3 c #D2D2D2", - "4 c #D8D8D8", - "5 c #D4D4D4", - "6 c #E6E6E6", - "7 c #F1F1F1", - "8 c #838383", - "9 c #8E8E8E", - "0 c #8F8F8F", - "a c #CBCBCB", - "b c #CCCCCC", - "c c #E9E9E9", - "d c #F2F2F2", - "e c #EDEDED", - "f c #B5B5B5", - "g c #A6A6A6", - "h c #ABABAB", - "i c #BBBBBB", - "j c #B0B0B0", - "k c #EAEAEA", - "l c #6C6C6C", - "m c #BCBCBC", - "n c #F5F5F5", - "o c #FAFAFA", - "p c #B6B6B6", - "q c #F3F3F3", - "r c #CFCFCF", - "s c #FBFBFB", - "t c #CDCDCD", - "u c #DDDDDD", - "v c #999999", - "w c #F0F0F0", - "x c #2B2B2B", - "y c #C3C3C3", - "z c #A4A4A4", - "A c #D7D7D7", - "B c #E7E7E7", - "C c #6E6E6E", - "D c #9D9D9D", - "E c #BABABA", - "F c #AEAEAE", - "G c #898989", - "H c #646464", - "I c #BDBDBD", - "J c #CACACA", - "K c #2A2A2A", - "L c #212121", - "M c #B7B7B7", - "N c #F4F4F4", - "O c #737373", - "P c #828282", - "Q c #4D4D4D", - "R c #000000", - "S c #151515", - "T c #B2B2B2", - "U c #D6D6D6", - "V c #D3D3D3", - "W c #2F2F2F", - "X c #636363", - "Y c #A1A1A1", - "Z c #BFBFBF", - "` c #E0E0E0", - " . c #6A6A6A", - ".. c #050505", - "+. c #A3A3A3", - "@. c #202020", - "#. c #5F5F5F", - "$. c #B9B9B9", - "%. c #C7C7C7", - "&. c #D0D0D0", - "*. c #3E3E3E", - "=. c #666666", - "-. c #DBDBDB", - ";. c #424242", - ">. c #C2C2C2", - ",. c #1A1A1A", - "'. c #2C2C2C", - "). c #F6F6F6", - "!. c #AAAAAA", - "~. c #DCDCDC", - "{. c #2D2D2D", - "]. c #2E2E2E", - "^. c #A7A7A7", - "/. c #656565", - "(. c #333333", - "_. c #464646", - ":. c #C4C4C4", - "<. c #B8B8B8", - "[. c #292929", - "}. c #979797", - "|. c #EFEFEF", - "1. c #909090", - "2. c #8A8A8A", - "3. c #575757", - "4. c #676767", - "5. c #C5C5C5", - "6. c #7A7A7A", - "7. c #797979", - "8. c #989898", - "9. c #EEEEEE", - "0. c #707070", - "a. c #C8C8C8", - "b. c #111111", - "c. c #AFAFAF", - "d. c #474747", - "e. c #565656", - "f. c #E3E3E3", - "g. c #494949", - "h. c #5B5B5B", - "i. c #222222", - "j. c #353535", - "k. c #D9D9D9", - "l. c #0A0A0A", - "m. c #858585", - "n. c #E5E5E5", - "o. c #0E0E0E", - "p. c #9A9A9A", - "q. c #6F6F6F", - "r. c #868686", - "s. c #060606", - "t. c #1E1E1E", - "u. c #E8E8E8", - "v. c #A5A5A5", - "w. c #0D0D0D", - "x. c #030303", - "y. c #272727", - "z. c #131313", - "A. c #1F1F1F", - "B. c #757575", - "C. c #F7F7F7", - "D. c #414141", - "E. c #080808", - "F. c #6B6B6B", - "G. c #313131", - "H. c #C0C0C0", - "I. c #C9C9C9", - "J. c #0B0B0B", - "K. c #232323", - "L. c #434343", - "M. c #3D3D3D", - "N. c #282828", - "O. c #7C7C7C", - "P. c #252525", - "Q. c #3A3A3A", - "R. c #F8F8F8", - "S. c #1B1B1B", - "T. c #949494", - "U. c #3B3B3B", - "V. c #242424", - "W. c #383838", - "X. c #6D6D6D", - "Y. c #818181", - "Z. c #939393", - "`. c #9E9E9E", - " + c #929292", - ".+ c #7D7D7D", - "++ c #ADADAD", - "@+ c #DADADA", - "#+ c #919191", - "$+ c #E1E1E1", - "%+ c #BEBEBE", - "&+ c #ACACAC", - "*+ c #9C9C9C", - "=+ c #B3B3B3", - "-+ c #808080", - ";+ c #A8A8A8", - ">+ c #393939", - ",+ c #747474", - "'+ c #7F7F7F", - ")+ c #D1D1D1", - "!+ c #606060", - "~+ c #5C5C5C", - "{+ c #686868", - "]+ c #7E7E7E", - "^+ c #787878", - "/+ c #595959", - ". . . + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / . . + + ", - ". ( + _ : < [ & } | 1 2 $ 3 4 5 3 6 7 + + 8 9 + . + . ", - ". + 0 9 a ( 3 a b c d e c f g h i g j $ k + l m + . + ", - "+ 2 8 n o p | ( q r s . # t + + + u ^ v e w + x + + + ", - "+ y z . @ A k B 7 n + ( s | p 8 C D 2 E 4 + + F G + . ", - "# H I $ J G K L - M N . 2 O P Q R R S T U s s V W j + ", - "X Y Z @ o ` _ g ...+.( 4 @.#.m G $.%.7 &.X *.=.-.;.&.", - "Q >.C ,.'.} e + ).!.k + . + + . ~.{.> ].x f 7 ^./.k (.", - "_.:.4 @ <.[.}.|.1.2.+ + + >.} 4 B + ( @ _ 3.4.5.6.r 7.", - "3.8.9.~ 0.+ a.Q b.+ + c.d.#.=.$ |.b #.e.z ^ ; ^. .f.g.", - "-.h.+ i.S M + # p j.% n 9.5.k.H l.m.V ^.n.o.M + M p.q.", - "7 r.N s.1.R t.<.|.| u.v.~ w.x.E + s y.z.A.B.C.+ 5 D.q ", - ").p.2 E.0.9 F.%.O {._ @.+ + i { [ i.G.H.P I.+ s q.} + ", - ").p.6 J.R b.K.L.M.A.! b.g.K [.R M k + N.I + + >.O.+ . ", - ").8.9.N.P...R R R R E.t.W n.+ Q.R.6 @.| + . + S.+ + . ", - "n }.w T.U.B.<.i.@ Y + + U.+ c u V.= B B 7 u.W.c + . + ", - "N T.# + }.X.Y.,.8.F.8 Z.[.`. +.+}.4 ++@+O.< ~.+ ( . + ", - "d #+1 + _ ~.u.$+b $.y @+| $+%+I.&+k.h W +.9.+ ( . + . ", - "w 0 |.*+. >.<.=+++++p a.p -+;+5.k.>+,+@ + . . + . + + ", - "q '+9.R.^ I.t b %.I.)+4 $+n.I.,+ .|.+ . . . + . + + + ", - ". p !+( + + + + + + E 0. .-+8.f.+ + . . + + . + + + + ", - ". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + " -] - -class QImageTest(UsesQApplication): - '''Test case for calling setPixel with float as argument''' - - def testQImageStringBuffer(self): - '''Test if the QImage signatures receiving string buffers exist.''' - img0 = QImage(adjust_filename('sample.png', __file__)) - - # btw let's test the bits() method - img1 = QImage(img0.bits(), img0.width(), img0.height(), img0.format()) - self.assertEqual(img0, img1) - img2 = QImage(img0.bits(), img0.width(), img0.height(), img0.bytesPerLine(), img0.format()) - self.assertEqual(img0, img2) - - ## test scanLine method - data1 = img0.scanLine(0) - data2 = img1.scanLine(0) - self.assertEqual(data1, data2) - - # PySide python 3.x does not support slice yet - if not py3k.IS_PY3K: - buff = py3k.buffer(img0.bits()[:img0.bytesPerLine()]) - self.assertEqual(data1, buff) - self.assertEqual(data2, buff) - - def testEmptyBuffer(self): - img = QImage(py3k.buffer(''), 100, 100, QImage.Format_ARGB32) - - def testEmptyStringAsBuffer(self): - img = QImage(py3k.b(''), 100, 100, QImage.Format_ARGB32) - - def testXpmConstructor(self): - label = QLabel() - img = QImage(xpm) - self.assertFalse(img.isNull()) - self.assertEqual(img.width(), 27) - self.assertEqual(img.height(), 22) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qinputdialog_get_test.py b/sources/pyside2/tests/QtWidgets/qinputdialog_get_test.py deleted file mode 100644 index 2f5dcec62..000000000 --- a/sources/pyside2/tests/QtWidgets/qinputdialog_get_test.py +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2 import QtCore, QtWidgets -from helper import UsesQApplication, TimedQApplication - -class TestInputDialog(TimedQApplication): - - def testGetDouble(self): - self.assertEqual(QtWidgets.QInputDialog.getDouble(None, "title", "label"), (0.0, False)) - - def testGetInt(self): - self.assertEqual(QtWidgets.QInputDialog.getInt(None, "title", "label"), (0, False)) - - def testGetItem(self): - (item, bool) = QtWidgets.QInputDialog.getItem(None, "title", "label", ["1", "2", "3"]) - self.assertEqual(str(item), "1") - - def testGetText(self): - (text, bool) = QtWidgets.QInputDialog.getText(None, "title", "label") - self.assertEqual(str(text),"") - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qkeysequenceedit_test.py b/sources/pyside2/tests/QtWidgets/qkeysequenceedit_test.py deleted file mode 100644 index cbfaf9c31..000000000 --- a/sources/pyside2/tests/QtWidgets/qkeysequenceedit_test.py +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QKeySequenceEdit.''' - -import unittest -from PySide2.QtCore import QTimer -from PySide2.QtWidgets import QKeySequenceEdit - -from helper import UsesQApplication - -class QKeySequenceEditTest(UsesQApplication): - def testKeySequence(self): - keySequenceEdit = QKeySequenceEdit() - keySequenceEdit.show() - QTimer.singleShot(0, keySequenceEdit.close) - self.app.exec_() - print(keySequenceEdit.keySequence()) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qlabel_test.py b/sources/pyside2/tests/QtWidgets/qlabel_test.py deleted file mode 100644 index 9d84b5c17..000000000 --- a/sources/pyside2/tests/QtWidgets/qlabel_test.py +++ /dev/null @@ -1,82 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QLabel''' - -import unittest - -from PySide2.QtGui import QPixmap -from PySide2.QtWidgets import QLabel -import shiboken2 as shiboken - -from helper import UsesQApplication - -class QLabelTest(UsesQApplication): - '''Test case for calling QLabel.setPixmap''' - - def setUp(self): - super(QLabelTest, self).setUp() - self.label = QLabel() - - def tearDown(self): - del self.label - super(QLabelTest, self).tearDown() - - def testSetPixmap(self): - - p1 = QPixmap(5, 5) - p2 = QPixmap(10, 10) - - self.label.setPixmap(p1) - self.assertIsNotNone(self.label.pixmap()) - - - # PYSIDE-150: - # When a new QPixmap is assigned to a QLabel, - # the previous one needs to be cleared. - # This means we should not keep a copy of the QPixmap - # on Python-side. - - # Getting pointer to the QPixmap - ret_p = self.label.pixmap() - self.assertIsNot(p1, ret_p) - # Save the address of the pointer - ret_p_addr = shiboken.getCppPointer(ret_p) - # Remove the QPixmap - del ret_p - # Set new QPixmap - self.label.setPixmap(p2) - - # There should be no pointers remaining with the same - # address that our QPixmap p1 because it was deleted - # using `del ret_p` - self.assertTrue(all(shiboken.getCppPointer(o) != ret_p_addr - for o in shiboken.getAllValidWrappers())) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qlayout_ref_test.py b/sources/pyside2/tests/QtWidgets/qlayout_ref_test.py deleted file mode 100644 index ece5626a3..000000000 --- a/sources/pyside2/tests/QtWidgets/qlayout_ref_test.py +++ /dev/null @@ -1,179 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QLayout handling of child widgets references''' - -import unittest -from sys import getrefcount - -from PySide2.QtWidgets import QHBoxLayout, QVBoxLayout, QGridLayout, QWidget -from PySide2.QtWidgets import QStackedLayout, QFormLayout -from PySide2.QtWidgets import QApplication, QPushButton, QLabel - -from helper import UsesQApplication - -class SaveReference(UsesQApplication): - '''Test case to check if QLayout-derived classes increment the refcount - of widgets passed to addWidget()''' - - # Adding here as nose can't see the qapplication attrib we inherit - qapplication = True - - def setUp(self): - #Acquire resources - super(SaveReference, self).setUp() - self.widget1 = QPushButton('click me') - self.widget2 = QLabel('aaa') - - def tearDown(self): - #Release resources - del self.widget2 - del self.widget1 - super(SaveReference, self).tearDown() - - def checkLayoutReference(self, layout): - #Checks the reference cound handling of layout.addWidget - self.assertEqual(getrefcount(self.widget1), 2) - layout.addWidget(self.widget1) - self.assertEqual(getrefcount(self.widget1), 3) - - self.assertEqual(getrefcount(self.widget2), 2) - layout.addWidget(self.widget2) - self.assertEqual(getrefcount(self.widget2), 3) - - # Check if doesn't mess around with previous widget refcount - self.assertEqual(getrefcount(self.widget1), 3) - - def testMoveLayout(self): - l = QHBoxLayout() - self.assertEqual(getrefcount(self.widget1), 2) - l.addWidget(self.widget1) - self.assertEqual(getrefcount(self.widget1), 3) - - w = QWidget() - w.setLayout(l) - self.assertEqual(getrefcount(self.widget1), 3) - - - def testHBoxReference(self): - #QHBoxLayout.addWidget reference count - w = QWidget() - self.checkLayoutReference(QHBoxLayout(w)) - - def testVBoxReference(self): - #QVBoxLayout.addWidget reference count - w = QWidget() - self.checkLayoutReference(QVBoxLayout(w)) - - def testGridReference(self): - #QGridLayout.addWidget reference count - w = QWidget() - self.checkLayoutReference(QGridLayout(w)) - - def testFormReference(self): - #QFormLayout.addWidget reference count - w = QWidget() - self.checkLayoutReference(QFormLayout(w)) - - def testStackedReference(self): - #QStackedLayout.addWidget reference count - w = QWidget() - self.checkLayoutReference(QStackedLayout(w)) - -class MultipleAdd(UsesQApplication): - '''Test case to check if refcount is incremented only once when multiple - calls to addWidget are made with the same widget''' - - qapplication = True - - def setUp(self): - #Acquire resources - super(MultipleAdd, self).setUp() - self.widget = QPushButton('click me') - self.win = QWidget() - self.layout = QHBoxLayout(self.win) - - def tearDown(self): - #Release resources - del self.widget - del self.layout - del self.win - super(MultipleAdd, self).tearDown() - - def testRefCount(self): - #Multiple QLayout.addWidget calls on the same widget - self.assertEqual(getrefcount(self.widget), 2) - self.layout.addWidget(self.widget) - self.assertEqual(getrefcount(self.widget), 3) - self.layout.addWidget(self.widget) - self.assertEqual(getrefcount(self.widget), 3) - self.layout.addWidget(self.widget) - self.assertEqual(getrefcount(self.widget), 3) - -class InternalAdd(UsesQApplication): - def testInternalRef(self): - mw = QWidget() - w = QWidget() - ow = QWidget() - - topLayout = QGridLayout() - - # unique reference - self.assertEqual(getrefcount(w), 2) - self.assertEqual(getrefcount(ow), 2) - - topLayout.addWidget(w, 0, 0) - topLayout.addWidget(ow, 1, 0) - - # layout keep the referemce - self.assertEqual(getrefcount(w), 3) - self.assertEqual(getrefcount(ow), 3) - - mainLayout = QGridLayout() - - mainLayout.addLayout(topLayout, 1, 0, 1, 4) - - # the same reference - self.assertEqual(getrefcount(w), 3) - self.assertEqual(getrefcount(ow), 3) - - mw.setLayout(mainLayout) - - # now trasfer the ownership to mw - self.assertEqual(getrefcount(w), 3) - self.assertEqual(getrefcount(ow), 3) - - del mw - - # remove the ref and invalidate the widget - self.assertEqual(getrefcount(w), 2) - self.assertEqual(getrefcount(ow), 2) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qlayout_test.py b/sources/pyside2/tests/QtWidgets/qlayout_test.py deleted file mode 100644 index 09b394a60..000000000 --- a/sources/pyside2/tests/QtWidgets/qlayout_test.py +++ /dev/null @@ -1,140 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys - -from helper import UsesQApplication -from PySide2.QtCore import * -from PySide2.QtWidgets import * - -class MyLayout(QLayout): - def __init__(self, parent=None): - QLayout.__init__(self, parent) - self._list = [] - - def addItem(self, item): - self.add(item) - - def addWidget(self, widget): - self.add(QWidgetItem(widget)) - - def itemAt(self, index): - if index < len(self._list): - return self._list[index] - - return None - - def count(self): - return len(self._list) - - def add(self, item): - self._list.append(item) - -class MissingItemAtLayout(QLayout): - def __init__(self, parent=None): - QLayout.__init__(self, parent) - self._list = [] - - def addItem(self, item): - self.add(item) - - def addWidget(self, widget): - self.add(QWidgetItem(widget)) - - def count(self): - return len(self._list) - - def add(self, item): - self._list.append(item) - -#Test if a layout implemented in python, the QWidget.setLayout works -#fine because this implement som layout functions used in glue code of -#QWidget, then in c++ when call a virtual function this need call the QLayout -#function implemented in python - -class QLayoutTest(UsesQApplication): - def testOwnershipTransfer(self): - b = QPushButton("teste") - l = MyLayout() - - l.addWidget(b) - - self.assertEqual(sys.getrefcount(b), 2) - - w = QWidget() - - #transfer ref - w.setLayout(l) - - self.assertEqual(sys.getrefcount(b), 3) - - - def testReferenceTransfer(self): - b = QPushButton("teste") - l = QHBoxLayout() - - # keep ref - l.addWidget(b) - self.assertEqual(sys.getrefcount(b), 3) - - w = QWidget() - - # transfer ref - w.setLayout(l) - - self.assertEqual(sys.getrefcount(b), 3) - - # release ref - del w - - self.assertEqual(sys.getrefcount(b), 2) - - def testMissingFunctions(self): - w = QWidget() - b = QPushButton("test") - l = MissingItemAtLayout() - - l.addWidget(b) - - self.assertRaises(RuntimeError, w.setLayout, l) - - def testQFormLayout(self): - w = QWidget() - formLayout = QFormLayout() - spacer = QSpacerItem(100, 30) - formLayout.setItem(0, QFormLayout.SpanningRole, spacer) - w.setLayout(formLayout) - w.show() - QTimer.singleShot(10, w.close) - self.app.exec_() - del w - self.assertRaises(RuntimeError, spacer.isEmpty) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qlcdnumber_test.py b/sources/pyside2/tests/QtWidgets/qlcdnumber_test.py deleted file mode 100644 index 6da0a31b8..000000000 --- a/sources/pyside2/tests/QtWidgets/qlcdnumber_test.py +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QApplication, QLCDNumber - -class QLCDNumberOverflow(unittest.TestCase): - '''Test case for unhandled overflow on QLCDNumber() numDigits argument (see bug #215).''' - - def setUp(self): - self.app = QApplication([]) - - def testnumDigitsOverflow(self): - # NOTE: PyQt4 raises TypeError, but boost.python raises OverflowError - self.assertRaises(OverflowError, QLCDNumber, 840835495615213080) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qlistwidget_test.py b/sources/pyside2/tests/QtWidgets/qlistwidget_test.py deleted file mode 100644 index 7e2d351bc..000000000 --- a/sources/pyside2/tests/QtWidgets/qlistwidget_test.py +++ /dev/null @@ -1,89 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -import sys -from PySide2 import QtWidgets, QtCore -from helper import UsesQApplication - -class QListWidgetTest(UsesQApplication): - - def populateList(self, lst): - o = QtCore.QObject() - o.setObjectName("obj") - - item = QtWidgets.QListWidgetItem("item0") - item.setData(QtCore.Qt.UserRole, o) - #item._data = o - self.assertTrue(sys.getrefcount(o), 3) - self.assertTrue(sys.getrefcount(item), 2) - lst.addItem(item) - self.assertTrue(sys.getrefcount(item), 3) - - def checkCurrentItem(self, lst): - item = lst.currentItem() - self.assertTrue(sys.getrefcount(item), 3) - - def checkItemData(self, lst): - item = lst.currentItem() - o = item.data(QtCore.Qt.UserRole) - self.assertTrue(sys.getrefcount(o), 4) - self.assertEqual(o, item._data) - self.assertTrue(sys.getrefcount(o), 2) - - def testConstructorWithParent(self): - lst = QtWidgets.QListWidget() - self.populateList(lst) - self.checkCurrentItem(lst) - i = lst.item(0) - self.assertTrue(sys.getrefcount(i), 3) - - del lst - self.assertTrue(sys.getrefcount(i), 2) - del i - - def testIt(self): - lst = QtWidgets.QListWidget() - lst.show() - slot = lambda : lst.removeItemWidget(lst.currentItem()) - lst.addItem(QtWidgets.QListWidgetItem("foo")) - QtCore.QTimer.singleShot(0, slot) - QtCore.QTimer.singleShot(0, lst.close) - self.app.exec_() - self.assertEqual(lst.count(), 1) - - def testClear(self): - lst = QtWidgets.QListWidget() - lst.addItem("foo") - item = lst.item(0) - self.assertIsNone(lst.clear()) - self.assertRaises(RuntimeError, lambda: item.text()) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py deleted file mode 100644 index 1bee79863..000000000 --- a/sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2 import QtWidgets - -from helper import UsesQApplication - -class QListWidgetItemConstructor(UsesQApplication): - - def setUp(self): - super(QListWidgetItemConstructor, self).setUp() - self.widgetList = QtWidgets.QListWidget() - - def tearDown(self): - del self.widgetList - super(QListWidgetItemConstructor, self).tearDown() - - def testConstructorWithParent(self): - # Bug 235 - QListWidgetItem constructor not saving ownership - QtWidgets.QListWidgetItem(self.widgetList) - item = self.widgetList.item(0) - self.assertEqual(item.listWidget(), self.widgetList) - - def testConstructorWithNone(self): - # Bug 452 - QListWidgetItem() not casting NoneType to null correctly. - item = QtWidgets.QListWidgetItem(None, 123) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qmainwindow_test.py b/sources/pyside2/tests/QtWidgets/qmainwindow_test.py deleted file mode 100644 index a6b4a05cc..000000000 --- a/sources/pyside2/tests/QtWidgets/qmainwindow_test.py +++ /dev/null @@ -1,113 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys -import weakref - -from PySide2 import QtWidgets -from PySide2 import QtCore - -from helper import UsesQApplication - -class MainWindow(QtWidgets.QMainWindow): - def __init__(self): - QtWidgets.QMainWindow.__init__(self) - - self.createToolbar() - - def createToolbar(self): - pointerButton = QtWidgets.QToolButton() - pointerToolbar = self.addToolBar("Pointer type") - pointerToolbar.addWidget(pointerButton) - -class MyButton(QtWidgets.QPushButton): - def __init__(self, parent=None): - QtWidgets.QPushButton.__init__(self) - self._called = False - - def myCallback(self): - self._called = True - - -class TestMainWindow(UsesQApplication): - - def testCreateToolbar(self): - w = MainWindow() - w.show() - QtCore.QTimer.singleShot(1000, self.app.quit) - self.app.exec_() - - def objDel(self, obj): - self.app.quit() - - def testRefCountToNull(self): - w = QtWidgets.QMainWindow() - c = QtWidgets.QWidget() - self.assertEqual(sys.getrefcount(c), 2) - w.setCentralWidget(c) - self.assertEqual(sys.getrefcount(c), 3) - wr = weakref.ref(c, self.objDel) - w.setCentralWidget(None) - c = None - self.app.exec_() - - def testRefCountToAnother(self): - w = QtWidgets.QMainWindow() - c = QtWidgets.QWidget() - self.assertEqual(sys.getrefcount(c), 2) - w.setCentralWidget(c) - self.assertEqual(sys.getrefcount(c), 3) - - c2 = QtWidgets.QWidget() - w.setCentralWidget(c2) - self.assertEqual(sys.getrefcount(c2), 3) - - wr = weakref.ref(c, self.objDel) - w.setCentralWidget(None) - c = None - - self.app.exec_() - - def testSignalDisconect(self): - w = QtWidgets.QMainWindow() - b = MyButton("button") - b.clicked.connect(b.myCallback) - w.setCentralWidget(b) - - b = MyButton("button") - b.clicked.connect(b.myCallback) - w.setCentralWidget(b) - - b.click() - self.assertEqual(b._called, True) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qmenu_test.py b/sources/pyside2/tests/QtWidgets/qmenu_test.py deleted file mode 100644 index 74a677938..000000000 --- a/sources/pyside2/tests/QtWidgets/qmenu_test.py +++ /dev/null @@ -1,86 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QMenu -from PySide2.QtGui import QKeySequence, QIcon -from PySide2.QtCore import SLOT - -from helper import UsesQApplication - -class QMenuAddAction(UsesQApplication): - - def setUp(self): - super(QMenuAddAction, self).setUp() - self.menu = QMenu() - - def tearDown(self): - del self.menu - super(QMenuAddAction, self).tearDown() - - def testAddActionWithoutKeySequenceCallable(self): - # bug #280 - action = self.menu.addAction(self.app.tr('aaa'), lambda : 1) - - def testAddActionKeySequenceCallable(self): - # bug #228 - action = self.menu.addAction(self.app.tr('aaa'), lambda : 1, - QKeySequence(self.app.tr('Ctrl+O'))) - - def testAddActionKeySequenceSlot(self): - action = self.menu.addAction('Quit', self.app, SLOT('quit()'), - QKeySequence('Ctrl+O')) - -class QMenuAddActionWithIcon(UsesQApplication): - - def setUp(self): - super(QMenuAddActionWithIcon, self).setUp() - self.menu = QMenu() - self.icon = QIcon() - - def tearDown(self): - del self.menu - del self.icon - super(QMenuAddActionWithIcon, self).tearDown() - - def testAddActionWithoutKeySequenceCallable(self): - # bug #280 - action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda : 1) - - def testAddActionKeySequenceCallable(self): - # bug #228 - action = self.menu.addAction(self.icon, self.app.tr('aaa'), lambda : 1, - QKeySequence(self.app.tr('Ctrl+O'))) - - def testAddActionKeySequenceSlot(self): - action = self.menu.addAction(self.icon, 'Quit', self.app, SLOT('quit()'), - QKeySequence('Ctrl+O')) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qmenuadd_test.py b/sources/pyside2/tests/QtWidgets/qmenuadd_test.py deleted file mode 100644 index 916b15660..000000000 --- a/sources/pyside2/tests/QtWidgets/qmenuadd_test.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test the QMenu.addAction() method''' - -import unittest -import sys - -from PySide2 import QtWidgets - -from helper import UsesQApplication - -class QMenuAddAction(UsesQApplication): - - def openFile(self, *args): - self.arg = args - - def testQMenuAddAction(self): - fileMenu = QtWidgets.QMenu("&File") - - addNewAction = fileMenu.addAction("&Open...", self.openFile) - addNewAction.trigger() - self.assertEqual(self.arg, ()) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qobject_mi_test.py b/sources/pyside2/tests/QtWidgets/qobject_mi_test.py deleted file mode 100644 index 4a7f8b35d..000000000 --- a/sources/pyside2/tests/QtWidgets/qobject_mi_test.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for multiple inheritance from 2 QObjects''' - -import unittest - -from PySide2.QtCore import QObject -from PySide2.QtGui import * -from PySide2.QtWidgets import * - -from helper import UsesQApplication - -class WidgetValidator(QWidget, QIntValidator): - def __init__(self, parent=None): - QWidget.__init__(self, parent) - QIntValidator.__init__(self, parent) - - -class DoubleQObjectInheritanceTest(UsesQApplication): - - def testDouble(self): - '''Double inheritance from QObject classes''' - - obj = WidgetValidator() - - #QObject methods - obj.setObjectName('aaaa') - self.assertEqual(obj.objectName(), 'aaaa') - - #QWidget methods - obj.setVisible(False) - self.assertFalse(obj.isVisible()) - - #QIntValidator methods - state, string, number = obj.validate('aaaa', 0) - self.assertEqual(state, QValidator.Invalid) - state, string, number = obj.validate('33', 0) - self.assertEqual(state, QValidator.Acceptable) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qpen_test.py b/sources/pyside2/tests/QtWidgets/qpen_test.py deleted file mode 100644 index 28efa731a..000000000 --- a/sources/pyside2/tests/QtWidgets/qpen_test.py +++ /dev/null @@ -1,72 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from helper import UsesQApplication - -from PySide2.QtCore import Qt, QTimer -from PySide2.QtGui import QPen, QPainter -from PySide2.QtWidgets import QWidget - -class Painting(QWidget): - def __init__(self): - QWidget.__init__(self) - self.penFromEnum = None - self.penFromInteger = None - - def paintEvent(self, event): - painter = QPainter(self) - painter.setPen(Qt.NoPen) - self.penFromEnum = painter.pen() - painter.setPen(int(Qt.NoPen)) - self.penFromInteger = painter.pen() - - -class QPenTest(UsesQApplication): - - def testCtorWithCreatedEnums(self): - '''A simple case of QPen creation using created enums.''' - width = 0 - style = Qt.PenStyle(0) - cap = Qt.PenCapStyle(0) - join = Qt.PenJoinStyle(0) - pen = QPen(Qt.blue, width, style, cap, join) - - def testSetPenWithPenStyleEnum(self): - '''Calls QPainter.setPen with both enum and integer. Bug #511.''' - w = Painting() - w.show() - QTimer.singleShot(1000, self.app.quit) - self.app.exec_() - self.assertEqual(w.penFromEnum.style(), Qt.NoPen) - self.assertEqual(w.penFromInteger.style(), Qt.SolidLine) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qpicture_test.py b/sources/pyside2/tests/QtWidgets/qpicture_test.py deleted file mode 100644 index b5ec577d2..000000000 --- a/sources/pyside2/tests/QtWidgets/qpicture_test.py +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -import os -from helper import UsesQApplication -from PySide2.QtCore import QTimer -from PySide2.QtGui import QPicture, QPainter -from PySide2.QtWidgets import QWidget - -class MyWidget(QWidget): - def paintEvent(self, e): - p = QPainter(self) - p.drawPicture(0, 0, self._picture) - self._app.quit() - -class QPictureTest(UsesQApplication): - def testFromData(self): - picture = QPicture() - painter = QPainter() - painter.begin(picture) - painter.drawEllipse(10,20, 80,70) - painter.end() - - data = picture.data() - picture2 = QPicture() - picture2.setData(data) - - self.assertEqual(picture2.data(), picture.data()) - - w = MyWidget() - w._picture = picture2 - w._app = self.app - - QTimer.singleShot(300, w.show) - self.app.exec_() - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qpixmap_constructor.py b/sources/pyside2/tests/QtWidgets/qpixmap_constructor.py deleted file mode 100644 index d3748beb9..000000000 --- a/sources/pyside2/tests/QtWidgets/qpixmap_constructor.py +++ /dev/null @@ -1,279 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtGui import QPixmap -from PySide2.QtWidgets import QLabel - -from helper import UsesQApplication - -xpm = [ - "27 22 206 2", - " c None", - ". c #FEFEFE", - "+ c #FFFFFF", - "@ c #F9F9F9", - "# c #ECECEC", - "$ c #D5D5D5", - "% c #A0A0A0", - "& c #767676", - "* c #525252", - "= c #484848", - "- c #4E4E4E", - "; c #555555", - "> c #545454", - ", c #5A5A5A", - "' c #4B4B4B", - ") c #4A4A4A", - "! c #4F4F4F", - "~ c #585858", - "{ c #515151", - "] c #4C4C4C", - "^ c #B1B1B1", - "/ c #FCFCFC", - "( c #FDFDFD", - "_ c #C1C1C1", - ": c #848484", - "< c #616161", - "[ c #5E5E5E", - "} c #CECECE", - "| c #E2E2E2", - "1 c #E4E4E4", - "2 c #DFDFDF", - "3 c #D2D2D2", - "4 c #D8D8D8", - "5 c #D4D4D4", - "6 c #E6E6E6", - "7 c #F1F1F1", - "8 c #838383", - "9 c #8E8E8E", - "0 c #8F8F8F", - "a c #CBCBCB", - "b c #CCCCCC", - "c c #E9E9E9", - "d c #F2F2F2", - "e c #EDEDED", - "f c #B5B5B5", - "g c #A6A6A6", - "h c #ABABAB", - "i c #BBBBBB", - "j c #B0B0B0", - "k c #EAEAEA", - "l c #6C6C6C", - "m c #BCBCBC", - "n c #F5F5F5", - "o c #FAFAFA", - "p c #B6B6B6", - "q c #F3F3F3", - "r c #CFCFCF", - "s c #FBFBFB", - "t c #CDCDCD", - "u c #DDDDDD", - "v c #999999", - "w c #F0F0F0", - "x c #2B2B2B", - "y c #C3C3C3", - "z c #A4A4A4", - "A c #D7D7D7", - "B c #E7E7E7", - "C c #6E6E6E", - "D c #9D9D9D", - "E c #BABABA", - "F c #AEAEAE", - "G c #898989", - "H c #646464", - "I c #BDBDBD", - "J c #CACACA", - "K c #2A2A2A", - "L c #212121", - "M c #B7B7B7", - "N c #F4F4F4", - "O c #737373", - "P c #828282", - "Q c #4D4D4D", - "R c #000000", - "S c #151515", - "T c #B2B2B2", - "U c #D6D6D6", - "V c #D3D3D3", - "W c #2F2F2F", - "X c #636363", - "Y c #A1A1A1", - "Z c #BFBFBF", - "` c #E0E0E0", - " . c #6A6A6A", - ".. c #050505", - "+. c #A3A3A3", - "@. c #202020", - "#. c #5F5F5F", - "$. c #B9B9B9", - "%. c #C7C7C7", - "&. c #D0D0D0", - "*. c #3E3E3E", - "=. c #666666", - "-. c #DBDBDB", - ";. c #424242", - ">. c #C2C2C2", - ",. c #1A1A1A", - "'. c #2C2C2C", - "). c #F6F6F6", - "!. c #AAAAAA", - "~. c #DCDCDC", - "{. c #2D2D2D", - "]. c #2E2E2E", - "^. c #A7A7A7", - "/. c #656565", - "(. c #333333", - "_. c #464646", - ":. c #C4C4C4", - "<. c #B8B8B8", - "[. c #292929", - "}. c #979797", - "|. c #EFEFEF", - "1. c #909090", - "2. c #8A8A8A", - "3. c #575757", - "4. c #676767", - "5. c #C5C5C5", - "6. c #7A7A7A", - "7. c #797979", - "8. c #989898", - "9. c #EEEEEE", - "0. c #707070", - "a. c #C8C8C8", - "b. c #111111", - "c. c #AFAFAF", - "d. c #474747", - "e. c #565656", - "f. c #E3E3E3", - "g. c #494949", - "h. c #5B5B5B", - "i. c #222222", - "j. c #353535", - "k. c #D9D9D9", - "l. c #0A0A0A", - "m. c #858585", - "n. c #E5E5E5", - "o. c #0E0E0E", - "p. c #9A9A9A", - "q. c #6F6F6F", - "r. c #868686", - "s. c #060606", - "t. c #1E1E1E", - "u. c #E8E8E8", - "v. c #A5A5A5", - "w. c #0D0D0D", - "x. c #030303", - "y. c #272727", - "z. c #131313", - "A. c #1F1F1F", - "B. c #757575", - "C. c #F7F7F7", - "D. c #414141", - "E. c #080808", - "F. c #6B6B6B", - "G. c #313131", - "H. c #C0C0C0", - "I. c #C9C9C9", - "J. c #0B0B0B", - "K. c #232323", - "L. c #434343", - "M. c #3D3D3D", - "N. c #282828", - "O. c #7C7C7C", - "P. c #252525", - "Q. c #3A3A3A", - "R. c #F8F8F8", - "S. c #1B1B1B", - "T. c #949494", - "U. c #3B3B3B", - "V. c #242424", - "W. c #383838", - "X. c #6D6D6D", - "Y. c #818181", - "Z. c #939393", - "`. c #9E9E9E", - " + c #929292", - ".+ c #7D7D7D", - "++ c #ADADAD", - "@+ c #DADADA", - "#+ c #919191", - "$+ c #E1E1E1", - "%+ c #BEBEBE", - "&+ c #ACACAC", - "*+ c #9C9C9C", - "=+ c #B3B3B3", - "-+ c #808080", - ";+ c #A8A8A8", - ">+ c #393939", - ",+ c #747474", - "'+ c #7F7F7F", - ")+ c #D1D1D1", - "!+ c #606060", - "~+ c #5C5C5C", - "{+ c #686868", - "]+ c #7E7E7E", - "^+ c #787878", - "/+ c #595959", - ". . . + @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / . . + + ", - ". ( + _ : < [ & } | 1 2 $ 3 4 5 3 6 7 + + 8 9 + . + . ", - ". + 0 9 a ( 3 a b c d e c f g h i g j $ k + l m + . + ", - "+ 2 8 n o p | ( q r s . # t + + + u ^ v e w + x + + + ", - "+ y z . @ A k B 7 n + ( s | p 8 C D 2 E 4 + + F G + . ", - "# H I $ J G K L - M N . 2 O P Q R R S T U s s V W j + ", - "X Y Z @ o ` _ g ...+.( 4 @.#.m G $.%.7 &.X *.=.-.;.&.", - "Q >.C ,.'.} e + ).!.k + . + + . ~.{.> ].x f 7 ^./.k (.", - "_.:.4 @ <.[.}.|.1.2.+ + + >.} 4 B + ( @ _ 3.4.5.6.r 7.", - "3.8.9.~ 0.+ a.Q b.+ + c.d.#.=.$ |.b #.e.z ^ ; ^. .f.g.", - "-.h.+ i.S M + # p j.% n 9.5.k.H l.m.V ^.n.o.M + M p.q.", - "7 r.N s.1.R t.<.|.| u.v.~ w.x.E + s y.z.A.B.C.+ 5 D.q ", - ").p.2 E.0.9 F.%.O {._ @.+ + i { [ i.G.H.P I.+ s q.} + ", - ").p.6 J.R b.K.L.M.A.! b.g.K [.R M k + N.I + + >.O.+ . ", - ").8.9.N.P...R R R R E.t.W n.+ Q.R.6 @.| + . + S.+ + . ", - "n }.w T.U.B.<.i.@ Y + + U.+ c u V.= B B 7 u.W.c + . + ", - "N T.# + }.X.Y.,.8.F.8 Z.[.`. +.+}.4 ++@+O.< ~.+ ( . + ", - "d #+1 + _ ~.u.$+b $.y @+| $+%+I.&+k.h W +.9.+ ( . + . ", - "w 0 |.*+. >.<.=+++++p a.p -+;+5.k.>+,+@ + . . + . + + ", - "q '+9.R.^ I.t b %.I.)+4 $+n.I.,+ .|.+ . . . + . + + + ", - ". p !+( + + + + + + E 0. .-+8.f.+ + . . + + . + + + + ", - ". ( A ~+{+]+^+l > /+D f.c q . + . . + + . + + + + + + " -] - -class QStringSequenceTest(UsesQApplication): - def testQPixmapConstructor(self): - label = QLabel() - pixmap1 = QPixmap(xpm) - self.assertFalse(pixmap1.isNull()) - self.assertEqual(pixmap1.width(), 27) - self.assertEqual(pixmap1.height(), 22) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qpushbutton_test.py b/sources/pyside2/tests/QtWidgets/qpushbutton_test.py deleted file mode 100644 index c73d550fb..000000000 --- a/sources/pyside2/tests/QtWidgets/qpushbutton_test.py +++ /dev/null @@ -1,69 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from helper import UsesQApplication -from PySide2.QtWidgets import QPushButton, QMenu, QWidget -from PySide2.QtCore import QTimer - -class MyWidget(QWidget): - def __init__(self): - QWidget.__init__(self) - - m = QMenu(self) - b = QPushButton("Hello", self) - b.setMenu(m) - - -class QPushButtonTest(UsesQApplication): - def createMenu(self, button): - m = QMenu() - button.setMenu(m) - - def testSetMenu(self): - w = MyWidget() - w.show() - - timer = QTimer.singleShot(100, self.app.quit) - self.app.exec_() - - def buttonCb(self, checked): - self._clicked = True - - def testBoolinSignal(self): - b = QPushButton() - b.setCheckable(True) - self._clicked = False - b.toggled[bool].connect(self.buttonCb) - b.toggle() - self.assertTrue(self._clicked) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qshortcut_test.py b/sources/pyside2/tests/QtWidgets/qshortcut_test.py deleted file mode 100644 index 7faaf6f92..000000000 --- a/sources/pyside2/tests/QtWidgets/qshortcut_test.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -''' Test the QShortcut constructor''' - -import unittest -import sys - -from PySide2 import QtCore, QtGui, QtWidgets - -class Foo(QtWidgets.QWidget): - def __init__(self): - QtWidgets.QWidget.__init__(self) - self.ok = False - self.copy = False - - def slot_of_foo(self): - self.ok = True - - def slot_of_copy(self): - self.copy = True - -class MyShortcut(QtWidgets.QShortcut): - def __init__(self, keys, wdg, slot): - QtWidgets.QShortcut.__init__(self, keys, wdg, slot) - - def emit_signal(self): - self.emit(QtCore.SIGNAL("activated()")) - -class QAppPresence(unittest.TestCase): - - def testQShortcut(self): - self.qapp = QtWidgets.QApplication([]) - f = Foo() - - self.sc = MyShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return), f, f.slot_of_foo) - self.scstd = MyShortcut(QtGui.QKeySequence.Copy, f, f.slot_of_copy) - QtCore.QTimer.singleShot(0, self.init); - self.qapp.exec_() - self.assertEqual(f.ok, True) - self.assertEqual(f.copy, True) - - def init(self): - self.sc.emit_signal(); - self.scstd.emit_signal(); - self.qapp.quit() - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qsplitter_test.py b/sources/pyside2/tests/QtWidgets/qsplitter_test.py deleted file mode 100644 index 6a6824a1a..000000000 --- a/sources/pyside2/tests/QtWidgets/qsplitter_test.py +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import QSplitter - -from helper import UsesQApplication - -class QSplitterTest(UsesQApplication): - - def testGetRange(self): - splitter = QSplitter() - _min, _max = splitter.getRange(0) - self.assertTrue(isinstance(_min, int)) - self.assertTrue(isinstance(_max, int)) - -if __name__ == "__main__": - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py b/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py deleted file mode 100644 index c07bd8705..000000000 --- a/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -import sys - -from PySide2.QtGui import QStandardItemModel, QStandardItem -from PySide2.QtWidgets import QWidget -import shiboken2 as shiboken - -from helper import UsesQApplication - - -class QStandardItemModelTest(UsesQApplication): - - def setUp(self): - super(QStandardItemModelTest, self).setUp() - self.window = QWidget() - self.model = QStandardItemModel(0, 3, self.window) - - def tearDown(self): - del self.window - del self.model - super(QStandardItemModelTest, self).tearDown() - - def testInsertRow(self): - # bug #227 - self.model.insertRow(0) - - def testClear(self): - - model = QStandardItemModel() - root = model.invisibleRootItem() - model.clear() - self.assertFalse(shiboken.isValid(root)) - - -class QStandardItemModelRef(UsesQApplication): - def testRefCount(self): - model = QStandardItemModel(5, 5) - items = [] - for r in range(5): - row = [] - for c in range(5): - row.append(QStandardItem("%d,%d" % (r,c)) ) - self.assertEqual(sys.getrefcount(row[c]), 2) - - model.insertRow(r, row) - - for c in range(5): - ref_after = sys.getrefcount(row[c]) - # check if the ref count was incremented after insertRow - self.assertEqual(ref_after, 3) - - items.append(row) - row = None - - for r in range(3): - my_row = model.takeRow(0) - my_row = None - for c in range(5): - # only rest 1 reference - self.assertEqual(sys.getrefcount(items[r][c]), 2) - - my_i = model.item(0,0) - # ref(my_i) + parent_ref + items list ref - self.assertEqual(sys.getrefcount(my_i), 4) - - model.clear() - # ref(my_i) - self.assertEqual(sys.getrefcount(my_i), 3) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py deleted file mode 100644 index 6538607ff..000000000 --- a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Tests conversions of QString to and from QKeySequence.''' - -import unittest -import py3kcompat as py3k -from helper import UsesQApplication - -from PySide2.QtGui import QKeySequence -from PySide2.QtWidgets import QAction - -class QStringQKeySequenceTest(UsesQApplication): - '''Tests conversions of QString to and from QKeySequence.''' - - def testQStringFromQKeySequence(self): - '''Creates a QString from a QKeySequence.''' - keyseq = 'Ctrl+A' - a = QKeySequence(keyseq) - self.assertEqual(a, keyseq) - - def testPythonStringAsQKeySequence(self): - '''Passes a Python string to an argument expecting a QKeySequence.''' - keyseq = py3k.unicode_('Ctrl+A') - action = QAction(None) - action.setShortcut(keyseq) - shortcut = action.shortcut() - self.assertTrue(isinstance(shortcut, QKeySequence)) - self.assertEqual(shortcut.toString(), keyseq) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qstyle_test.py b/sources/pyside2/tests/QtWidgets/qstyle_test.py deleted file mode 100644 index 1dcce2737..000000000 --- a/sources/pyside2/tests/QtWidgets/qstyle_test.py +++ /dev/null @@ -1,91 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -import unittest -from helper import UsesQApplication - -from PySide2.QtGui import QWindow -from PySide2.QtWidgets import (QApplication, QFontComboBox, QLabel, QProxyStyle, - QStyleFactory, QWidget) - -class ProxyStyle(QProxyStyle): - - def __init__(self, style): - QProxyStyle.__init__(self, style) - self.polished = 0 - - def polish(self, widget): - self.polished = self.polished + 1 - super(ProxyStyle, self).polish(widget) - - -class SetStyleTest(UsesQApplication): - '''Tests setting the same QStyle for all objects in a UI hierarchy.''' - - def testSetStyle(self): - '''All this test have to do is not break with some invalid Python wrapper.''' - - def setStyleHelper(widget, style): - widget.setStyle(style) - widget.setPalette(style.standardPalette()) - for child in widget.children(): - if isinstance(child, QWidget): - setStyleHelper(child, style) - - container = QWidget() - # QFontComboBox is used because it has an QLineEdit created in C++ inside it, - # and if the QWidget.setStyle(style) steals the ownership of the style - # for the C++ originated widget everything will break. - fontComboBox = QFontComboBox(container) - label = QLabel(container) - label.setText('Label') - style = QStyleFactory.create(QStyleFactory.keys()[0]) - setStyleHelper(container, style) - - def testSetProxyStyle(self): - label = QLabel("QtWidgets/ProxyStyle test") - baseStyle = QStyleFactory.create(QApplication.instance().style().objectName()) - self.assertTrue(baseStyle) - proxyStyle = ProxyStyle(baseStyle) - label.setStyle(proxyStyle) - label.show() - while not label.windowHandle().isExposed(): - QApplication.instance().processEvents() - self.assertTrue(proxyStyle.polished > 0) - - def testSetStyleOwnership(self): - style = QStyleFactory.create(QStyleFactory.keys()[0]) - self.assertEqual(sys.getrefcount(style), 2) - QApplication.instance().setStyle(style) - self.assertEqual(sys.getrefcount(style), 3) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qtableview_test.py b/sources/pyside2/tests/QtWidgets/qtableview_test.py deleted file mode 100644 index 1f5b52cda..000000000 --- a/sources/pyside2/tests/QtWidgets/qtableview_test.py +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtCore import QAbstractTableModel -from PySide2.QtWidgets import QTableWidget -from helper import UsesQApplication - -class QPenTest(UsesQApplication): - - def testItemModel(self): - tv = QTableWidget() - - self.assertEqual(type(tv.model()), QAbstractTableModel) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qtabwidget_test.py b/sources/pyside2/tests/QtWidgets/qtabwidget_test.py deleted file mode 100644 index b3ce46d90..000000000 --- a/sources/pyside2/tests/QtWidgets/qtabwidget_test.py +++ /dev/null @@ -1,56 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import * -from helper import TimedQApplication - -def makeBug643(tab): - button = QPushButton('Foo') - tab.insertTab(0, button, 'Foo') - -class RemoveTabMethod(TimedQApplication): - def setUp(self): - TimedQApplication.setUp(self) - self.tab = QTabWidget() - - def tearDown(self): - del self.tab - TimedQApplication.tearDown(self) - - - def testRemoveTabPresence(self): - self.assertTrue(getattr(self.tab, 'removeTab')) - - def testInsertTab(self): - makeBug643(self.tab) - self.assertEqual(self.tab.count(), 1) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py b/sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py deleted file mode 100644 index c3300fc77..000000000 --- a/sources/pyside2/tests/QtWidgets/qtabwidgetclear_test.py +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QMainWindow, QTabWidget, QTextEdit, QSplitter -from helper import UsesQApplication - -class TabWidgetClear(QMainWindow): - def __init__(self): - QMainWindow.__init__(self) - self.tabWidget = QTabWidget(self) - self.setCentralWidget(self.tabWidget) - self.editBox = QTextEdit(self) - self.tabWidget.addTab(self.getSplitter(), 'Test') - - def getSplitter(self): - splitter = QSplitter() - splitter.addWidget(self.editBox) - return splitter - - def toggle(self): - self.tabWidget.clear() - self.getSplitter() - -class TestTabWidgetClear(UsesQApplication): - - def testClear(self): - self.window = TabWidgetClear() - self.window.show() - try: - self.window.toggle() - except RuntimeError as e: - # This should never happened, PYSIDE-213 - raise e - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qtextedit_signal_test.py b/sources/pyside2/tests/QtWidgets/qtextedit_signal_test.py deleted file mode 100644 index f6730a282..000000000 --- a/sources/pyside2/tests/QtWidgets/qtextedit_signal_test.py +++ /dev/null @@ -1,65 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2 import QtCore, QtWidgets -from helper import UsesQApplication - -import unittest - -class MyWindow(QtWidgets.QMainWindow): - appendText = QtCore.Signal(str) - - @QtCore.Slot() - def onButtonPressed(self): - self.appendText.emit("PySide") - - def __init__(self, parent=None): - super(MyWindow, self).__init__(parent) - - self.textEdit = QtWidgets.QTextEdit() - self.btn = QtWidgets.QPushButton("ClickMe") - self.btn.clicked.connect(self.onButtonPressed) - self.appendText.connect(self.textEdit.append) - - def start(self): - self.btn.click() - - def text(self): - return self.textEdit.toPlainText() - - -class testSignalWithCPPSlot(UsesQApplication): - - def testEmission(self): - w = MyWindow() - w.start() - self.assertEqual(w.text(), "PySide") - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qtextedit_test.py b/sources/pyside2/tests/QtWidgets/qtextedit_test.py deleted file mode 100644 index 34467ddae..000000000 --- a/sources/pyside2/tests/QtWidgets/qtextedit_test.py +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QTextEdit and ownership problems.''' - -import unittest -from sys import getrefcount -from PySide2.QtWidgets import QTextEdit - -from helper import UsesQApplication - -class DontTouchReference(UsesQApplication): - '''Check if the QTextTable returned by QTextCursor.insertTable() is not - referenced by the QTextCursor that returns it.''' - - def setUp(self): - super(DontTouchReference, self).setUp() - self.editor = QTextEdit() - self.cursor = self.editor.textCursor() - self.table = self.cursor.insertTable(1, 1) - - def testQTextTable(self): - # methods which return QTextTable should not increment its reference - self.assertEqual(getrefcount(self.table), 2) - f = self.cursor.currentFrame() - del f - self.assertEqual(getrefcount(self.table), 2) - # destroying the cursor should not raise any "RuntimeError: internal - # C++ object already deleted." when accessing the QTextTable - del self.cursor - self.assertEqual(getrefcount(self.table), 2) - cell = self.table.cellAt(0, 0) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qtoolbar_test.py b/sources/pyside2/tests/QtWidgets/qtoolbar_test.py deleted file mode 100644 index 24b36e09b..000000000 --- a/sources/pyside2/tests/QtWidgets/qtoolbar_test.py +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for QToolbar''' - -import unittest - -from PySide2.QtWidgets import QToolBar, QMainWindow, QAction - -from helper import UsesQApplication - -class AddActionText(UsesQApplication): - '''Test case for calling QToolbar.addAction passing a text''' - - def setUp(self): - #Acquire resources - super(AddActionText, self).setUp() - self.window = QMainWindow() - self.toolbar = QToolBar() - self.window.addToolBar(self.toolbar) - - def tearDown(self): - #Release resources - super(AddActionText, self).tearDown() - del self.toolbar - del self.window - - def testText(self): - #QToolBar.addAction(text) - add a QToolButton - self.toolbar.addAction('aaaa') - self.assertEqual(len(self.toolbar.actions()), 1) - action = self.toolbar.actions()[0] - self.assertTrue(isinstance(action, QAction)) - self.assertEqual(action.text(), 'aaaa') - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qtoolbox_test.py b/sources/pyside2/tests/QtWidgets/qtoolbox_test.py deleted file mode 100644 index f41933c2e..000000000 --- a/sources/pyside2/tests/QtWidgets/qtoolbox_test.py +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtGui import QIcon -from PySide2.QtWidgets import QToolBox, QWidget - -from helper import UsesQApplication - -class OwnershipControl(UsesQApplication): - - def setUp(self): - super(OwnershipControl, self).setUp() - self.toolbox = QToolBox() - - def tearDown(self): - del self.toolbox - super(OwnershipControl, self).tearDown() - - def testAddItem(self): - # Was losing ownership of the widget. - index = self.toolbox.addItem(QWidget(), 'item') - item = self.toolbox.widget(index) - self.assertTrue(isinstance(item, QWidget)) - - def testAddItemWithIcon(self): - index = self.toolbox.addItem(QWidget(), QIcon(), 'item') - item = self.toolbox.widget(index) - self.assertTrue(isinstance(item, QWidget)) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qtreeview_test.py b/sources/pyside2/tests/QtWidgets/qtreeview_test.py deleted file mode 100644 index a344aeff8..000000000 --- a/sources/pyside2/tests/QtWidgets/qtreeview_test.py +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtGui import QStandardItemModel -from PySide2.QtWidgets import (QWidget, QTreeView, QVBoxLayout, - QStyledItemDelegate, QHeaderView) -from PySide2.QtCore import Qt -from helper import UsesQApplication - -class Widget(QWidget): - def __init__(self, parent=None): - QWidget.__init__(self, parent) - self.treeView = QTreeView(self) - layout = QVBoxLayout() - layout.addWidget(self.treeView) - self.setLayout(layout) - self.treeView.setModel(QStandardItemModel()) - - self.treeView.model().setHorizontalHeaderLabels(('3', '1', '5')) - -class QWidgetTest(UsesQApplication): - - def testDelegates(self): - widget = Widget() - t = widget.treeView - - # When calling setItemDelegateForColumn using a separate variable - # for the second argument (QAbstractItemDelegate), there was no problem - # on keeping the reference to this object, since the variable was kept - # alive (case A) - # Contrary, when instantiating this argument on the function call - # Using QStyledItemDelegate inside the call the reference of the - # object was lost, causing a segfault. (case B) - - # Case A - d = QStyledItemDelegate() - # Using QStyledItemDelegate from a variable so we keep the reference alive - # and we encounter no segfault. - t.setItemDelegateForColumn(0, d) - # This raised the Segmentation Fault too, because manually destroying - # the object caused a missing refrence. - del d - - # Getting the delegates - a = t.itemDelegateForColumn(0) - self.assertIsInstance(a, QStyledItemDelegate) - - # Case B - t.setItemDelegateForColumn(1, QStyledItemDelegate()) - - # Getting the delegates - b = t.itemDelegateForColumn(1) - self.assertIsInstance(b, QStyledItemDelegate) - - # Test for Rows - t.setItemDelegateForRow(0, QStyledItemDelegate()) - self.assertIsInstance(t.itemDelegateForRow(0), QStyledItemDelegate) - - # Test for general delegate - t.setItemDelegate(QStyledItemDelegate()) - self.assertIsInstance(t.itemDelegate(), QStyledItemDelegate) - - def testHeader(self): - tree = QTreeView() - tree.setHeader(QHeaderView(Qt.Horizontal)) - self.assertIsNotNone(tree.header()) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qtreewidget_test.py b/sources/pyside2/tests/QtWidgets/qtreewidget_test.py deleted file mode 100644 index 4afd0690d..000000000 --- a/sources/pyside2/tests/QtWidgets/qtreewidget_test.py +++ /dev/null @@ -1,64 +0,0 @@ -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QTreeWidget, QTreeWidgetItem, QPushButton -from helper import UsesQApplication - -class QTreeWidgetTest(UsesQApplication): - - # PYSIDE-73: - # There was a problem when adding items to a QTreeWidget - # when the Widget was being build on the method call instead - # of as a separate variable. - # The problem was there was not ownership transfer, so the - # QTreeWidget did not own the QWidget element - def testSetItemWidget(self): - - treeWidget = QTreeWidget() - treeWidget.setColumnCount(2) - - item = QTreeWidgetItem(['text of column 0', '']) - treeWidget.insertTopLevelItem(0, item) - # Adding QPushButton inside the method - treeWidget.setItemWidget(item, 1, - QPushButton('Push button on column 1')) - - # Getting the widget back - w = treeWidget.itemWidget(treeWidget.itemAt(0,1), 1) - self.assertIsInstance(w, QPushButton) - - p = QPushButton('New independent button') - # Adding QPushButton object from variable - treeWidget.setItemWidget(item, 0, p) - w = treeWidget.itemWidget(treeWidget.itemAt(0,0), 0) - self.assertIsInstance(w, QPushButton) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qvariant_test.py b/sources/pyside2/tests/QtWidgets/qvariant_test.py deleted file mode 100644 index 907e6d9ed..000000000 --- a/sources/pyside2/tests/QtWidgets/qvariant_test.py +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest -from PySide2.QtWidgets import (QApplication, QComboBox, QGraphicsScene, - QGraphicsRectItem) - -from helper import UsesQApplication - -class MyDiagram(QGraphicsScene): - pass - -class MyItem(QGraphicsRectItem): - def itemChange(self, change, value): - return value; - -class Sequence(object): - # Having the __getitem__ method on a class transform the Python - # type to a PySequence. - # Before the patch: aa75437f9119d997dd290471ac3e2cc88ca88bf1 - # "Fix QVariant conversions when using PySequences" - # one could not use an object from this class, because internally - # we were requiring that the PySequence was finite. - def __getitem__(self, key): - raise IndexError() - -class QGraphicsSceneOnQVariantTest(UsesQApplication): - """Test storage ot QGraphicsScene into QVariants""" - def setUp(self): - super(QGraphicsSceneOnQVariantTest, self).setUp() - self.s = MyDiagram() - self.i = MyItem() - self.combo = QComboBox() - - def tearDown(self): - del self.s - del self.i - del self.combo - super(QGraphicsSceneOnQVariantTest, self).tearDown() - - def testIt(self): - self.s.addItem(self.i) - self.assertEqual(len(self.s.items()), 1) - - def testSequence(self): - # PYSIDE-641 - self.combo.addItem("test", userData=Sequence()) - self.assertTrue(isinstance(self.combo.itemData(0), Sequence)) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/qwidget_setlayout_test.py b/sources/pyside2/tests/QtWidgets/qwidget_setlayout_test.py deleted file mode 100644 index 7fb17f912..000000000 --- a/sources/pyside2/tests/QtWidgets/qwidget_setlayout_test.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication, QHBoxLayout -from helper import UsesQApplication - -class QWidgetTest(UsesQApplication): - - def test_setLayout(self): - layout = QVBoxLayout() - btn1 = QPushButton("button_v1") - layout.addWidget(btn1) - - btn2 = QPushButton("button_v2") - layout.addWidget(btn2) - - layout2 = QHBoxLayout() - - btn1 = QPushButton("button_h1") - layout2.addWidget(btn1) - - btn2 = QPushButton("button_h2") - layout2.addWidget(btn2) - - layout.addLayout(layout2) - - widget = QWidget() - widget.setLayout(layout) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/qwidget_test.py b/sources/pyside2/tests/QtWidgets/qwidget_test.py deleted file mode 100644 index d0a4a8dfa..000000000 --- a/sources/pyside2/tests/QtWidgets/qwidget_test.py +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import sys -import unittest - -from PySide2.QtWidgets import QWidget, QMainWindow -from helper import UsesQApplication - -class QWidgetInherit(QMainWindow): - def __init__(self): - QWidget.__init__(self) - -class NativeEventTestWidget(QWidget): - - nativeEventCount = 0 - - def __init__(self): - QWidget.__init__(self) - - def nativeEvent(self, eventType, message): - self.nativeEventCount = self.nativeEventCount + 1 - return [False, 0] - -class QWidgetTest(UsesQApplication): - - def testInheritance(self): - self.assertRaises(TypeError, QWidgetInherit) - - if sys.version_info[0] < 3: - def testCallType_Issue_816(self): - thing = type(QWidget).__new__(type(QWidget), "", (), {}) - self.assertEqual(repr(thing), "<class '__main__.'>") - -class QWidgetVisible(UsesQApplication): - - def testBasic(self): - # Also related to bug #244, on existence of setVisible''' - widget = NativeEventTestWidget() - self.assertTrue(not widget.isVisible()) - widget.setVisible(True) - self.assertTrue(widget.isVisible()) - self.assertTrue(widget.winId() is not 0) - # skip this test on macOS since no native events are received - if sys.platform == 'darwin': - return - for i in range(10): - if widget.nativeEventCount > 0: - break - self.app.processEvents() - self.assertTrue(widget.nativeEventCount > 0) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/reference_count_test.py b/sources/pyside2/tests/QtWidgets/reference_count_test.py deleted file mode 100644 index c2a0ec979..000000000 --- a/sources/pyside2/tests/QtWidgets/reference_count_test.py +++ /dev/null @@ -1,99 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for Reference count when the object is created in c++ side''' - -import unittest - -import sys -import weakref -import gc - - -from PySide2.QtCore import Qt, QPointF -from PySide2.QtGui import QPolygonF -from PySide2.QtWidgets import QApplication, QGraphicsScene, QGraphicsRectItem, QGraphicsPolygonItem, QGraphicsRectItem - -from helper import UsesQApplication - -destroyedRect = False -destroyedPol = False - -def rect_del(o): - global destroyedRect - destroyedRect = True - -def pol_del(o): - global destroyedPol - destroyedPol = True - -class ReferenceCount(UsesQApplication): - - def setUp(self): - super(ReferenceCount, self).setUp() - self.scene = QGraphicsScene() - - def tearDown(self): - super(ReferenceCount, self).tearDown() - - def beforeTest(self): - points = [QPointF(0, 0), QPointF(100, 100), QPointF(0, 100)] - pol = self.scene.addPolygon(QPolygonF(points)) - self.assertTrue(isinstance(pol, QGraphicsPolygonItem)) - self.wrp = weakref.ref(pol, pol_del) - - #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj - self.assertEqual(sys.getrefcount(pol), 3) - - def testReferenceCount(self): - global destroyedRect - global destroyedPol - - self.beforeTest() - - rect = self.scene.addRect(10.0, 10.0, 10.0, 10.0) - self.assertTrue(isinstance(rect, QGraphicsRectItem)) - - self.wrr = weakref.ref(rect, rect_del) - - #refcount need be 3 because one ref for QGraphicsScene, and one to rect obj - self.assertEqual(sys.getrefcount(rect), 3) - - del rect - #not destroyed because one ref continue in QGraphicsScene - self.assertEqual(destroyedRect, False) - self.assertEqual(destroyedPol, False) - - del self.scene - - #QGraphicsScene was destroyed and this destroy internal ref to rect - self.assertEqual(destroyedRect, True) - self.assertEqual(destroyedPol, True) - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/sample.png b/sources/pyside2/tests/QtWidgets/sample.png Binary files differdeleted file mode 100644 index 60450f0dc..000000000 --- a/sources/pyside2/tests/QtWidgets/sample.png +++ /dev/null diff --git a/sources/pyside2/tests/QtWidgets/signature_test.py b/sources/pyside2/tests/QtWidgets/signature_test.py deleted file mode 100644 index 3a0114b07..000000000 --- a/sources/pyside2/tests/QtWidgets/signature_test.py +++ /dev/null @@ -1,87 +0,0 @@ -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of Qt for Python. -## -## $QT_BEGIN_LICENSE:LGPL$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 3 as published by the Free Software -## Foundation and appearing in the file LICENSE.LGPL3 included in the -## packaging of this file. Please review the following information to -## ensure the GNU Lesser General Public License version 3 requirements -## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 2.0 or (at your option) the GNU General -## Public license version 3 or any later version approved by the KDE Free -## Qt Foundation. The licenses are as published by the Free Software -## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-2.0.html and -## https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from __future__ import print_function, absolute_import - -import unittest -import PySide2.QtCore -import PySide2.QtWidgets -from shibokensupport.signature import inspect - - -class PySideSignatureTest(unittest.TestCase): - def testSignatureExist(self): - t1 = type(PySide2.QtCore.QObject.children.__signature__) - self.assertEqual(t1, inspect.Signature) - t2 = type(PySide2.QtCore.QObject.__dict__["children"].__signature__) - self.assertEqual(t2, t1) - obj = PySide2.QtWidgets.QApplication.palette - t3 = type(obj.__signature__) - self.assertEqual(t3, list) - self.assertEqual(len(obj.__signature__), 3) - for thing in obj.__signature__: - self.assertEqual(type(thing), inspect.Signature) - sm = PySide2.QtWidgets.QApplication.__dict__["palette"] - self.assertFalse(callable(sm)) - self.assertEqual(sm.__func__, obj) - self.assertTrue(hasattr(sm, "__signature__") and - sm.__signature__ is not None) - - def testSignatureIsCached(self): - # see if we get the same object - ob1 = PySide2.QtCore.QObject.children.__signature__ - ob2 = PySide2.QtCore.QObject.children.__signature__ - self.assertTrue(ob1 is ob2) - # same with multi signature - ob1 = PySide2.QtWidgets.QApplication.palette.__signature__ - ob2 = PySide2.QtWidgets.QApplication.palette.__signature__ - self.assertTrue(ob1 is ob2) - - def testModuleIsInitialized(self): - self.assertTrue(PySide2.QtWidgets.QApplication.__signature__ is not None) - - def test_NotCalled_is_callable_and_correct(self): - # A signature that has a default value with some "Default(...)" - # wrapper is callable and creates an object of the right type. - sig = PySide2.QtCore.QByteArray().toPercentEncoding.__signature__ - called_default = sig.parameters["exclude"].default() - self.assertEqual(type(called_default), PySide2.QtCore.QByteArray) - -if __name__ == "__main__": - unittest.main() diff --git a/sources/pyside2/tests/QtWidgets/standardpixmap_test.py b/sources/pyside2/tests/QtWidgets/standardpixmap_test.py deleted file mode 100644 index 57c697aa3..000000000 --- a/sources/pyside2/tests/QtWidgets/standardpixmap_test.py +++ /dev/null @@ -1,43 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtGui import QPixmap -from PySide2.QtWidgets import QStyle - -from helper import UsesQApplication - -class StandardPixmapTest(UsesQApplication): - def testDefaultOptions(self): # Bug 253 - pixmap = self.app.style().standardPixmap(QStyle.SP_DirClosedIcon) - self.assertTrue(isinstance(pixmap, QPixmap)) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/test_module_template.py b/sources/pyside2/tests/QtWidgets/test_module_template.py deleted file mode 100644 index cc61fcf69..000000000 --- a/sources/pyside2/tests/QtWidgets/test_module_template.py +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -from PySide2.QtWidgets import QWidget -from PySide2.QtCore import QObject - -class MyQObject(QObject): - pass - -class MyQWidget(QWidget): - pass - -class Sentinel(): - value = 10 - diff --git a/sources/pyside2/tests/QtWidgets/virtual_protected_inheritance_test.py b/sources/pyside2/tests/QtWidgets/virtual_protected_inheritance_test.py deleted file mode 100644 index 8895e1980..000000000 --- a/sources/pyside2/tests/QtWidgets/virtual_protected_inheritance_test.py +++ /dev/null @@ -1,97 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for overriding inherited protected virtual methods''' - -import unittest - -from PySide2.QtCore import QTimerEvent -from PySide2.QtWidgets import QApplication, QSpinBox - -from helper import UsesQApplication - -class MySpinButton(QSpinBox): - '''Simple example class of overriding QObject.timerEvent''' - - def __init__(self, max_runs=5, app=None): - #Creates a new spinbox that will run <max_runs> and quit <app> - super(MySpinButton, self).__init__() - - if app is None: - app = QApplication([]) - - self.app = app - self.max_runs = max_runs - self.runs = 0 - - def timerEvent(self, event): - #Timer event method - self.runs += 1 - - self.setValue(self.runs) - - if self.runs == self.max_runs: - self.app.quit() - - if not isinstance(event, QTimerEvent): - raise TypeError('Invalid event type. Must be TimerEvent') - -class TimerEventTest(UsesQApplication): - '''Test case for running QObject.timerEvent from inherited class''' - - qapplication = True - - def setUp(self): - #Acquire resources - super(TimerEventTest, self).setUp() - self.widget = MySpinButton(app=self.app) - - def tearDown(self): - #Release resources - del self.widget - super(TimerEventTest, self).tearDown() - - def testMethod(self): - #QWidget.timerEvent overrinding (protected inherited) - timer_id = self.widget.startTimer(0) - - self.app.exec_() - - self.widget.killTimer(timer_id) - - self.assertTrue(self.widget.runs >= self.widget.max_runs) - - -if __name__ == '__main__': - unittest.main() - #app = QApplication([]) - #widget = MySpinButton(app=app) - #widget.startTimer(500) - #widget.show() - #app.exec_() - diff --git a/sources/pyside2/tests/QtWidgets/virtual_pure_override_test.py b/sources/pyside2/tests/QtWidgets/virtual_pure_override_test.py deleted file mode 100644 index 756915d67..000000000 --- a/sources/pyside2/tests/QtWidgets/virtual_pure_override_test.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import unittest - -from PySide2.QtWidgets import QGraphicsScene, QGraphicsRectItem, QGraphicsView, QApplication -from PySide2.QtGui import QBrush, QColor -from PySide2.QtCore import QTimer -from helper import UsesQApplication - -qgraphics_item_painted = False - -class RoundRectItem(QGraphicsRectItem): - - def __init__(self, x, y, w, h): - QGraphicsRectItem.__init__(self, x, y, w, h) - - def paint(self, painter, qstyleoptiongraphicsitem, qwidget): - global qgraphics_item_painted - qgraphics_item_painted = True - - -class QGraphicsItemTest(UsesQApplication): - - def createRoundRect(self, scene): - item = RoundRectItem(10, 10, 100, 100) - item.setBrush(QBrush(QColor(255, 0, 0))) - scene.addItem(item) - return item - - def quit_app(self): - self.app.quit() - - def test_setParentItem(self): - global qgraphics_item_painted - - scene = QGraphicsScene() - scene.addText("test") - view = QGraphicsView(scene) - - rect = self.createRoundRect(scene) - view.show() - QTimer.singleShot(1000, self.quit_app) - self.app.exec_() - self.assertTrue(qgraphics_item_painted) - - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtWidgets/wrong_return_test.py b/sources/pyside2/tests/QtWidgets/wrong_return_test.py deleted file mode 100644 index f4f036cc9..000000000 --- a/sources/pyside2/tests/QtWidgets/wrong_return_test.py +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -'''Test cases for Virtual functions with wrong return type''' - -import unittest -import py3kcompat as py3k -from PySide2 import QtWidgets -from helper import UsesQApplication - -import warnings -warnings.simplefilter('error') - - -class MyWidget(QtWidgets.QWidget): - def __init__(self, parent=None): - super(MyWidget, self).__init__(parent) - - def sizeHint(self): - pass - -class testCase(UsesQApplication): - - def testVirtualReturn(self): - w = MyWidget() - if py3k.IS_PY3K: - self.assertWarns(RuntimeWarning, w.show) - else: - self.assertRaises(RuntimeWarning, w.show) - - -if __name__ == '__main__': - unittest.main() |