예제 #1
0
        public void TestMouseBehavior_Panning_VisibleChangedCorrectly()
        {
            const int offsetX = 100;
            const int offsetY = 100;

            action = new ActionsExtension(Driver);
            JsVisible visibleBefore = vcPageObj.GetViewport();
            JsVisible visibleAfter;

            action.MoveToElement(vcPageObj.VirtualCanvas, offsetX, offsetY);
            action.ClickAndHold();
            action.MoveByOffset(offsetX, offsetY);
            action.Release();
            action.Perform();

            vcPageObj.WaitAnimation();
            visibleAfter = vcPageObj.GetViewport();

            JsCoordinates offsetScreen;
            JsCoordinates offsetVirtual;

            // Firefox browser had an inaccuracy in 3px.
            offsetScreen  = (Browser == BrowserType.Firefox) ? new JsCoordinates(offsetX - 3, offsetY - 3) : new JsCoordinates(offsetX, offsetY);
            offsetVirtual = vcPageObj.VectorScreenToVirtual(offsetScreen);
            Assert.AreEqual(visibleBefore.CenterX - offsetVirtual.X, visibleAfter.CenterX, 1);
            Assert.AreEqual(visibleBefore.CenterY - offsetVirtual.Y, visibleAfter.CenterY, 1);
        }