@@ -32,6 +32,8 @@ public partial class TestSceneTouchInput : ManualInputManagerTestScene
32
32
[ SetUp ]
33
33
public new void SetUp ( ) => Schedule ( ( ) =>
34
34
{
35
+ InputManager . RightClickFromLongTouch = true ;
36
+
35
37
Children = new Drawable [ ]
36
38
{
37
39
new Container
@@ -606,6 +608,25 @@ public void TestHoldTwoTouchesAndReleaseSecondBeforeRightClick()
606
608
AddAssert ( "no right click received" , ( ) => primaryReceptor . MouseEvents . Count == 0 && secondaryReceptor . MouseEvents . Count == 0 ) ;
607
609
}
608
610
611
+ [ Test ]
612
+ public void TestHoldTouchAndDisableHoldingBeforeRightClick ( )
613
+ {
614
+ InputReceptor primaryReceptor = null ;
615
+
616
+ AddStep ( "retrieve primary receptor" , ( ) => primaryReceptor = receptors [ ( int ) TouchSource . Touch1 ] ) ;
617
+ AddStep ( "setup handlers to receive mouse-from-touch" , ( ) =>
618
+ {
619
+ primaryReceptor . HandleTouch = _ => false ;
620
+ primaryReceptor . HandleMouse = e => e is MouseButtonEvent button && button . Button == MouseButton . Right ;
621
+ } ) ;
622
+
623
+ AddStep ( "begin touch" , ( ) => InputManager . BeginTouch ( new Touch ( TouchSource . Touch1 , getTouchDownPos ( TouchSource . Touch1 ) ) ) ) ;
624
+ AddWaitStep ( "hold shortly" , 2 ) ;
625
+ AddStep ( "turn off hold-to-right-click" , ( ) => InputManager . RightClickFromLongTouch = false ) ;
626
+ AddWaitStep ( "wait a bit" , 4 ) ;
627
+ AddAssert ( "no right click received" , ( ) => primaryReceptor . MouseEvents . Count == 0 ) ;
628
+ }
629
+
609
630
private partial class InputReceptor : Container
610
631
{
611
632
public readonly TouchSource AssociatedSource ;
0 commit comments