From 680c0183a130753e3519bed20dee2a717f319baf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 5 Sep 2017 11:20:02 +0200 Subject: Add bindings for QVersionNumber Task-number: PYSIDE-487 Change-Id: I0106d87418c757d14c2dd7dd9fd1ab9d0c66a449 Reviewed-by: Alexandru Croitor --- sources/pyside2/PySide2/QtCore/CMakeLists.txt | 1 + .../PySide2/QtCore/typesystem_core_common.xml | 8 ++++ sources/pyside2/tests/QtCore/CMakeLists.txt | 1 + .../pyside2/tests/QtCore/qversionnumber_test.py | 48 ++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 sources/pyside2/tests/QtCore/qversionnumber_test.py diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt index f685b61d7..5e178cb70 100644 --- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt @@ -140,6 +140,7 @@ ${QtCore_GEN_DIR}/qurl_wrapper.cpp ${QtCore_GEN_DIR}/qurlquery_wrapper.cpp ${QtCore_GEN_DIR}/quuid_wrapper.cpp ${QtCore_GEN_DIR}/qvariantanimation_wrapper.cpp +${QtCore_GEN_DIR}/qversionnumber_wrapper.cpp ${QtCore_GEN_DIR}/qwaitcondition_wrapper.cpp ${QtCore_GEN_DIR}/qwritelocker_wrapper.cpp ${QtCore_GEN_DIR}/qxmlstreamattribute_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index d8eb16644..af6ca7700 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -4133,6 +4133,14 @@ s1.addTransition(button.clicked, s1h)</code> + + + + + + + + diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt index 7dca530e9..940bf523c 100644 --- a/sources/pyside2/tests/QtCore/CMakeLists.txt +++ b/sources/pyside2/tests/QtCore/CMakeLists.txt @@ -107,6 +107,7 @@ PYSIDE_TEST(qtnamespace_test.py) PYSIDE_TEST(qurl_test.py) PYSIDE_TEST(qurlquery_test.py) PYSIDE_TEST(quuid_test.py) +PYSIDE_TEST(qversionnumber_test.py) PYSIDE_TEST(repr_test.py) PYSIDE_TEST(setprop_on_ctor_test.py) PYSIDE_TEST(staticMetaObject_test.py) diff --git a/sources/pyside2/tests/QtCore/qversionnumber_test.py b/sources/pyside2/tests/QtCore/qversionnumber_test.py new file mode 100644 index 000000000..929772fa6 --- /dev/null +++ b/sources/pyside2/tests/QtCore/qversionnumber_test.py @@ -0,0 +1,48 @@ +#!/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 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 tests for QVersionNumber''' + +import unittest + +from PySide2.QtCore import QVersionNumber + +class QVersionNumberTest(unittest.TestCase): + def testFromString(self): + versionString = '5.9.2' + version = QVersionNumber.fromString(versionString) + self.assertTrue(not version.isNull()) + self.assertEqual(version.majorVersion(), 5) + self.assertEqual(version.minorVersion(), 9) + self.assertEqual(version.microVersion(), 2) + self.assertEqual(version.toString(), versionString) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3