private void TestForm_Load(object sender, EventArgs e)
        {
            propertyGrid.SelectedObject = domainUpDown;

            GridEntryCollection entries          = propertyGrid.GetPropEntries();
            PropertyGridView    propertyGridView = (PropertyGridView)propertyGrid.ActiveControl;

            foreach (GridEntry entry in entries)
            {
                int entryHeight = propertyGridView.AccessibilityGetGridEntryBounds(entry).Height;
                AccRowHeightSum += entryHeight;
                if (entryHeight > 0)
                {
                    entriesBorders++;
                }

                foreach (GridEntry item in entry.GridItems)
                {
                    int itemHeight = propertyGridView.AccessibilityGetGridEntryBounds(item).Height;
                    AccRowHeightSum += itemHeight;
                    if (itemHeight > 0)
                    {
                        entriesBorders++;
                    }
                }
            }
            AccPropertyGridViewHeight = propertyGridView.AccessibilityObject.Bounds.Height;

            Application.Exit();
        }
Ejemplo n.º 2
0
        public async Task PropertyGridViewRowsAccessibleObject_Ctor_DefaultAsync()
        {
            await RunControlPairTestAsync <DomainUpDown, PropertyGrid>((form, controls) =>
            {
                (DomainUpDown domainUpDown, PropertyGrid propertyGrid) = controls;
                propertyGrid.Size                 = new Size(223, 244);
                form.ClientSize                   = new Size(508, 367);
                propertyGrid.SelectedObject       = domainUpDown;
                GridEntryCollection entries       = propertyGrid.GetCurrentEntries();
                PropertyGridView propertyGridView = (PropertyGridView)propertyGrid.Controls[2];

                int borderHeight   = 2;
                int heightSum      = 0;
                int entriesBorders = 0;

                foreach (GridEntry entry in entries)
                {
                    int entryHeight = propertyGridView.AccessibilityGetGridEntryBounds(entry).Height;
                    heightSum      += entryHeight;
                    if (entryHeight > 0)
                    {
                        entriesBorders++;
                    }

                    foreach (GridEntry item in entry.GridItems)
                    {
                        int itemHeight = propertyGridView.AccessibilityGetGridEntryBounds(item).Height;
                        heightSum     += itemHeight;
                        if (itemHeight > 0)
                        {
                            entriesBorders++;
                        }
                    }
                }

                Assert.Equal(heightSum, propertyGridView.AccessibilityObject.Bounds.Height - borderHeight - entriesBorders);

                return(Task.CompletedTask);
            });
        }
        public ScenarioResult PropertyGridViewRowsAccessibleObject_Ctor_Default(TParams p)
        {
            _propertyGrid.SelectedObject = _domainUpDown;
            int heightSum      = 0;
            int entriesBorders = 0;

            GridEntryCollection entries          = _propertyGrid.GetPropEntries();
            PropertyGridView    propertyGridView = (PropertyGridView)_propertyGrid.ActiveControl;

            foreach (GridEntry entry in entries)
            {
                int entryHeight = propertyGridView.AccessibilityGetGridEntryBounds(entry).Height;
                heightSum += entryHeight;
                if (entryHeight > 0)
                {
                    entriesBorders++;
                }

                foreach (GridEntry item in entry.GridItems)
                {
                    int itemHeight = propertyGridView.AccessibilityGetGridEntryBounds(item).Height;
                    heightSum += itemHeight;
                    if (itemHeight > 0)
                    {
                        entriesBorders++;
                    }
                }
            }

            if (heightSum != propertyGridView.AccessibilityObject.Bounds.Height - topBorder - bottomBorder - entriesBorders)
            {
                return(new ScenarioResult(false, "Incorrect dimensions"));
            }

            return(new ScenarioResult(true));
        }