Ejemplo n.º 1
0
 public void ActionsError_BadPointerTouch_Twist()
 {
     try
     {
         // Perform pen move action using a bad pointer twist parameter value
         PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
         ActionSequence     sequence    = new ActionSequence(touchDevice, 0);
         sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact, new TouchInfo {
             Twist = -1
         }));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentParameterTwist, exception.Message);
     }
 }
Ejemplo n.º 2
0
 public void ActionsError_BadPointerTouch_Width_MissingHeight()
 {
     try
     {
         // Perform pen move action using a pointer width parameter value without providing the height
         PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
         ActionSequence     sequence    = new ActionSequence(touchDevice, 0);
         sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact, new TouchInfo {
             Width = 1f
         }));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentParameterMissingWidthOrHeight, exception.Message);
     }
 }
Ejemplo n.º 3
0
 public void DrawCircle(PointerInputDevice penDevice, ActionSequence sequence, int centerX, int centerY, int radius, int stepSize)
 {
     sequence.AddAction(penDevice.CreatePointerMove(
                            CoordinateOrigin.Viewport,
                            centerX + radius,
                            centerY,
                            TimeSpan.Zero
                            ));
     sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
     for (int i = 0; i <= stepSize; i++)
     {
         sequence.AddAction(penDevice.CreatePointerMove(
                                CoordinateOrigin.Viewport,
                                Convert.ToInt32(centerX + radius * Math.Cos(2 * Math.PI * i / stepSize)),
                                Convert.ToInt32(centerY + radius * Math.Sin(2 * Math.PI * i / stepSize)),
                                TimeSpan.Zero
                                ));
     }
     sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
 }
Ejemplo n.º 4
0
 public void ActionsError_BadPointerPen_TiltY()
 {
     try
     {
         // Perform pen move action using a bad pointer tilt y parameter value
         PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence  = new ActionSequence(penDevice, 0);
         sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact, new PenInfo {
             TiltY = 100
         }));
         session.PerformActions(new List <ActionSequence> {
             sequence
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsArgumentParameterTiltY, exception.Message);
     }
 }
Ejemplo n.º 5
0
        private void DrawCircle()
        {
            // Draw a circle with radius 300 and 40 (x, y) points
            const int radius = 300;
            const int points = 40;

            // Select the Brushes toolbox to have the Brushes Pane sidebar displayed and ensure that Marker is selected
            session.FindElementByAccessibilityId("Toolbox").FindElementByAccessibilityId("TopBar_ArtTools").Click();
            session.FindElementByAccessibilityId("SidebarWrapper").FindElementByAccessibilityId("Marker3d").Click();

            // Locate the drawing surface
            WindowsElement inkCanvas = session.FindElementByAccessibilityId("InteractorFocusWrapper");
            //WindowsElement paintCanvas = session.FindElementByClassName("Afx:00007FF6908E0000:8");

            // Draw the circle with a single touch actions
            PointerInputDevice touchContact  = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touchSequence = new ActionSequence(touchContact, 0);

            //touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, 0, -radius, TimeSpan.Zero));
            //touchSequence.AddAction(touchContact.CreatePointerMove(paintCanvas, 0, -radius, TimeSpan.Zero));
            touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, 0, -radius, TimeSpan.Zero));
            touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));
            for (double angle = 0; angle <= 2 * Math.PI; angle += 2 * Math.PI / points)
            {
                //touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, (int)(Math.Sin(angle) * radius), -(int)(Math.Cos(angle) * radius), TimeSpan.Zero));
                touchSequence.AddAction(touchContact.CreatePointerMove(CoordinateOrigin.Viewport, (int)(Math.Sin(angle) * radius), -(int)(Math.Cos(angle) * radius), TimeSpan.Zero));
                //touchSequence.AddAction(touchContact.CreatePointerMove(paintCanvas, 0, -radius, TimeSpan.Zero));
            }
            touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));


            session.PerformActions(new List <ActionSequence> {
                touchSequence
            });

            // Verify that the drawing operations took place
            WindowsElement undoButton = session.FindElementByAccessibilityId("UndoIcon");

            Assert.IsTrue(undoButton.Displayed);
            Assert.IsTrue(undoButton.Enabled);
        }
Ejemplo n.º 6
0
 public void ActionsError_MultiplePen()
 {
     try
     {
         // Perform pen move action on stale element
         PointerInputDevice penDevice1 = new PointerInputDevice(PointerKind.Pen);
         PointerInputDevice penDevice2 = new PointerInputDevice(PointerKind.Pen);
         ActionSequence     sequence1  = new ActionSequence(penDevice1, 0);
         ActionSequence     sequence2  = new ActionSequence(penDevice2, 0);
         sequence1.AddAction(penDevice1.CreatePointerDown(PointerButton.PenContact));
         sequence2.AddAction(penDevice2.CreatePointerDown(PointerButton.PenContact));
         session.PerformActions(new List <ActionSequence> {
             sequence1, sequence2
         });
         Assert.Fail("Exception should have been thrown");
     }
     catch (InvalidOperationException exception)
     {
         Assert.AreEqual(ErrorStrings.ActionsUnimplementedMultiPen, exception.Message);
     }
 }
Ejemplo n.º 7
0
        public void DrawFlower()
        {
            const int             LinesCount          = 10; // Paint application only supports up to 10 touch inputs
            List <ActionSequence> actionSequencesList = new List <ActionSequence>();

            // Draw N petals shape graph to create a flower like shape
            double angle = 0;

            for (int line = 0; line < LinesCount; line++)
            {
                OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchContact = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Touch);
                ActionSequence touchSequence = new ActionSequence(touchContact, 0);

                int radius = 0;
                int x      = (int)(Math.Sin(angle) * (defaultRadius * Math.Cos(radius * 2 * Math.PI / 360)));
                int y      = (int)(Math.Cos(angle) * (defaultRadius * Math.Cos(radius * 2 * Math.PI / 360)));
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, x, -y, TimeSpan.Zero));
                touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));

                double subAngle = angle;
                while (radius < defaultRadius)
                {
                    x = (int)(Math.Sin(subAngle) * (defaultRadius * Math.Cos(radius * 2 * Math.PI / 360)));
                    y = (int)(Math.Cos(subAngle) * (defaultRadius * Math.Cos(radius * 2 * Math.PI / 360)));
                    touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, x, -y, TimeSpan.Zero));
                    radius   += 5;
                    subAngle += 2 * Math.PI / 360;
                }

                touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
                actionSequencesList.Add(touchSequence);
                angle += 2 * Math.PI / LinesCount;
            }

            ourSession.PerformActions(actionSequencesList);

            // Verify that the drawing operations took place
            Assert.IsTrue(undoButton.Displayed);
            Assert.IsTrue(undoButton.Enabled);
        }
Ejemplo n.º 8
0
        public void DrawTwistingHurricane()
        {
            const int             LinesCount          = 10; // Paint application only supports up to 10 touch inputs
            List <ActionSequence> actionSequencesList = new List <ActionSequence>();

            // Draw N lines following a twisting & rotating radial pattern ressembling a hurricane eye
            double angle = 0;

            for (int line = 0; line < LinesCount; line++)
            {
                PointerInputDevice touchContact  = new PointerInputDevice(PointerKind.Touch);
                ActionSequence     touchSequence = new ActionSequence(touchContact, 0);

                int radius = 100;
                int x      = (int)(Math.Sin(angle) * radius);
                int y      = (int)(Math.Cos(angle) * radius);
                touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, x, -y, TimeSpan.Zero));
                touchSequence.AddAction(touchContact.CreatePointerDown(PointerButton.TouchContact));

                double subAngle = angle;
                while (radius < defaultRadius)
                {
                    x = (int)(Math.Sin(subAngle) * radius);
                    y = (int)(Math.Cos(subAngle) * radius);
                    touchSequence.AddAction(touchContact.CreatePointerMove(inkCanvas, x, -y, TimeSpan.Zero));
                    radius   += 5;
                    subAngle += 2 * Math.PI / 36;
                }

                touchSequence.AddAction(touchContact.CreatePointerUp(PointerButton.TouchContact));
                actionSequencesList.Add(touchSequence);
                angle += Math.PI / LinesCount;
            }

            session.PerformActions(actionSequencesList);

            // Verify that the drawing operations took place
            Assert.IsTrue(undoButton.Displayed);
            Assert.IsTrue(undoButton.Enabled);
        }
