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

QTest::mouseEvent and QtQuickTest::mouseEvent do not set timestamp

    XMLWordPrintable

    Details

    • Commits:
      qtbase: 8325808dcf0cc9061f05ec89b6c3e3afb8c1ab8f qtdeclarative: af002b8df9b084fd7f26e9eead9844aab36bdc4d 291223876bb190ca4b5a07cf8f605c7bf88d7ab6

      Description

      QGuiApplicationPrivate::processMouseEvent() (http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/kernel/qguiapplication.cpp#n1890) sets timestamp:

      QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers, e->source);
      ev.setTimestamp(e->timestamp);
      

      QTest::mouseEvent does not: http://code.qt.io/cgit/qt/qtbase.git/tree/src/testlib/qtestmouse.h#n196

      Neither QtQuickTest::mouseEvent do:
      http://code.qt.io/cgit/qt/qtdeclarative.git/tree/src/qmltest/quicktestevent.cpp#n167

      Due to this the timestamp() method of a QMouseEvent generated by a QTest::mouseClick() always returns 0.

      In Qt WebEngine we use timestamp() function to recognize non-single clicks (double, triple, whatever clicks):
      http://code.qt.io/cgit/qt/qtwebengine.git/tree/src/core/render_widget_host_view_qt.cpp?h=5.8#n921

      Currently two subsequent mouseClick() call is detected as a double click no matter how long waiting between two clicks. Due to this we can't test/simulate clicking without workarounds (eg. https://codereview.qt-project.org/#/c/172158/).

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              pvarga Peter Varga
              Reporter:
              pvarga Peter Varga
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes