[Zope-CVS] CVS: PythonNet/src/testing - EventTest.cs:1.3

Brian Lloyd brian at zope.com
Tue Oct 7 22:29:48 EDT 2003


Update of /cvs-repository/PythonNet/src/testing
In directory cvs.zope.org:/tmp/cvs-serv8705/src/testing

Modified Files:
	EventTest.cs 
Log Message:
Finally finished event / delegate tests, refactoring and fixing. Now 
its a race to see if I can get out a preview 3 before the baby comes ;)


=== PythonNet/src/testing/EventTest.cs 1.2 => 1.3 ===
--- PythonNet/src/testing/EventTest.cs:1.2	Thu Oct  2 23:06:20 2003
+++ PythonNet/src/testing/EventTest.cs	Tue Oct  7 22:29:17 2003
@@ -38,6 +38,17 @@
 
 	private event TestEventHandler PrivateEvent;
 
+	public static int s_value;
+	public int value;
+
+	public EventTest () {
+	    this.value = 0;
+	}
+
+	static EventTest () {
+	    s_value = 0;
+	}
+
 	public static void FireStatic(TestEventArgs e) {
 	    if (PublicStaticEvent != null) {
 		PublicStaticEvent(null, e);
@@ -50,16 +61,26 @@
 	    }
 	}
 
-	public void ShutUpCompiler() {
-	    // This is just to quiet compiler warnings about events never
-	    // being used - they are used from the Python unit tests.
-	    ProtectedStaticEvent = null;
-	    InternalStaticEvent = null;
-	    PrivateStaticEvent = null;
-	    ProtectedEvent = null;
-	    InternalEvent = null;
-	    PrivateEvent = null;
+	public void GenericHandler(object sender, TestEventArgs e) {
+	    this.value = e.value;
 	}
+
+	public static void StaticHandler(object sender, TestEventArgs e) {
+	    s_value = e.value;
+	}
+
+	public static void ShutUpCompiler() {
+	    // Quiet compiler warnings.
+	    EventTest e = new EventTest();
+	    TestEventHandler f = new TestEventHandler(e.GenericHandler);
+	    ProtectedStaticEvent += f;
+	    InternalStaticEvent += f;
+	    PrivateStaticEvent += f;
+	    e.ProtectedEvent += f;
+	    e.InternalEvent += f;
+	    e.PrivateEvent += f;
+	}
+
     }
 
 




More information about the Zope-CVS mailing list