[mapserver-commits] r7206 - trunk/mapserver/mapscript/csharp/examples

svn at osgeo.org svn at osgeo.org
Sat Dec 22 12:44:04 EST 2007


Author: tamas
Date: 2007-12-22 12:44:04 -0500 (Sat, 22 Dec 2007)
New Revision: 7206

Modified:
   trunk/mapserver/mapscript/csharp/examples/RFC24.cs
Log:
Added tests for styleObj (#2442)

Modified: trunk/mapserver/mapscript/csharp/examples/RFC24.cs
===================================================================
--- trunk/mapserver/mapscript/csharp/examples/RFC24.cs	2007-12-22 09:13:59 UTC (rev 7205)
+++ trunk/mapserver/mapscript/csharp/examples/RFC24.cs	2007-12-22 17:44:04 UTC (rev 7206)
@@ -41,6 +41,12 @@
 		catch (Exception e) { Console.WriteLine("\t- testsymbolSetObj exception:" + e.Message); }
 		try { testimageObj(); }
 		catch (Exception e) { Console.WriteLine("\t- testimageObj exception:" + e.Message); }
+		try { testStyleObj(); }
+		catch (Exception e) { Console.WriteLine("\t- testStyleObj exception:" + e.Message); }
+		try { testInsertStyleObj(); }
+		catch (Exception e) { Console.WriteLine("\t- testInsertStyleObj exception:" + e.Message); }
+		try { testGetStyleObj(); }
+		catch (Exception e) { Console.WriteLine("\t- testGetStyleObj exception:" + e.Message); }
 		Console.WriteLine("Finished RFC24");
 	}
 
@@ -171,15 +177,16 @@
 		assertNotNull(newClass.layer, "testClassObj");
 	}
 
-	public void testClassObjHashtable() 
+	public void testStyleObj() 
 	{
 		mapObj map=new mapObj(mapfile);
 		layerObj layer=map.getLayer(1);
-		classObj newClass=new classObj(layer);
+		classObj classobj=layer.getClass(0);
+		styleObj newStyle=new styleObj(classobj);
 		
-		map=null; layer=null;
+		map=null; layer=null; classobj=null;
 		gc();
-		assertNotNull(newClass.layer, "testClassObj");
+		assert(newStyle.refcount == 2, "testStyleObj");
 	}
 
 	public void testInsertClassObj() {
@@ -194,6 +201,20 @@
 		assertNotNull(newClass.layer, "testInsertClassObj");
 	}
 
+	public void testInsertStyleObj() 
+	{
+		mapObj map=new mapObj(mapfile);
+		layerObj layer=map.getLayer(1);
+		classObj classobj=layer.getClass(0);
+		styleObj newStyle = new styleObj(null);
+		classobj.insertStyle(newStyle,-1);
+		
+		assert(newStyle.refcount == 2, "testInsertStyleObj precondition");
+		map=null; layer=null; classobj=null;
+		gc();
+		assert(newStyle.refcount == 2, "testInsertStyleObj");
+	}
+
 	public void testGetClassObj() {
 		mapObj map=new mapObj(mapfile);
 		layerObj layer=map.getLayer(1);
@@ -204,6 +225,18 @@
 		assertNotNull(newClass.layer, "testGetClassObj");
 	}
 
+	public void testGetStyleObj() 
+	{
+		mapObj map=new mapObj(mapfile);
+		layerObj layer=map.getLayer(1);
+		classObj classobj=layer.getClass(0);
+		styleObj style=classobj.getStyle(0);
+		
+		map=null; layer=null; classobj=null;
+		gc();
+		assert(style.refcount == 2, "testGetStyleObj");
+	}
+
 	public void gc() {
 		for (int i=0; i<100; i++) {
 			GC.Collect();



More information about the mapserver-commits mailing list