Ejemplo n.º 9
0
        public void ZoomingInMultiTouch()
        {
            // Drag a touch contact diagonally in NE direction distancing apart from the other contact point
            PointerInputDevice touch1         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touch1Sequence = new ActionSequence(touch1, 0);

            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 50, -50, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerDown(PointerButton.TouchContact));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 55, -55, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 60, -60, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 65, -65, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 70, -70, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 75, -75, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 80, -80, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerUp(PointerButton.TouchContact));

            // Drag a touch contact diagonally in SW direction distancing apart from the other contact point
            PointerInputDevice touch2         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touch2Sequence = new ActionSequence(touch2, 0);

            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -50, 50, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerDown(PointerButton.TouchContact));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -55, 55, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -60, 60, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -65, 65, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -70, 70, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -75, 75, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -80, 80, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerUp(PointerButton.TouchContact));

            // Perform the 2 fingers zoom in (expand) multi-touch sequences defined above
            session.PerformActions(new List <ActionSequence> {
                touch1Sequence, touch2Sequence
            });

            // Ensure that the zoom level now is greater than 100%
            Assert.IsTrue(int.Parse(zoomScaleTextBox.Text) > 100);
        }
Ejemplo n.º 10
0
        public void ZoomingOutMultiTouch()
        {
            // Drag a touch contact diagonally in SW direction approaching the other contact point
            PointerInputDevice touch1         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touch1Sequence = new ActionSequence(touch1, 0);

            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 50, -50, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerDown(PointerButton.TouchContact));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 45, -45, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 40, -40, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 35, -35, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 30, -30, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 25, -25, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerMove(zoomInteractor, 20, -20, TimeSpan.Zero));
            touch1Sequence.AddAction(touch1.CreatePointerUp(PointerButton.TouchContact));

            // Drag a touch contact diagonally in NE direction approaching the other contact point
            PointerInputDevice touch2         = new PointerInputDevice(PointerKind.Touch);
            ActionSequence     touch2Sequence = new ActionSequence(touch2, 0);

            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -50, 50, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerDown(PointerButton.TouchContact));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -45, 45, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -40, 40, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -35, 35, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -30, 30, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -25, 25, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerMove(zoomInteractor, -20, 20, TimeSpan.Zero));
            touch2Sequence.AddAction(touch2.CreatePointerUp(PointerButton.TouchContact));

            // Perform the 2 fingers zoom out (pinch) multi-touch sequences defined above
            session.PerformActions(new List <ActionSequence> {
                touch1Sequence, touch2Sequence
            });

            // Ensure that the zoom level now is less than 100%
            Assert.IsTrue(int.Parse(zoomScaleTextBox.Text) < 100);
        }
