aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-01-07 12:46:13 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-01-08 11:47:47 +0000
commitc8970b29d76415d41fa383cbe5eb77eefb191fa1 (patch)
tree3cadb0b721f8bd9778a07589fe693bc6e0a00210 /sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
parent1bd279b01d06eba0abbbb5fea0c12a6de2600cdd (diff)
[reg] Remove createIndex method that uses PyObject*
Even though we have support for Void*, having to import it as an additional class to be able to call a separate function, is adding too much complexity so something that should be easy to do, like creating an index for an itemmodel. The regression is a change that replaced the way of doing: QAbstractItemModel.createIndex(0, 0, PyObject*) to QAbstractItemModel.createIndex(0, 0, VoidPtr(PyObject*)) which is not really intuitive, and is generating other issues. Included modification in the registries too. Change-Id: Ie6112c6baeb4fc3b22fc78e7edeb66aa4a17c22b Fixes: PYSIDE-883 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py')
-rw-r--r--sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
index a67bb380a..770600ea3 100644
--- a/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
+++ b/sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py
@@ -33,7 +33,6 @@
import sys
import unittest
from PySide2.QtCore import *
-from PySide2.support import VoidPtr
class MyModel (QAbstractListModel):
pass
@@ -51,21 +50,20 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
def testInternalPointer(self):
#Test QAbstractListModel.createIndex and
- #QModelIndex.internalPointer
+ #QModelIndex.internalPointer with regular Python objects
obj = QObject()
- obj_ptr = VoidPtr(obj)
- idx = self.model.createIndex(0, 0, obj)
+ idx = self.model.createIndex(0, 0, "Hello")
i = idx.internalPointer()
- self.assertEqual(int(obj_ptr), int(i))
+ self.assertEqual(i, "Hello")
def testReferenceCounting(self):
#Test reference counting when retrieving data with
#QModelIndex.internalPointer
- o = QObject()
+ o = [1, 2, 3]
o_refcnt = sys.getrefcount(o)
idx = self.model.createIndex(0, 0, o)
ptr = idx.internalPointer()
- self.assertEqual(sys.getrefcount(o), o_refcnt)
+ self.assertEqual(sys.getrefcount(o), o_refcnt + 1)
def testIndexForDefaultDataArg(self):