Skip to content

Commit e3793fc

Browse files
authored
Merge branch 'main' into main
2 parents 7b6bd6e + 02ed37a commit e3793fc

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Desktop.Robot.TestApp/MouseTests.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

Desktop.Robot.TestApp/Program.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
6163
type App() =
6264
inherit Application()
6365

0 commit comments

Comments
 (0)