2 // Unit tests for ComboBoxAutomationPeer
5 // Moonlight List (moonlight-list@lists.ximian.com)
7 // Copyright (C) 2009 olivier dufour olivier(dot)duff(at)gmail(dot)com
8 // Copyright (c) 2009 Novell, Inc. (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System
.Windows
.Controls
;
33 using System
.Windows
.Automation
;
34 using System
.Collections
.Generic
;
35 using System
.Windows
.Automation
.Peers
;
36 using System
.Windows
.Automation
.Provider
;
37 using System
.Windows
.Controls
.Primitives
;
39 using Mono
.Moonlight
.UnitTesting
;
40 using Microsoft
.Silverlight
.Testing
;
41 using Microsoft
.VisualStudio
.TestTools
.UnitTesting
;
43 namespace MoonTest
.System
.Windows
.Automation
.Peers
{
46 public class ComboBoxAutomationPeerTest
: SelectorAutomationPeerTest
{
48 public class ComboBoxAutomationPeerConcrete
49 : ComboBoxAutomationPeer
, FrameworkElementAutomationPeerContract
{
51 public ComboBoxAutomationPeerConcrete (ComboBoxConcrete owner
)
56 #region Overriden methods
58 public string GetNameCore_ ()
60 return base.GetNameCore ();
63 public object GetPattern_ (PatternInterface iface
)
65 return base.GetPattern (iface
);
70 #region Wrapper methods
72 public AutomationControlType
GetAutomationControlTypeCore_ ()
74 return base.GetAutomationControlTypeCore ();
77 public string GetClassNameCore_ ()
79 return base.GetClassNameCore ();
82 public bool IsControlElementCore_ ()
84 return base.IsControlElementCore ();
87 public AutomationPeer
GetLabeledByCore_ ()
89 return base.GetLabeledByCore ();
92 public bool IsContentElementCore_ ()
94 return base.IsContentElementCore ();
97 public string GetAcceleratorKeyCore_ ()
99 return base.GetAcceleratorKeyCore ();
102 public string GetAccessKeyCore_ ()
104 return base.GetAccessKeyCore ();
107 public string GetAutomationIdCore_ ()
109 return base.GetAutomationIdCore ();
112 public Rect
GetBoundingRectangleCore_ ()
114 return base.GetBoundingRectangleCore ();
117 public List
<AutomationPeer
> GetChildrenCore_ ()
119 return base.GetChildrenCore ();
122 public Point
GetClickablePointCore_ ()
124 return base.GetClickablePointCore ();
127 public string GetHelpTextCore_ ()
129 return base.GetHelpTextCore ();
132 public string GetItemStatusCore_ ()
134 return base.GetItemStatusCore ();
137 public string GetItemTypeCore_ ()
139 return base.GetItemTypeCore ();
142 public string GetLocalizedControlTypeCore_ ()
144 return base.GetLocalizedControlTypeCore ();
147 public AutomationOrientation
GetOrientationCore_ ()
149 return base.GetOrientationCore ();
152 public bool HasKeyboardFocusCore_ ()
154 return base.HasKeyboardFocusCore ();
157 public bool IsEnabledCore_ ()
159 return base.IsEnabledCore ();
162 public bool IsKeyboardFocusableCore_ ()
164 return base.IsKeyboardFocusableCore ();
167 public bool IsOffscreenCore_ ()
169 return base.IsOffscreenCore ();
172 public bool IsPasswordCore_ ()
174 return base.IsPasswordCore ();
177 public bool IsRequiredForFormCore_ ()
179 return base.IsRequiredForFormCore ();
185 public class ComboBoxConcrete
: ComboBox
{
186 public ComboBoxConcrete () : base ()
190 protected override AutomationPeer
OnCreateAutomationPeer ()
192 return new ComboBoxAutomationPeerConcrete (this);
197 public override void GetPattern ()
199 ComboBoxAutomationPeerConcrete feap
200 = (ComboBoxAutomationPeerConcrete
)CreateConcreteFrameworkElementAutomationPeer (CreateConcreteFrameworkElement ());
202 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Dock
), "Dock");
203 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Grid
), "Grid");
204 Assert
.IsNull (feap
.GetPattern (PatternInterface
.GridItem
), "GridItem");
205 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Invoke
), "Invoke");
206 Assert
.IsNull (feap
.GetPattern (PatternInterface
.MultipleView
), "MultipleView");
207 Assert
.IsNull (feap
.GetPattern (PatternInterface
.RangeValue
), "RangeValue");
208 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Scroll
), "Scroll");
209 Assert
.IsNull (feap
.GetPattern (PatternInterface
.ScrollItem
), "ScrollItem");
210 Assert
.IsNull (feap
.GetPattern (PatternInterface
.SelectionItem
), "SelectionItem");
211 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Table
), "Table");
212 Assert
.IsNull (feap
.GetPattern (PatternInterface
.TableItem
), "TableItem");
213 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Toggle
), "Toggle");
214 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Transform
), "Transform");
215 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Window
), "Window");
217 Assert
.IsNotNull (feap
.GetPattern (PatternInterface
.ExpandCollapse
), "ExpandCollapse");
218 Assert
.IsNotNull (feap
.GetPattern (PatternInterface
.Selection
), "Selection");
220 // LAMESPEC: Value should be returned because ComboBoxAutomationPeer realizes the interface
221 Assert
.IsNull (feap
.GetPattern (PatternInterface
.Value
), "Value");
225 public override void GetClassName ()
227 FrameworkElementAutomationPeerContract feap
228 = CreateConcreteFrameworkElementAutomationPeer (CreateConcreteFrameworkElement ());
229 Assert
.AreEqual ("ComboBox", feap
.GetClassName (), "GetClassNameCore");
230 Assert
.AreEqual ("ComboBox", feap
.GetClassNameCore_ (), "GetClassNameCoreCore");
234 public override void GetAutomationControlType ()
236 FrameworkElementAutomationPeerContract feap
237 = CreateConcreteFrameworkElementAutomationPeer (CreateConcreteFrameworkElement ());
238 Assert
.AreEqual (AutomationControlType
.ComboBox
, feap
.GetAutomationControlType (), "GetAutomationControlType");
239 Assert
.AreEqual (AutomationControlType
.ComboBox
, feap
.GetAutomationControlTypeCore_ (), "GetAutomationControlTypeCore");
244 public override void ContentTest_NoTemplate ()
246 ContentTest_Template (new ComboBoxConcrete () { Template = null }
);
251 public override void ContentTest ()
253 ContentTest_Template (new ComboBoxConcrete ());
256 protected override void ContentTest_Template (Selector selectorConcrete
)
258 Assert
.IsTrue (IsContentPropertyElement (), "ComboBox ContentElement.");
260 bool concreteLoaded
= false;
261 bool expanded
= false;
263 ComboBoxConcrete concrete
= (ComboBoxConcrete
) selectorConcrete
;
264 concrete
.Width
= 300;
265 concrete
.Loaded
+= (o
, e
) => concreteLoaded
= true;
266 concrete
.DropDownOpened
+= (o
, e
) => expanded
= true;
267 TestPanel
.Children
.Add (concrete
);
269 concrete
.Items
.Add ("Item 0");
270 concrete
.Items
.Add ("Item 1");
272 EnqueueConditional (() => concreteLoaded
, "ConcreteLoaded #0");
273 Enqueue (() => concrete
.ApplyTemplate ());
275 AutomationPeer peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (concrete
);
276 Assert
.IsNotNull (peer
, "FrameworkElementAutomationPeer.CreatePeerForElement");
277 Assert
.AreEqual (concrete
.Template
== null,
278 peer
.GetChildren () != null,
281 Enqueue (() => concrete
.IsDropDownOpen
= true);
282 EnqueueConditional (() => expanded
, "Expanded #0");
283 Enqueue (() => concrete
.IsDropDownOpen
= false);
285 AutomationPeer peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (concrete
);
286 Assert
.IsNotNull (peer
.GetChildren (), "GetChildren #1");
287 Assert
.AreEqual (2, peer
.GetChildren ().Count
, "GetChildren.Count #1");
289 Enqueue (() => concrete
.Items
.Add (new TextBlock () { Text = "Item 2" }
));
291 AutomationPeer peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (concrete
);
292 Assert
.IsNotNull (peer
.GetChildren (), "GetChildren #2");
293 Assert
.AreEqual (3, peer
.GetChildren ().Count
, "GetChildren.Count #2");
295 EnqueueTestComplete ();
298 #region IExpandCollapseProvider Tests
302 public void ExpandCollapseProvider_Methods ()
304 bool concreteLoaded
= false;
305 bool concreteLayoutUpdated
= false;
306 ComboBoxConcrete concrete
= CreateConcreteFrameworkElement () as ComboBoxConcrete
;
307 concrete
.Loaded
+= (o
, e
) => concreteLoaded
= true;
308 concrete
.LayoutUpdated
+= (o
, e
) => concreteLayoutUpdated
= true;
309 concrete
.Items
.Add (new ComboBoxItem () { Content = "1" }
);
310 concrete
.Items
.Add (new ComboBoxItem () { Content = "2" }
);
311 concrete
.Width
= 300;
312 TestPanel
.Children
.Add (concrete
);
314 EnqueueConditional (() => concreteLoaded
, "ConcreteLoaded #0");
315 Enqueue (() => concrete
.ApplyTemplate ());
317 IExpandCollapseProvider expandCollapse
= GetExpandCollapseProvider (concrete
);
318 Assert
.AreEqual (ExpandCollapseState
.Collapsed
,
319 expandCollapse
.ExpandCollapseState
, "ExpandCollapseState #0");
320 concreteLayoutUpdated
= false;
321 expandCollapse
.Expand ();
323 EnqueueConditional (() => concreteLayoutUpdated
, "ConcreteLayoutUpdated #0");
326 IExpandCollapseProvider expandCollapse
= GetExpandCollapseProvider (concrete
);
327 Assert
.AreEqual (ExpandCollapseState
.Expanded
,
328 expandCollapse
.ExpandCollapseState
, "ExpandCollapseState #1");
329 concreteLayoutUpdated
= false;
330 expandCollapse
.Collapse ();
332 EnqueueConditional (() => concreteLayoutUpdated
, "ConcreteLayoutUpdated #1");
335 IExpandCollapseProvider expandCollapse
= GetExpandCollapseProvider (concrete
);
336 Assert
.AreEqual (ExpandCollapseState
.Collapsed
,
337 expandCollapse
.ExpandCollapseState
, "ExpandCollapseState #2");
338 concreteLayoutUpdated
= false;
340 EnqueueTestComplete ();
343 private IExpandCollapseProvider
GetExpandCollapseProvider (FrameworkElement element
)
345 AutomationPeer peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (element
);
346 Assert
.IsNotNull (peer
, "CreatePeerForElement #0");
348 IExpandCollapseProvider expandCollapse
349 = peer
.GetPattern (PatternInterface
.ExpandCollapse
) as IExpandCollapseProvider
;
350 Assert
.IsNotNull (expandCollapse
, "ExpandCollapseProvider #0");
351 return expandCollapse
;
356 public void ExpandCollapseProvider_Events ()
358 if (!EventsManager
.Instance
.AutomationSingletonExists
) {
359 EnqueueTestComplete ();
363 bool expanded
= false;
364 bool concreteLoaded
= false;
365 bool collapsed
= false;
366 ComboBox combobox
= CreateConcreteFrameworkElement () as ComboBox
;
367 combobox
.Width
= 300;
368 combobox
.Height
= 400;
369 combobox
.Loaded
+= (o
, e
) => concreteLoaded
= true;
370 combobox
.DropDownOpened
+= (o
, e
) => expanded
= true;
371 combobox
.DropDownClosed
+= (o
, e
) => collapsed
= true;
373 combobox
.Items
.Add (new TextBlock () { Text = "Item0" }
);
374 combobox
.Items
.Add (new TextBlock () { Text = "Item1" }
);
376 AutomationPeer peer
= null;
377 AutomationPropertyEventTuple propertyTuple
= null;
379 EventsManager
.Instance
.Reset ();
380 TestPanel
.Children
.Add (combobox
);
382 EnqueueConditional (() => concreteLoaded
, "ConcreteLoaded #0");
383 Enqueue (() => combobox
.ApplyTemplate ());
385 peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (combobox
);
386 propertyTuple
= EventsManager
.Instance
.GetAutomationEventFrom (peer
, ExpandCollapsePatternIdentifiers
.ExpandCollapseStateProperty
);
387 Assert
.IsNull (propertyTuple
, "GetAutomationPropertyEventFrom #0");
390 EventsManager
.Instance
.Reset ();
391 combobox
.IsDropDownOpen
= true;
393 EnqueueConditional (() => expanded
, "Expanded #0");
395 propertyTuple
= EventsManager
.Instance
.GetAutomationEventFrom (peer
, ExpandCollapsePatternIdentifiers
.ExpandCollapseStateProperty
);
396 Assert
.IsNotNull (propertyTuple
, "GetAutomationPropertyEventFrom #1");
397 Assert
.AreEqual ((ExpandCollapseState
) propertyTuple
.OldValue
,
398 ExpandCollapseState
.Collapsed
,
399 "GetPropertyAutomationEventFrom.OldValue #0");
400 Assert
.AreEqual ((ExpandCollapseState
) propertyTuple
.NewValue
,
401 ExpandCollapseState
.Expanded
,
402 "GetPropertyAutomationEventFrom.NewValue #0");
405 EventsManager
.Instance
.Reset ();
406 combobox
.IsDropDownOpen
= false;
408 EnqueueConditional (() => collapsed
, "Collapsed #0");
410 propertyTuple
= EventsManager
.Instance
.GetAutomationEventFrom (peer
, ExpandCollapsePatternIdentifiers
.ExpandCollapseStateProperty
);
411 Assert
.IsNotNull (propertyTuple
, "GetAutomationPropertyEventFrom #2");
412 Assert
.AreEqual ((ExpandCollapseState
) propertyTuple
.OldValue
,
413 ExpandCollapseState
.Expanded
,
414 "GetPropertyAutomationEventFrom.OldValue #1");
415 Assert
.AreEqual ((ExpandCollapseState
) propertyTuple
.NewValue
,
416 ExpandCollapseState
.Collapsed
,
417 "GetPropertyAutomationEventFrom.NewValue #1");
419 EnqueueTestComplete ();
424 #region IValueProvider Tests
428 public void ValueProvider_Methods ()
430 bool concreteLoaded
= false;
431 ComboBoxConcrete concrete
= CreateConcreteFrameworkElement () as ComboBoxConcrete
;
432 concrete
.Loaded
+= (o
, e
) => concreteLoaded
= true;
433 concrete
.Items
.Add (new ComboBoxItem () { Content = "1" }
);
434 concrete
.Items
.Add (new ComboBoxItem () { Content = "2" }
);
435 concrete
.Width
= 300;
436 TestPanel
.Children
.Add (concrete
);
438 EnqueueConditional (() => concreteLoaded
, "ConcreteLoaded #0");
439 Enqueue (() => concrete
.ApplyTemplate ());
441 AutomationPeer peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (concrete
);
442 Assert
.IsNotNull (peer
, "CreatePeerForElement #0");
445 = peer
.GetPattern (PatternInterface
.Value
) as IValueProvider
;
446 // Yes is returning null!
447 Assert
.IsNull (value, "ValueProvider #0");
449 // We are going to try again using explicit cast
450 value = peer
as IValueProvider
;
451 Assert
.IsNotNull (value, "ValueProvider #1");
453 // We can't change the value anyway
454 Assert
.IsTrue (value.IsReadOnly
, "IsReadOnly #0");
455 Assert
.Throws
<InvalidOperationException
> (delegate {
456 value.SetValue ("1");
459 EnqueueTestComplete ();
464 #region ISelectionProvider Tests
468 [SilverlightBug("A11y implementation doesn't work")]
469 public override void ISelectionProvider_Methods ()
471 bool concreteLoaded
= false;
472 bool expanded
= false;
473 ComboBox combobox
= CreateConcreteFrameworkElement () as ComboBox
;
474 combobox
.Width
= 300;
475 combobox
.Loaded
+= (o
, e
) => concreteLoaded
= true;
476 combobox
.DropDownOpened
+= (o
, e
) => expanded
= true;
478 combobox
.Items
.Add ("Item0");
479 combobox
.Items
.Add ("Item1");
481 TestPanel
.Children
.Add (combobox
);
483 AutomationPeer peer
= null;
484 ISelectionProvider selectionProvider
= null;
485 IRawElementProviderSimple
[] selection
= null;
487 EnqueueConditional (() => concreteLoaded
, "ConcreteLoaded #0");
488 Enqueue (() => combobox
.ApplyTemplate ());
489 Enqueue (() => combobox
.IsDropDownOpen
= true);
490 EnqueueConditional (() => expanded
, "Expanded #0");
491 Enqueue (() => combobox
.IsDropDownOpen
= false);
493 peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (combobox
);
495 selectionProvider
= peer
.GetPattern (PatternInterface
.Selection
) as ISelectionProvider
;
496 Assert
.IsNotNull (selectionProvider
, "Selection Provider");
498 Assert
.IsFalse (selectionProvider
.CanSelectMultiple
, "CanSelectMultiple #0");
499 Assert
.IsFalse (selectionProvider
.IsSelectionRequired
, "IsSelectionRequired #0");
501 selection
= selectionProvider
.GetSelection ();
502 Assert
.IsNull (selection
, "GetSelection #0");
504 Enqueue (() => combobox
.SelectedIndex
= 1);
506 selection
= selectionProvider
.GetSelection ();
507 Assert
.IsNotNull (selection
, "GetSelection #1");
508 Assert
.AreEqual ("Item1",
509 new PeerFromProvider ().GetPeerFromProvider (selection
[0]).GetName (),
512 selectionProvider
= peer
.GetPattern (PatternInterface
.Selection
) as ISelectionProvider
;
513 Assert
.AreEqual (1, selection
.Length
, "GetSelection #2");
516 combobox
.Items
.Add ("Item2");
517 combobox
.SelectedIndex
= 0;
520 selection
= selectionProvider
.GetSelection ();
521 Assert
.IsNotNull (selection
, "GetSelection #3");
522 Assert
.AreEqual (1, selection
.Length
, "GetSelection #4");
523 Assert
.AreEqual ("Item0",
524 new PeerFromProvider ().GetPeerFromProvider (selection
[0]).GetName (),
527 Enqueue (() => combobox
.SelectedIndex
= 1 );
529 selection
= selectionProvider
.GetSelection ();
530 Assert
.IsNotNull (selection
, "GetSelection #5");
531 Assert
.AreEqual (1, selection
.Length
, "GetSelection #6");
532 Assert
.AreEqual ("Item1",
533 new PeerFromProvider ().GetPeerFromProvider (selection
[0]).GetName (),
536 Enqueue (() => combobox
.SelectedIndex
= 2 );
538 selection
= selectionProvider
.GetSelection ();
539 Assert
.IsNotNull (selection
, "GetSelection #7");
540 Assert
.AreEqual (1, selection
.Length
, "GetSelection #8");
541 Assert
.AreEqual ("Item2",
542 new PeerFromProvider ().GetPeerFromProvider (selection
[0]).GetName (),
545 EnqueueTestComplete ();
550 public override void ISelectionProvider_Events ()
552 if (!EventsManager
.Instance
.AutomationSingletonExists
) {
553 EnqueueTestComplete ();
557 bool expanded
= false;
558 bool concreteLoaded
= false;
559 ComboBox combobox
= CreateConcreteFrameworkElement () as ComboBox
;
560 combobox
.Width
= 300;
561 combobox
.Height
= 400;
562 combobox
.Loaded
+= (o
, e
) => concreteLoaded
= true;
563 combobox
.DropDownOpened
+= (o
, e
) => expanded
= true;
565 combobox
.Items
.Add (new TextBlock () { Text = "Item0" }
);
566 combobox
.Items
.Add (new TextBlock () { Text = "Item1" }
);
568 AutomationPeer peer
= null;
569 AutomationPeer childPeer
= null;
570 IRawElementProviderSimple
[] selection
= null;
571 AutomationPropertyEventTuple propertyTuple
= null;
572 ISelectionProvider selectionProvider
= null;
574 TestPanel
.Children
.Add (combobox
);
576 EnqueueConditional (() => concreteLoaded
, "ConcreteLoaded #0");
577 Enqueue (() => combobox
.ApplyTemplate ());
578 Enqueue (() => combobox
.IsDropDownOpen
= true);
579 EnqueueConditional (() => expanded
, "Expanded #0");
580 Enqueue (() => combobox
.IsDropDownOpen
= false);
582 peer
= FrameworkElementAutomationPeer
.CreatePeerForElement (combobox
);
584 selectionProvider
= peer
.GetPattern (PatternInterface
.Selection
) as ISelectionProvider
;
585 Assert
.IsNotNull (selectionProvider
, "Selection Provider");
587 Assert
.IsFalse (selectionProvider
.CanSelectMultiple
, "CanSelectMultiple #0");
588 Assert
.IsFalse (selectionProvider
.IsSelectionRequired
, "IsSelectionRequired #0");
590 selection
= selectionProvider
.GetSelection ();
591 Assert
.IsNull (selection
, "GetSelection #0");
594 EventsManager
.Instance
.Reset ();
595 combobox
.SelectedIndex
= 1;
598 selection
= selectionProvider
.GetSelection ();
599 Assert
.IsNotNull (selection
, "GetSelection #1");
600 Assert
.AreEqual (1, selection
.Length
, "GetSelection #2");
602 propertyTuple
= EventsManager
.Instance
.GetAutomationEventFrom (peer
, SelectionPatternIdentifiers
.SelectionProperty
);
603 Assert
.IsNotNull (propertyTuple
, "GetAutomationPropertyEventFrom #0");
604 Assert
.IsNull (propertyTuple
.OldValue
, "GetPropertyAutomationEventFrom.OldValue #0");
605 Assert
.IsNotNull (propertyTuple
.NewValue
, "GetPropertyAutomationEventFrom.NewValue #0");
607 childPeer
= new PeerFromProvider ().GetPeerFromProvider (selection
[0]);
610 EventsManager
.Instance
.Reset ();
611 combobox
.Items
.Add (new TextBlock () { Text = "Item1" }
);
612 combobox
.SelectedIndex
= 0;
615 selection
= selectionProvider
.GetSelection ();
616 Assert
.IsNotNull (selection
, "GetSelection #3");
617 Assert
.AreEqual (1, selection
.Length
, "GetSelection #4");
619 propertyTuple
= EventsManager
.Instance
.GetAutomationEventFrom (peer
, SelectionPatternIdentifiers
.SelectionProperty
);
620 Assert
.IsNotNull (propertyTuple
, "GetAutomationPropertyEventFrom #1");
621 Assert
.IsNotNull (propertyTuple
.OldValue
, "GetPropertyAutomationEventFrom.OldValue #1");
622 Assert
.IsNotNull (propertyTuple
.NewValue
, "GetPropertyAutomationEventFrom.NewValue #1");
624 Assert
.AreNotEqual (selection
[0], childPeer
, "GetSelection #5");
627 EventsManager
.Instance
.Reset ();
628 combobox
.SelectedIndex
= -1;
631 selection
= selectionProvider
.GetSelection ();
632 Assert
.IsNull (selection
, "GetSelection #6");
634 propertyTuple
= EventsManager
.Instance
.GetAutomationEventFrom (peer
, SelectionPatternIdentifiers
.SelectionProperty
);
635 Assert
.IsNotNull (propertyTuple
, "GetAutomationPropertyEventFrom #2");
636 Assert
.IsNotNull (propertyTuple
.OldValue
, "GetPropertyAutomationEventFrom.OldValue #2");
637 Assert
.IsNull (propertyTuple
.NewValue
, "GetPropertyAutomationEventFrom.NewValue #2");
639 EnqueueTestComplete ();
645 protected override FrameworkElement
CreateConcreteFrameworkElement ()
647 return new ComboBoxConcrete ();
650 protected override FrameworkElementAutomationPeerContract
CreateConcreteFrameworkElementAutomationPeer (FrameworkElement element
)
652 return new ComboBoxAutomationPeerConcrete (element
as ComboBoxConcrete
);