aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-08 14:26:45 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-11 11:42:03 +0000
commit1e4cad1d99d873e0cab831b11829adb175324a5e (patch)
treec31d5d8c556bc9321937f70d60e125ecd1fb6e84
parente7cf4e32902a4df5f31e96878ef7b2404a8e69f6 (diff)
Add more QtCore classes
Add QIdentityProxyModel, QLockFile, QMessageAuthenticationCode, OperatingSystemVersion and QSignalBlocker. Task-number: PYSIDE-487 Change-Id: I680c3d175394e9d560152a38195d015fc6abb7fa Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml9
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt3
-rw-r--r--sources/pyside2/tests/QtCore/blocking_signals_test.py11
-rw-r--r--sources/pyside2/tests/QtCore/qabstractitemmodel_test.py9
-rw-r--r--sources/pyside2/tests/QtCore/qlockfile_test.py55
-rw-r--r--sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py45
-rw-r--r--sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py40
8 files changed, 176 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index d29c0dfa..f086a3f3 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -55,6 +55,7 @@ ${QtCore_GEN_DIR}/qfinalstate_wrapper.cpp
${QtCore_GEN_DIR}/qgenericargument_wrapper.cpp
${QtCore_GEN_DIR}/qgenericreturnargument_wrapper.cpp
${QtCore_GEN_DIR}/qhistorystate_wrapper.cpp
+${QtCore_GEN_DIR}/qidentityproxymodel_wrapper.cpp
${QtCore_GEN_DIR}/qiodevice_wrapper.cpp
${QtCore_GEN_DIR}/qjsonarray_wrapper.cpp
${QtCore_GEN_DIR}/qjsondocument_wrapper.cpp
@@ -67,8 +68,10 @@ ${QtCore_GEN_DIR}/qlibraryinfo_wrapper.cpp
${QtCore_GEN_DIR}/qline_wrapper.cpp
${QtCore_GEN_DIR}/qlinef_wrapper.cpp
${QtCore_GEN_DIR}/qlocale_wrapper.cpp
+${QtCore_GEN_DIR}/qlockfile_wrapper.cpp
${QtCore_GEN_DIR}/qmargins_wrapper.cpp
${QtCore_GEN_DIR}/qmarginsf_wrapper.cpp
+${QtCore_GEN_DIR}/qmessageauthenticationcode_wrapper.cpp
${QtCore_GEN_DIR}/qmessagelogcontext_wrapper.cpp
${QtCore_GEN_DIR}/qmetaclassinfo_wrapper.cpp
${QtCore_GEN_DIR}/qmetaenum_wrapper.cpp
@@ -83,6 +86,7 @@ ${QtCore_GEN_DIR}/qmodelindex_wrapper.cpp
${QtCore_GEN_DIR}/qmutex_wrapper.cpp
${QtCore_GEN_DIR}/qmutexlocker_wrapper.cpp
${QtCore_GEN_DIR}/qobject_wrapper.cpp
+${QtCore_GEN_DIR}/qoperatingsystemversion_wrapper.cpp
${QtCore_GEN_DIR}/qparallelanimationgroup_wrapper.cpp
${QtCore_GEN_DIR}/qpauseanimation_wrapper.cpp
${QtCore_GEN_DIR}/qpersistentmodelindex_wrapper.cpp
@@ -106,6 +110,7 @@ ${QtCore_GEN_DIR}/qsavefile_wrapper.cpp
${QtCore_GEN_DIR}/qsemaphore_wrapper.cpp
${QtCore_GEN_DIR}/qsequentialanimationgroup_wrapper.cpp
${QtCore_GEN_DIR}/qsettings_wrapper.cpp
+${QtCore_GEN_DIR}/qsignalblocker_wrapper.cpp
${QtCore_GEN_DIR}/qsignalmapper_wrapper.cpp
${QtCore_GEN_DIR}/qsignaltransition_wrapper.cpp
${QtCore_GEN_DIR}/qsize_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index f8259063..b0c4da4e 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -1974,6 +1974,11 @@
</inject-code>
</add-function>
</value-type>
+ <object-type name="QLockFile">
+ <enum-type name="LockError"/>
+ </object-type>
+ <object-type name="QMessageAuthenticationCode"/>
+ <object-type name="QSignalBlocker"/>
<value-type name="QStorageInfo"/>
<!-- QReadWriteLock does not have a copy ctor! -->
<object-type name="QReadWriteLock">
@@ -2123,6 +2128,7 @@
<modify-function signature="filterChanged()" remove="all"/>
<!--### End of obsolete section -->
</object-type>
+ <object-type name="QIdentityProxyModel"/>
<!-- QObject is created manually -->
<object-type name="QObject">
<extra-includes>
@@ -2953,6 +2959,9 @@
</inject-code>
</modify-function>
</object-type>
+ <value-type name="QOperatingSystemVersion" since="5.9">
+ <enum-type name="OSType"/>
+ </value-type>
<object-type name="QLibraryInfo">
<enum-type name="LibraryLocation"/>
</object-type>
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt
index bc83aec7..4efee6eb 100644
--- a/sources/pyside2/tests/QtCore/CMakeLists.txt
+++ b/sources/pyside2/tests/QtCore/CMakeLists.txt
@@ -66,6 +66,8 @@ PYSIDE_TEST(qflags_test.py)
PYSIDE_TEST(qinstallmsghandler_test.py)
PYSIDE_TEST(qlinef_test.py)
PYSIDE_TEST(qlocale_test.py)
+PYSIDE_TEST(qlockfile_test.py)
+PYSIDE_TEST(qmessageauthenticationcode_test.py)
PYSIDE_TEST(qmetaobject_test.py)
PYSIDE_TEST(qmimedatabase_test.py)
PYSIDE_TEST(qmodelindex_internalpointer_test.py)
@@ -81,6 +83,7 @@ PYSIDE_TEST(qobject_protected_methods_test.py)
PYSIDE_TEST(qobject_test.py)
PYSIDE_TEST(qobject_timer_event_test.py)
PYSIDE_TEST(qobject_tr_as_instance_test.py)
+PYSIDE_TEST(qoperatingsystemversion_test.py)
PYSIDE_TEST(qpoint_test.py)
PYSIDE_TEST(qprocess_test.py)
PYSIDE_TEST(qproperty_decorator.py)
diff --git a/sources/pyside2/tests/QtCore/blocking_signals_test.py b/sources/pyside2/tests/QtCore/blocking_signals_test.py
index 76982035..2f8b95b2 100644
--- a/sources/pyside2/tests/QtCore/blocking_signals_test.py
+++ b/sources/pyside2/tests/QtCore/blocking_signals_test.py
@@ -32,7 +32,7 @@ import unittest
import os
from tempfile import mkstemp
-from PySide2.QtCore import QObject, SIGNAL, QFile
+from PySide2.QtCore import QObject, SIGNAL, QFile, QSignalBlocker
class TestSignalsBlockedBasic(unittest.TestCase):
'''Basic test case for signalsBlocked'''
@@ -46,6 +46,15 @@ class TestSignalsBlockedBasic(unittest.TestCase):
self.assertTrue(not obj.blockSignals(True))
self.assertTrue(obj.signalsBlocked())
self.assertTrue(obj.blockSignals(False))
+ blocker = QSignalBlocker(obj)
+ self.assertTrue(obj.signalsBlocked())
+ blocker.unblock()
+ self.assertTrue(not obj.signalsBlocked())
+ blocker.reblock()
+ self.assertTrue(obj.signalsBlocked())
+ del blocker
+ self.assertTrue(not obj.signalsBlocked())
+
class TestSignalsBlocked(unittest.TestCase):
'''Test case to check if the signals are really blocked'''
diff --git a/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py b/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
index 66c17894..3f321c7d 100644
--- a/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
+++ b/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
@@ -50,6 +50,15 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
idx = QPersistentModelIndex()
m.span(idx)
+ def testQIdentityProxyModel(self):
+ sourceModel = QStringListModel(['item1', 'item2'])
+ sourceIndex = sourceModel.index(0, 0)
+ sourceData = str(sourceModel.data(sourceIndex, Qt.DisplayRole))
+ proxyModel = QIdentityProxyModel()
+ proxyModel.setSourceModel(sourceModel)
+ proxyIndex = proxyModel.mapFromSource(sourceIndex)
+ proxyData = str(proxyModel.data(proxyIndex, Qt.DisplayRole))
+ self.assertEqual(sourceData, proxyData)
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qlockfile_test.py b/sources/pyside2/tests/QtCore/qlockfile_test.py
new file mode 100644
index 00000000..e943af2b
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qlockfile_test.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+
+#############################################################################
+##
+## Copyright (C) 2018 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$
+##
+#############################################################################
+
+'''Test cases for QLockFile'''
+
+import os, unittest
+
+from PySide2.QtCore import QDir, QLockFile, QCoreApplication
+
+class TestQMessageAuthenticationCode (unittest.TestCase):
+
+ def setUp(self):
+ pid = QCoreApplication.applicationPid()
+ self._fileName = "{}/pqlockfiletest{}.tmp".format(QDir.tempPath(), pid)
+
+ def tearDown(self):
+ if (os.path.exists(self._fileName)):
+ os.remove(self._fileName)
+
+ def test(self):
+ # Merely exercise the API, no locking against another processes.
+ lockFile = QLockFile(self._fileName)
+ self.assertTrue(lockFile.lock())
+ self.assertTrue(lockFile.isLocked())
+ lockFile.unlock()
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py b/sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py
new file mode 100644
index 00000000..392e6f05
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+#############################################################################
+##
+## Copyright (C) 2018 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$
+##
+#############################################################################
+
+'''Test cases for QMessageAuthenticationCode'''
+
+import unittest
+
+from PySide2.QtCore import QCryptographicHash, QMessageAuthenticationCode
+
+class TestQMessageAuthenticationCode (unittest.TestCase):
+ def test(self):
+ code = QMessageAuthenticationCode(QCryptographicHash.Sha1, 'bla')
+ result = code.result()
+ self.assertTrue(result.size() > 0)
+ print(result.toHex())
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py b/sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py
new file mode 100644
index 00000000..82c571d1
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py
@@ -0,0 +1,40 @@
+#############################################################################
+##
+## Copyright (C) 2018 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 unittest
+from PySide2.QtCore import QOperatingSystemVersion
+
+class TestQOperatingSystemVersion(unittest.TestCase):
+ def test(self):
+ ov = QOperatingSystemVersion.current()
+ name = "{} v{}.{}.{}".format(ov.name(), ov.majorVersion(),
+ ov.minorVersion(), ov.microVersion())
+ print(name)
+
+if __name__ == '__main__':
+ unittest.main()