示例#1
0
        public void GetItemEmulateChangeSelected()
        {
            var item = listBox.GetItem(99);

            item.EmulateChangeSelected(false);
            Assert.IsFalse(item.IsSelected);
            item.EmulateChangeSelected(true);
            Assert.IsTrue(item.IsSelected);
        }
示例#2
0
        public void ListViewActiveItemIndexTest()
        {
            var listEx = new WPFListBox <ItemDriver>(_ctrl._listView);

            listEx.GetItem(1).VisualTree().ByType <TextBox>()[0].Dynamic().Focus();

            Assert.AreEqual(-1, listEx.SelectedIndex);
            Assert.AreEqual(1, listEx.ActiveItemIndex);
        }
示例#3
0
        public void コントロール特定2()
        {
            AppVar main = _app.Type <Application>().Current.MainWindow;

            var tab = new WPFTabControl(main.LogicalTree().ByType <TabControl>().Single());

            tab.EmulateChangeSelectedIndex(1);

            var userControl = main.LogicalTree().ByType("WpfApplication.DemoItemsControl").Single();
            var listBox     = new WPFListBox(userControl.LogicalTree().ByType <ListBox>().Single());

            var textBoxAge = new WPFTextBox(listBox.GetItem(2).VisualTree().ByBinding("Age").Single());

            textBoxAge.EmulateChangeText("50");
        }
        public void WPF()
        {
            var app = new WindowsAppFriend(Process.Start("Wpf.exe"));
            var window = app.Type().System.Windows.Application.Current.MainWindow;

            //ガタガタ言わずにx:Name使えばいいじゃん。
            var _textBox = new WPFTextBox(window._textBox);
            _textBox.EmulateChangeText("x:Name最高!");

            //嫌って言う人いるから頑張ったよ。
            AppVar windowAppVar = window;
            var logicalTree = windowAppVar.LogicalTree();
            var textBox = new WPFTextBox(logicalTree.ByBinding("Memo").ByType<System.Windows.Controls.TextBox>().Single());
            var textBlock = new WPFTextBlock(logicalTree.ByBinding("Memo").ByType<System.Windows.Controls.TextBlock>().Single());
            var buttonModal = new WPFButtonBase(logicalTree.ByBinding("CommandModal").Single());
            var buttonModalSequential = new WPFButtonBase(logicalTree.ByBinding("CommandModalSequential").Single());
            var buttonModeless = new WPFButtonBase(logicalTree.ByBinding("CommandModeless").Single());
            var listBox = new WPFListBox(logicalTree.ByBinding("Persons").Single());

            //VisualTreeにしか現れない要素は気を付けて
            var item = listBox.GetItem(20);
            var itemText = new WPFTextBlock(item.VisualTree().ByBinding("Name").Single());

            //これでもダメな場合は工夫してね!

            Process.GetProcessById(app.ProcessId).Kill();
        }