diff options
author | Liang Qi <liang.qi@qt.io> | 2017-03-21 10:45:59 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-21 12:24:12 +0000 |
commit | 46728eff5514742eed6b35820958740c50008825 (patch) | |
tree | 046d2e655caf4703170128999586c7f203b8b443 | |
parent | cf5ad85a35824646a30d90de79d72f4068dade50 (diff) |
Add QCollator and QCollatorSortKey to typesystem
Task-number: PYSIDE-487
Change-Id: Ifd4ed0ce2b2e5ad55ee176826e642ae5539d51be
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | PySide2/QtCore/CMakeLists.txt | 2 | ||||
-rw-r--r-- | PySide2/QtCore/typesystem_core_common.xml | 3 | ||||
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/qcollator_test.py | 61 |
4 files changed, 67 insertions, 0 deletions
diff --git a/PySide2/QtCore/CMakeLists.txt b/PySide2/QtCore/CMakeLists.txt index 97a6f68e..82a25b77 100644 --- a/PySide2/QtCore/CMakeLists.txt +++ b/PySide2/QtCore/CMakeLists.txt @@ -31,6 +31,8 @@ ${QtCore_GEN_DIR}/qbuffer_wrapper.cpp ${QtCore_GEN_DIR}/qbytearray_wrapper.cpp ${QtCore_GEN_DIR}/qbytearraymatcher_wrapper.cpp ${QtCore_GEN_DIR}/qchildevent_wrapper.cpp +${QtCore_GEN_DIR}/qcollator_wrapper.cpp +${QtCore_GEN_DIR}/qcollatorsortkey_wrapper.cpp ${QtCore_GEN_DIR}/qcoreapplication_wrapper.cpp ${QtCore_GEN_DIR}/qcryptographichash_wrapper.cpp ${QtCore_GEN_DIR}/qdatastream_wrapper.cpp diff --git a/PySide2/QtCore/typesystem_core_common.xml b/PySide2/QtCore/typesystem_core_common.xml index eab9d834..ae3df443 100644 --- a/PySide2/QtCore/typesystem_core_common.xml +++ b/PySide2/QtCore/typesystem_core_common.xml @@ -3172,6 +3172,9 @@ </object-type> <object-type name="QSignalMapper" /> + <object-type name="QCollatorSortKey" since="5.2" /> + <object-type name="QCollator" since="5.2" /> + <object-type name="QCoreApplication"> <!--Qt5: gone <enum-type name="Encoding" /> --> <enum-type identified-by-value="ApplicationFlags" since="4.8" revision="4800"/> diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index ba90ad12..6f62eee7 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -50,6 +50,7 @@ PYSIDE_TEST(qbytearray_concatenation_operator_test.py) PYSIDE_TEST(qbytearray_operator_iadd_test.py) PYSIDE_TEST(qbytearray_operator_test.py) PYSIDE_TEST(qbytearray_test.py) +PYSIDE_TEST(qcollator_test.py) PYSIDE_TEST(qcoreapplication_instance_test.py) PYSIDE_TEST(qdatastream_test.py) PYSIDE_TEST(qdatetime_test.py) diff --git a/tests/QtCore/qcollator_test.py b/tests/QtCore/qcollator_test.py new file mode 100644 index 00000000..0afb1ca8 --- /dev/null +++ b/tests/QtCore/qcollator_test.py @@ -0,0 +1,61 @@ +#!/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 QCollator''' + +import unittest +import ctypes +import sys + +from PySide2.QtCore import * + +class QCollatorTest(unittest.TestCase): + def testState(self): + c = QCollator() + c.setCaseSensitivity(Qt.CaseInsensitive) + c.setLocale(QLocale.German) + + print("compare a and b:", c.compare("a", "b")) + + self.assertEqual(c.caseSensitivity(), Qt.CaseInsensitive) + self.assertEqual(c.locale(), QLocale(QLocale.German)) + + c.setLocale(QLocale.French) + c.setNumericMode(True) + c.setIgnorePunctuation(True) + c.setLocale(QLocale.Norwegian) + + self.assertEqual(c.caseSensitivity(), Qt.CaseInsensitive) + self.assertEqual(c.numericMode(), True) + self.assertEqual(c.ignorePunctuation(), True) + self.assertEqual(c.locale(), QLocale(QLocale.Norwegian)) + +if __name__ == '__main__': + unittest.main() |