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

m=modeler.ModelerWindow()

#assert len(modeler.modelerWindows) == 1

m.main(loop=0)

co= m.getOutlineEditor().childCount()
action.newProject( ["UML", 1, 4] )
currentProject=m.getCurrentFocus().__getProject__()
assert len(currentProject.contents()) == 1

assert m.getOutlineEditor().childCount() == co+1,m.getOutlineEditor().childCount()

model2 = coral.lang.UML14.Model()

coral.TransactionManager.beginModifyCmd()
try:
    model2.__setProject__(currentProject)
finally:
    coral.TransactionManager.endModifyCmd()

assert m.getOutlineEditor().childCount() == co+1
assert len(currentProject.contents()) == 2
