|
@@ -24,6 +24,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
public void ContentWidth_BiggerAfterExpand ()
|
|
public void ContentWidth_BiggerAfterExpand ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
@@ -32,8 +33,6 @@ public class TreeViewTests
|
|
|
|
|
|
tree.Viewport = new Rectangle (0, 0, 10, 10);
|
|
tree.Viewport = new Rectangle (0, 0, 10, 10);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
-
|
|
|
|
//-+Factory
|
|
//-+Factory
|
|
Assert.Equal (9, tree.GetContentWidth (true));
|
|
Assert.Equal (9, tree.GetContentWidth (true));
|
|
|
|
|
|
@@ -49,10 +48,10 @@ public class TreeViewTests
|
|
//-+Factory
|
|
//-+Factory
|
|
Assert.Equal (9, tree.GetContentWidth (true));
|
|
Assert.Equal (9, tree.GetContentWidth (true));
|
|
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
public void ContentWidth_VisibleVsAll ()
|
|
public void ContentWidth_VisibleVsAll ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out Car car2);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out Car car2);
|
|
@@ -62,8 +61,6 @@ public class TreeViewTests
|
|
// control only allows 1 row to be viewed at once
|
|
// control only allows 1 row to be viewed at once
|
|
tree.Viewport = new Rectangle (0, 0, 20, 1);
|
|
tree.Viewport = new Rectangle (0, 0, 20, 1);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
-
|
|
|
|
//-+Factory
|
|
//-+Factory
|
|
Assert.Equal (9, tree.GetContentWidth (true));
|
|
Assert.Equal (9, tree.GetContentWidth (true));
|
|
Assert.Equal (9, tree.GetContentWidth (false));
|
|
Assert.Equal (9, tree.GetContentWidth (false));
|
|
@@ -95,12 +92,10 @@ public class TreeViewTests
|
|
tree.ScrollOffsetVertical = 5;
|
|
tree.ScrollOffsetVertical = 5;
|
|
Assert.Equal (0, tree.GetContentWidth (true));
|
|
Assert.Equal (0, tree.GetContentWidth (true));
|
|
Assert.Equal (13, tree.GetContentWidth (false));
|
|
Assert.Equal (13, tree.GetContentWidth (false));
|
|
-
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void CursorVisibility_MultiSelect ()
|
|
public void CursorVisibility_MultiSelect ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -290,7 +285,6 @@ public class TreeViewTests
|
|
|
|
|
|
Assert.False (tree.IsExpanded (c));
|
|
Assert.False (tree.IsExpanded (c));
|
|
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>Tests that <see cref="TreeView.Expand(object)"/> and <see cref="TreeView.IsExpanded(object)"/> are consistent</summary>
|
|
/// <summary>Tests that <see cref="TreeView.Expand(object)"/> and <see cref="TreeView.IsExpanded(object)"/> are consistent</summary>
|
|
@@ -354,12 +348,11 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
public void ObjectActivated_Called ()
|
|
public void ObjectActivated_Called ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
-
|
|
|
|
object activated = null;
|
|
object activated = null;
|
|
var called = false;
|
|
var called = false;
|
|
|
|
|
|
@@ -385,17 +378,15 @@ public class TreeViewTests
|
|
|
|
|
|
Assert.True (called);
|
|
Assert.True (called);
|
|
Assert.Same (f, activated);
|
|
Assert.Same (f, activated);
|
|
-
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
|
|
+
|
|
public void ObjectActivated_CustomKey ()
|
|
public void ObjectActivated_CustomKey ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
-
|
|
|
|
tree.ObjectActivationKey = KeyCode.Delete;
|
|
tree.ObjectActivationKey = KeyCode.Delete;
|
|
object activated = null;
|
|
object activated = null;
|
|
var called = false;
|
|
var called = false;
|
|
@@ -430,16 +421,14 @@ public class TreeViewTests
|
|
Assert.True (called);
|
|
Assert.True (called);
|
|
Assert.Same (f, activated);
|
|
Assert.Same (f, activated);
|
|
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
public void ObjectActivationButton_DoubleClick ()
|
|
public void ObjectActivationButton_DoubleClick ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
-
|
|
|
|
object activated = null;
|
|
object activated = null;
|
|
var called = false;
|
|
var called = false;
|
|
|
|
|
|
@@ -459,16 +448,14 @@ public class TreeViewTests
|
|
Assert.Same (f, activated);
|
|
Assert.Same (f, activated);
|
|
Assert.Same (f, tree.SelectedObject);
|
|
Assert.Same (f, tree.SelectedObject);
|
|
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
public void ObjectActivationButton_RightClick ()
|
|
public void ObjectActivationButton_RightClick ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
-
|
|
|
|
tree.ObjectActivationButton = MouseFlags.Button2Clicked;
|
|
tree.ObjectActivationButton = MouseFlags.Button2Clicked;
|
|
tree.ExpandAll ();
|
|
tree.ExpandAll ();
|
|
|
|
|
|
@@ -495,16 +482,14 @@ public class TreeViewTests
|
|
Assert.True (called);
|
|
Assert.True (called);
|
|
Assert.Same (car1, activated);
|
|
Assert.Same (car1, activated);
|
|
Assert.Same (car1, tree.SelectedObject);
|
|
Assert.Same (car1, tree.SelectedObject);
|
|
-
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
|
|
+ [SetupFakeDriver]
|
|
public void ObjectActivationButton_SetToNull ()
|
|
public void ObjectActivationButton_SetToNull ()
|
|
{
|
|
{
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
TreeView<object> tree = CreateTree (out Factory f, out Car car1, out _);
|
|
|
|
|
|
- InitFakeDriver ();
|
|
|
|
|
|
|
|
// disable activation
|
|
// disable activation
|
|
tree.ObjectActivationButton = null;
|
|
tree.ObjectActivationButton = null;
|
|
@@ -527,8 +512,6 @@ public class TreeViewTests
|
|
Assert.False (called);
|
|
Assert.False (called);
|
|
Assert.Null (activated);
|
|
Assert.Null (activated);
|
|
Assert.Null (tree.SelectedObject);
|
|
Assert.Null (tree.SelectedObject);
|
|
-
|
|
|
|
- Application.Shutdown ();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -716,7 +699,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestBottomlessTreeView_MaxDepth_3 ()
|
|
public void TestBottomlessTreeView_MaxDepth_3 ()
|
|
{
|
|
{
|
|
TreeView<string> tv = new () { Width = 20, Height = 10 };
|
|
TreeView<string> tv = new () { Width = 20, Height = 10 };
|
|
@@ -754,7 +737,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestBottomlessTreeView_MaxDepth_5 ()
|
|
public void TestBottomlessTreeView_MaxDepth_5 ()
|
|
{
|
|
{
|
|
TreeView<string> tv = new () { Width = 20, Height = 10 };
|
|
TreeView<string> tv = new () { Width = 20, Height = 10 };
|
|
@@ -821,7 +804,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestGetObjectOnRow ()
|
|
public void TestGetObjectOnRow ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -876,7 +859,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestGetObjectRow ()
|
|
public void TestGetObjectRow ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -944,7 +927,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestTreeView_DrawLineEvent ()
|
|
public void TestTreeView_DrawLineEvent ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -1010,7 +993,7 @@ public class TreeViewTests
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestTreeView_DrawLineEvent_Handled ()
|
|
public void TestTreeView_DrawLineEvent_Handled ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -1056,7 +1039,7 @@ FFFFFFFFFF
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestTreeView_DrawLineEvent_WithScrolling ()
|
|
public void TestTreeView_DrawLineEvent_WithScrolling ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -1119,7 +1102,7 @@ oot two
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestTreeView_Filter ()
|
|
public void TestTreeView_Filter ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -1203,7 +1186,7 @@ oot two
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
- [AutoInitShutdown]
|
|
|
|
|
|
+ [SetupFakeDriver]
|
|
public void TestTreeViewColor ()
|
|
public void TestTreeViewColor ()
|
|
{
|
|
{
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
var tv = new TreeView { Width = 20, Height = 10 };
|
|
@@ -1303,13 +1286,6 @@ oot two
|
|
Assert.Equal (2, tree.GetChildren (root).Count ());
|
|
Assert.Equal (2, tree.GetChildren (root).Count ());
|
|
}
|
|
}
|
|
|
|
|
|
- private void InitFakeDriver ()
|
|
|
|
- {
|
|
|
|
- var driver = new FakeDriver ();
|
|
|
|
- Application.Init (driver);
|
|
|
|
- driver.Init ();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/// <summary>Test object which considers for equality only <see cref="Name"/></summary>
|
|
/// <summary>Test object which considers for equality only <see cref="Name"/></summary>
|
|
private class EqualityTestObject
|
|
private class EqualityTestObject
|
|
{
|
|
{
|