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

mouseDrag positionChanged incorrect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: Testing: QuickTest
    • Labels:
      None

      Description

      Calling mouseDrag one would expect the mouse to press at the start point and move to the end point continuously. The test below produces results showing that is not the case. Possibly related to QTBUG-83637

      Test

      import QtQuick 2.14
      import QtTest 1.14
      
      MouseArea {
          id: root
          width: 200
          height: 200
      
          signal mouseDragSignal(string signalName, int mouse_x)
      
          onPressed: {
              root.mouseDragSignal("pressed", mouse.x)
          }
      
          onPositionChanged: {
              root.mouseDragSignal("positionChanged", mouse.x)
          }
      
          onReleased: {
              root.mouseDragSignal("released", mouse.x)
          }
      
      
          SignalSpy {
              id: mouseDragSignalSpy
              target: root
              signalName: "mouseDragSignal"
          }
      
          TestCase {
              id: testCase
              name: "MouseDragTests"
              when: windowShown
      
              function test_affect_of_mouseDrag_on_positionChanged() {
                  let start = 1
                  let dragDist = 1
                  mouseDrag(root, start, start, dragDist, dragDist)
                  let mouseStayedBetweenStartAndEndPt = true
                  for (let i = 0; i < mouseDragSignalSpy.signalArguments.length; i++) {
                      let signalName = mouseDragSignalSpy.signalArguments[i][0]
                      let mouse_x = mouseDragSignalSpy.signalArguments[i][1]
      
                      print("signalName: " + signalName + " mouse_x: " + mouse_x)
                      if(mouse_x < start || mouse_x > start + dragDist)
                          mouseStayedBetweenStartAndEndPt = false
                  }
                  verify(mouseStayedBetweenStartAndEndPt)
              }
      
          }
      }
      

      Results (cause of concern is second line where "mouse_x: 12")

      QDEBUG : MouseDragTests::test_affect_of_mouseDrag_on_positionChanged() qml: signalName: pressed mouse_x: 1
      QDEBUG : MouseDragTests::test_affect_of_mouseDrag_on_positionChanged() qml: signalName: positionChanged mouse_x: 12
      QDEBUG : MouseDragTests::test_affect_of_mouseDrag_on_positionChanged() qml: signalName: positionChanged mouse_x: 3
      QDEBUG : MouseDragTests::test_affect_of_mouseDrag_on_positionChanged() qml: signalName: released mouse_x: 3
      FAIL!  : MouseDragTests::test_affect_of_mouseDrag_on_positionChanged() 'verify()' returned FALSE. ()
      

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            samgillam Sam Gillam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes