#!/usr/bin/env python
from coral.modeler import modeler, action
import coral as coral
import os

m=modeler.ModelerWindow()


for l in [("UML",1,1),("UML",1,3),("UML",1,4),("UML",1,5),("SMD",0,1),("SMD",0,1),("FSM",1,0)]:
	print "*"*80
	print "** new project ",l
	action.newProject(l)
	n="test-"+l[0]+str(l[1])+str(l[2])

	tm=coral.getTransactionManager()
        tr=tm.getCurrentTransaction()
	print "save as 1"
	print "1 size==",tr.size()
	action.saveProjectAs(n+".xml")

	print "save as 2"
	tm=coral.getTransactionManager()
        tr=tm.getCurrentTransaction()
	print "2 size==",tr.size()
	action.saveProjectAs(n+".xml")
	
	print "open "
	action.openProject(n+".xml")

	print "save as 3"
	action.saveProjectAs(n+"2.xml")
	os.system("diff "+n+".xml "+n+"2.xml")
action.quit()
