|
13 | 13 |
|
14 | 14 | import os
|
15 | 15 | from qgis.PyQt.QtCore import QEventLoop
|
16 |
| -from qgis.PyQt import sip |
17 | 16 | from qgis.core import QgsDataCollectionItem, QgsLayerItem, QgsDirectoryItem
|
18 | 17 | from utilities import unitTestDataPath
|
19 | 18 | from qgis.testing import start_app, unittest
|
@@ -66,26 +65,18 @@ def testPythonCreateChildrenCalledFromCplusplus(self):
|
66 | 65 | # Python object PyQgsLayerItem should still be alive
|
67 | 66 | self.assertFalse(tabSetDestroyedFlag[0])
|
68 | 67 |
|
69 |
| - self.assertTrue(item.hasChildren()) |
70 |
| - self.assertEqual(item.rowCount(), 2) |
| 68 | + children = item.children() |
| 69 | + self.assertEqual(len(children), 2) |
| 70 | + self.assertEqual(children[0].name(), "name") |
| 71 | + self.assertEqual(children[1].name(), "name2") |
71 | 72 |
|
72 |
| - if i % 2 == 0: |
73 |
| - # make the test a bit more exhaustive -- on every second run we don't eveb |
74 |
| - # create any sip wrappers around the children |
75 |
| - children = item.children() |
76 |
| - self.assertEqual(len(children), 2) |
77 |
| - self.assertEqual(children[0].name(), "name") |
78 |
| - self.assertEqual(children[1].name(), "name2") |
| 73 | + del(children) |
79 | 74 |
|
80 | 75 | # Delete the object and make sure all deferred deletions are processed
|
81 | 76 | item.destroyed.connect(loop.quit)
|
82 | 77 | item.deleteLater()
|
83 | 78 | loop.exec_()
|
84 | 79 |
|
85 |
| - if i % 2 == 0: |
86 |
| - self.assertTrue(sip.isdeleted(children[0])) |
87 |
| - self.assertTrue(sip.isdeleted(children[1])) |
88 |
| - |
89 | 80 | # Check that the PyQgsLayerItem Python object is now destroyed
|
90 | 81 | self.assertTrue(tabSetDestroyedFlag[0])
|
91 | 82 | tabSetDestroyedFlag[0] = False
|
|
0 commit comments