예제 #1
0
        public void ExpandCollapseProvider_Methods()
        {
            bool             concreteLoaded        = false;
            bool             concreteLayoutUpdated = false;
            ComboBoxConcrete concrete = CreateConcreteFrameworkElement() as ComboBoxConcrete;

            concrete.Loaded        += (o, e) => concreteLoaded = true;
            concrete.LayoutUpdated += (o, e) => concreteLayoutUpdated = true;
            concrete.Items.Add(new ComboBoxItem()
            {
                Content = "1"
            });
            concrete.Items.Add(new ComboBoxItem()
            {
                Content = "2"
            });
            concrete.Width = 300;
            TestPanel.Children.Add(concrete);

            EnqueueConditional(() => concreteLoaded, "ConcreteLoaded #0");
            Enqueue(() => concrete.ApplyTemplate());
            Enqueue(() => {
                IExpandCollapseProvider expandCollapse = GetExpandCollapseProvider(concrete);
                Assert.AreEqual(ExpandCollapseState.Collapsed,
                                expandCollapse.ExpandCollapseState, "ExpandCollapseState #0");
                concreteLayoutUpdated = false;
                expandCollapse.Expand();
            });
            EnqueueConditional(() => concreteLayoutUpdated, "ConcreteLayoutUpdated #0");
            Enqueue(() => {
                // Test event
                IExpandCollapseProvider expandCollapse = GetExpandCollapseProvider(concrete);
                Assert.AreEqual(ExpandCollapseState.Expanded,
                                expandCollapse.ExpandCollapseState, "ExpandCollapseState #1");
                concreteLayoutUpdated = false;
                expandCollapse.Collapse();
            });
            EnqueueConditional(() => concreteLayoutUpdated, "ConcreteLayoutUpdated #1");
            Enqueue(() => {
                // Test event
                IExpandCollapseProvider expandCollapse = GetExpandCollapseProvider(concrete);
                Assert.AreEqual(ExpandCollapseState.Collapsed,
                                expandCollapse.ExpandCollapseState, "ExpandCollapseState #2");
                concreteLayoutUpdated = false;
            });
            EnqueueTestComplete();
        }
예제 #2
0
        protected override void ContentTest_Template(Selector selectorConcrete)
        {
            Assert.IsTrue(IsContentPropertyElement(), "ComboBox ContentElement.");

            bool concreteLoaded = false;
            bool expanded       = false;

            ComboBoxConcrete concrete = (ComboBoxConcrete)selectorConcrete;

            concrete.Width           = 300;
            concrete.Loaded         += (o, e) => concreteLoaded = true;
            concrete.DropDownOpened += (o, e) => expanded = true;
            TestPanel.Children.Add(concrete);

            concrete.Items.Add("Item 0");
            concrete.Items.Add("Item 1");

            EnqueueConditional(() => concreteLoaded, "ConcreteLoaded #0");
            Enqueue(() => concrete.ApplyTemplate());
            Enqueue(() => {
                AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(concrete);
                Assert.IsNotNull(peer, "FrameworkElementAutomationPeer.CreatePeerForElement");
                Assert.AreEqual(concrete.Template == null,
                                peer.GetChildren() != null,
                                "GetChildren #0");
            });
            Enqueue(() => concrete.IsDropDownOpen = true);
            EnqueueConditional(() => expanded, "Expanded #0");
            Enqueue(() => concrete.IsDropDownOpen = false);
            Enqueue(() => {
                AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(concrete);
                Assert.IsNotNull(peer.GetChildren(), "GetChildren #1");
                Assert.AreEqual(2, peer.GetChildren().Count, "GetChildren.Count #1");
            });
            Enqueue(() => concrete.Items.Add(new TextBlock()
            {
                Text = "Item 2"
            }));
            Enqueue(() => {
                AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(concrete);
                Assert.IsNotNull(peer.GetChildren(), "GetChildren #2");
                Assert.AreEqual(3, peer.GetChildren().Count, "GetChildren.Count #2");
            });
            EnqueueTestComplete();
        }
예제 #3
0
        public void ValueProvider_Methods()
        {
            bool             concreteLoaded = false;
            ComboBoxConcrete concrete       = CreateConcreteFrameworkElement() as ComboBoxConcrete;

            concrete.Loaded += (o, e) => concreteLoaded = true;
            concrete.Items.Add(new ComboBoxItem()
            {
                Content = "1"
            });
            concrete.Items.Add(new ComboBoxItem()
            {
                Content = "2"
            });
            concrete.Width = 300;
            TestPanel.Children.Add(concrete);

            EnqueueConditional(() => concreteLoaded, "ConcreteLoaded #0");
            Enqueue(() => concrete.ApplyTemplate());
            Enqueue(() => {
                AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(concrete);
                Assert.IsNotNull(peer, "CreatePeerForElement #0");

                IValueProvider value
                    = peer.GetPattern(PatternInterface.Value) as IValueProvider;
                // Yes is returning null!
                Assert.IsNull(value, "ValueProvider #0");

                // We are going to try again using explicit cast
                value = peer as IValueProvider;
                Assert.IsNotNull(value, "ValueProvider #1");

                // We can't change the value anyway
                Assert.IsTrue(value.IsReadOnly, "IsReadOnly #0");
                Assert.Throws <InvalidOperationException> (delegate {
                    value.SetValue("1");
                }, "SetValue #0");
            });
            EnqueueTestComplete();
        }
예제 #4
0
			public ComboBoxAutomationPeerConcrete (ComboBoxConcrete owner)
				: base (owner)
			{
			}
예제 #5
0
 public ComboBoxAutomationPeerConcrete(ComboBoxConcrete owner)
     : base(owner)
 {
 }