[commit] r1926 - trunk/Tests/GPyUnit
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Tue May 15 10:31:30 CDT 2012
Author: ksmyth
Date: Tue May 15 10:31:29 2012
New Revision: 1926
Log:
Test attribute ordering in MetaInterpreter (test for fix in r1924)
Added:
trunk/Tests/GPyUnit/test_MetaInterpreter.py
Modified:
trunk/Tests/GPyUnit/__init__.py
Modified: trunk/Tests/GPyUnit/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/__init__.py Wed May 9 16:42:40 2012 (r1925)
+++ trunk/Tests/GPyUnit/__init__.py Tue May 15 10:31:29 2012 (r1926)
@@ -30,6 +30,7 @@
'GME_310.suite',
'GME_371',
'GME_391',
+ 'test_MetaInterpreter',
]
import GPyUnit.util
if not GPyUnit.util._opts.Dispatch_x64:
Added: trunk/Tests/GPyUnit/test_MetaInterpreter.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/test_MetaInterpreter.py Tue May 15 10:31:29 2012 (r1926)
@@ -0,0 +1,58 @@
+import unittest
+import os
+import os.path
+import GPyUnit.util
+from GPyUnit.util import DispatchEx
+
+def _adjacent_file(file):
+ import os.path
+ return os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
+
+class TestMetaInterpreter(unittest.TestCase):
+ def test_AttributeOrdering(self):
+ mga = GPyUnit.util.parse_xme(self.connstr)
+ try:
+ mga.Save()
+ selectedobj = DispatchEx("Mga.MgaFCOs")
+ launcher = DispatchEx("Mga.MgaLauncher")
+ launcher.RunComponent("Mga.Interpreter.MetaInterpreter", mga, None, selectedobj, 128)
+ finally:
+ mga.Close()
+
+ with open(os.path.join(self.outdir(), "MetaGME.xmp")) as xmp:
+ lines = xmp.readlines()
+ atomattributes = "IsAbstract InRootFolder GeneralPreferences DisplayedName IsTypeShown Icon IsNameEnabled PortIcon SubTypeIcon NamePosition InstanceIcon Decorator NameWrapNum IsHotspotEnabled IsResizable AutoRouterPref HelpURL IsGradientFillEnabled GradientFillColor GradientFillDirection IsShadowCastEnabled ShadowColor ShadowThickness ShadowDirection IsRoundRectangleEnabled RoundRectangleRadius"
+ self.assertTrue(atomattributes in "".join(lines), filter(lambda x: '<atom name = "Atom"' in x, lines))
+
+ metaproj = DispatchEx("Mga.MgaMetaProject")
+ metaproj.Open("MGA=" + os.path.join(self.outdir(), "MetaGME.mta"))
+ try:
+ atomattrs = [attr.Name for attr in metaproj.RootFolder.DefinedFCOByName("Atom", True).Attributes]
+ self.assertEqual(atomattrs, list(atomattributes.split()))
+ finally:
+ metaproj.Close()
+
+
+ def tearDown(self):
+ for file in ("MetaGME.xmp", "MetaGME.mta", "MetaGME.xmp.log"):
+ if os.path.isfile(os.path.join(self.outdir(), file)):
+ os.unlink(os.path.join(self.outdir(), file))
+ registrar = DispatchEx("Mga.MgaRegistrar")
+ registrar.RegisterParadigmFromData("XML=" + os.path.abspath(_adjacent_file("..\\..\\Paradigms\\MetaGME\\MetaGME.xmp")), "MetaGME", 1)
+ setUp = tearDown
+
+ @property
+ def connstr(self):
+ return "MGA=" + _adjacent_file("MetaInterpretertest.mga")
+
+ def outdir(self):
+ return os.path.abspath(_adjacent_file('.'))
+
+GPyUnit.util.MUGenerator(globals(), TestMetaInterpreter)
+def _muoutdir(self):
+ return os.path.abspath(os.getcwd())
+TestMetaInterpreterMU.outdir = _muoutdir
+
+if __name__ == "__main__":
+ unittest.main()
+
More information about the gme-commit
mailing list