Exemplo n.º 1
0
 public void OnePlusTwoEnter()
 {
     using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
     {
         Log.Comment("Invoking 1");
         this.ObjectModel.NumPad.OneButton.Invoke();
         waiter.TryWait();
     }
     using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
     {
         Log.Comment("Pressing +");
         this.ObjectModel.SendKeys("{ADD}");
         // PropertyChangeWaiter is unreliable for the first name changed notification
         // Bug 17624996: PropertyChanged event not fired when Name is updated for the first time for a control with custom automation peer.
         waiter.TryWait();
     }
     using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
     {
         Log.Comment("Pressing 2");
         this.ObjectModel.SendKeys("2");
         waiter.TryWait();
     }
     // When pressing enter, both the display and the expression change.
     using (UIEventWaiter expressionWaiter = this.ObjectModel.GetExpressionChangedWaiter())
         using (UIEventWaiter displayWaiter = this.ObjectModel.GetDisplayChangedWaiter())
         {
             Log.Comment("Invoking equals");
             this.ObjectModel.EqualButton.Invoke();
             expressionWaiter.TryWait();
             displayWaiter.TryWait();
         }
 }
 private bool WaitForCheckBoxUpdated(CheckBox checkBox, ToggleState state, double millisecondsTimeout, bool throwOnError)
 {
     using (UIEventWaiter waiter = checkBox.GetToggledWaiter())
     {
         Log.Comment(checkBox.Name + " Checked: " + checkBox.ToggleState);
         if (checkBox.ToggleState == state)
         {
             return(true);
         }
         else
         {
             Log.Comment("Waiting for toggle state to change to {0} for {1}ms", state, millisecondsTimeout);
             waiter.TryWait(TimeSpan.FromMilliseconds(millisecondsTimeout));
         }
         if (checkBox.ToggleState != state)
         {
             Log.Warning(checkBox.Name + " value never changed");
             if (throwOnError)
             {
                 throw new WaiterException();
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
 }
Exemplo n.º 3
0
 public void Clear()
 {
     using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
     {
         Log.Comment("Pressing escape");
         this.ObjectModel.ClearButton.Invoke();
         waiter.TryWait();
     }
 }
 public void PressPlus()
 {
     using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
     {
         Log.Comment("Invoking plus");
         this.ObjectModel.PlusButton.Invoke();
         waiter.TryWait();
     }
 }
 public void Press4()
 {
     using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
     {
         Log.Comment("Invoking 4");
         this.ObjectModel.FourButton.Invoke();
         waiter.TryWait();
     }
 }
 public void Press2()
 {
     using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
     {
         Log.Comment("Invoking 2");
         this.ObjectModel.NumberPad.TwoButton.Invoke();
         waiter.TryWait();
     }
 }
Exemplo n.º 7
0
        public void FiveMemorySet()
        {
            using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter())
            {
                this.ObjectModel.NumberPad.FiveButton.Invoke();
                waiter.TryWait();
            }

            this.ObjectModel.MemoryControls.SetButton.Invoke();
        }
 public void PressSqrt()
 {
     // When invoking sqrt, both the expression changes.
     using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter())
     {
         Log.Comment("Invoking sqrt");
         this.ObjectModel.SqrtButton.Invoke();
         waiter.TryWait();
     }
 }
 public void PressEquals()
 {
     // When invoking equals, both the display and the expression change.
     using (UIEventWaiter expressionWaiter = this.ObjectModel.GetExpressionChangedWaiter())
         using (UIEventWaiter displayWaiter = this.ObjectModel.GetDisplayChangedWaiter())
         {
             Log.Comment("Invoking equals");
             this.ObjectModel.EqualButton.Invoke();
             expressionWaiter.TryWait();
             displayWaiter.TryWait();
         }
 }
Exemplo n.º 10
0
        public static bool ForScrollChanged(Scroller scroller, ScrollProperty scrollProperty)
        {
            Log.Comment("Wait.ForScrollChanged call for {0}.", scrollProperty.ToString());

            using (UIEventWaiter scrollChangedWaiter =
                       (scrollProperty == ScrollProperty.HorizontallyScrollable || scrollProperty == ScrollProperty.VerticallyScrollable) ?
                       scroller.GetScrollChangedWaiter(scrollProperty, null) :
                       scroller.GetScrollChangedWaiter(scrollProperty, double.NaN))
            {
                if (!scrollChangedWaiter.TryWait(TimeSpan.FromSeconds(5)))
                {
                    Log.Comment("Timeout expired.");
                    return(false);
                }
            }

            return(true);
        }