@@ -576,11 +576,13 @@ TEST_F(RenderedTargetTest, SpriteDragging)
576576 QMouseEvent moveEventRightButton (QEvent::MouseMove, QPointF (), QPointF (), Qt::RightButton, Qt::RightButton, Qt::NoModifier);
577577 QMouseEvent pressEventRightButton (QEvent::MouseButtonPress, QPointF (), QPointF (), Qt::RightButton, Qt::RightButton, Qt::NoModifier);
578578 QMouseEvent releaseEventRightButton (QEvent::MouseButtonRelease, QPointF (), QPointF (), Qt::RightButton, Qt::RightButton, Qt::NoModifier);
579+ EXPECT_CALL (engine, clickTarget (&sprite));
579580 QCoreApplication::sendEvent (&target, &pressEventRightButton);
580581 QCoreApplication::sendEvent (&target, &moveEventRightButton);
581582 ASSERT_EQ (sprite.x (), 64.08 );
582583 ASSERT_EQ (sprite.y (), -6.86 );
583584 ASSERT_EQ (mouseArea.draggedSprite (), nullptr );
585+ EXPECT_CALL (engine, clickTarget).Times (0 );
584586 QCoreApplication::sendEvent (&target, &releaseEventRightButton);
585587 ASSERT_EQ (mouseArea.draggedSprite (), nullptr );
586588
@@ -591,11 +593,13 @@ TEST_F(RenderedTargetTest, SpriteDragging)
591593
592594 // Try right mouse button with "draggable" set to true (should not work)
593595 sprite.setDraggable (true );
596+ EXPECT_CALL (engine, clickTarget).Times (0 );
594597 QCoreApplication::sendEvent (&target, &pressEventRightButton);
595598 QCoreApplication::sendEvent (&target, &moveEventRightButton);
596599 ASSERT_EQ (sprite.x (), 64.08 );
597600 ASSERT_EQ (sprite.y (), -6.86 );
598601 ASSERT_EQ (mouseArea.draggedSprite (), nullptr );
602+ EXPECT_CALL (engine, clickTarget (&sprite));
599603 QCoreApplication::sendEvent (&target, &releaseEventRightButton);
600604 ASSERT_EQ (mouseArea.draggedSprite (), nullptr );
601605
@@ -609,6 +613,7 @@ TEST_F(RenderedTargetTest, SpriteDragging)
609613 QMouseEvent moveEvent (QEvent::MouseMove, QPointF (), QPointF (), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
610614 QMouseEvent pressEvent (QEvent::MouseButtonPress, QPointF (), QPointF (), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
611615 QMouseEvent releaseEvent (QEvent::MouseButtonRelease, QPointF (), QPointF (), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
616+ EXPECT_CALL (engine, clickTarget (&sprite));
612617 QCoreApplication::sendEvent (&target, &pressEvent);
613618 QCoreApplication::sendEvent (&target, &moveEvent);
614619 ASSERT_EQ (sprite.x (), 64.08 );
@@ -619,10 +624,12 @@ TEST_F(RenderedTargetTest, SpriteDragging)
619624 ASSERT_EQ (sprite.x (), 64.08 );
620625 ASSERT_EQ (sprite.y (), -6.86 );
621626 ASSERT_EQ (mouseArea.draggedSprite (), nullptr );
627+ EXPECT_CALL (engine, clickTarget).Times (0 );
622628 QCoreApplication::sendEvent (&target, &releaseEvent);
623629
624630 // Try left mouse button with "draggable" set to true
625631 sprite.setDraggable (true );
632+ EXPECT_CALL (engine, clickTarget).Times (0 );
626633 QCoreApplication::sendEvent (&target, &pressEvent);
627634 EXPECT_CALL (engine, mouseX ()).WillOnce (Return (67.95 ));
628635 EXPECT_CALL (engine, mouseY ()).WillOnce (Return (2.1 ));
@@ -663,12 +670,15 @@ TEST_F(RenderedTargetTest, SpriteDragging)
663670
664671 // Try to drag the second sprite while the first is being dragged
665672 sprite.setDraggable (true );
673+ EXPECT_CALL (engine, clickTarget).Times (0 );
666674 QCoreApplication::sendEvent (&anotherTarget, &pressEvent);
667675 QCoreApplication::sendEvent (&anotherTarget, &moveEvent);
668676 ASSERT_EQ (mouseArea.draggedSprite (), &target);
677+ EXPECT_CALL (engine, clickTarget (&sprite));
669678 QCoreApplication::sendEvent (&anotherTarget, &releaseEvent);
670679
671680 // Stop dragging
681+ EXPECT_CALL (engine, clickTarget).Times (0 );
672682 QCoreApplication::sendEvent (&target, &releaseEvent);
673683 ASSERT_EQ (std::round (sprite.x () * 100 ) / 100 , 68.26 );
674684 ASSERT_EQ (std::round (sprite.y () * 100 ) / 100 , -1.95 );
0 commit comments