示例#1
0
 /// <summary></summary>
 protected TransformPatternWrapper(AutomationElement element, string testSuite, TestPriorities priority, TypeOfControl typeOfControl, TypeOfPattern typeOfPattern, string dirResults, bool testEvents, IApplicationCommands commands)
     :
     base(element, testSuite, priority, typeOfControl, typeOfPattern, dirResults, testEvents, commands)
 {
     m_pattern = (TransformPattern)GetPattern(m_le, m_useCurrent, TransformPattern.Pattern);
 }
示例#2
0
		/// -------------------------------------------------------------------
		/// <summary></summary>
		/// -------------------------------------------------------------------
		public TransformTests(AutomationElement element, TestPriorities priority, string dirResults, bool testEvents, TypeOfControl typeOfControl, IApplicationCommands commands)
            :
            base(element, TestSuite, priority, typeOfControl, TypeOfPattern.Transform, dirResults, testEvents, commands)
        {
            m_pattern = (TransformPattern)element.GetCurrentPattern(TransformPattern.Pattern);
            if (m_pattern == null)
                throw new Exception(Helpers.PatternNotSupported);
        }
示例#3
0
			internal TransformPatternInformation (TransformPattern pattern, bool cache)
			{
				this.pattern = pattern;
				this.cache = cache;
			}
示例#4
0
        /// <summary>
        ///     The Startup handler.
        /// </summary>
        /// <param name="e">The event arguments</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Start the WindowMove client.
            CreateWindow();

            try
            {
                // Obtain an AutomationElement from the target window handle.
                _targetWindow = StartTargetApp(_targetApplication);

                // Does the automation element exist?
                if (_targetWindow == null)
                {
                    Feedback("No target.");
                    return;
                }
                Feedback("Found target.");

                // find current location of our window
                _targetLocation = _targetWindow.Current.BoundingRectangle.Location;

                // Obtain required control patterns from our automation element
                _windowPattern = GetControlPattern(_targetWindow,
                    WindowPattern.Pattern) as WindowPattern;

                if (_windowPattern == null) return;

                // Make sure our window is usable.
                // WaitForInputIdle will return before the specified time 
                // if the window is ready.
                if (false == _windowPattern.WaitForInputIdle(10000))
                {
                    Feedback("Object not responding in a timely manner.");
                    return;
                }
                Feedback("Window ready for user interaction");

                // Register for required events
                RegisterForEvents(
                    _targetWindow, WindowPattern.Pattern, TreeScope.Element);

                // Obtain required control patterns from our automation element
                _transformPattern =
                    GetControlPattern(_targetWindow, TransformPattern.Pattern)
                        as TransformPattern;

                if (_transformPattern == null) return;

                // Is the TransformPattern object moveable?
                if (_transformPattern.Current.CanMove)
                {
                    // Enable our WindowMove fields
                    _xCoordinate.IsEnabled = true;
                    _yCoordinate.IsEnabled = true;
                    _moveTarget.IsEnabled = true;

                    // Move element
                    _transformPattern.Move(0, 0);
                }
                else
                {
                    Feedback("Wndow is not moveable.");
                }
            }
            catch (ElementNotAvailableException)
            {
                Feedback("Client window no longer available.");
            }
            catch (InvalidOperationException)
            {
                Feedback("Client window cannot be moved.");
            }
            catch (Exception exc)
            {
                Feedback(exc.ToString());
            }
        }
示例#5
0
 internal TransformPatternInformation(TransformPattern pattern, bool cache)
 {
     this.pattern = pattern;
     this.cache   = cache;
 }