internal override UiaCore.IRawElementProviderFragment ElementProviderFromPoint(double x, double y)
            {
                int innerX = (int)x;
                int innerY = (int)y;

                MCHITTESTINFO hitTestInfo = GetHitTestInfo(innerX, innerY);

                switch ((MCHT)hitTestInfo.uHit)
                {
                case MCHT.TITLEBTNPREV:
                    return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.PreviousButton));

                case MCHT.TITLEBTNNEXT:
                    return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.NextButton));

                case MCHT.TITLE:
                case MCHT.TITLEMONTH:
                case MCHT.TITLEYEAR:
                    return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.CalendarHeader));

                case MCHT.CALENDARDAY:
                case MCHT.CALENDARWEEKNUM:
                case MCHT.CALENDARDATE:
                    // Get calendar body's child.
                    CalendarBodyAccessibleObject calendarBodyAccessibleObject = (CalendarBodyAccessibleObject)GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.CalendarBody);
                    return(calendarBodyAccessibleObject.GetFromPoint(hitTestInfo));

                case MCHT.TODAYLINK:
                    return(GetCalendarChildAccessibleObject(_calendarIndex, CalendarChildType.TodayLink));
                }

                return(base.ElementProviderFromPoint(x, y));
            }
Пример #2
0
        public ScenarioResult CalendarBodyAccessibleObject_GetFromPoint_ReturnsNull_IfMCHITTESTINFOIsIncorrect(TParams p)
        {
            using var wrapper = new MonthCalendarWrapper(this);
            Application.DoEvents();
            MonthCalendarAccessibleObject accessibleObject     = (MonthCalendarAccessibleObject)wrapper.Calendar.AccessibilityObject;
            CalendarBodyAccessibleObject  bodyAccessibleObject = new CalendarBodyAccessibleObject(accessibleObject, 0);
            MCHITTESTINFO info = new MCHITTESTINFO
            {
                uHit = MCHT.CALENDARDAY,
                iRow = -10
            };

            Application.DoEvents();
            CalendarChildAccessibleObject cell = bodyAccessibleObject.GetFromPoint(info);

            return(new ScenarioResult(cell is null));
        }