Exemple #1
0
        protected override void OnNotify(WaiterEventArgs e)
        {
            string newValue = string.Empty;

            switch (this.scrollProperty)
            {
            case ScrollProperty.HorizontallyScrollable:
                newValue = (this.root as IScroll).HorizontallyScrollable.ToString();
                break;

            case ScrollProperty.HorizontalScrollPercent:
                newValue = (this.root as IScroll).HorizontalScrollPercent.ToString();
                break;

            case ScrollProperty.HorizontalViewSize:
                newValue = (this.root as IScroll).HorizontalViewSize.ToString();
                break;

            case ScrollProperty.VerticallyScrollable:
                newValue = (this.root as IScroll).VerticallyScrollable.ToString();
                break;

            case ScrollProperty.VerticalScrollPercent:
                newValue = (this.root as IScroll).VerticalScrollPercent.ToString();
                break;

            case ScrollProperty.VerticalViewSize:
                newValue = (this.root as IScroll).VerticalViewSize.ToString();
                break;
            }
            Log.Comment("ScrollChangedEventWaiter - OnNotify {0}={1}", this.scrollProperty.ToString(), newValue);
            base.OnNotify(e);
        }
Exemple #2
0
 internal void OnWaiterFired(object sender, WaiterEventArgs args)
 {
     // Waiter was fired, resume the bookmark
     _instance.BeginResumeBookmark(
         _bookmark,
         args.Message,
         (asr) => _instance.EndResumeBookmark(asr),
         null);
 }
Exemple #3
0
        // When the test app crashes because of a catchable exception,
        // it posts the exception's contents to a TextBox immediately before closing,
        // which enables us to find out what the exception was.
        // We normally can't since the application exists in a different process,
        // so we don't catch any exceptions that it encounters, but this works around that.
        public void SinkEvent(WaiterEventArgs eventArgs)
        {
            AutomationPropertyChangedEventArgs args = eventArgs.EventArgs as AutomationPropertyChangedEventArgs;
            string exceptionMessage = args.NewValue as string;

            // For some reason, the exception message uses \r as the only newline character, which console windows don't like.
            // We need to make sure that it uses the correct newline character everywhere.
            exceptionMessage = exceptionMessage.Replace("\n\r", "\n").Replace("\r", "\n").Replace("\n", Environment.NewLine);

            Log.Error("Test app has crashed! This will likely be the root cause of any ElementNotAvailableExceptions for this test.");
            Log.Error("Exception from app: " + exceptionMessage);
        }
 static bool ExpandFilter(WaiterEventArgs args)
 {
     return(ExpandCollapseStateFilter(args: (AutomationPropertyChangedEventArgs)args.EventArgs, state: ExpandCollapseState.Expanded));
 }