Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-102441

QuickTest cannot double-click TapHandler

    XMLWordPrintable

    Details

    • Commits:
      0f94430a0f (qt/qtbase/dev) 0f94430a0f (qt/tqtc-qtbase/dev)

      Description

      When using mouseDoubleClickSequence(), or simulating a double click via press-release-press-release, in a QuickTest the TapHandler does not register the double click. It emits two tapped() signals, and doubleTapped is not emitted.

      I did some digging of the code to see if I could understand what was happening, and work around it.
      The issue stems from the two press events being too far apart. TapHandler wants the presses to be < 0.4 seconds apart. However, the helper in QuickTest for sending mouse events explicitly stops this from happening:

      case MouseRelease:
                      me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, {}, stateKey);
                      me.setTimestamp(++lastMouseTimestamp);
                      lastMouseTimestamp += 500; // avoid double clicks being generated
                      break;
      

      qtdeclarative/src/imports/testlib/quicktestevent.cpp:199

      Thus making it impossible to perform a double click action with a TapHandler.

      mouseDoubleClickSequence() is a shortcut for press-release-press-doubleclick-release. Thus the timestamps would be 1; 2; 503; 504; 505.

        Attachments

        1. main.cpp
          0.1 kB
        2. taptest.pro
          0.1 kB
        3. tst_taptest.qml
          0.7 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              srutledg Shawn Rutledge
              Reporter:
              samuelshaw Samuel Shaw
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes