winIDEA SDK
test_reset.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6
7import isystem.connect as ic
8
9
10winidea_id = ''
11
12
13def test_reset():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16 main_path = 'src/main.cpp'
17 main2_path = 'src/main2.cpp'
18 print("Creating 'main.cpp' file copy: 'main2.cpp'...")
19 docCtrl = ic.CDocumentController(connMgr, main_path, "r")
20 try:
21 docCtrl.saveCopy(main2_path)
22 except Warning as wrn:
23 print("File exited and was overwritten!")
24
25 print(f"Reseting 'main2.cpp' file content...")
26 docCtrl2 = ic.CDocumentController(connMgr, main2_path, "u")
27 docCtrl2.reset(ic.IConnectIDE.drContent)
28
29 print(f"Closing 'main2.cpp' file...")
30 docCtrl2.save()
31 docCtrl2.close()
32
33
34if __name__ == "__main__":
35 test_reset()