diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-09 11:05:17 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-26 14:44:53 +0000 |
commit | 4cdadcdc2338c34b2e883feff52d199e6e0a0c18 (patch) | |
tree | 06f34d45b57eaa32d3432908a79522bb36a91366 | |
parent | cef4c17fc8d4c8de4707f8a37427d37feb2012f9 (diff) |
Add QUrlQuery to typesystem
Task-number: PYSIDE-345
Change-Id: Idffe4b317f22775f0728c94ed802b34236a166a2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r-- | PySide2/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | PySide2/QtCore/typesystem_core_common.xml | 1 | ||||
-rw-r--r-- | tests/QtCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtCore/qurlquery_test.py | 59 |
4 files changed, 62 insertions, 0 deletions
diff --git a/PySide2/QtCore/CMakeLists.txt b/PySide2/QtCore/CMakeLists.txt index 77e304c3..9eec8978 100644 --- a/PySide2/QtCore/CMakeLists.txt +++ b/PySide2/QtCore/CMakeLists.txt @@ -134,6 +134,7 @@ ${QtCore_GEN_DIR}/qtimer_wrapper.cpp ${QtCore_GEN_DIR}/qtimerevent_wrapper.cpp ${QtCore_GEN_DIR}/qtranslator_wrapper.cpp ${QtCore_GEN_DIR}/qurl_wrapper.cpp +${QtCore_GEN_DIR}/qurlquery_wrapper.cpp ${QtCore_GEN_DIR}/qvariantanimation_wrapper.cpp ${QtCore_GEN_DIR}/qwaitcondition_wrapper.cpp ${QtCore_GEN_DIR}/qwritelocker_wrapper.cpp diff --git a/PySide2/QtCore/typesystem_core_common.xml b/PySide2/QtCore/typesystem_core_common.xml index a15547a4..dfce090e 100644 --- a/PySide2/QtCore/typesystem_core_common.xml +++ b/PySide2/QtCore/typesystem_core_common.xml @@ -2330,6 +2330,7 @@ <include file-name="QSize" location="global"/> </extra-includes> </object-type> + <value-type name="QUrlQuery" since="5.0" /> <value-type name="QUrl" hash-function="PySide::hash"> <!-- Qt5: lots of changes --> <enum-type name="ComponentFormattingOption" flags="ComponentFormattingOptions,FormattingOptions"/> diff --git a/tests/QtCore/CMakeLists.txt b/tests/QtCore/CMakeLists.txt index 5771e10f..cbb7c5f2 100644 --- a/tests/QtCore/CMakeLists.txt +++ b/tests/QtCore/CMakeLists.txt @@ -103,6 +103,7 @@ PYSIDE_TEST(qtimer_singleshot_test.py) PYSIDE_TEST(qtimer_timeout_test.py) PYSIDE_TEST(qtnamespace_test.py) PYSIDE_TEST(qurl_test.py) +PYSIDE_TEST(qurlquery_test.py) PYSIDE_TEST(repr_test.py) PYSIDE_TEST(setprop_on_ctor_test.py) PYSIDE_TEST(staticMetaObject_test.py) diff --git a/tests/QtCore/qurlquery_test.py b/tests/QtCore/qurlquery_test.py new file mode 100644 index 00000000..e42856e6 --- /dev/null +++ b/tests/QtCore/qurlquery_test.py @@ -0,0 +1,59 @@ +#!/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 QUrlQuery''' + +import unittest +import ctypes +import sys + +from PySide2.QtCore import QUrlQuery + +class QUrlQueryTest(unittest.TestCase): + def testConstructing(self): + empty = QUrlQuery() + self.assertTrue(empty.isEmpty()) + self.assertEqual(empty.queryPairDelimiter(), QUrlQuery.defaultQueryPairDelimiter()) + self.assertEqual(empty.queryValueDelimiter(), QUrlQuery.defaultQueryValueDelimiter()) + + empty.clear(); + self.assertTrue(empty.isEmpty()) + + def testAddRemove(self): + query = QUrlQuery() + + query.addQueryItem("a", "b"); + self.assertTrue(not query.isEmpty()) + self.assertTrue(query.hasQueryItem("a")) + self.assertEqual(query.queryItemValue("a"), "b") + self.assertEqual(query.allQueryItemValues("a"), ["b"]) + +if __name__ == '__main__': + unittest.main() |