Beispiel #1
0
        public override void Body()
        {
            ActualResult = QAliber.RemotingModel.TestCaseResult.Failed;

            UIControlBase c = UIControlBase.FindControlByPath(control);

            if (!c.Exists)
            {
                Log.Error("Start control not found.");
                return;
            }

            IScrollItemPattern pattern = c.GetControlInterface <IScrollItemPattern>();

            if (pattern != null && _scrollIntoView)
            {
                pattern.ScrollIntoView();
            }

            if (!c.Visible)
            {
                Log.Error("Start control not visible.");
                return;
            }

            Point point2 = _point2;

            if (!string.IsNullOrEmpty(_endControl))
            {
                UIControlBase endControl = UIControlBase.FindControlByPath(_endControl);

                if (!endControl.Exists)
                {
                    Log.Error("End control not found.");
                    return;
                }

                pattern = endControl.GetControlInterface <IScrollItemPattern>();

                if (pattern != null && _scrollIntoView)
                {
                    pattern.ScrollIntoView();
                }

                if (!endControl.Visible)
                {
                    Log.Error("End control not visible.");
                    return;
                }

                // Figure out end coordinate relative to begin coord
                Vector offset = endControl.Layout.TopLeft - c.Layout.TopLeft;
                point2 += offset;
            }

            LowLevelInput.PressKeys(_modifierKeys);
            c.Drag(button, point1, point2);
            LowLevelInput.ReleaseKeys(_modifierKeys);

            ActualResult = TestCaseResult.Passed;
        }