Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Added tests

svn path=/trunk/winforms/; revision=54252
  • Loading branch information...
commit 91c73ffd9f9a258f617023672518bfeab0322cab 1 parent 02f4cde
Peter Dennis Bartok authored
Showing with 23 additions and 7 deletions.
  1. +23 −7 events/events.cs
View
30 events/events.cs
@@ -493,9 +493,7 @@ public class TestControl : Control {
four.Text = "four";
five.Text = "five";
- one.Controls.Add(two);
this.Controls.Add(one);
- this.Controls.Add(three);
t = new System.Windows.Forms.Timer();
t.Interval = 2000;
@@ -511,6 +509,7 @@ public class TestControl : Control {
five.Calls = null;
}
+ // Check events sent when moving a child from one to another control
public void ReparentTest() {
ClearCalls();
@@ -521,6 +520,7 @@ public class TestControl : Control {
PrintList("Reparent, Three Calls", three.Calls);
}
+ // Check events that are sent when a control is added as a child
public void ControlsAddTest() {
two.Parent = null;
three.Controls.Clear();
@@ -530,6 +530,7 @@ public class TestControl : Control {
PrintList("Add, Child calls", two.Calls);
}
+ // Check events that are sent when a child of a control is removed
public void ControlsRemoveTest() {
three.Controls.Add(two);
ClearCalls();
@@ -538,18 +539,32 @@ public class TestControl : Control {
PrintList("Add, Child calls", two.Calls);
}
+ // Check events that are sent when all children of a control are removed
public void ControlsClearTest() {
- three.Controls.Add(two);
- three.Controls.Add(four);
- three.Controls.Add(five);
+ one.Cursor = Cursors.SizeNWSE; // Check for CursorChanged event
+ one.Controls.Add(two);
+ one.Controls.Add(three);
+ one.Controls.Add(four);
+ one.Controls.Add(five);
+
ClearCalls();
- three.Controls.Clear();
- PrintList("Clear, Former parent calls", three.Calls);
+ one.Controls.Clear();
+ PrintList("Clear, Former parent calls", one.Calls);
PrintList("Clear, Child two calls", two.Calls);
+ PrintList("Clear, Child two calls", three.Calls);
PrintList("Clear, Child four calls", four.Calls);
PrintList("Clear, Child five calls", five.Calls);
}
+ // Check events sent when
+ public void ControlsAddSame() {
+ three.Controls.Add(two);
+ ClearCalls();
+ three.Controls.Add(two);
+ PrintList("Re-Add, parent", three.Calls);
+ PrintList("Re-Add, child", two.Calls);
+ }
+
static void Main() {
test = new MainForm();
Application.Run(test);
@@ -565,5 +580,6 @@ public class TestControl : Control {
//ReparentTest();
ControlsClearTest();
+ //ControlsAddSame();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.