aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtWidgets
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/QtWidgets')
-rw-r--r--sources/pyside2/tests/QtWidgets/CMakeLists.txt134
-rw-r--r--sources/pyside2/tests/QtWidgets/action_clear.py74
-rw-r--r--sources/pyside2/tests/QtWidgets/add_action_test.py71
-rw-r--r--sources/pyside2/tests/QtWidgets/api2_test.py89
-rw-r--r--sources/pyside2/tests/QtWidgets/application_test.py51
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_1002.py47
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_1006.py111
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_1048.py36
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_1077.py45
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_172.py41
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_243.py45
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_307.py54
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_324.py60
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_338.py55
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_363.py54
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_389.py43
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_400.py54
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_416.py71
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_429.py38
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_430.py42
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_433.py43
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_467.py47
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_493.py51
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_512.py50
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_525.py49
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_546.py42
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_547.py85
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_549.py44
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_569.py47
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_575.py48
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_576.py62
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_585.py54
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_589.py47
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_632.py48
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_635.py57
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_640.py39
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_653.py45
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_662.py57
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_667.py53
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_668.py50
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_674.py51
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_675.py43
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_688.py116
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_693.py58
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_696.py55
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_711.py53
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_714.py50
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_722.py52
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_728.py36
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_736.py47
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_750.py54
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_778.py50
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_785.py58
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_793.py58
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_811.py61
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_834.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_836.py56
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_844.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_854.py68
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_860.py63
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_862.py67
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_871.py70
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_879.py58
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_919.py66
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_921.py79
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_941.py45
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_964.py47
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_967.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_972.py67
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_979.py37
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_988.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_998.py38
-rw-r--r--sources/pyside2/tests/QtWidgets/customproxywidget_test.py62
-rw-r--r--sources/pyside2/tests/QtWidgets/event_filter_test.py67
-rw-r--r--sources/pyside2/tests/QtWidgets/grandparent_method_test.py50
-rw-r--r--sources/pyside2/tests/QtWidgets/hashabletype_test.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/import_test.py2
-rw-r--r--sources/pyside2/tests/QtWidgets/keep_reference_test.py103
-rw-r--r--sources/pyside2/tests/QtWidgets/missing_symbols_test.py57
-rw-r--r--sources/pyside2/tests/QtWidgets/paint_event_test.py98
-rw-r--r--sources/pyside2/tests/QtWidgets/parent_method_test.py52
-rw-r--r--sources/pyside2/tests/QtWidgets/python_properties_test.py44
-rw-r--r--sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py75
-rw-r--r--sources/pyside2/tests/QtWidgets/qaction_test.py69
-rw-r--r--sources/pyside2/tests/QtWidgets/qapp_test.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/qapplication_exit_segfault_test.py44
-rw-r--r--sources/pyside2/tests/QtWidgets/qapplication_singleton_test.py39
-rw-r--r--sources/pyside2/tests/QtWidgets/qbrush_test.py52
-rw-r--r--sources/pyside2/tests/QtWidgets/qdynamic_signal.py55
-rw-r--r--sources/pyside2/tests/QtWidgets/qfontdialog_test.py51
-rw-r--r--sources/pyside2/tests/QtWidgets/qformlayout_test.py84
-rw-r--r--sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py58
-rw-r--r--sources/pyside2/tests/QtWidgets/qgraphicsitem_test.py63
-rw-r--r--sources/pyside2/tests/QtWidgets/qgraphicsproxywidget_test.py58
-rw-r--r--sources/pyside2/tests/QtWidgets/qgraphicsscene_test.py197
-rw-r--r--sources/pyside2/tests/QtWidgets/qimage_test.py308
-rw-r--r--sources/pyside2/tests/QtWidgets/qinputdialog_get_test.py52
-rw-r--r--sources/pyside2/tests/QtWidgets/qkeysequenceedit_test.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/qlayout_ref_test.py179
-rw-r--r--sources/pyside2/tests/QtWidgets/qlayout_test.py140
-rw-r--r--sources/pyside2/tests/QtWidgets/qlcdnumber_test.py44
-rw-r--r--sources/pyside2/tests/QtWidgets/qlistwidget_test.py82
-rw-r--r--sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py56
-rw-r--r--sources/pyside2/tests/QtWidgets/qmainwindow_test.py113
-rw-r--r--sources/pyside2/tests/QtWidgets/qmenu_test.py86
-rw-r--r--sources/pyside2/tests/QtWidgets/qmenuadd_test.py53
-rw-r--r--sources/pyside2/tests/QtWidgets/qobject_mi_test.py70
-rw-r--r--sources/pyside2/tests/QtWidgets/qpen_test.py72
-rw-r--r--sources/pyside2/tests/QtWidgets/qpicture_test.py66
-rw-r--r--sources/pyside2/tests/QtWidgets/qpixmap_constructor.py279
-rw-r--r--sources/pyside2/tests/QtWidgets/qpushbutton_test.py69
-rw-r--r--sources/pyside2/tests/QtWidgets/qshortcut_test.py76
-rw-r--r--sources/pyside2/tests/QtWidgets/qsplitter_test.py44
-rw-r--r--sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py112
-rw-r--r--sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py61
-rw-r--r--sources/pyside2/tests/QtWidgets/qstyle_test.py59
-rw-r--r--sources/pyside2/tests/QtWidgets/qtableview_test.py44
-rw-r--r--sources/pyside2/tests/QtWidgets/qtabwidget_test.py56
-rw-r--r--sources/pyside2/tests/QtWidgets/qtextedit_signal_test.py65
-rw-r--r--sources/pyside2/tests/QtWidgets/qtextedit_test.py60
-rw-r--r--sources/pyside2/tests/QtWidgets/qtoolbar_test.py62
-rw-r--r--sources/pyside2/tests/QtWidgets/qtoolbox_test.py59
-rw-r--r--sources/pyside2/tests/QtWidgets/qvalidator_test.py114
-rw-r--r--sources/pyside2/tests/QtWidgets/qvariant_test.py50
-rw-r--r--sources/pyside2/tests/QtWidgets/qwidget_setlayout_test.py61
-rw-r--r--sources/pyside2/tests/QtWidgets/qwidget_test.py55
-rw-r--r--sources/pyside2/tests/QtWidgets/reference_count_test.py99
-rw-r--r--sources/pyside2/tests/QtWidgets/returnquadruplesofnumbers_test.py95
-rw-r--r--sources/pyside2/tests/QtWidgets/sample.pngbin0 -> 55944 bytes
-rw-r--r--sources/pyside2/tests/QtWidgets/standardpixmap_test.py43
-rw-r--r--sources/pyside2/tests/QtWidgets/test_module_template.py40
-rw-r--r--sources/pyside2/tests/QtWidgets/virtual_protected_inheritance_test.py97
-rw-r--r--sources/pyside2/tests/QtWidgets/virtual_pure_override_test.py77
-rw-r--r--sources/pyside2/tests/QtWidgets/wrong_return_test.py58
134 files changed, 8694 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
new file mode 100644
index 000000000..3c31b1d7d
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
@@ -0,0 +1,134 @@
+#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(python_properties_test.py)
+PYSIDE_TEST(qabstracttextdocumentlayout_test.py)
+PYSIDE_TEST(qaction_test.py)
+PYSIDE_TEST(qapp_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(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(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(qtextedit_test.py)
+PYSIDE_TEST(qtextedit_signal_test.py)
+PYSIDE_TEST(qtoolbar_test.py)
+PYSIDE_TEST(qtoolbox_test.py)
+PYSIDE_TEST(qvalidator_test.py)
+PYSIDE_TEST(qvariant_test.py)
+PYSIDE_TEST(qwidget_setlayout_test.py)
+PYSIDE_TEST(qwidget_test.py)
+PYSIDE_TEST(reference_count_test.py)
+PYSIDE_TEST(returnquadruplesofnumbers_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
new file mode 100644
index 000000000..72ea41e08
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/action_clear.py
@@ -0,0 +1,74 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..c6bc7abb5
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/add_action_test.py
@@ -0,0 +1,71 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ad46567bc
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/api2_test.py
@@ -0,0 +1,89 @@
+# -*- 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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..78628a556
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/application_test.py
@@ -0,0 +1,51 @@
+#!/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 PySide2.
+##
+## $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
+
+class QApplicationInstance(unittest.TestCase):
+
+ def appDestroyed(self):
+ sefl.assertTrue(False)
+
+ def testInstanceObject(self):
+ TestObject.createApp()
+ app1 = QApplication.instance()
+ app2 = QApplication.instance()
+ app1.setObjectName("MyApp")
+ self.assertEqual(app1, app2)
+ self.assertEqual(app2.objectName(), app1.objectName())
+ 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
new file mode 100644
index 000000000..6deadb238
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_1002.py
@@ -0,0 +1,47 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..6a8ea03b4
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_1006.py
@@ -0,0 +1,111 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..1e09fa66a
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_1048.py
@@ -0,0 +1,36 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..68380e42c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_1077.py
@@ -0,0 +1,45 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..993b634c3
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_172.py
@@ -0,0 +1,41 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..361f02f17
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_243.py
@@ -0,0 +1,45 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..4937f9835
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_307.py
@@ -0,0 +1,54 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..cc1871c7f
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_324.py
@@ -0,0 +1,60 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..326c10a4d
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_338.py
@@ -0,0 +1,55 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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() \ No newline at end of file
diff --git a/sources/pyside2/tests/QtWidgets/bug_363.py b/sources/pyside2/tests/QtWidgets/bug_363.py
new file mode 100644
index 000000000..7587c45de
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_363.py
@@ -0,0 +1,54 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..1ea8183e3
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_389.py
@@ -0,0 +1,43 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ad673704d
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_400.py
@@ -0,0 +1,54 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..988f3f83b
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_416.py
@@ -0,0 +1,71 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..2d9a9fee6
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_429.py
@@ -0,0 +1,38 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..7c7a5fa7a
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_430.py
@@ -0,0 +1,42 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..798bc28bd
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_433.py
@@ -0,0 +1,43 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..0bc5ed80d
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_467.py
@@ -0,0 +1,47 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..5372e28b7
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_493.py
@@ -0,0 +1,51 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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 TestBug569(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.assertEqual(ev1, ks)
+ self.assertEqual(ks, ev1)
+ self.assertNotEqual(ev2, ks)
+ self.assertNotEqual(ks, ev2)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/bug_512.py b/sources/pyside2/tests/QtWidgets/bug_512.py
new file mode 100644
index 000000000..37b68c551
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_512.py
@@ -0,0 +1,50 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..2a999a3fc
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_525.py
@@ -0,0 +1,49 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..bfcf503e6
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_546.py
@@ -0,0 +1,42 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..9b348b61f
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_547.py
@@ -0,0 +1,85 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..24159dbc5
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_549.py
@@ -0,0 +1,44 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..05a964c18
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_569.py
@@ -0,0 +1,47 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..9b0e00e1c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_575.py
@@ -0,0 +1,48 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..eefb2cb52
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_576.py
@@ -0,0 +1,62 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..1232d6c0b
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_585.py
@@ -0,0 +1,54 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..25ba10d71
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_589.py
@@ -0,0 +1,47 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..fa8063412
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_632.py
@@ -0,0 +1,48 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..f23241d30
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_635.py
@@ -0,0 +1,57 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..b9a9a0e8b
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_640.py
@@ -0,0 +1,39 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ba7178b98
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_653.py
@@ -0,0 +1,45 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..369bccfeb
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_662.py
@@ -0,0 +1,57 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ad91b5a78
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_667.py
@@ -0,0 +1,53 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..02036fae4
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_668.py
@@ -0,0 +1,50 @@
+# 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 PySide2.
+##
+## $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)
+
+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
new file mode 100644
index 000000000..c26bd7eee
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_674.py
@@ -0,0 +1,51 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..9e1358a8c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_675.py
@@ -0,0 +1,43 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..d622b33be
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_688.py
@@ -0,0 +1,116 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..eecc6b62b
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_693.py
@@ -0,0 +1,58 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..60f6f2166
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_696.py
@@ -0,0 +1,55 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..c56081f9b
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_711.py
@@ -0,0 +1,53 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..6fef26d33
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_714.py
@@ -0,0 +1,50 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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 increment the reference because this is an internal pointer
+ self.assertEqual(sys.getrefcount(p), 3)
+
+ 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
new file mode 100644
index 000000000..20087a088
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_722.py
@@ -0,0 +1,52 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..8ef40b374
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_728.py
@@ -0,0 +1,36 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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 *
+
+app = QApplication([])
+QTimer.singleShot(200, app.quit)
+
+# 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
new file mode 100644
index 000000000..2fe80f801
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_736.py
@@ -0,0 +1,47 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..055e982a8
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_750.py
@@ -0,0 +1,54 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..270b1a48a
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_778.py
@@ -0,0 +1,50 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ccd8dfddc
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_785.py
@@ -0,0 +1,58 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..89dc4408c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_793.py
@@ -0,0 +1,58 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..d219ec6c3
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_811.py
@@ -0,0 +1,61 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..00fe06510
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_834.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..5aeb94659
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_836.py
@@ -0,0 +1,56 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..991abbd13
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_844.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..47c368259
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_854.py
@@ -0,0 +1,68 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..f961a8ff2
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_860.py
@@ -0,0 +1,63 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..fc164bcc4
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_862.py
@@ -0,0 +1,67 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..a3ea007a2
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_871.py
@@ -0,0 +1,70 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..2a4207aa8
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_879.py
@@ -0,0 +1,58 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..c71fd8005
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_919.py
@@ -0,0 +1,66 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..1a60b123c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_921.py
@@ -0,0 +1,79 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..adacd62ac
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_941.py
@@ -0,0 +1,45 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..c462d2591
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_964.py
@@ -0,0 +1,47 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..7fa360317
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_967.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..09d0bee51
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_972.py
@@ -0,0 +1,67 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..24372fea3
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_979.py
@@ -0,0 +1,37 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..613c4df5e
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_988.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..104a726af
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/bug_998.py
@@ -0,0 +1,38 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..3f4811a21
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/customproxywidget_test.py
@@ -0,0 +1,62 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..e7e525640
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/event_filter_test.py
@@ -0,0 +1,67 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..cbd561f58
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/grandparent_method_test.py
@@ -0,0 +1,50 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..21486b28a
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/hashabletype_test.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..0b60241f0
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/import_test.py
@@ -0,0 +1,2 @@
+class PysideImportTest2(object):
+ pass
diff --git a/sources/pyside2/tests/QtWidgets/keep_reference_test.py b/sources/pyside2/tests/QtWidgets/keep_reference_test.py
new file mode 100644
index 000000000..17502c267
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/keep_reference_test.py
@@ -0,0 +1,103 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..fedc2859f
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/missing_symbols_test.py
@@ -0,0 +1,57 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..cbbe3acb3
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/paint_event_test.py
@@ -0,0 +1,98 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..b3d883362
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/parent_method_test.py
@@ -0,0 +1,52 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/python_properties_test.py b/sources/pyside2/tests/QtWidgets/python_properties_test.py
new file mode 100644
index 000000000..077702964
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/python_properties_test.py
@@ -0,0 +1,44 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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))
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py b/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py
new file mode 100644
index 000000000..70d25295c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qabstracttextdocumentlayout_test.py
@@ -0,0 +1,75 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..bbc8a5201
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qaction_test.py
@@ -0,0 +1,69 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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_test.py b/sources/pyside2/tests/QtWidgets/qapp_test.py
new file mode 100644
index 000000000..63496f7dd
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qapp_test.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..21250c4cb
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qapplication_exit_segfault_test.py
@@ -0,0 +1,44 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..77dca33cf
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qapplication_singleton_test.py
@@ -0,0 +1,39 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/qbrush_test.py b/sources/pyside2/tests/QtWidgets/qbrush_test.py
new file mode 100644
index 000000000..88e07f462
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qbrush_test.py
@@ -0,0 +1,52 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/qdynamic_signal.py b/sources/pyside2/tests/QtWidgets/qdynamic_signal.py
new file mode 100644
index 000000000..cba2bc041
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qdynamic_signal.py
@@ -0,0 +1,55 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..4475190a6
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qfontdialog_test.py
@@ -0,0 +1,51 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..feb4b4114
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qformlayout_test.py
@@ -0,0 +1,84 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ec8c046ed
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py
@@ -0,0 +1,58 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..1a25fdf31
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qgraphicsitem_test.py
@@ -0,0 +1,63 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/qgraphicsproxywidget_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsproxywidget_test.py
new file mode 100644
index 000000000..7fbdf5467
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qgraphicsproxywidget_test.py
@@ -0,0 +1,58 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..8b883aa55
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qgraphicsscene_test.py
@@ -0,0 +1,197 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
+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
+
+from helper import UsesQApplication
+
+class Constructor(unittest.TestCase):
+ '''QGraphicsScene constructor'''
+
+ def testConstructor(self):
+ #QGraphicsScene constructor
+ obj = QGraphicsScene()
+ self.assertTrue(isinstance(obj, QGraphicsScene))
+
+
+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)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/qimage_test.py b/sources/pyside2/tests/QtWidgets/qimage_test.py
new file mode 100644
index 000000000..fab97ddf6
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qimage_test.py
@@ -0,0 +1,308 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..3f94dcd44
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qinputdialog_get_test.py
@@ -0,0 +1,52 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..0591df1ba
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qkeysequenceedit_test.py
@@ -0,0 +1,46 @@
+#############################################################################
+##
+## Copyright (C) 2017 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/qlayout_ref_test.py b/sources/pyside2/tests/QtWidgets/qlayout_ref_test.py
new file mode 100644
index 000000000..f1a9f363f
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qlayout_ref_test.py
@@ -0,0 +1,179 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..684a6c409
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qlayout_test.py
@@ -0,0 +1,140 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..56a983d0d
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qlcdnumber_test.py
@@ -0,0 +1,44 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..b89d2f77c
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qlistwidget_test.py
@@ -0,0 +1,82 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py b/sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py
new file mode 100644
index 000000000..284b5ef83
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qlistwidgetitem_test.py
@@ -0,0 +1,56 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ae1129494
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qmainwindow_test.py
@@ -0,0 +1,113 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..f5b9cbd02
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qmenu_test.py
@@ -0,0 +1,86 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..39fa50a0d
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qmenuadd_test.py
@@ -0,0 +1,53 @@
+# -*- 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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..e0c98b2a7
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qobject_mi_test.py
@@ -0,0 +1,70 @@
+# -*- 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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..75c728884
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qpen_test.py
@@ -0,0 +1,72 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..15a527f6b
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qpicture_test.py
@@ -0,0 +1,66 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..9ae7d0fcf
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qpixmap_constructor.py
@@ -0,0 +1,279 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..7039a8e3f
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qpushbutton_test.py
@@ -0,0 +1,69 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..0cf749ebd
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qshortcut_test.py
@@ -0,0 +1,76 @@
+# -*- 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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..f90663155
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qsplitter_test.py
@@ -0,0 +1,44 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..2e9d260a3
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py
@@ -0,0 +1,112 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
+try:
+ # the normal call with installed PySide2
+ from PySide2 import shiboken2 as shiboken
+except ImportError:
+ try:
+ # When running make test on macOS, shiboken2 is not part of the PySide2 module,
+ # so it needs to be imported as a standalone module.
+ import shiboken2 as shiboken
+ except ImportError:
+ # sys.path is set a bit weird during tests, so we help a little to find shiboken2.
+ sys.path.append("../../..")
+ # the special call with testrunner.py
+ from shiboken2.shibokenmodule 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
new file mode 100644
index 000000000..ed4c5ad00
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py
@@ -0,0 +1,61 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..0650c96e9
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qstyle_test.py
@@ -0,0 +1,59 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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 QWidget, QLabel, QFontComboBox, QStyleFactory
+
+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)
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/sources/pyside2/tests/QtWidgets/qtableview_test.py b/sources/pyside2/tests/QtWidgets/qtableview_test.py
new file mode 100644
index 000000000..f7d0f4c4e
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qtableview_test.py
@@ -0,0 +1,44 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..b36310ed0
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qtabwidget_test.py
@@ -0,0 +1,56 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/qtextedit_signal_test.py b/sources/pyside2/tests/QtWidgets/qtextedit_signal_test.py
new file mode 100644
index 000000000..f60102806
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qtextedit_signal_test.py
@@ -0,0 +1,65 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..f67f8fbe1
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qtextedit_test.py
@@ -0,0 +1,60 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..fc55d8bfe
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qtoolbar_test.py
@@ -0,0 +1,62 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..ac6e590d1
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qtoolbox_test.py
@@ -0,0 +1,59 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/qvalidator_test.py b/sources/pyside2/tests/QtWidgets/qvalidator_test.py
new file mode 100644
index 000000000..951d6b2b0
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qvalidator_test.py
@@ -0,0 +1,114 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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.QtGui import *
+from PySide2.QtWidgets import *
+
+import unittest
+from helper import UsesQApplication
+
+class MyValidator1(QValidator):
+ def fixUp(self, input):
+ return "fixed"
+
+ def validate(self, input, pos):
+ return (QValidator.Acceptable, "fixed", 1)
+
+class MyValidator2(QValidator):
+ def fixUp(self, input):
+ return "fixed"
+
+ def validate(self, input, pos):
+ return (QValidator.Acceptable, "fixed")
+
+class MyValidator3(QValidator):
+ def fixUp(self, input):
+ return "fixed"
+
+ def validate(self, input, pos):
+ return (QValidator.Acceptable,)
+
+class MyValidator4(QValidator):
+ def fixUp(self, input):
+ return "fixed"
+
+ def validate(self, input, pos):
+ return QValidator.Acceptable
+
+class QValidatorTest(UsesQApplication):
+ def testValidator1(self):
+ line = QLineEdit()
+ line.setValidator(MyValidator1())
+ line.show()
+ line.setText("foo")
+
+ QTimer.singleShot(0, line.close)
+ self.app.exec_()
+
+ self.assertEqual(line.text(), "fixed")
+ self.assertEqual(line.cursorPosition(), 1)
+
+ def testValidator2(self):
+ line = QLineEdit()
+ line.setValidator(MyValidator2())
+ line.show()
+ line.setText("foo")
+
+ QTimer.singleShot(0, line.close)
+ self.app.exec_()
+
+ self.assertEqual(line.text(), "fixed")
+ self.assertEqual(line.cursorPosition(), 3)
+
+ def testValidator3(self):
+ line = QLineEdit()
+ line.setValidator(MyValidator3())
+ line.show()
+ line.setText("foo")
+
+ QTimer.singleShot(0, line.close)
+ self.app.exec_()
+
+ self.assertEqual(line.text(), "foo")
+ self.assertEqual(line.cursorPosition(), 3)
+
+ def testValidator4(self):
+ line = QLineEdit()
+ line.setValidator(MyValidator4())
+ line.show()
+ line.setText("foo")
+
+ QTimer.singleShot(0, line.close)
+ self.app.exec_()
+
+ self.assertEqual(line.text(), "foo")
+ self.assertEqual(line.cursorPosition(), 3)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/qvariant_test.py b/sources/pyside2/tests/QtWidgets/qvariant_test.py
new file mode 100644
index 000000000..f80460697
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qvariant_test.py
@@ -0,0 +1,50 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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 MyDiagram(QGraphicsScene):
+ pass
+
+class MyItem(QGraphicsRectItem):
+ def itemChange(self, change, value):
+ return value;
+
+class QGraphicsSceneOnQVariantTest(unittest.TestCase):
+ """Test storage ot QGraphicsScene into QVariants"""
+ def testIt(self):
+ app = QApplication([])
+ s = MyDiagram()
+ i = MyItem()
+ s.addItem(i)
+ self.assertEqual(len(s.items()), 1)
+
+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
new file mode 100644
index 000000000..fb5bebb53
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qwidget_setlayout_test.py
@@ -0,0 +1,61 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..22ea82cc6
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qwidget_test.py
@@ -0,0 +1,55 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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, QMainWindow
+from helper import UsesQApplication
+
+class QWidgetInherit(QMainWindow):
+ def __init__(self):
+ QWidget.__init__(self)
+
+class QWidgetTest(UsesQApplication):
+
+ def testInheritance(self):
+ self.assertRaises(TypeError, QWidgetInherit)
+
+class QWidgetVisible(UsesQApplication):
+
+ def testBasic(self):
+ # Also related to bug #244, on existence of setVisible'''
+ widget = QWidget()
+ self.assertTrue(not widget.isVisible())
+ widget.setVisible(True)
+ self.assertTrue(widget.isVisible())
+ self.assertTrue(widget.winId() is not 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
new file mode 100644
index 000000000..9fa51f161
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/reference_count_test.py
@@ -0,0 +1,99 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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/returnquadruplesofnumbers_test.py b/sources/pyside2/tests/QtWidgets/returnquadruplesofnumbers_test.py
new file mode 100644
index 000000000..6e4cfeb63
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/returnquadruplesofnumbers_test.py
@@ -0,0 +1,95 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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 __future__ import print_function
+
+import unittest
+from PySide2.QtGui import QTextCursor
+from PySide2.QtPrintSupport import QPrinter
+from PySide2.QtWidgets import QLayout, QWidget, QGraphicsLayout, QGraphicsLayoutItem
+
+from helper import UsesQApplication
+
+class Layout(QLayout):
+ def __init__(self):
+ QLayout.__init__(self)
+
+class GraphicsLayout(QGraphicsLayout):
+ def __init__(self):
+ QGraphicsLayout.__init__(self)
+
+class GraphicsLayoutItem(QGraphicsLayoutItem):
+ def __init__(self):
+ QGraphicsLayoutItem.__init__(self)
+
+class ReturnsQuadruplesOfNumbers(UsesQApplication):
+ def compareTuples(self, ta, tb):
+ for va,vb in zip(ta, tb):
+ if round(va) != round(vb):
+ return False
+ return True
+
+ def testQGraphicsLayoutGetContentsMargins(self):
+ obj = GraphicsLayout()
+ values = (10.0, 20.0, 30.0, 40.0)
+ obj.setContentsMargins(*values)
+ self.assertTrue(self.compareTuples(obj.getContentsMargins(), values))
+
+ def testQGraphicsLayoutItemGetContentsMargins(self):
+ obj = GraphicsLayoutItem()
+ self.assertTrue(self.compareTuples(obj.getContentsMargins(), (0.0, 0.0, 0.0, 0.0)))
+
+ def testQWidgetGetContentsMargins(self):
+ obj = QWidget()
+ values = (10, 20, 30, 40)
+ obj.setContentsMargins(*values)
+ self.assertTrue(self.compareTuples(obj.getContentsMargins(), values))
+
+ def testQLayoutGetContentsMargins(self):
+ obj = Layout()
+ values = (10, 20, 30, 40)
+ obj.setContentsMargins(*values)
+ self.assertTrue(self.compareTuples(obj.getContentsMargins(), values))
+
+ def testQTextCursorSelectedTableCells(self):
+ obj = QTextCursor()
+ self.assertEqual(obj.selectedTableCells(), (-1, -1, -1, -1))
+
+ def testQPrinterGetPageMargins(self):
+ # Bug #742
+ obj = QPrinter()
+ # On macOS the minimum margin of a page is ~12, setting something lower than that will
+ # actually fail to set all the margins.
+ values = (15.0, 16.0, 17.0, 18.0, QPrinter.Point)
+ obj.setPageMargins(*values)
+ print(obj.getPageMargins(QPrinter.Point), values[:-1])
+ self.assertTrue(self.compareTuples(obj.getPageMargins(QPrinter.Point), values[:-1]))
+
+if __name__ == "__main__":
+ unittest.main()
+
diff --git a/sources/pyside2/tests/QtWidgets/sample.png b/sources/pyside2/tests/QtWidgets/sample.png
new file mode 100644
index 000000000..60450f0dc
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/sample.png
Binary files differ
diff --git a/sources/pyside2/tests/QtWidgets/standardpixmap_test.py b/sources/pyside2/tests/QtWidgets/standardpixmap_test.py
new file mode 100644
index 000000000..dc93ba354
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/standardpixmap_test.py
@@ -0,0 +1,43 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..d5e9db0f0
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/test_module_template.py
@@ -0,0 +1,40 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..b46ca8c88
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/virtual_protected_inheritance_test.py
@@ -0,0 +1,97 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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
new file mode 100644
index 000000000..d7b82d786
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/virtual_pure_override_test.py
@@ -0,0 +1,77 @@
+#!/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 PySide2.
+##
+## $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
new file mode 100644
index 000000000..f50420a64
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/wrong_return_test.py
@@ -0,0 +1,58 @@
+#############################################################################
+##
+## Copyright (C) 2016 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of PySide2.
+##
+## $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()