Ejemplo n.º 1
0
        /// <summary>
        /// Builds the sequence of actions.
        /// </summary>
        /// <returns>A composite <see cref="IAction"/> which can be used to perform the actions.</returns>
        public IAction Build()
        {
            IAction toReturn = new BuiltAction(driver, actionBuilder, action);

            action        = new CompositeAction();
            actionBuilder = new ActionBuilder();
            return(toReturn);
        }
Ejemplo n.º 2
0
        public void OutputsPointerEventsToDictionary()
        {
            ActionBuilder actionBuilder = new ActionBuilder();

            var pointerInputDevice = new PointerInputDevice(PointerKind.Pen);
            var properties         = new PointerInputDevice.PointerEventProperties()
            {
                Width              = 10,
                Height             = 11,
                Pressure           = 0.5,
                TangentialPressure = 0.1,
                TiltX              = 15,
                TiltY              = 15,
                Twist              = 30,
                AltitudeAngle      = 0.1,
                AzimuthAngle       = 0.1
            };

            var action = pointerInputDevice.CreatePointerDown(MouseButton.Left, properties);

            actionBuilder.AddAction(action);
            var sequence = actionBuilder.ToActionSequenceList();

            var dictionary = sequence[0].ToDictionary();

            Console.WriteLine(dictionary);
            Assert.AreEqual("pointer", dictionary["type"]);
            Assert.NotNull(dictionary["id"]);
            Assert.NotNull(dictionary["parameters"]);
            var parameters = new Dictionary <string, object> {
                { "pointerType", "pen" }
            };

            CollectionAssert.AreEquivalent(parameters, (IEnumerable)dictionary["parameters"]);

            var events = new Dictionary <string, object>
            {
                { "width", 10 },
                { "height", 11 },
                { "pressure", 0.5 },
                { "tangentialPressure", 0.1 },
                { "tiltX", 15 },
                { "tiltY", 15 },
                { "twist", 30 },
                { "altitudeAngle", 0.1 },
                { "azimuthAngle", 0.1 },
                { "type", "pointerDown" },
                { "button", 0 }
            };
            var actions = (IList <Object>)dictionary["actions"];

            CollectionAssert.AreEquivalent(events, (IEnumerable)actions[0]);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Clears the list of actions to be performed.
 /// </summary>
 public void Reset()
 {
     this.actionBuilder = new ActionBuilder();
 }
Ejemplo n.º 4
0
 public BuiltAction(IWebDriver driver, ActionBuilder actionBuilder, CompositeAction action)
 {
     this.driver        = driver;
     this.actionBuilder = actionBuilder;
     this.action        = action;
 }