コード例 #1
0
        public void VerifyIndeterminateProgressRingDoesNotImplementRangeValuePattern()
        {
            using (var setup = new TestSetupHelper("ProgressRing Tests"))
            {
                UIObject progressRing = FindElement.ByName("Busy TestProgressRing");

                Verify.IsNotNull(progressRing);

                RangeValueImplementation rangeValueImplementation = new RangeValueImplementation(progressRing);

                Verify.IsFalse(rangeValueImplementation.IsAvailable);
            }
        }
コード例 #2
0
        void AddSupportedPatterns(UIObject uiObjectToAdd, XmlNode nodeToPopulate)
        {
            foreach (var supportedPattern in uiObjectToAdd.GetSupportedPatterns())
            {
                if (supportedPattern != null)
                {
                    if (supportedPattern.ProgrammaticName == DockPatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        IDock dock = new DockImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: dock);
                    }
                    else if (supportedPattern.ProgrammaticName == ExpandCollapsePatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        IExpandCollapse expandCollapse = new ExpandCollapseImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: expandCollapse);
                    }
                    else if (supportedPattern.ProgrammaticName == RangeValuePatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        IRangeValue rangeValue = new RangeValueImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: rangeValue);
                    }
                    else if (supportedPattern.ProgrammaticName == ScrollPatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        IScroll scroll = new ScrollImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: scroll);
                    }
                    else if (supportedPattern.ProgrammaticName == TogglePatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        IToggle toggle = new ToggleImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: toggle);
                    }
                    else if (supportedPattern.ProgrammaticName == TransformPatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        ITransform transform = new TransformImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: transform);
                    }
                    else if (supportedPattern.ProgrammaticName == WindowPatternIdentifiers.Pattern.ProgrammaticName)
                    {
                        IWindow window = new WindowImplementation(uiObject: uiObjectToAdd);
                        AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: window);
                    }
                    else
                    {
                        if (supportedPattern.ProgrammaticName == SelectionItemPattern.Pattern.ProgrammaticName)
                        {
                            ISelectionItem <UIObject> selectionItem = new SelectionItemImplementation <UIObject>(uiObject: uiObjectToAdd, containerFactory: UIObject.Factory);
                            AddPropertiesAsXmlAttributes(nodeToPopulate: nodeToPopulate, currObject: selectionItem);
                            break;
                        }

                        if (supportedPattern.ProgrammaticName == SelectionPattern.Pattern.ProgrammaticName)
                        {
                            var selectionImplementation = new SelectionImplementation <UIObject>(uiObject: uiObjectToAdd, itemFactory: UIObject.Factory);
                            var empty = string.Empty;
                            foreach (var uiObject in selectionImplementation.Selection)
                            {
                                if (empty != string.Empty)
                                {
                                    empty += ";";
                                }
                                empty += uiObject.RuntimeId;
                            }

                            var attribute = this._xmlDoc.CreateAttribute(name: "Selection");
                            attribute.Value = empty;
                            nodeToPopulate.Attributes.Append(node: attribute);
                        }
                    }
                }
            }
        }
コード例 #3
0
 void Initialize()
 {
     RangeValueProvider = new RangeValueImplementation(uiObject: this);
 }
コード例 #4
0
        public static string GetDescription(this UIObject obj)
        {
            List <string> patternsSupported       = new List <string>();
            StringBuilder extraInformationBuilder = new StringBuilder();

            DockImplementation           dockImplementation           = new DockImplementation(obj);
            ExpandCollapseImplementation expandCollapseImplementation = new ExpandCollapseImplementation(obj);
            InvokeImplementation         invokeImplementation         = new InvokeImplementation(obj);
            RangeValueImplementation     rangeValueImplementation     = new RangeValueImplementation(obj);
            ScrollImplementation         scrollImplementation         = new ScrollImplementation(obj);
            TextImplementation           textImplementation           = new TextImplementation(obj);
            ToggleImplementation         toggleImplementation         = new ToggleImplementation(obj);
            ValueImplementation          valueImplementation          = new ValueImplementation(obj);
            WindowImplementation         windowImplementation         = new WindowImplementation(obj);

            if (dockImplementation.IsAvailable)
            {
                patternsSupported.Add("Dock");
                extraInformationBuilder.AppendFormat(", Dock.DockPosition={0}", dockImplementation.DockPosition);
            }

            if (expandCollapseImplementation.IsAvailable)
            {
                patternsSupported.Add("ExpandCollapse");
                extraInformationBuilder.AppendFormat(", ExpandCollapse.ExpandCollapseState={0}", expandCollapseImplementation.ExpandCollapseState);
            }

            if (invokeImplementation.IsAvailable)
            {
                patternsSupported.Add("Invoke");
            }

            if (rangeValueImplementation.IsAvailable)
            {
                patternsSupported.Add("RangeValue");
                extraInformationBuilder.AppendFormat(", RangeValue.Minimum={0}, RangeValue.Maximum={1}, RangeValue.LargeChange={2}, RangeValue.SmallChange={3}, RangeValue.Value={4}, RangeValue.IsReadOnly={5}",
                                                     rangeValueImplementation.Minimum, rangeValueImplementation.Maximum,
                                                     rangeValueImplementation.LargeChange, rangeValueImplementation.SmallChange,
                                                     rangeValueImplementation.Value,
                                                     rangeValueImplementation.IsReadOnly);
            }

            if (scrollImplementation.IsAvailable)
            {
                patternsSupported.Add("Scroll");
                extraInformationBuilder.AppendFormat(", Scroll.HorizontallyScrollable={0}, Scroll.VerticallyScrollable={1}, Scroll.HorizontalScrollPercent={2}, Scroll.VerticalScrollPercent={3}, Scroll.HorizontalViewSize={4}, Scroll.VerticalViewSize={5}",
                                                     scrollImplementation.HorizontallyScrollable, scrollImplementation.VerticallyScrollable,
                                                     scrollImplementation.HorizontalScrollPercent, scrollImplementation.VerticalScrollPercent,
                                                     scrollImplementation.HorizontalViewSize, scrollImplementation.VerticalViewSize);
            }

            if (textImplementation.IsAvailable)
            {
                patternsSupported.Add("Text");
                string textContent = textImplementation.DocumentRange.GetText(-1);
                extraInformationBuilder.AppendFormat(", Text.Text=\"{0}\", Text.SupportsTextSelection={1}", textContent.Substring(0, Math.Min(100, textContent.Length)), textImplementation.SupportsTextSelection);
            }

            if (toggleImplementation.IsAvailable)
            {
                patternsSupported.Add("Toggle");
                extraInformationBuilder.AppendFormat(", Toggle.ToggleState={0}", toggleImplementation.ToggleState);
            }

            if (valueImplementation.IsAvailable)
            {
                patternsSupported.Add("Value");
                extraInformationBuilder.AppendFormat(", Value.Value=\"{0}\", Value.IsReadOnly={1}", valueImplementation.Value, valueImplementation.IsReadOnly);
            }

            if (windowImplementation.IsAvailable)
            {
                patternsSupported.Add("Window");
                extraInformationBuilder.AppendFormat(", Window.CanMaximize={0}, Window.CanMinimize={1}, Window.IsModal={2}, Window.WindowVisualState={3}, Window.WindowInteractionState={4}, Window.IsTopmost={5}",
                                                     windowImplementation.CanMaximize, windowImplementation.CanMinimize, windowImplementation.IsModal,
                                                     windowImplementation.WindowVisualState, windowImplementation.WindowInteractionState, windowImplementation.IsTopmost);
            }

            string patternsSupportedString = string.Empty;

            if (patternsSupported.Count > 0)
            {
                patternsSupportedString = string.Format(", PatternsSupported={0}", string.Join(";", patternsSupported));
            }

            return(string.Format("{0} [Aid={1}, Class={2}, Type={3}{4}{5}]", obj.Name, obj.AutomationId, obj.ClassName, obj.ControlType, patternsSupportedString, extraInformationBuilder.ToString()));
        }