def testToolBar(self): self._actionDestroyed = False w = QWidget() toolBar = QToolBar(w) act = toolBar.addAction("MENU") _ref = weakref.ref(act, self.actionDestroyed) act = None self.assertFalse(self._actionDestroyed) toolBar.clear() self.assertTrue(self._actionDestroyed)
def testReference(self): toolbar = QToolBar() for i in xrange(20): toolbar.addAction(QAction("Action %d" % i, None)) buttons = toolbar.findChildren(QToolButton, "") toolbar.clear() for b in buttons: self.assertRaises(RuntimeError, b.objectName)