aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt3
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml9
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtCore/qregularexpression_test.py56
4 files changed, 69 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index 5e178cb70..384243f7c 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -97,6 +97,9 @@ ${QtCore_GEN_DIR}/qreadwritelock_wrapper.cpp
${QtCore_GEN_DIR}/qrect_wrapper.cpp
${QtCore_GEN_DIR}/qrectf_wrapper.cpp
${QtCore_GEN_DIR}/qregexp_wrapper.cpp
+${QtCore_GEN_DIR}/qregularexpression_wrapper.cpp
+${QtCore_GEN_DIR}/qregularexpressionmatch_wrapper.cpp
+${QtCore_GEN_DIR}/qregularexpressionmatchiterator_wrapper.cpp
${QtCore_GEN_DIR}/qresource_wrapper.cpp
${QtCore_GEN_DIR}/qrunnable_wrapper.cpp
${QtCore_GEN_DIR}/qsavefile_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index af6ca7700..bb0986f10 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -2467,6 +2467,15 @@
</inject-code>
</add-function>
</value-type>
+
+ <value-type name="QRegularExpression">
+ <enum-type name="MatchOption" flags="MatchOptions"/>
+ <enum-type name="MatchType"/>
+ <enum-type name="PatternOption" flags="PatternOptions"/>
+ </value-type>
+ <value-type name="QRegularExpressionMatch"/>
+ <value-type name="QRegularExpressionMatchIterator"/>
+
<value-type name="QFileInfo">
<extra-includes>
<include file-name="QDateTime" location="global"/>
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt
index 940bf523c..d3d31af18 100644
--- a/sources/pyside2/tests/QtCore/CMakeLists.txt
+++ b/sources/pyside2/tests/QtCore/CMakeLists.txt
@@ -85,6 +85,7 @@ PYSIDE_TEST(qprocess_test.py)
PYSIDE_TEST(qproperty_decorator.py)
PYSIDE_TEST(qrect_test.py)
PYSIDE_TEST(qregexp_test.py)
+PYSIDE_TEST(qregularexpression_test.py)
PYSIDE_TEST(qresource_test.py)
PYSIDE_TEST(qsize_test.py)
PYSIDE_TEST(qslot_object_test.py)
diff --git a/sources/pyside2/tests/QtCore/qregularexpression_test.py b/sources/pyside2/tests/QtCore/qregularexpression_test.py
new file mode 100644
index 000000000..e11b9b61c
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qregularexpression_test.py
@@ -0,0 +1,56 @@
+#!/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 QRegularExpression'''
+
+import unittest
+from PySide2.QtCore import QRegularExpression, QRegularExpressionMatch, QRegularExpressionMatchIterator
+
+class QRegularExpressionTest(unittest.TestCase):
+
+ def testMatch(self):
+ re = QRegularExpression('^.*(word2).*$')
+ self.assertTrue(re.isValid())
+ match = re.match('word1 word2 word3')
+ self.assertTrue(match.isValid())
+ self.assertEqual(match.captured(1), 'word2')
+
+ def testMatchIterator(self):
+ re = QRegularExpression('(\w+)')
+ self.assertTrue(re.isValid())
+ count = 0
+ it = re.globalMatch('word1 word2 word3');
+ while it.hasNext():
+ it.next()
+ count = count + 1
+ self.assertEqual(count, 3)
+
+if __name__ == '__main__':
+ unittest.main()