diff options
author | Andreas Buhr <andreas@andreasbuhr.de> | 2020-05-08 17:36:27 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-05-15 07:12:32 +0000 |
commit | 7a2562aabcc8e1c4659386340956ed44bfbfa6ca (patch) | |
tree | e8371e4c5bbbdcd5ad0768608255221ebd8ed3eb /sources/pyside2/tests | |
parent | 70102765aaeaa926bd65f4e2a192268420b85459 (diff) |
Add support for QSerialPort
QSerialPort is part of Qt since Qt 5.1. PySide2 so far
had no support for QSerialPort. At the same time, QSerialPort
was not listed as unsupported.
Task-number: PYSIDE-487
Change-Id: I88d4282a206dadf6f398c3f0e5740f02641724b6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2/tests')
-rw-r--r-- | sources/pyside2/tests/QtSerialPort/CMakeLists.txt | 1 | ||||
-rw-r--r-- | sources/pyside2/tests/QtSerialPort/serial.py | 58 |
2 files changed, 59 insertions, 0 deletions
diff --git a/sources/pyside2/tests/QtSerialPort/CMakeLists.txt b/sources/pyside2/tests/QtSerialPort/CMakeLists.txt new file mode 100644 index 000000000..554373445 --- /dev/null +++ b/sources/pyside2/tests/QtSerialPort/CMakeLists.txt @@ -0,0 +1 @@ +PYSIDE_TEST(serial.py) diff --git a/sources/pyside2/tests/QtSerialPort/serial.py b/sources/pyside2/tests/QtSerialPort/serial.py new file mode 100644 index 000000000..c30d9eb03 --- /dev/null +++ b/sources/pyside2/tests/QtSerialPort/serial.py @@ -0,0 +1,58 @@ +#!/usr/bin/python + +############################################################################# +## +## Copyright (C) 2020 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 QSerialPort''' + +import os +import sys +import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from init_paths import init_test_paths +init_test_paths(False) + +from PySide2.QtSerialPort import QSerialPort, QSerialPortInfo + + +def callPortInfoMemberFunctions(portinfo): + portinfo.description() + portinfo.hasProductIdentifier() + portinfo.hasVendorIdentifier() + portinfo.isNull() + + +class QSerialPortInfoTest(unittest.TestCase): + def test_available_ports(self): + allportinfos = QSerialPortInfo.availablePorts() + for portinfo in allportinfos: + callPortInfoMemberFunctions(portinfo) + +if __name__ == '__main__': + unittest.main() |