Ejemplo n.º 11
0
        // draws a given digit on canvas
        // (0,0)  (x,0)
        //  ┌───────┐
        //  │       │   In viewport(default) origin mode:
        //  │       │   - X is absolute horizontal position in the session window
        //  └───────┘   - Y is absolute vertical position in the session window
        // (y,0)  (x,y) - (0,0) is on the top left corner, and (x,y) is on bottom right corner
        public void Draw(uint digit)
        {
            PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
            ActionSequence     sequence  = new ActionSequence(penDevice, 0);
            Point canvasCoordiante       = inkCanvas.Coordinates.LocationInViewport;

            switch (digit)
            {
            case 0:
            {
                // drawing a circle around a center
                // start from cos(0), sin(0)
                var centerX  = canvasCoordiante.X + inkCanvas.Size.Width / 2;
                var centerY  = canvasCoordiante.Y + inkCanvas.Size.Height / 2;
                var radius   = inkCanvas.Size.Width / 3;
                var stepSize = 10;
                DrawCircle(penDevice, sequence, centerX, centerY, radius, stepSize);
                break;
            }

            case 1:
                // (0,0)   (x,0)
                //  ┌───────┐   Draw a basic line from top to bottom.
                //  │   |   │
                //  │   |   │
                //  └───────┘
                // (y,0)   (x,y)
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + inkCanvas.Size.Width / 2,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 9,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + inkCanvas.Size.Width / 2,
                                       canvasCoordiante.Y + 8 * inkCanvas.Size.Height / 9,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                break;

            case 2:
                break;

            case 3:
                break;

            case 4:
                // (0,0)   (x,0)
                //  ┌───────┐
                //  │  / |  │
                //  │ ───── |
                //  │    |  │
                //  └───────┘
                // (y,0)   (x,y)
                // vertical line
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + 2 * inkCanvas.Size.Width / 3,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 8,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + 2 * inkCanvas.Size.Width / 3,
                                       canvasCoordiante.Y + 5 * inkCanvas.Size.Height / 6,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                // horizontal line
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + inkCanvas.Size.Width / 4,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 2,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + 3 * inkCanvas.Size.Width / 4,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 2,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                // diagonal
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + inkCanvas.Size.Width / 4,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 2,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + 2 * inkCanvas.Size.Width / 3,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 8,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                break;

            case 5:
                break;

            case 6:
                break;

            case 7:
                // (0,0)   (x,0)
                //  ┌───────┐
                //  │ ───── |
                //  │    /  │
                //  │   /   │
                //  └───────┘
                // (y,0)   (x,y)
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + inkCanvas.Size.Width / 6,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 6,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + 6 * inkCanvas.Size.Width / 6,
                                       canvasCoordiante.Y + inkCanvas.Size.Height / 6,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerMove(
                                       CoordinateOrigin.Viewport,
                                       canvasCoordiante.X + 3 * inkCanvas.Size.Width / 6,
                                       canvasCoordiante.Y + 5 * inkCanvas.Size.Height / 6,
                                       TimeSpan.Zero));
                sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
                break;

            case 8:
            {
                // two circles. Smaller circle on top of bigger circle
                var centerX = canvasCoordiante.X + inkCanvas.Size.Width / 2;
                var centerY = canvasCoordiante.Y + inkCanvas.Size.Height / 5 + inkCanvas.Size.Height / 10;
                var radius  = inkCanvas.Size.Height / 6;

                var stepSize = 10;
                DrawCircle(penDevice, sequence, centerX, centerY, radius, stepSize);
                centerX = canvasCoordiante.X + inkCanvas.Size.Width / 2;
                centerY = canvasCoordiante.Y + 3 * inkCanvas.Size.Height / 5 + inkCanvas.Size.Height / 10;
                radius  = Convert.ToInt32(1.4 * inkCanvas.Size.Height / 6);
                DrawCircle(penDevice, sequence, centerX, centerY, radius, stepSize);
                break;
            }

            case 9:
                break;

            default:
                Assert.Fail("wrong argument");
                break;
            }
            session.PerformActions(new List <ActionSequence> {
                sequence
            });
        }
Ejemplo n.º 12
0
        public void DrawSquareAndDeleteStrokes()
        {
            int offset = 400;
            // A        B
            //  ┌──────┐   Draw a basic ABCD square using Pen through the Actions API
            //  │      │   in pointer element mode:
            //  │      │   - X is relative to the horizontal element center point
            //  └──────┘   - Y is relative to the vertical element center point
            // D        C
            PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
            ActionSequence     sequence  = new ActionSequence(penDevice, 0);

            // Draw line CD from point C to D and apply 30% pen pressure
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, offset, offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact, new PenInfo {
                Pressure = 0.3f
            }));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, -offset, offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line DA from point D to A
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, -offset, -offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line AB from point A to B
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, offset, -offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw line BC from point B to C
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, offset, offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw diagonal line CA from point C straight to A
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, -offset, -offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Draw diagonal line DB from point D straight to B
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, -offset, offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, offset, -offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));

            // Erase line AB by pressing PenEraser (Pen tail end/eraser button) on the line AB from right to left
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, offset / 2, -offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenEraser));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, -offset / 2, -offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenEraser));

            // Erase line CD by pressing PenEraser (Pen tail end/eraser button) on the line CD from left to right
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, -offset / 2, offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenEraser));
            sequence.AddAction(penDevice.CreatePointerMove(inkCanvas, offset / 2, offset, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenEraser));

            newStickyNoteSession.PerformActions(new List <ActionSequence> {
                sequence
            });

            try
            {
                var result = newStickyNoteSession.FindElementByAccessibilityId("RichEditBox");
                Assert.Fail("RichEditBox should not be defined anymore after a pen input is successfully performed.");
            }
            catch { }
        }