diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-19 11:20:27 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-19 11:20:27 +0100 |
| commit | 84234b3987fa8f78024b650bb0596e64a2030a0e (patch) | |
| tree | ab119054394a10f73b3bbb6ab60bbf133cb521ca /sources/pyside2/tests/support/voidptr_test.py | |
| parent | 2e327c6f3ccec91c291dfe251823a8520fa280a1 (diff) | |
| parent | 1c2d6c525aabdaa0e2a264b5aac6e4146d3319e5 (diff) | |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I137dc1d4b7dc73ee8ad4cff2eb031e2aaead2644
Diffstat (limited to 'sources/pyside2/tests/support/voidptr_test.py')
| -rw-r--r-- | sources/pyside2/tests/support/voidptr_test.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sources/pyside2/tests/support/voidptr_test.py b/sources/pyside2/tests/support/voidptr_test.py index 330788c63..c04022489 100644 --- a/sources/pyside2/tests/support/voidptr_test.py +++ b/sources/pyside2/tests/support/voidptr_test.py @@ -38,9 +38,21 @@ class PySide2Support(unittest.TestCase): # a C++ object, a wrapped Shiboken Object type, # an object implementing the Python Buffer interface, # or another VoidPtr object. - ba = QByteArray(b"Hello world") - voidptr = VoidPtr(ba) - self.assertIsInstance(voidptr, shiboken.VoidPtr) + + # Original content + b = b"Hello world" + ba = QByteArray(b) + vp = VoidPtr(ba, ba.size()) + self.assertIsInstance(vp, shiboken.VoidPtr) + + # Create QByteArray from voidptr byte interpretation + nba = QByteArray.fromRawData(vp.toBytes()) + # Compare original bytes to toBytes() + self.assertTrue(b, vp.toBytes()) + # Compare original with new QByteArray data + self.assertTrue(b, nba.data()) + # Convert original and new to str + self.assertTrue(str(b), str(nba)) if __name__ == '__main__': unittest.main() |
