diff options
Diffstat (limited to 'sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py')
-rw-r--r-- | sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py index 23940df71..23e2d6e7e 100644 --- a/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py +++ b/sources/pyside6/tests/Qt3DExtras/qt3dextras_test.py @@ -1,32 +1,6 @@ #!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 '''Test cases for Q3DExtras''' @@ -39,17 +13,18 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.usesqguiapplication import UsesQGuiApplication +from helper.usesqapplication import UsesQApplication -from PySide6.QtCore import(Property, QObject, QPropertyAnimation, QTimer, Signal, Slot) +from PySide6.QtCore import (Property, QObject, QPropertyAnimation, QTimer, Signal, Slot) from PySide6.QtGui import (QGuiApplication, QMatrix4x4, QQuaternion, QVector3D, QWindow) from PySide6.Qt3DCore import (Qt3DCore) from PySide6.Qt3DRender import (Qt3DRender) from PySide6.Qt3DExtras import (Qt3DExtras) + class OrbitTransformController(QObject): def __init__(self, parent): - super(OrbitTransformController, self).__init__(parent) + super().__init__(parent) self._target = None self._matrix = QMatrix4x4() self._radius = 1 @@ -80,7 +55,7 @@ class OrbitTransformController(QObject): return self._angle def updateMatrix(self): - self._matrix.setToIdentity(); + self._matrix.setToIdentity() self._matrix.rotate(self._angle, QVector3D(0, 1, 0)) self._matrix.translate(self._radius, 0, 0) if self._target is not None: @@ -91,9 +66,10 @@ class OrbitTransformController(QObject): angle = Property(float, getAngle, setAngle, notify=angleChanged) radius = Property(float, getRadius, setRadius, notify=radiusChanged) + class Window(Qt3DExtras.Qt3DWindow): def __init__(self): - super(Window, self).__init__() + super().__init__() # Camera self.camera().lens().setPerspectiveProjection(45, 16 / 9, 0.1, 1000) @@ -146,7 +122,8 @@ class Window(Qt3DExtras.Qt3DWindow): self.sphereEntity.addComponent(self.sphereTransform) self.sphereEntity.addComponent(self.material) -class Qt3DExtrasTestCase(UsesQGuiApplication): + +class Qt3DExtrasTestCase(UsesQApplication): '''Tests related to Q3DExtras''' def test3DExtras(self): @@ -156,7 +133,8 @@ class Qt3DExtrasTestCase(UsesQGuiApplication): while not window.isExposed(): self.app.processEvents() QTimer.singleShot(2000, self.app.quit) - self.app.exec_() + self.app.exec() + if __name__ == '__main__': unittest.main() |