示例#1
0
        public void LinkAccessibleObject_GetPropertyValue_Pattern_ReturnsExpected(bool expected, int propertyId)
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            Assert.Equal(expected, accessibleObject.GetPropertyValue((UIA)propertyId) ?? false);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_GetPropertyValue_RuntimeIdNotNull()
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            object actual = accessibleObject.GetPropertyValue(UiaCore.UIA.RuntimeIdPropertyId);

            Assert.NotNull(actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_GetPropertyValue_IsPatternSupported(int patternId)
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            bool actual = (bool)accessibleObject.GetPropertyValue((UiaCore.UIA)patternId);

            Assert.True(actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_Role_IsLink()
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            AccessibleRole actual = accessibleObject.Role;

            Assert.Equal(AccessibleRole.Link, actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
示例#5
0
        public void LinkAccessibleObject_GetPropertyValue_IsOffscreen_ReturnsFalse()
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            var actual = (bool)accessibleObject.GetPropertyValue(UIA.IsOffscreenPropertyId);

            Assert.False(actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
示例#6
0
        public void LinkAccessibleObject_GetPropertyValue_HelpText_ReturnsExpected()
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            object actual = accessibleObject.GetPropertyValue(UIA.HelpTextPropertyId);

            Assert.Equal(accessibleObject.Help ?? string.Empty, actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
示例#7
0
        public void LinkAccessibleObject_GetPropertyValue_RuntimeId_ReturnsExpected()
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject accessibleObject = linkLabel.Links[0].AccessibleObject;

            object actual = accessibleObject.GetPropertyValue(UIA.RuntimeIdPropertyId);

            Assert.Equal(accessibleObject.RuntimeId, actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_Parent_IsExpected_IfNoOneLinkWasAdded()
        {
            using LinkLabel linkLabel = new();
            LinkAccessibleObject linkAccessibleObject = linkLabel.Links[0].AccessibleObject;

            AccessibleObject expected = linkLabel.AccessibilityObject;
            AccessibleObject actual   = linkAccessibleObject.Parent;

            Assert.Equal(linkLabel.AccessibilityObject, linkAccessibleObject.Parent);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_GetPropertyValue_Name_IsExpected_ForOneLink()
        {
            using LinkLabel linkLabel = new();
            string testName = "TestNameLink";

            linkLabel.Text = testName;

            LinkAccessibleObject linkAccessibleObject = linkLabel.Links[0].AccessibleObject;
            object actual = linkAccessibleObject.GetPropertyValue(UiaCore.UIA.NamePropertyId);

            Assert.Equal(testName, actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkLabelAccessibleObject_GetChild_IsExpectedValue(int childIndex)
        {
            using LinkLabel linkLabel = new();

            for (int index = 0; index < 50; index++)
            {
                linkLabel.Links.Add(new());
            }

            LinkAccessibleObject expected = linkLabel.Links[childIndex].AccessibleObject;
            var actual = (LinkAccessibleObject)linkLabel.AccessibilityObject.GetChild(childIndex);

            Assert.Equal(expected, actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_FragmentNavigate_Parent_IsExpected(int linkIndex)
        {
            using LinkLabel linkLabel = new();

            AccessibleObject expected = linkLabel.AccessibilityObject;

            for (int index = 0; index < 4; index++)
            {
                linkLabel.Links.Add(new());
            }

            LinkAccessibleObject linkAccessibleObject = linkLabel.Links[linkIndex].AccessibleObject;

            UiaCore.IRawElementProviderFragment actual = linkAccessibleObject.FragmentNavigate(UiaCore.NavigateDirection.Parent);

            Assert.Equal(expected, actual);
            Assert.False(linkLabel.IsHandleCreated);
        }
        public void LinkAccessibleObject_CurrentIndex_IsExpected()
        {
            using LinkLabel linkLabel = new();

            for (int index = 0; index < 4; index++)
            {
                linkLabel.Links.Add(new());
            }

            for (int index = 0; index < 4; index++)
            {
                LinkAccessibleObject linkAccessibleObject = linkLabel.Links[index].AccessibleObject;
                int actual = linkAccessibleObject.TestAccessor().Dynamic.CurrentIndex;

                Assert.Equal(index, actual);
            }

            Assert.False(linkLabel.IsHandleCreated);
        }