1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2017 - ESI Group - Clement DAVID
5 // This file is distributed under the same license as the Scilab package.
6 // =============================================================================
9 // <-- NO CHECK REF -->
10 // <-- ENGLISH IMPOSED -->
12 // <-- Non-regression test for bug 15149 -->
14 // <-- Bugzilla URL -->
15 // http://bugzilla.scilab.org/show_bug.cgi?id=15149
17 // <-- Short Description -->
18 // Some schema file were corrupted on save and reload
24 scs_m1 = xcosDiagramToScilab("SCI/modules/xcos/tests/nonreg_tests/bug_15149.zcos");
25 xcosDiagramToScilab("TMPDIR/foo.zcos", scs_m1);
28 scs_m2 = xcosDiagramToScilab("TMPDIR/foo.zcos");
30 scs_m3 = xcosDiagramToScilab("TMPDIR/foo.zcos");
32 // check that objs have the same size
33 assert_checkequal(lstsize(scs_m1.objs), lstsize(scs_m2.objs));
34 assert_checkequal(lstsize(scs_m1.objs), lstsize(scs_m3.objs));
36 // check that all blocks are connected
37 for i=1:lstsize(scs_m1.objs)
39 if typeof(o) == "Block" then
40 assert_checktrue(o.graphics.pin <> 0);
41 assert_checktrue(o.graphics.pout <> 0);
42 assert_checktrue(o.graphics.pein <> 0);
43 assert_checktrue(o.graphics.peout <> 0);
46 for i=1:lstsize(scs_m2.objs)
48 if typeof(o) == "Block" then
49 assert_checktrue(o.graphics.pin <> 0);
50 assert_checktrue(o.graphics.pout <> 0);
51 assert_checktrue(o.graphics.pein <> 0);
52 assert_checktrue(o.graphics.peout <> 0);
55 for i=1:lstsize(scs_m3.objs)
57 if typeof(o) == "Block" then
58 assert_checktrue(o.graphics.pin <> 0);
59 assert_checktrue(o.graphics.pout <> 0);
60 assert_checktrue(o.graphics.pein <> 0);
61 assert_checktrue(o.graphics.peout <> 0);
66 // simulate scs_m1 and scs_m2
67 // warnings are possible but scs_m2 simulation should pass and should not
68 // destroy scs_m1 nor scs_m3 objects
70 scicos_simulate(scs_m1, "nw");
72 // check that objs have the same size
73 assert_checkequal(lstsize(scs_m1.objs), lstsize(scs_m2.objs));
74 assert_checkequal(lstsize(scs_m1.objs), lstsize(scs_m3.objs));
76 // check that all blocks are connected
77 for i=1:lstsize(scs_m1.objs)
79 if typeof(o) == "Block" then
80 assert_checktrue(o.graphics.pin <> 0);
81 assert_checktrue(o.graphics.pout <> 0);
82 assert_checktrue(o.graphics.pein <> 0);
83 assert_checktrue(o.graphics.peout <> 0);
86 for i=1:lstsize(scs_m2.objs)
88 if typeof(o) == "Block" then
89 assert_checktrue(o.graphics.pin <> 0);
90 assert_checktrue(o.graphics.pout <> 0);
91 assert_checktrue(o.graphics.pein <> 0);
92 assert_checktrue(o.graphics.peout <> 0);
95 for i=1:lstsize(scs_m3.objs)
97 if typeof(o) == "Block" then
98 assert_checktrue(o.graphics.pin <> 0);
99 assert_checktrue(o.graphics.pout <> 0);
100 assert_checktrue(o.graphics.pein <> 0);
101 assert_checktrue(o.graphics.peout <> 0);
106 scicos_simulate(scs_m2, "nw");
108 // check that objs have the same size
109 assert_checkequal(lstsize(scs_m1.objs), lstsize(scs_m2.objs));
110 assert_checkequal(lstsize(scs_m1.objs), lstsize(scs_m3.objs));
112 // check that all blocks are connected
113 for i=1:lstsize(scs_m1.objs)
115 if typeof(o) == "Block" then
116 assert_checktrue(o.graphics.pin <> 0);
117 assert_checktrue(o.graphics.pout <> 0);
118 assert_checktrue(o.graphics.pein <> 0);
119 assert_checktrue(o.graphics.peout <> 0);
122 for i=1:lstsize(scs_m2.objs)
124 if typeof(o) == "Block" then
125 assert_checktrue(o.graphics.pin <> 0);
126 assert_checktrue(o.graphics.pout <> 0);
127 assert_checktrue(o.graphics.pein <> 0);
128 assert_checktrue(o.graphics.peout <> 0);
131 for i=1:lstsize(scs_m3.objs)
133 if typeof(o) == "Block" then
134 assert_checktrue(o.graphics.pin <> 0);
135 assert_checktrue(o.graphics.pout <> 0);
136 assert_checktrue(o.graphics.pein <> 0);
137 assert_checktrue(o.graphics.peout <> 0);