QTest::mouseClick on disabled button
-
I am currently trying to write some smoke tests for a PyQT5 app.
When certain functionality is no possible I disable a button that would use that functionality. In the actual app this works as expected: a user can't click the button and if they try then nothing happens. Problematically, when clicking the disabled button using
QTest::mouseClick
in an automated test, theclicked
signal is sent despite the button being disabled.Is this expected or am I failing to set up my test right? If this is expected, is there a better way to test this?
-
Hi and welcome to devnet,
That sounds pretty surprising...
Can you provide a minimal Python project showing this behaviour ?
-
-
My apologies, I've realized that everything was working as written, but not as intended. The code that disables the button was not being called in the test, hence the reason why it wasn't working. As soon as I fixed that error, everything worked as expected.
-
-
Nice !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the tree dotted menu beside that answer you deem correct so other forum users may know a solution has been found.