Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-63855 Tasks and issues related to flaky tests
  3. QTBUG-63991

cleanup tests [qtbase]: mouse event handling

    XMLWordPrintable

Details

    • Technical task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Testing: qtestlib
    • None

    Description

      For description and WIP patch see https://codereview.qt-project.org/#/c/208000/

      Also check why some test do odd things like: http://code.qt.io/cgit/qt/qtbase.git/tree/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp#n79

      static void sendMousePress(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::LeftButton)
      {
          QMouseEvent event(QEvent::MouseButtonPress, point, widget->mapToGlobal(point), button, 0, 0);
          QApplication::sendEvent(widget, &event);
      }
      
      static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0)
      {
          QTest::mouseMove(widget, point);
          QMouseEvent event(QEvent::MouseMove, point, button, buttons, 0);
          QApplication::sendEvent(widget, &event);
          QApplication::processEvents();
      }
      
      static void sendMouseRelease(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::LeftButton)
      {
          QMouseEvent event(QEvent::MouseButtonRelease, point, widget->mapToGlobal(point), button, 0, 0);
          QApplication::sendEvent(widget, &event);
      }
      

      Instead of using QTest::mouse* API. Ideally we should be able to remove the following https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qapplication.cpp?h=5.12#n2919 from Qt source tree (which is there to support the above hack of sending mouse events directly to widgets).

      Attachments

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              paeglis Gatis Paeglis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes