public void PropertyGridViewAccessibleObject_Parent_IsNotNull() { using PropertyGrid propertyGrid = new PropertyGrid(); ControlAccessibleObject accessibleObject = (ControlAccessibleObject)propertyGrid.GridViewAccessibleObject; Assert.NotNull(accessibleObject.Parent); }
public void ToolStripTextBoxControlAccessibleObject_ctor_default() { using ToolStripTextBox toolStripTextBox = new ToolStripTextBox(); TextBox textBox = toolStripTextBox.TextBox; Type type = toolStripTextBox.GetType().GetNestedType("ToolStripTextBoxControlAccessibleObject", BindingFlags.NonPublic); Assert.NotNull(type); ControlAccessibleObject accessibleObject = (ControlAccessibleObject)Activator.CreateInstance(type, textBox, toolStripTextBox); Assert.Equal(textBox, accessibleObject.Owner); }
public void GridViewListBoxAccessibleObject_Ctor_Default() { using PropertyGrid propertyGrid = new PropertyGrid(); PropertyGridView propertyGridView = propertyGrid.TestAccessor().GridView; using GridViewListBox gridViewListBox = new GridViewListBox(propertyGridView); Type type = gridViewListBox.AccessibilityObject.GetType(); ControlAccessibleObject accessibleObject = (ControlAccessibleObject)Activator.CreateInstance(type, gridViewListBox); Assert.Equal(gridViewListBox, accessibleObject.Owner); Assert.False(propertyGrid.IsHandleCreated); Assert.False(gridViewListBox.IsHandleCreated); }
public void GridViewTextBoxAccessibleObject_ctor_default() { using PropertyGrid propertyGrid = new PropertyGrid(); PropertyGridView gridView = propertyGrid.TestAccessor().GridView; Type gridViewTextBoxType = typeof(PropertyGridView).GetNestedType("GridViewTextBox", BindingFlags.NonPublic); Assert.NotNull(gridViewTextBoxType); TextBox gridViewTextBox = (TextBox)Activator.CreateInstance(gridViewTextBoxType, gridView); Type accessibleObjectType = gridViewTextBoxType.GetNestedType("GridViewTextBoxAccessibleObject", BindingFlags.NonPublic); Assert.NotNull(accessibleObjectType); ControlAccessibleObject accessibleObject = (ControlAccessibleObject)Activator.CreateInstance(accessibleObjectType, gridViewTextBox); Assert.Equal(gridViewTextBox, accessibleObject.Owner); }
public void PropertyGridViewAccessibleObject_Entry_IsOffscreen_ReturnsCorrectValue() { using PropertyGrid propertyGrid = new PropertyGrid(); propertyGrid.Size = new Size(300, 500); propertyGrid.Location = new Point(0, 0); propertyGrid.CreateControl(); using ComboBox comboBox = new ComboBox(); propertyGrid.SelectedObject = comboBox; ControlAccessibleObject accessibleObject = (ControlAccessibleObject)propertyGrid.GridViewAccessibleObject; PropertyGridView propertyGridView = (PropertyGridView)accessibleObject.Owner; Rectangle gridViewRectangle = accessibleObject.Bounds; int ROWLABEL = 1; int ROWVALUE = 2; foreach (GridEntry category in propertyGrid.GetPropEntries()) { AccessibleObject categoryAccessibilityObject = category.AccessibilityObject; int row = propertyGridView.GetRowFromGridEntry(category); Rectangle rect = propertyGridView.GetRectangle(row, ROWVALUE | ROWLABEL); rect = propertyGridView.RectangleToScreen(rect); bool visible = rect.Height > 0 && ((rect.Y > gridViewRectangle.Y + 1 && rect.Y < gridViewRectangle.Bottom - 1) || (rect.Y <gridViewRectangle.Bottom - 1 && rect.Bottom> gridViewRectangle.Y + 1)); // +-1 are borders Assert.Equal(!visible, (bool)categoryAccessibilityObject.GetPropertyValue(UiaCore.UIA.IsOffscreenPropertyId)); foreach (GridEntry entry in category.Children) { AccessibleObject entryAccessibilityObject = entry.AccessibilityObject; row = propertyGridView.GetRowFromGridEntry(entry); rect = propertyGridView.GetRectangle(row, ROWVALUE | ROWLABEL); rect = propertyGridView.RectangleToScreen(rect); visible = rect.Height > 0 && ((rect.Y > gridViewRectangle.Y + 1 && rect.Y < gridViewRectangle.Bottom - 1) || (rect.Y <gridViewRectangle.Bottom - 1 && rect.Bottom> gridViewRectangle.Y + 1)); // +-1 are borders Assert.Equal(!visible, (bool)entryAccessibilityObject.GetPropertyValue(UiaCore.UIA.IsOffscreenPropertyId)); } } }