diff options
Diffstat (limited to 'sources/pyside6/tests/QtQml')
21 files changed, 106 insertions, 46 deletions
diff --git a/sources/pyside6/tests/QtQml/bug_451.py b/sources/pyside6/tests/QtQml/bug_451.py index 9924ee854..7fd73ba90 100644 --- a/sources/pyside6/tests/QtQml/bug_451.py +++ b/sources/pyside6/tests/QtQml/bug_451.py @@ -42,7 +42,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6 import QtCore, QtGui, QtQuick @@ -83,8 +83,11 @@ class TestBug(unittest.TestCase): obj = PythonObject() context = view.rootContext() context.setContextProperty("python", obj) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_451.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_451.qml' + self.assertTrue(file.is_file()) + view.setSource(QtCore.QUrl.fromLocalFile(os.fspath(file))) root = view.rootObject() + self.assertTrue(root, quickview_errorstring(view)) root.simpleFunction() self.assertEqual(obj.called, "simpleFunction") diff --git a/sources/pyside6/tests/QtQml/bug_456.py b/sources/pyside6/tests/QtQml/bug_456.py index 8a5c54478..17028a902 100644 --- a/sources/pyside6/tests/QtQml/bug_456.py +++ b/sources/pyside6/tests/QtQml/bug_456.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6 import QtCore, QtGui, QtQuick @@ -67,8 +67,11 @@ class TestConnectionWithInvalidSignature(TimedQApplication): context = view.rootContext() context.setContextProperty("rotatevalue", rotatevalue) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_456.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_456.qml' + self.assertTrue(file.is_file()) + view.setSource(QtCore.QUrl.fromLocalFile(os.fspath(file))) root = view.rootObject() + self.assertTrue(root, quickview_errorstring(view)) button = root.findChild(QtCore.QObject, "buttonMouseArea") view.show() button.entered.emit() diff --git a/sources/pyside6/tests/QtQml/bug_557.py b/sources/pyside6/tests/QtQml/bug_557.py index 88366a5bf..172a15777 100644 --- a/sources/pyside6/tests/QtQml/bug_557.py +++ b/sources/pyside6/tests/QtQml/bug_557.py @@ -47,5 +47,7 @@ engine = QQmlEngine() component = QQmlComponent(engine) # This should segfault if the QDeclarativeComponent has not QQmlEngine -component.loadUrl(QUrl.fromLocalFile(adjust_filename('foo.qml', __file__))) +file = Path(__file__).resolve().parent / 'foo.qml' +assert(not file.is_file()) +component.loadUrl(QUrl.fromLocalFile(os.fspath(file))) diff --git a/sources/pyside6/tests/QtQml/bug_726.py b/sources/pyside6/tests/QtQml/bug_726.py index 9d1f9cd82..aab597675 100644 --- a/sources/pyside6/tests/QtQml/bug_726.py +++ b/sources/pyside6/tests/QtQml/bug_726.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6 import QtCore, QtGui, QtQuick @@ -68,8 +68,11 @@ class TestConnectionWithInvalidSignature(TimedQApplication): context = view.rootContext() context.setContextProperty("proxy", proxy) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_726.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_726.qml' + self.assertTrue(file.is_file()) + view.setSource(QtCore.QUrl.fromLocalFile(os.fspath(file))) root = view.rootObject() + self.assertTrue(root, quickview_errorstring(view)) button = root.findChild(QtCore.QObject, "buttonMouseArea") view.show() button.entered.emit() diff --git a/sources/pyside6/tests/QtQml/bug_814.py b/sources/pyside6/tests/QtQml/bug_814.py index 4c6b1f488..b89eb93f6 100644 --- a/sources/pyside6/tests/QtQml/bug_814.py +++ b/sources/pyside6/tests/QtQml/bug_814.py @@ -46,7 +46,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6.QtCore import QUrl, QAbstractListModel, QModelIndex, Qt @@ -72,8 +72,11 @@ class TestBug814(TimedQApplication): view = QQuickView() model = ListModel() view.rootContext().setContextProperty("pythonModel", model) - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_814.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_814.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) root = view.rootObject() + self.assertTrue(root, quickview_errorstring(view)) view.show() if __name__ == '__main__': diff --git a/sources/pyside6/tests/QtQml/bug_825.py b/sources/pyside6/tests/QtQml/bug_825.py index f3315c6ed..039611c70 100644 --- a/sources/pyside6/tests/QtQml/bug_825.py +++ b/sources/pyside6/tests/QtQml/bug_825.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6.QtCore import Qt, QUrl, QTimer from PySide6.QtGui import QGuiApplication, QPen @@ -79,7 +79,10 @@ class TestBug825 (unittest.TestCase): self.assertRaises(TypeError, qmlRegisterType, A, 'bugs', 1, 0, 'A') view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_825.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_825.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() QTimer.singleShot(250, view.close) app.exec_() diff --git a/sources/pyside6/tests/QtQml/bug_847.py b/sources/pyside6/tests/QtQml/bug_847.py index 35acea051..99e3d54eb 100644 --- a/sources/pyside6/tests/QtQml/bug_847.py +++ b/sources/pyside6/tests/QtQml/bug_847.py @@ -43,7 +43,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.usesqapplication import UsesQApplication from PySide6.QtCore import Slot, Signal, QUrl, QTimer, QCoreApplication @@ -71,11 +71,13 @@ class TestQML(UsesQApplication): # Connect first, then set the property. view.called.connect(self.done) - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_847.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_847.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) while view.status() == QQuickView.Loading: self.app.processEvents() self.assertEqual(view.status(), QQuickView.Ready) - self.assertTrue(view.rootObject()) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.rootObject().setProperty('pythonObject', view) view.show() diff --git a/sources/pyside6/tests/QtQml/bug_926.py b/sources/pyside6/tests/QtQml/bug_926.py index 63d2107c8..f76c3c310 100644 --- a/sources/pyside6/tests/QtQml/bug_926.py +++ b/sources/pyside6/tests/QtQml/bug_926.py @@ -36,7 +36,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6.QtCore import QUrl, QTimer, QObject, Signal, Property from PySide6.QtGui import QGuiApplication @@ -66,8 +66,11 @@ class TestBug926 (unittest.TestCase): app = QGuiApplication([]) qmlRegisterType(MyClass,'Example',1,0,'MyClass') view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_926.qml', __file__))) - self.assertEqual(len(view.errors()), 0) + file = Path(__file__).resolve().parent / 'bug_926.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) + view.show() QTimer.singleShot(0, app.quit) app.exec_() diff --git a/sources/pyside6/tests/QtQml/bug_951.py b/sources/pyside6/tests/QtQml/bug_951.py index 59776c327..2996fada7 100644 --- a/sources/pyside6/tests/QtQml/bug_951.py +++ b/sources/pyside6/tests/QtQml/bug_951.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6.QtCore import QUrl @@ -60,7 +60,10 @@ class TestRegisterQMLType(TimedQApplication): qmlRegisterType(MyItem, "my.item", 1, 0, "MyItem") view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_951.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_951.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) self.app.exec_() self.assertTrue(MyItem.COMPONENT_COMPLETE_CALLED) diff --git a/sources/pyside6/tests/QtQml/bug_995.py b/sources/pyside6/tests/QtQml/bug_995.py index 0f9a7449f..7db0c2e77 100644 --- a/sources/pyside6/tests/QtQml/bug_995.py +++ b/sources/pyside6/tests/QtQml/bug_995.py @@ -38,11 +38,14 @@ init_test_paths(False) from helper.helper import adjust_filename from helper.usesqapplication import UsesQApplication +from PySide6.QtCore import QUrl from PySide6.QtGui import QGuiApplication from PySide6.QtQuick import QQuickView app = QGuiApplication([]) -view = QQuickView(adjust_filename('bug_995.qml', __file__)) +file = Path(__file__).resolve().parent / 'bug_995.qml' +assert(file.is_file()) +view = QQuickView(QUrl.fromLocalFile(os.fspath(file))) view.show() view.resize(200, 200) contentItem = view.contentItem() diff --git a/sources/pyside6/tests/QtQml/bug_997.py b/sources/pyside6/tests/QtQml/bug_997.py index a66db98bc..3d77e18e7 100644 --- a/sources/pyside6/tests/QtQml/bug_997.py +++ b/sources/pyside6/tests/QtQml/bug_997.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.usesqapplication import UsesQApplication from PySide6 import QtCore, QtQml, QtQuick @@ -50,7 +50,10 @@ class TestBug(UsesQApplication): view = QtQuick.QQuickView() ctxt = view.rootContext() ctxt.setContextProperty('owner', ownerData) - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('bug_997.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_997.qml' + self.assertTrue(file.is_file()) + view.setSource(QtCore.QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() QtCore.QTimer.singleShot(1000, self.app.quit) self.app.exec_() diff --git a/sources/pyside6/tests/QtQml/connect_python_qml.py b/sources/pyside6/tests/QtQml/connect_python_qml.py index 47e0fdae0..40b695b95 100644 --- a/sources/pyside6/tests/QtQml/connect_python_qml.py +++ b/sources/pyside6/tests/QtQml/connect_python_qml.py @@ -42,7 +42,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6 import QtCore, QtGui, QtQuick @@ -59,8 +59,11 @@ class TestConnectionWithInvalidSignature(TimedQApplication): self.buttonClicked = False self.buttonFailClicked = False view = QtQuick.QQuickView() - view.setSource(QtCore.QUrl.fromLocalFile(adjust_filename('connect_python_qml.qml', __file__))) + file = Path(__file__).resolve().parent / 'connect_python_qml.qml' + self.assertTrue(file.is_file()) + view.setSource(QtCore.QUrl.fromLocalFile(os.fspath(file))) root = view.rootObject() + self.assertTrue(root, quickview_errorstring(view)) button = root.findChild(QtCore.QObject, "buttonMouseArea") self.assertRaises(TypeError, QtCore.QObject.connect, [button,QtCore.SIGNAL('entered()'), self.onButtonFailClicked]) button.entered.connect(self.onButtonClicked) diff --git a/sources/pyside6/tests/QtQml/javascript_exceptions.py b/sources/pyside6/tests/QtQml/javascript_exceptions.py index fbf84fcf6..6d238b35c 100644 --- a/sources/pyside6/tests/QtQml/javascript_exceptions.py +++ b/sources/pyside6/tests/QtQml/javascript_exceptions.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.usesqapplication import UsesQApplication from PySide6.QtCore import Slot, Property, Signal, QObject, QUrl @@ -99,9 +99,12 @@ class JavaScriptExceptionsTest(UsesQApplication): qmlRegisterType(TestClass, 'JavaScriptExceptions', 1, 0, 'JavaScriptExceptions'); view = QQuickView() - qml_url = QUrl.fromLocalFile(adjust_filename('javascript_exceptions.qml', __file__)) + file = Path(__file__).resolve().parent / 'javascript_exceptions.qml' + self.assertTrue(file.is_file()) + qml_url = QUrl.fromLocalFile(os.fspath(file)) view.setSource(qml_url) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) self.assertTrue(test_1) self.assertTrue(test_2) diff --git a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py index dee5601e6..519341b6a 100644 --- a/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py +++ b/sources/pyside6/tests/QtQml/qqmlincubator_incubateWhile.py @@ -38,7 +38,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6.QtCore import QObject, QUrl, Slot, QTimer from PySide6.QtGui import QGuiApplication @@ -76,8 +76,10 @@ class TestBug(unittest.TestCase): controller = CustomIncubationController(self) view.engine().setIncubationController(controller) view.setResizeMode(QQuickView.SizeRootObjectToView) - view.setSource(QUrl.fromLocalFile(adjust_filename('qqmlincubator_incubateWhile.qml', - __file__))) + file = Path(__file__).resolve().parent / 'qqmlincubator_incubateWhile.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() root = view.rootObject() diff --git a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py index 5f9b18d6d..35843cf3d 100644 --- a/sources/pyside6/tests/QtQml/qqmlnetwork_test.py +++ b/sources/pyside6/tests/QtQml/qqmlnetwork_test.py @@ -42,7 +42,7 @@ from PySide6.QtQuick import QQuickView from PySide6.QtQml import QQmlNetworkAccessManagerFactory from PySide6.QtNetwork import QNetworkAccessManager -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication @@ -64,9 +64,12 @@ class TestQQmlNetworkFactory(TimedQApplication): self.factory = CustomFactory() view.engine().setNetworkAccessManagerFactory(self.factory) - url = QUrl.fromLocalFile(adjust_filename('hw.qml', __file__)) + file = Path(__file__).resolve().parent / 'hw.qml' + self.assertTrue(file.is_file()) + url = QUrl.fromLocalFile(os.fspath(file)) view.setSource(url) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() self.assertEqual(view.status(), QQuickView.Ready) diff --git a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py index 0aae8e974..36d6ac097 100644 --- a/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py +++ b/sources/pyside6/tests/QtQml/qquickitem_grabToImage.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6 import QtCore, QtGui, QtQuick @@ -46,8 +46,10 @@ class TestGrabToSharedPointerImage(TimedQApplication): def testQQuickItemGrabToImageSharedPointer(self): view = QtQuick.QQuickView() - view.setSource(QtCore.QUrl.fromLocalFile( - adjust_filename('qquickitem_grabToImage.qml', __file__))) + file = Path(__file__).resolve().parent / 'qquickitem_grabToImage.qml' + self.assertTrue(file.is_file()) + view.setSource(QtCore.QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() # Get the QQuickItem objects for the blue Rectangle and the Image item. diff --git a/sources/pyside6/tests/QtQml/qquickview_test.py b/sources/pyside6/tests/QtQml/qquickview_test.py index 56d71cb5f..99b8ab055 100644 --- a/sources/pyside6/tests/QtQml/qquickview_test.py +++ b/sources/pyside6/tests/QtQml/qquickview_test.py @@ -37,7 +37,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6.QtCore import QUrl, QObject, Property, Slot @@ -70,8 +70,11 @@ class TestQQuickView(TimedQApplication): ctxt = view.rootContext() ctxt.setContextProperty("myModel", dataList) - url = QUrl.fromLocalFile(adjust_filename('view.qml', __file__)) + file = Path(__file__).resolve().parent / 'view.qml' + self.assertTrue(file.is_file()) + url = QUrl.fromLocalFile(os.fspath(file)) view.setSource(url) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() self.assertEqual(view.status(), QQuickView.Ready) @@ -88,8 +91,11 @@ class TestQQuickView(TimedQApplication): ctxt = view.rootContext() ctxt.setContextProperty("myModel", dataList) - url = QUrl.fromLocalFile(adjust_filename('viewmodel.qml', __file__)) + file = Path(__file__).resolve().parent / 'viewmodel.qml' + self.assertTrue(file.is_file()) + url = QUrl.fromLocalFile(os.fspath(file)) view.setSource(url) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() self.assertEqual(view.status(), QQuickView.Ready) diff --git a/sources/pyside6/tests/QtQml/registersingletontype.py b/sources/pyside6/tests/QtQml/registersingletontype.py index 72b5238d0..90846fc43 100644 --- a/sources/pyside6/tests/QtQml/registersingletontype.py +++ b/sources/pyside6/tests/QtQml/registersingletontype.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6.QtCore import Property, Signal, QTimer, QUrl, QObject from PySide6.QtGui import QGuiApplication @@ -77,7 +77,10 @@ class TestQmlSupport(unittest.TestCase): qmlRegisterSingletonType('Singletons', 1, 0, 'SingletonQJSValue', singletonQJSValueCallback) view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('registersingletontype.qml', __file__))) + file = Path(__file__).resolve().parent / 'registersingletontype.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() QTimer.singleShot(250, view.close) app.exec_() diff --git a/sources/pyside6/tests/QtQml/registertype.py b/sources/pyside6/tests/QtQml/registertype.py index 6d8ad47eb..cb1208b9c 100644 --- a/sources/pyside6/tests/QtQml/registertype.py +++ b/sources/pyside6/tests/QtQml/registertype.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6.QtCore import Property, QObject, QTimer, QUrl from PySide6.QtGui import QGuiApplication, QPen, QColor, QPainter @@ -115,7 +115,10 @@ class TestQmlSupport(unittest.TestCase): app = QGuiApplication([]) view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('registertype.qml', __file__))) + file = Path(__file__).resolve().parent / 'registertype.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() QTimer.singleShot(250, view.close) app.exec_() diff --git a/sources/pyside6/tests/QtQml/registeruncreatabletype.py b/sources/pyside6/tests/QtQml/registeruncreatabletype.py index 06a18970a..ce70ab542 100644 --- a/sources/pyside6/tests/QtQml/registeruncreatabletype.py +++ b/sources/pyside6/tests/QtQml/registeruncreatabletype.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import qmlcomponent_errorstring from PySide6.QtCore import Property, QObject, QUrl from PySide6.QtGui import QGuiApplication @@ -65,7 +65,9 @@ class TestQmlSupport(unittest.TestCase): 'Uncreatable', noCreationReason) != -1); engine = QQmlEngine() - component = QQmlComponent(engine, QUrl.fromLocalFile(adjust_filename('registeruncreatable.qml', __file__))) + file = Path(__file__).resolve().parent / 'registeruncreatable.qml' + self.assertTrue(file.is_file()) + component = QQmlComponent(engine, QUrl.fromLocalFile(os.fspath(file))) # Check that the uncreatable item produces the correct error self.assertEqual(component.status(), QQmlComponent.Error) diff --git a/sources/pyside6/tests/QtQml/signal_arguments.py b/sources/pyside6/tests/QtQml/signal_arguments.py index 65dedce45..9fc8af24d 100644 --- a/sources/pyside6/tests/QtQml/signal_arguments.py +++ b/sources/pyside6/tests/QtQml/signal_arguments.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from helper.timedqapplication import TimedQApplication from PySide6.QtQuick import QQuickView @@ -65,9 +65,11 @@ class TestConnectionWithQml(TimedQApplication): context = view.rootContext() context.setContextProperty("o", obj) - view.setSource(QUrl.fromLocalFile(adjust_filename('signal_arguments.qml', __file__))) + file = Path(__file__).resolve().parent / 'signal_arguments.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) root = view.rootObject() - self.assertTrue(root) + self.assertTrue(root, quickview_errorstring(view)) button = root.findChild(QObject, "button") self.assertTrue(button) view.show() |