[commit] r2205 - in trunk: GME/Mga Tests/GPyUnit

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed May 22 11:51:38 CDT 2013


Author: ksmyth
Date: Wed May 22 11:51:38 2013
New Revision: 2205

Log:
Follow-up to 'Bugfix: registry subtree removal'

Modified:
   trunk/GME/Mga/MgaAttribute.cpp
   trunk/Tests/GPyUnit/test_registry.py

Modified: trunk/GME/Mga/MgaAttribute.cpp
==============================================================================
--- trunk/GME/Mga/MgaAttribute.cpp	Wed May 22 11:14:06 2013	(r2204)
+++ trunk/GME/Mga/MgaAttribute.cpp	Wed May 22 11:51:38 2013	(r2205)
@@ -1,4 +1,4 @@
-(// MgaAttribute.cpp : Implementation of CMgaAttribute
+// MgaAttribute.cpp : Implementation of CMgaAttribute
 #include "stdafx.h"
 #include "MgaAttribute.h"
 #include "MgaFCO.h"
@@ -838,7 +838,7 @@
 			if (wcsncmp(path.c_str(), mypath, mypath.Length()) == 0)
 			{
 				// PV: Remove only true subtree nodes (not just prefix testing)
-				if (path.length() > mypath.Length() && (mypath.Length() == 0 || path[mypath.Length()] == L'/')) {
+				if (mypath.Length() == 0 || mypath.Length() == path.length() || (path.length() > mypath.Length() && path[mypath.Length()] == L'/')) {
 					map->erase(it++);
 					continue;	// modify collection while iterating
 				}

Modified: trunk/Tests/GPyUnit/test_registry.py
==============================================================================
--- trunk/Tests/GPyUnit/test_registry.py	Wed May 22 11:14:06 2013	(r2204)
+++ trunk/Tests/GPyUnit/test_registry.py	Wed May 22 11:51:38 2013	(r2205)
@@ -166,6 +166,33 @@
             self.project.Save()
             self.project.Close()
 
+    def test_subtree_removal(self):
+        from GPyUnit import util
+        util.register_xmp('MetaGME')
+        with util.disable_early_binding():
+            self.project = DispatchEx("Mga.MgaProject")
+            self.project.Create(self.connstr, "MetaGME")
+            self.project.BeginTransactionInNewTerr()
+            
+            for i in range(1, self.project.RootMeta.RootFolder.DefinedFCOs.Count+1):
+                if self.project.RootMeta.RootFolder.DefinedFCOs.Item(i).Name == 'ParadigmSheet':
+                    sheet_meta = self.project.RootMeta.RootFolder.DefinedFCOs.Item(i)
+            sheet = self.project.RootFolder.CreateRootObject(sheet_meta)
+            #sys.stdin.readline()
+            sheet.SetRegistryValueDisp('test123', 'test')
+            sheet.SetRegistryValueDisp('test123/123', 'test')
+            sheet.SetRegistryValueDisp('test123456', 'test')
+            sheet.SetRegistryValueDisp('test123456/123', 'test')
+            sheet.GetRegistryNodeDisp('test123').RemoveTree()
+            ATTSTATUS_UNDEFINED = -2
+            self.assertEqual(sheet.GetRegistryNodeDisp('test123').Status(), ATTSTATUS_UNDEFINED)
+            self.assertEqual(sheet.GetRegistryNodeDisp('test123/123').Status(), ATTSTATUS_UNDEFINED)
+            self.assertEqual(sheet.GetRegistryValueDisp('test123456'), 'test')
+            self.assertEqual(sheet.GetRegistryValueDisp('test123456/123'), 'test')
+            self.project.CommitTransaction()
+            self.project.Save()
+            self.project.Close()
+
     def xxxtestupgrade(self):
         from GPyUnit import util
         util.register_xmp('MetaGME')


More information about the gme-commit mailing list