File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,21 @@ let tests (window:Window) = testList "Mouse tests" [
110110 testMouseDownUp RightButton
111111 testMouseDownUp MiddleButton
112112
113+ uiTest " Can scroll vertical" <| async {
114+ let wheelDeltas = window.PointerWheelChanged.Select( fun x -> x.Delta)
115+
116+ let! deltaEvents = attemptUIActionList wheelDeltas <| async {
117+ Robot() .MouseScrollVertical( 100 ) // scroll down
118+ Robot() .MouseScrollVertical(- 100 ) // then scroll up
119+ }
120+ Expect.hasLength deltaEvents 2 " Should have a wheel event for each mouse scroll"
121+ let xDeltas = deltaEvents |> List.map ( fun p -> p.X)
122+ let yDeltas = deltaEvents |> List.map ( fun p -> p.Y)
123+ Expect.allEqual xDeltas 0 " Should not scroll horizontally"
124+ Expect.isLessThan yDeltas[ 0 ] 0 " Should scroll down first"
125+ Expect.isGreaterThan yDeltas[ 1 ] 0 " Should scroll up next"
126+ }
127+
113128 uiTest " Can move to point" <| async {
114129 let toPixelPoint ( p : Point ) = PixelPoint( int p.X, int p.Y)
115130 let toDrawingPoint ( p : PixelPoint ) = Drawing.Point( p.X, p.Y)
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ type MainWindow() as this =
5858 .Subscribe( fun _ -> runTests())
5959 |> ignore
6060
61+ this.PointerWheelChanged.ObserveOn( SynchronizationContext.Current) .Subscribe( fun x -> printfn " Wheel %f ... %A " x.Delta.Y x) |> ignore
62+
6163type App () =
6264 inherit Application()
6365
You can’t perform that action at this time.
0 commit comments