Skip to content

Commit e6cd2a8

Browse files
committed
[dotnet] Add infratructure for previously unsupported interaction types
1 parent 5632da3 commit e6cd2a8

File tree

3 files changed

+370
-2
lines changed

3 files changed

+370
-2
lines changed

dotnet/src/webdriver/Interactions/InputDeviceKind.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// <copyright file="InputDeviceKind.cs" company="WebDriver Committers">
1+
// <copyright file="InputDeviceKind.cs" company="WebDriver Committers">
22
// Licensed to the Software Freedom Conservancy (SFC) under one
33
// or more contributor license agreements. See the NOTICE file
44
// distributed with this work for additional information
@@ -36,6 +36,11 @@ public enum InputDeviceKind
3636
/// <summary>
3737
/// Represents a pointer-based device, such as a mouse, pen, or stylus.
3838
/// </summary>
39-
Pointer
39+
Pointer,
40+
41+
/// <summary>
42+
/// Represents a wheel device.
43+
/// </summary>
44+
Wheel
4045
}
4146
}

dotnet/src/webdriver/Interactions/PointerInputDevice.cs

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,15 @@ public Interaction CreatePointerCancel()
221221
private class PointerDownInteraction : Interaction
222222
{
223223
private MouseButton button;
224+
private double? width;
225+
private double? height;
226+
private double? pressure;
227+
private double? tangentialPressure;
228+
private int? tiltX;
229+
private int? tiltY;
230+
private int? twist;
231+
private double? altitudeAngle;
232+
private double? azimuthAngle;
224233

225234
public PointerDownInteraction(InputDevice sourceDevice, MouseButton button)
226235
: base(sourceDevice)
@@ -234,6 +243,51 @@ public override Dictionary<string, object> ToDictionary()
234243
toReturn["type"] = "pointerDown";
235244
toReturn["button"] = Convert.ToInt32(this.button, CultureInfo.InvariantCulture);
236245

246+
if (this.width.HasValue)
247+
{
248+
toReturn["width"] = this.width.Value;
249+
}
250+
251+
if (this.height.HasValue)
252+
{
253+
toReturn["height"] = this.width.Value;
254+
}
255+
256+
if (this.pressure.HasValue)
257+
{
258+
toReturn["pressure"] = this.width.Value;
259+
}
260+
261+
if (this.tangentialPressure.HasValue)
262+
{
263+
toReturn["tangentialPressure"] = this.width.Value;
264+
}
265+
266+
if (this.tiltX.HasValue)
267+
{
268+
toReturn["tiltX"] = this.width.Value;
269+
}
270+
271+
if (this.tiltY.HasValue)
272+
{
273+
toReturn["tiltY"] = this.width.Value;
274+
}
275+
276+
if (this.twist.HasValue)
277+
{
278+
toReturn["twist"] = this.width.Value;
279+
}
280+
281+
if (this.altitudeAngle.HasValue)
282+
{
283+
toReturn["altitudeAngle"] = this.width.Value;
284+
}
285+
286+
if (this.azimuthAngle.HasValue)
287+
{
288+
toReturn["azimuthAngle"] = this.width.Value;
289+
}
290+
237291
return toReturn;
238292
}
239293

@@ -246,6 +300,15 @@ public override string ToString()
246300
private class PointerUpInteraction : Interaction
247301
{
248302
private MouseButton button;
303+
private double? width;
304+
private double? height;
305+
private double? pressure;
306+
private double? tangentialPressure;
307+
private int? tiltX;
308+
private int? tiltY;
309+
private int? twist;
310+
private double? altitudeAngle;
311+
private double? azimuthAngle;
249312

250313
public PointerUpInteraction(InputDevice sourceDevice, MouseButton button)
251314
: base(sourceDevice)
@@ -259,6 +322,51 @@ public override Dictionary<string, object> ToDictionary()
259322
toReturn["type"] = "pointerUp";
260323
toReturn["button"] = Convert.ToInt32(this.button, CultureInfo.InvariantCulture);
261324

325+
if (this.width.HasValue)
326+
{
327+
toReturn["width"] = this.width.Value;
328+
}
329+
330+
if (this.height.HasValue)
331+
{
332+
toReturn["height"] = this.width.Value;
333+
}
334+
335+
if (this.pressure.HasValue)
336+
{
337+
toReturn["pressure"] = this.width.Value;
338+
}
339+
340+
if (this.tangentialPressure.HasValue)
341+
{
342+
toReturn["tangentialPressure"] = this.width.Value;
343+
}
344+
345+
if (this.tiltX.HasValue)
346+
{
347+
toReturn["tiltX"] = this.width.Value;
348+
}
349+
350+
if (this.tiltY.HasValue)
351+
{
352+
toReturn["tiltY"] = this.width.Value;
353+
}
354+
355+
if (this.twist.HasValue)
356+
{
357+
toReturn["twist"] = this.width.Value;
358+
}
359+
360+
if (this.altitudeAngle.HasValue)
361+
{
362+
toReturn["altitudeAngle"] = this.width.Value;
363+
}
364+
365+
if (this.azimuthAngle.HasValue)
366+
{
367+
toReturn["azimuthAngle"] = this.width.Value;
368+
}
369+
262370
return toReturn;
263371
}
264372

@@ -295,6 +403,15 @@ private class PointerMoveInteraction : Interaction
295403
private int y = 0;
296404
private TimeSpan duration = TimeSpan.MinValue;
297405
private CoordinateOrigin origin = CoordinateOrigin.Pointer;
406+
private double? width;
407+
private double? height;
408+
private double? pressure;
409+
private double? tangentialPressure;
410+
private int? tiltX;
411+
private int? tiltY;
412+
private int? twist;
413+
private double? altitudeAngle;
414+
private double? azimuthAngle;
298415

299416
public PointerMoveInteraction(InputDevice sourceDevice, IWebElement target, CoordinateOrigin origin, int x, int y, TimeSpan duration)
300417
: base(sourceDevice)
@@ -343,6 +460,51 @@ public override Dictionary<string, object> ToDictionary()
343460
toReturn["x"] = this.x;
344461
toReturn["y"] = this.y;
345462

463+
if (this.width.HasValue)
464+
{
465+
toReturn["width"] = this.width.Value;
466+
}
467+
468+
if (this.height.HasValue)
469+
{
470+
toReturn["height"] = this.width.Value;
471+
}
472+
473+
if (this.pressure.HasValue)
474+
{
475+
toReturn["pressure"] = this.width.Value;
476+
}
477+
478+
if (this.tangentialPressure.HasValue)
479+
{
480+
toReturn["tangentialPressure"] = this.width.Value;
481+
}
482+
483+
if (this.tiltX.HasValue)
484+
{
485+
toReturn["tiltX"] = this.width.Value;
486+
}
487+
488+
if (this.tiltY.HasValue)
489+
{
490+
toReturn["tiltY"] = this.width.Value;
491+
}
492+
493+
if (this.twist.HasValue)
494+
{
495+
toReturn["twist"] = this.width.Value;
496+
}
497+
498+
if (this.altitudeAngle.HasValue)
499+
{
500+
toReturn["altitudeAngle"] = this.width.Value;
501+
}
502+
503+
if (this.azimuthAngle.HasValue)
504+
{
505+
toReturn["azimuthAngle"] = this.width.Value;
506+
}
507+
346508
return toReturn;
347509
}
348510

0 commit comments

Comments
 (0)