From 1eeb3f35282384dfea621268ca7dd093b2b9361f Mon Sep 17 00:00:00 2001 From: ilya-murzinov Date: Thu, 6 Feb 2014 14:24:15 +0400 Subject: [PATCH 1/4] added ComboBox to DataGrid in WpfTestApplication --- .../WpfTestApplication/MainWindow.xaml | 15 ++++- .../WpfTestApplication/MainWindow.xaml.cs | 59 ++++++++++++++++--- .../WpfTestApplication/TestItem.cs | 9 --- .../WpfTestApplication.csproj | 1 - 4 files changed, 65 insertions(+), 19 deletions(-) delete mode 100644 src/TestApplications/WpfTestApplication/TestItem.cs diff --git a/src/TestApplications/WpfTestApplication/MainWindow.xaml b/src/TestApplications/WpfTestApplication/MainWindow.xaml index 9050d34a..80be06b7 100644 --- a/src/TestApplications/WpfTestApplication/MainWindow.xaml +++ b/src/TestApplications/WpfTestApplication/MainWindow.xaml @@ -81,7 +81,20 @@ - + + + + + + + + + + + + + + diff --git a/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs b/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs index 3ab913ed..975bc96b 100644 --- a/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs +++ b/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs @@ -12,7 +12,7 @@ namespace WpfTestApplication public partial class MainWindow { private bool controlsDisabled; - + private readonly ObservableCollection states = new ObservableCollection(); public MainWindow() { DataContext = this; @@ -23,6 +23,31 @@ public MainWindow() treeViewItem.Items.Add(new TreeViewItem { Header = "Child" + i }); } TreeView.Items.Add(treeViewItem); + states.Add(new State() + { + Id = "1", + Contents = "Item1", + Description = "Simple item 1", + ComboboxItems = new ObservableCollection(DataGridComboboxItems) + }); + + states.Add(new State() + { + Id = "2", + Contents = "Item2", + Description = "", + ComboboxItems = new ObservableCollection(DataGridComboboxItems) + }); + + states.Add(new State() + { + Id = "3", + Contents = "Item3", + Description = "", + ComboboxItems = new ObservableCollection(DataGridComboboxItems) + }); + + DataContext = states; } public ObservableCollection ListItems @@ -159,16 +184,34 @@ private void ClickMe_OnClick(object sender, RoutedEventArgs e) AutomationProperties.SetHelpText(this, "Click Me Clicked"); } - public TestItem[] TestItems + public string[] DataGridComboboxItems { - get + get { - return new[]{ - new TestItem {Id = 1, Contents = "Item1", Description = "Simple item 1"}, - new TestItem {Id = 2, Contents = "Item2", Description = ""}, - new TestItem {Id = 3, Contents = "Item3"} - }; + return new[] + { + "Item1", + "Item2", + "Item3", + "Item4" + }; } + + } + + public class State + { + public string Id + { get; set; } + + public string Contents + { get; set; } + + public string Description + { get; set; } + + public ObservableCollection ComboboxItems + { get; set; } } } } diff --git a/src/TestApplications/WpfTestApplication/TestItem.cs b/src/TestApplications/WpfTestApplication/TestItem.cs deleted file mode 100644 index 1906ae82..00000000 --- a/src/TestApplications/WpfTestApplication/TestItem.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace WpfTestApplication -{ - public class TestItem - { - public int Id { get; set; } - public string Contents { get; set; } - public string Description { get; set; } - } -} diff --git a/src/TestApplications/WpfTestApplication/WpfTestApplication.csproj b/src/TestApplications/WpfTestApplication/WpfTestApplication.csproj index e9540215..25ad1f82 100644 --- a/src/TestApplications/WpfTestApplication/WpfTestApplication.csproj +++ b/src/TestApplications/WpfTestApplication/WpfTestApplication.csproj @@ -123,7 +123,6 @@ HorizontalGridSplitter.xaml - ListControls.xaml From 6a7e55b027e0d762426b358766c4de7376199bac Mon Sep 17 00:00:00 2001 From: ilya-murzinov Date: Thu, 6 Feb 2014 14:49:54 +0400 Subject: [PATCH 2/4] fixed extra row bug in DataGrid --- src/TestApplications/WpfTestApplication/MainWindow.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestApplications/WpfTestApplication/MainWindow.xaml b/src/TestApplications/WpfTestApplication/MainWindow.xaml index 80be06b7..feb1b173 100644 --- a/src/TestApplications/WpfTestApplication/MainWindow.xaml +++ b/src/TestApplications/WpfTestApplication/MainWindow.xaml @@ -81,7 +81,7 @@ - + From 4020c04d26d3374e447b962f52860e3594f701e8 Mon Sep 17 00:00:00 2001 From: ilya-murzinov Date: Thu, 6 Feb 2014 16:48:43 +0400 Subject: [PATCH 3/4] fixed failed tests --- .../WpfTestApplication/MainWindow.xaml | 2 +- .../WpfTestApplication/MainWindow.xaml.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/TestApplications/WpfTestApplication/MainWindow.xaml b/src/TestApplications/WpfTestApplication/MainWindow.xaml index feb1b173..a3f56a02 100644 --- a/src/TestApplications/WpfTestApplication/MainWindow.xaml +++ b/src/TestApplications/WpfTestApplication/MainWindow.xaml @@ -81,7 +81,7 @@ - + diff --git a/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs b/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs index 975bc96b..13357902 100644 --- a/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs +++ b/src/TestApplications/WpfTestApplication/MainWindow.xaml.cs @@ -13,16 +13,21 @@ public partial class MainWindow { private bool controlsDisabled; private readonly ObservableCollection states = new ObservableCollection(); + public MainWindow() { DataContext = this; + InitializeComponent(); + var treeViewItem = new TreeViewItem { Header = "Lots Of Children" }; foreach (var i in Enumerable.Range(1, 50)) { treeViewItem.Items.Add(new TreeViewItem { Header = "Child" + i }); } + TreeView.Items.Add(treeViewItem); + states.Add(new State() { Id = "1", @@ -46,8 +51,11 @@ public MainWindow() Description = "", ComboboxItems = new ObservableCollection(DataGridComboboxItems) }); + } - DataContext = states; + public ObservableCollection States + { + get { return states; } } public ObservableCollection ListItems From b52cea3fcf62cbdb713b50164b44ee29bc9a4200 Mon Sep 17 00:00:00 2001 From: ilya-murzinov Date: Thu, 6 Feb 2014 17:03:13 +0400 Subject: [PATCH 4/4] fixed last test --- src/TestStack.White.UITests/ControlTests/DataGridTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestStack.White.UITests/ControlTests/DataGridTests.cs b/src/TestStack.White.UITests/ControlTests/DataGridTests.cs index 683bfeda..acd3e92a 100644 --- a/src/TestStack.White.UITests/ControlTests/DataGridTests.cs +++ b/src/TestStack.White.UITests/ControlTests/DataGridTests.cs @@ -32,7 +32,7 @@ void CanGetAllItemsWpf() var rows = DataGridWpfUnderTest.Rows; Assert.Equal(3, rows.Count); var row1 = rows.Get(0); - Assert.Equal(3, row1.Cells.Count); + Assert.Equal(4, row1.Cells.Count); Assert.Equal("1", row1.Cells[0].Text); Assert.Equal("Item1", row1.Cells[1].Text); Assert.Contains("Simple", row1.Cells[2].Text);