import os
import isystem.connect as ic
winidea_id = ''
def test_save():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
DOC_NAME = "test_save.trd"
covCtrl = ic.CCoverageController2(connMgr, DOC_NAME, "w")
wksFolder = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_DIR)
filePath = os.path.join(wksFolder, DOC_NAME)
covCtrl.save()
print(f"Document '{DOC_NAME}' saved: {filePath}")
covCtrl.saveAs(filePath, True)
print(f"Document '{DOC_NAME}' forcibly overwritten (saved): {filePath}")
DOC_NAME_2 = "test_save_2.trd"
newFilePath = os.path.join(wksFolder, DOC_NAME_2)
covCtrl.saveCopy(DOC_NAME_2)
print(f"A copy of document '{DOC_NAME}' saved to: {newFilePath}")
print(f"Optionally, user can save document with prompt by using '.saveAsPrompt()' function.")
if __name__ == "__main__":
test_save()