aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtUiTools
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/tests/QtUiTools')
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_1060.py10
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_360.py10
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_376.py10
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_392.py10
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_426.py8
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_552.py10
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_797.py12
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_909.py9
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_913.py8
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_958.py11
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_965.py13
-rw-r--r--sources/pyside2/tests/QtUiTools/loadUiType_test.py75
-rw-r--r--sources/pyside2/tests/QtUiTools/ui_test.py8
-rw-r--r--sources/pyside2/tests/QtUiTools/uiloader_test.py10
14 files changed, 183 insertions, 21 deletions
diff --git a/sources/pyside2/tests/QtUiTools/bug_1060.py b/sources/pyside2/tests/QtUiTools/bug_1060.py
index 94c15b54d..f60912780 100644
--- a/sources/pyside2/tests/QtUiTools/bug_1060.py
+++ b/sources/pyside2/tests/QtUiTools/bug_1060.py
@@ -28,9 +28,17 @@
''' unit test for BUG #1060 '''
+import os
+import sys
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import adjust_filename
from PySide2.QtWidgets import QApplication
from PySide2.QtUiTools import QUiLoader
-from helper import adjust_filename
+
class MyQUiLoader(QUiLoader):
def __init__(self):
diff --git a/sources/pyside2/tests/QtUiTools/bug_360.py b/sources/pyside2/tests/QtUiTools/bug_360.py
index 345c4f95e..8d15f2730 100644
--- a/sources/pyside2/tests/QtUiTools/bug_360.py
+++ b/sources/pyside2/tests/QtUiTools/bug_360.py
@@ -26,9 +26,15 @@
##
#############################################################################
-import unittest
import os
-from helper import UsesQApplication
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
from PySide2 import QtCore, QtWidgets
from PySide2.QtUiTools import QUiLoader
diff --git a/sources/pyside2/tests/QtUiTools/bug_376.py b/sources/pyside2/tests/QtUiTools/bug_376.py
index f26177ab4..264faad7f 100644
--- a/sources/pyside2/tests/QtUiTools/bug_376.py
+++ b/sources/pyside2/tests/QtUiTools/bug_376.py
@@ -26,9 +26,15 @@
##
#############################################################################
-import unittest
import os
-from helper import UsesQApplication
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
from PySide2 import QtCore, QtWidgets
from PySide2.QtUiTools import QUiLoader
diff --git a/sources/pyside2/tests/QtUiTools/bug_392.py b/sources/pyside2/tests/QtUiTools/bug_392.py
index 9e8648135..2439e7203 100644
--- a/sources/pyside2/tests/QtUiTools/bug_392.py
+++ b/sources/pyside2/tests/QtUiTools/bug_392.py
@@ -26,9 +26,15 @@
##
#############################################################################
-import unittest
import os
-from helper import UsesQApplication
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
from PySide2 import QtWidgets
from PySide2.QtUiTools import QUiLoader
diff --git a/sources/pyside2/tests/QtUiTools/bug_426.py b/sources/pyside2/tests/QtUiTools/bug_426.py
index 5b055a45f..e84da0382 100644
--- a/sources/pyside2/tests/QtUiTools/bug_426.py
+++ b/sources/pyside2/tests/QtUiTools/bug_426.py
@@ -26,8 +26,14 @@
##
#############################################################################
-import sys
import os
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
from PySide2 import QtCore, QtWidgets
from PySide2.QtUiTools import QUiLoader
diff --git a/sources/pyside2/tests/QtUiTools/bug_552.py b/sources/pyside2/tests/QtUiTools/bug_552.py
index b9d4f750b..be42789cf 100644
--- a/sources/pyside2/tests/QtUiTools/bug_552.py
+++ b/sources/pyside2/tests/QtUiTools/bug_552.py
@@ -26,7 +26,15 @@
##
#############################################################################
-from helper import adjust_filename
+import os
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import adjust_filename
from PySide2 import QtWidgets, QtCore
from PySide2.QtUiTools import QUiLoader
diff --git a/sources/pyside2/tests/QtUiTools/bug_797.py b/sources/pyside2/tests/QtUiTools/bug_797.py
index b1a0e5bb3..454699196 100644
--- a/sources/pyside2/tests/QtUiTools/bug_797.py
+++ b/sources/pyside2/tests/QtUiTools/bug_797.py
@@ -26,10 +26,20 @@
##
#############################################################################
+import os
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import adjust_filename
+
from PySide2 import QtUiTools
from PySide2 import QtCore
from PySide2 import QtWidgets
-from helper import adjust_filename
+
app = QtWidgets.QApplication([])
loader = QtUiTools.QUiLoader()
diff --git a/sources/pyside2/tests/QtUiTools/bug_909.py b/sources/pyside2/tests/QtUiTools/bug_909.py
index c4185e11f..9831b6b0e 100644
--- a/sources/pyside2/tests/QtUiTools/bug_909.py
+++ b/sources/pyside2/tests/QtUiTools/bug_909.py
@@ -26,15 +26,20 @@
##
#############################################################################
+import os
import sys
import unittest
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
from PySide2.QtCore import QFile
from PySide2.QtWidgets import QTabWidget
from PySide2.QtUiTools import QUiLoader
-from helper import UsesQApplication
-from helper import adjust_filename
+from helper.usesqapplication import UsesQApplication
+from helper.helper import adjust_filename
class TestDestruction(UsesQApplication):
def testBug909(self):
diff --git a/sources/pyside2/tests/QtUiTools/bug_913.py b/sources/pyside2/tests/QtUiTools/bug_913.py
index 9ace5bbef..3e2ca818b 100644
--- a/sources/pyside2/tests/QtUiTools/bug_913.py
+++ b/sources/pyside2/tests/QtUiTools/bug_913.py
@@ -29,9 +29,15 @@
##
#############################################################################
+import os
import sys
import unittest
-from helper import adjust_filename
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.helper import adjust_filename
from PySide2.QtCore import *
from PySide2.QtWidgets import *
diff --git a/sources/pyside2/tests/QtUiTools/bug_958.py b/sources/pyside2/tests/QtUiTools/bug_958.py
index 503433405..98ac16189 100644
--- a/sources/pyside2/tests/QtUiTools/bug_958.py
+++ b/sources/pyside2/tests/QtUiTools/bug_958.py
@@ -26,10 +26,17 @@
##
#############################################################################
+import os
+import sys
import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
from PySide2 import QtWidgets, QtUiTools
-from helper import adjust_filename
-from helper import TimedQApplication
+from helper.helper import adjust_filename
+from helper.timedqapplication import TimedQApplication
class Gui_Qt(QtWidgets.QMainWindow):
def __init__(self, parent=None):
diff --git a/sources/pyside2/tests/QtUiTools/bug_965.py b/sources/pyside2/tests/QtUiTools/bug_965.py
index b0df5fc71..217f948af 100644
--- a/sources/pyside2/tests/QtUiTools/bug_965.py
+++ b/sources/pyside2/tests/QtUiTools/bug_965.py
@@ -26,11 +26,18 @@
##
#############################################################################
-from PySide2.QtUiTools import QUiLoader
+import os
+import sys
import unittest
-from helper import UsesQApplication
-from helper import adjust_filename
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide2.QtUiTools import QUiLoader
+
+from helper.usesqapplication import UsesQApplication
+from helper.helper import adjust_filename
class MyQUiLoader(QUiLoader):
def __init__(self):
diff --git a/sources/pyside2/tests/QtUiTools/loadUiType_test.py b/sources/pyside2/tests/QtUiTools/loadUiType_test.py
new file mode 100644
index 000000000..9a3756376
--- /dev/null
+++ b/sources/pyside2/tests/QtUiTools/loadUiType_test.py
@@ -0,0 +1,75 @@
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import os
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
+
+from PySide2.QtWidgets import QWidget, QFrame, QPushButton
+from PySide2.QtUiTools import loadUiType
+
+class loadUiTypeTester(UsesQApplication):
+ def testFunction(self):
+ filePath = os.path.join(os.path.dirname(__file__), "minimal.ui")
+ loaded = loadUiType(filePath)
+ self.assertNotEqual(loaded, None)
+
+ # (<class '__main__.Ui_Form'>, <class 'PySide2.QtWidgets.QFrame'>)
+ generated, base = loaded
+
+ # Generated class contains retranslateUi method
+ self.assertTrue("retranslateUi" in dir(generated))
+
+ # Base class instance will be QFrame for this example
+ self.assertTrue(isinstance(base(), QFrame))
+
+ anotherFileName = os.path.join(os.path.dirname(__file__), "test.ui")
+ another = loadUiType(anotherFileName)
+ self.assertNotEqual(another, None)
+
+ generated, base = another
+ # Base class instance will be QWidget for this example
+ self.assertTrue(isinstance(base(), QWidget))
+
+ w = base()
+ ui = generated()
+ ui.setupUi(w)
+
+ self.assertTrue(isinstance(ui.child_object, QFrame))
+ self.assertTrue(isinstance(ui.grandson_object, QPushButton))
+
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/sources/pyside2/tests/QtUiTools/ui_test.py b/sources/pyside2/tests/QtUiTools/ui_test.py
index f84f9c3d1..6705bb0be 100644
--- a/sources/pyside2/tests/QtUiTools/ui_test.py
+++ b/sources/pyside2/tests/QtUiTools/ui_test.py
@@ -26,11 +26,17 @@
##
#############################################################################
+import os
+import sys
import unittest
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
from PySide2.QtUiTools import QUiLoader
-from helper import UsesQApplication
+from helper.usesqapplication import UsesQApplication
class QUiLoaderCreation(UsesQApplication):
diff --git a/sources/pyside2/tests/QtUiTools/uiloader_test.py b/sources/pyside2/tests/QtUiTools/uiloader_test.py
index c550b8020..48b401426 100644
--- a/sources/pyside2/tests/QtUiTools/uiloader_test.py
+++ b/sources/pyside2/tests/QtUiTools/uiloader_test.py
@@ -26,9 +26,15 @@
##
#############################################################################
-import unittest
import os
-from helper import UsesQApplication
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from helper.usesqapplication import UsesQApplication
from PySide2.QtWidgets import QWidget
from PySide2.QtUiTools import QUiLoader