winIDEA SDK
test_remove_items.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_removeItems():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 profCtrl = ic.CProfilerController2(connMgr, "example.trd", "w")
16
17 profCtrl.addFunction(0, 'main')
18 profCtrl.addFunction(0, 'target_init')
19 print("Removing function 'main' of trigger with index 0...")
20 a = profCtrl.removeFunction(0, "main")
21 if a == 0:
22 print("\tOK.")
23 else:
24 print("\tOK, already removed or not present.")
25
26 a = profCtrl.removeFunction(0, "target_init")
27 if a == 0:
28 print("\tOK.")
29 else:
30 print("\tOK, already removed or not present.")
31
32 print("Removing functions of trigger with index 0...")
33 profCtrl.removeAllFunctions(0)
34
35 print("Removing variable 'main_loop_counter' of trigger with index 0...")
36 if profCtrl.removeVariable(0, "main_loop_counter") == 0:
37 print("\tOK.")
38 else:
39 print("\tOK, already removed or not present.")
40
41 print("Removing all variables of trigger with index 0...")
42 profCtrl.removeAllVariables(0)
43 profCtrl.closeDiscard()
44
45
46if __name__ == "__main__":
47 test_removeItems()