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

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Nov 30 11:29:05 CST 2011


Author: ksmyth
Date: Wed Nov 30 11:29:04 2011
New Revision: 1708

Log:
Fix FCO::get_Registry (and thus xme exporting)

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

Modified: trunk/GME/Mga/MgaAttribute.cpp
==============================================================================
--- trunk/GME/Mga/MgaAttribute.cpp	Wed Nov 30 11:28:51 2011	(r1707)
+++ trunk/GME/Mga/MgaAttribute.cpp	Wed Nov 30 11:29:04 2011	(r1708)
@@ -743,7 +743,7 @@
 				if (wcsncmp(it->first, mypath, mypath.Length()) == 0)
 				{
 					std::wstring path = it->first;
-					if (path.length() > mypath.Length() && path[mypath.Length()] == L'/')
+					if (path.length() > mypath.Length() && (mypath.Length() == 0 || path[mypath.Length()] == L'/'))
 					{
 						size_t end = path.find(L'/', mypath.Length() + 1);
 						if (end != std::wstring::npos)

Modified: trunk/Tests/GPyUnit/test_registry.py
==============================================================================
--- trunk/Tests/GPyUnit/test_registry.py	Wed Nov 30 11:28:51 2011	(r1707)
+++ trunk/Tests/GPyUnit/test_registry.py	Wed Nov 30 11:29:04 2011	(r1708)
@@ -82,15 +82,27 @@
             
             self.project.Open("MGA=" + _adjacent_file(self.output_file))
             terr = self.project.BeginTransactionInNewTerr()
-            self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123').Value, 'xxx')
-            self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('ytest123').Value, 'yyy')
-            self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/ztest').Value, 'zzz')
-            self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/ztest/blank').Value, '')
-            ATTSTATUS_HERE = 0
-            self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/ztest/blank').Status(), ATTSTATUS_HERE)
+            def testxtest():
+                self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123').Value, 'xxx')
+                self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('ytest123').Value, 'yyy')
+                self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/ztest').Value, 'zzz')
+                self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/ztest/blank').Value, '')
+                ATTSTATUS_HERE = 0
+                self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/ztest/blank').Status(), ATTSTATUS_HERE)
+            testxtest()
             
             self.project.RootFolder.GetRegistryNodeDisp('xtest123/zt').Value = 'xxxx'
             self.assertEqual(self.project.RootFolder.GetRegistryNodeDisp('xtest123/zt').GetSubNodesDisp().Count, 0)
+            self.assertEqual(self.project.RootFolder.GetRegistryDisp(False).Count, 2)
+            self.project.CommitTransaction()
+            self.project.Close(True)
+            
+            import util.gme
+            util.gme.mga2xme(_adjacent_file(self.output_file))
+            util.gme.xme2mga(os.path.splitext(_adjacent_file(self.output_file))[0] + ".xme")
+            self.project.Open("MGA=" + _adjacent_file(self.output_file))
+            terr = self.project.BeginTransactionInNewTerr()
+            testxtest()
             self.project.CommitTransaction()
             self.project.Close(True)
 
@@ -117,7 +129,9 @@
             self.assertEqual(sheet4.GetRegistryValueDisp('test123'), 'test')
             sheet3.DetachFromArcheType()
             self.assertEqual(sheet4.GetRegistryValueDisp('test123'), 'test')
-            self.assertEqual(sheet2.GetRegistryDisp(False).Count, 0)
+            self.assertEqual(sheet.GetRegistryDisp(False).Count, 1)
+            self.assertEqual(sheet4.GetRegistryDisp(False).Count, 0)
+            self.assertEqual(sheet3.GetRegistryDisp(False).Count, 2) # detaching adds a regnode
             self.assertEqual(sheet4.GetRegistryDisp(False).Count, 0)
             self.project.CommitTransaction()
             self.project.Save()


More information about the gme-commit mailing list