Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. QTest::mouseClick on disabled button

QTest::mouseClick on disabled button

Scheduled Pinned Locked Moved Solved Qt for Python
qtestbuttondisabled
4 Posts 2 Posters 481 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yodal_
    wrote on 24 May 2023, 18:41 last edited by
    #1

    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, the clicked 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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 24 May 2023, 18:45 last edited by
      #2

      Hi and welcome to devnet,

      That sounds pretty surprising...

      Can you provide a minimal Python project showing this behaviour ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S SGaist moved this topic from General and Desktop on 24 May 2023, 18:46
      • Y Offline
        Y Offline
        yodal_
        wrote on 24 May 2023, 19:06 last edited by
        #3

        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.

        S 1 Reply Last reply 24 May 2023, 19:22
        1
        • Y yodal_ has marked this topic as solved on 24 May 2023, 19:07
        • Y yodal_
          24 May 2023, 19:06

          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.

          S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 24 May 2023, 19:22 last edited by
          #4

          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.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          1/4

          24 May 2023, 18:41

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved