Exemplo n.º 1
0
        public virtual void TimeUpDownPeerOnlySupportsValuePattern()
        {
            TimeUpDown item = new TimeUpDown();
            TimeUpDownAutomationPeer peer = null;

            TestAsync(
                item,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as TimeUpDownAutomationPeer,
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "TimeUpDownAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ExpandCollapse), "TimeUpDownAutomationPeer should not support the ExpandCollapse pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "TimeUpDownAutomationPeer should not support the Grid pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "TimeUpDownAutomationPeer should not support the GridItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "TimeUpDownAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "TimeUpDownAutomationPeer should not support the MultipleView pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "TimeUpDownAutomationPeer should not support the RangeValue pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Scroll), "TimeUpDownAutomationPeer should not support the Scroll pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "TimeUpDownAutomationPeer should not support the ScrollItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Selection), "TimeUpDownAutomationPeer should not support the Selection pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "TimeUpDownAutomationPeer should not support the Table pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "TimeUpDownAutomationPeer should not support the TableItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "TimeUpDownAutomationPeer should not support the Toggle pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "TimeUpDownAutomationPeer should not support the Transform pattern!"),
                () => Assert.IsNotNull(peer.GetPattern(PatternInterface.Value), "TimeUpDownAutomationPeer should support the Value pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "TimeUpDownAutomationPeer should not support the Window pattern!"));
        }
Exemplo n.º 2
0
        public virtual void CreateTimeUpDownPeer()
        {
            TimeUpDown tud = new TimeUpDown();
            TimeUpDownAutomationPeer peer = new TimeUpDownAutomationPeer(tud);

            Assert.IsNotNull(peer);
        }
Exemplo n.º 3
0
        public virtual void TimeUpDownCreatesCorrectAutomationPeer()
        {
            TimeUpDown tud = new TimeUpDown();
            TimeUpDownAutomationPeer peer = null;

            TestAsync(
                tud,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(tud) as TimeUpDownAutomationPeer,
                () => Assert.IsNotNull(peer, "TimeUpDown peer should not be null!"),
                () => Assert.AreEqual(tud, peer.Owner, "TimeUpDown should be owner of the peer!"));
        }
Exemplo n.º 4
0
        public virtual void ShouldCorrelateReadOnlyToIsEnabledInAutomationPeer()
        {
            TimeUpDown item = new TimeUpDown();

            item.Value = new DateTime(1900, 1, 1, 3, 45, 12);
            TimeUpDownAutomationPeer peer     = null;
            IValueProvider           provider = null;

            TestAsync(
                item,
                () => peer     = (TimeUpDownAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(item),
                () => provider = (IValueProvider)peer.GetPattern(PatternInterface.Value),
                () => Assert.IsFalse(provider.IsReadOnly),
                () => item.IsEnabled = false,
                () => Assert.IsTrue(provider.IsReadOnly));
        }
Exemplo n.º 5
0
        public virtual void ShouldBeAbleToGetValueThroughAutomationPeer()
        {
            TimeUpDown item = new TimeUpDown();

            item.Culture = new CultureInfo("nl-NL");
            item.Format  = new CustomTimeFormat("HH:mm:ss");
            item.Value   = new DateTime(1900, 1, 1, 3, 45, 12);
            TimeUpDownAutomationPeer peer     = null;
            IValueProvider           provider = null;

            TestAsync(
                item,
                () => peer     = (TimeUpDownAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(item),
                () => provider = (IValueProvider)peer.GetPattern(PatternInterface.Value),
                () => Assert.AreEqual(provider.Value, "03:45:12"));
        }
 public virtual void CreateTimeUpDownPeer()
 {
     TimeUpDown tud = new TimeUpDown();
     TimeUpDownAutomationPeer peer = new TimeUpDownAutomationPeer(tud);
     Assert.IsNotNull(peer);
 }