Xcos MVC: remove the "Deleted" adapter
[scilab.git] / scilab / modules / scicos / tests / unit_tests / model / Delete_objects.tst
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2014 - Scilab Enterprises - Paul Bignier
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7
8 // <-- CLI SHELL MODE -->
9
10 loadXcosLibs();
11 scicos_log("TRACE");
12
13 scs_m = scicos_diagram();
14
15 Sum1 = BIGSOM_f("define");
16 Sum2 = BIGSOM_f("define");
17 lnk1 = scicos_link( from=[1 1 0],to=[2 1 1]);
18 lnk2 = scicos_link();
19
20 // 'Sum1' is linked to 'Sum2' through 'lnk1'
21 scs_m.objs(1) = Sum1;
22 scs_m.objs(2) = Sum2;
23 scs_m.objs(3) = lnk1;
24 scs_m.objs(4) = lnk2;
25
26 // Consecutively delete the diagram objects,
27 // check that they were replaced with "Deleted" mlists.
28 DeletedBlock = mlist("Deleted");
29
30 scs_m.objs(1) = DeletedBlock;
31 assert_checkequal(scs_m.objs(1), DeletedBlock);
32
33 scs_m.objs(2) = DeletedBlock;
34 assert_checkequal(scs_m.objs(2), DeletedBlock);
35
36 scs_m.objs(3) = DeletedBlock;
37 assert_checkequal(scs_m.objs(3), DeletedBlock);
38
39 scs_m.objs(4) = DeletedBlock;
40 assert_checkequal(scs_m.objs(4), DeletedBlock);
41
42 // Test that all objects are simultaneously "deleted"
43 assert_checkequal(scs_m.objs(1), DeletedBlock);
44 assert_checkequal(scs_m.objs(2), DeletedBlock);
45 assert_checkequal(scs_m.objs(3), DeletedBlock);
46 assert_checkequal(scs_m.objs(4), DeletedBlock);
47
48
49 // Check that all the model items are freed
50 clear