forked from ygoe/MultiSelectTreeView
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBindingTest.cs
More file actions
116 lines (101 loc) · 5.62 KB
/
Copy pathBindingTest.cs
File metadata and controls
116 lines (101 loc) · 5.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MultiSelectTreeView.Test.Model.Helper;
using System.Windows.Automation;
using System.Threading;
namespace MultiSelectTreeView.Test.Model
{
[TestClass]
public class BindingTest
{
[TestMethod]
public void KeyboardLeftRightUpDownArrow()
{
using (TreeApplication app = new TreeApplication("BindingSample"))
{
BindingTrees trees = new BindingTrees(app);
trees.LeftTree.Element1.Select();
Keyboard.Right();
Keyboard.Down();
trees.RightTree.Element1.Select();
Keyboard.Right();
Keyboard.Down();
//Assert.IsFalse(trees.LeftTree.Element11.IsFocused, "Left Element11 has not focus after down"); //does not work, because asking for IsFocused sets focus?????
Assert.IsTrue(trees.LeftTree.Element11.IsSelected, "Left Element11 selected after down");
Assert.IsTrue(trees.RightTree.Element11.IsFocused, "Right Element11 has focus after down");
Assert.IsTrue(trees.RightTree.Element11.IsSelected, "Right Element11 selected after down");
}
}
[TestMethod]
public void KeyboardUpDownWithShiftArrow()
{
using (TreeApplication app = new TreeApplication("SimpleSample"))
{
SimpleSampleTree sst = new SimpleSampleTree(app);
sst.Element1.Select();
Keyboard.Right();
Keyboard.Down();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 not selected after down");
Assert.IsTrue(sst.Element11.IsFocused, "Element11 has not focus after down");
Keyboard.ShiftDown();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 not selected after second down");
Assert.IsTrue(sst.Element12.IsSelected, "Element12 not selected after second down");
Assert.IsTrue(sst.Element12.IsFocused, "Element12 has not focus after second down");
Keyboard.Down();
Assert.IsFalse(sst.Element11.IsSelected, "Element11 selected after second down");
Assert.IsFalse(sst.Element12.IsSelected, "Element12 selected after second down");
Assert.IsTrue(sst.Element13.IsSelected, "Element13 not selected after down");
Assert.IsTrue(sst.Element13.IsFocused, "Element13 has not focus after down");
Keyboard.ShiftUp();
Keyboard.ShiftUp();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 selected after up");
Assert.IsTrue(sst.Element12.IsSelected, "Element12 selected after up");
Assert.IsTrue(sst.Element13.IsSelected, "Element13 not selected after up");
Assert.IsTrue(sst.Element11.IsFocused, "Element13 has not focus after up");
Keyboard.ShiftDown();
Keyboard.ShiftDown();
Keyboard.ShiftDown();
Assert.IsTrue(sst.Element13.IsSelected, "Element13 not selected after fourth down");
Assert.IsTrue(sst.Element14.IsSelected, "Element14 not selected after fourth down");
Assert.IsTrue(sst.Element14.IsFocused, "Element14 has not focus after fourth down");
}
}
[TestMethod]
public void KeyboardUpDownWithCtrlArrow()
{
using (TreeApplication app = new TreeApplication("SimpleSample"))
{
SimpleSampleTree sst = new SimpleSampleTree(app);
sst.Element1.Select();
Keyboard.Right();
Keyboard.Down();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 not selected after down");
Assert.IsTrue(sst.Element11.IsFocused, "Element11 not has focus after down");
Keyboard.CtrlDown();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 not selected after ctrldown");
Assert.IsTrue(sst.Element11.IsFocused, "Element11 not has focus after ctrldown");
Assert.IsTrue(sst.Element12.IsSelectedPreview, "Element12 not selectedPreview after ctrldown");
Keyboard.CtrlDown();
Keyboard.CtrlDown();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 not selected after ctrldowndowndown");
Assert.IsTrue(sst.Element11.IsFocused, "Element11 not has focus after ctrldowndowndown");
Assert.IsTrue(sst.Element14.IsSelectedPreview, "Element12 not selectedPreview after ctrldowndowndown");
Keyboard.CtrlSpace();
Assert.IsTrue(sst.Element11.IsSelected, "Element11 not selected after ctrlspace");
Assert.IsTrue(sst.Element14.IsFocused, "Element14 not has focus after ctrlspace");
Assert.IsTrue(sst.Element14.IsSelected, "Element14 not selected after ctrlspace");
Assert.IsFalse(sst.Element14.IsSelectedPreview, "Element14 selectedPreview after ctrlspace");
Keyboard.CtrlDown();
Keyboard.Space();
Assert.IsTrue(sst.Element15.IsSelected, "Element15 not selected after space");
Assert.IsTrue(sst.Element15.IsFocused, "Element15 not has focus after space");
}
}
#region Public Properties
public TestContext TestContext { get; set; }
#endregion
}
}