diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-05 11:20:02 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-09-05 11:14:38 +0000 |
commit | 680c0183a130753e3519bed20dee2a717f319baf (patch) | |
tree | 87e7d59d91691cf431c18ef4dde2d2e98631d797 /sources/pyside2/tests/QtCore | |
parent | db904f8e9ed06eac37151c9a8b955c63c1eb8a46 (diff) |
Add bindings for QVersionNumber
Task-number: PYSIDE-487
Change-Id: I0106d87418c757d14c2dd7dd9fd1ab9d0c66a449
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/pyside2/tests/QtCore')
-rw-r--r-- | sources/pyside2/tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtCore/qversionnumber_test.py | 48 |
2 files changed, 49 insertions, 0 deletions
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() |