* Bug 16374 fixed: BC error loading in 6.x datatips saved in 5.5 44/21444/3
Samuel GOUGEON [Mon, 16 Mar 2020 11:30:40 +0000 (12:30 +0100)]
  http://bugzilla.scilab.org/16374

  Test file from 5.5.2: 135 kb despite it has been generated with
  a minimal example.

Change-Id: Ie3fbc2b9820fe00acd06bd2e07a71fc45a3ce036

scilab/CHANGES.md
scilab/modules/io/macros/%_sodload.sci
scilab/modules/io/tests/nonreg_tests/bug_16374.tst [new file with mode: 0644]
scilab/modules/io/tests/nonreg_tests/bug_16374_552.scg [new file with mode: 0644]

index 05c614b..1a52c35 100644 (file)
@@ -273,6 +273,7 @@ Bug Fixes
 * [#16366](https://bugzilla.scilab.org/16366): `plot([0 1], ":")` plotted a dash-dotted curve instead of a dotted one.
 * [#16369](https://bugzilla.scilab.org/16369): Right divisions / involving one or two sparse numerical matrices were no longer supported.
 * [#16370](https://bugzilla.scilab.org/16370): `msprintf()` did not handle LaTeX dollars anymore.
+* [#16374](https://bugzilla.scilab.org/16374): Any plot with datatips saved in Scilab 5.5 could not be loaded in Scilab 6.
 * [#16397](https://bugzilla.scilab.org/16397): display of long (real) column vectors was slow (regression).
 * [#16399](https://bugzilla.scilab.org/16399): `mtlb_zeros([])` was crashing Scilab.
 * [#16401](https://bugzilla.scilab.org/16401): global `external_object_java` class was crashing Scilab.
index b358b44..f95c3c9 100644 (file)
@@ -773,18 +773,24 @@ function varargout = %_sodload(%__varnameList__)
     //
     function h = createDatatip(datatipProperties)
 
-        fields = fieldnames(datatipProperties);
+        fields = fieldnames(datatipProperties)';
         fields(1) = [];
 
         tip_data = datatipProperties("data");
         h = datatipCreate(%POLYLINE, tip_data);
-
-        for i = 1:size(fields, "*")
-            if fields(i) == "data" then
-                continue;
+        for f = fields
+            if f == "data" then
+                continue
             end
-
-            set(h, fields(i), datatipProperties(fields(i)));
+            v = datatipProperties(f)
+            if f == "z_component" // up to 5.5.2: http://bugzilla.scilab.org/16374
+                if v=="on"
+                    [f, v] = ("display_components", "xyz")
+                else
+                    continue
+                end
+            end
+            set(h, f, v);
         end
     endfunction
 
diff --git a/scilab/modules/io/tests/nonreg_tests/bug_16374.tst b/scilab/modules/io/tests/nonreg_tests/bug_16374.tst
new file mode 100644 (file)
index 0000000..4fc06c8
--- /dev/null
@@ -0,0 +1,17 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2020 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- NO CHECK REF -->
+// <-- TEST WITH GRAPHIC -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/16374
+//
+// .scg files from Scilab 5 with datatips could not be loaded in Scilab 6
+assert_checktrue(execstr("load(""SCI/modules/io/tests/nonreg_tests/bug_16374_552.scg"")", "errcatch")==0);
+d = gce().children.datatips;
+assert_checkequal(d.display_components, ["xyz" ; "xy"]);
diff --git a/scilab/modules/io/tests/nonreg_tests/bug_16374_552.scg b/scilab/modules/io/tests/nonreg_tests/bug_16374_552.scg
new file mode 100644 (file)
index 0000000..aed5dd4
Binary files /dev/null and b/scilab/modules/io/tests/nonreg_tests/bug_16374_552.scg differ