[PyQt] Problem with Qt.QTest.mouseClick
Brent Villalobos
Brent.Villalobos at pdi.dreamworks.com
Wed Jun 17 19:09:00 BST 2009
I am having issues getting Qt.QTest.mouseClick() working in some tests I
wrote. This test fails:
def testFixBug(self):
# Trying to figure out why my mouse click isn't being recognized.
checkBox = QtGui.QCheckBox(self.view)
self.assertEqual(checkBox.checkState(), QtCore.Qt.Unchecked)
Qt.QTest.mouseClick(checkBox, QtCore.Qt.LeftButton)
self.assertEqual(checkBox.checkState(), QtCore.Qt.Checked)
However, changing "Qt.QTest.mouseClick(checkBox, QtCore.Qt.LeftButton)"
to "checkBox.click()" works. I'm confused because I know I've used the
Qt.QTest.mouseClick() method in other tests in the past and it worked.
That was a while ago and perhaps I'm doing something differently now or
I forgot some important caveat. Anyone have any suggestions on why
Qt.QTest.mouseClick() might not work? Thanks.
-Brent
More information about the PyQt
mailing list