コード例 #1
0
        public override void Body()
        {
            ActualResult = QAliber.RemotingModel.TestCaseResult.Failed;

            UIControlBase c = UIControlBase.FindControlByPath(control);

            if (!c.Exists)
            {
                ActualResult = QAliber.RemotingModel.TestCaseResult.Failed;
                Log.Error("Control not found");
                return;
            }

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

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

            LowLevelInput.PressKeys(_modifierKeys);
            c.Click(button, point);
            LowLevelInput.ReleaseKeys(_modifierKeys);

            ActualResult = QAliber.RemotingModel.TestCaseResult.Passed;
        }
コード例 #2
0
        public void Play()
        {
            long lastTime = 0;

            for (int i = 0; i < macroEntries.Count; i++)
            {
                Win32Input input       = macroEntries[i].Input;
                long       currentTime = macroEntries[i].Time;
                System.Threading.Thread.Sleep((int)(currentTime - lastTime));
                lastTime = currentTime;
                LowLevelInput.SendInput(1, ref input, Marshal.SizeOf(typeof(Win32Input)));
            }
        }
コード例 #3
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;
        }