Bug 13510 fixed: Datatip callback cleared 'd' 34/14834/3
Calixte DENIZET [Wed, 9 Jul 2014 13:01:26 +0000 (15:01 +0200)]
Change-Id: If745552e7a13439acd47b79201ed8ecfbf39d179

scilab/CHANGES_5.5.X
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/datatip/Datatip.java
scilab/modules/graphic_objects/tests/nonreg_tests/bug_13510.dia.ref [new file with mode: 0644]
scilab/modules/graphic_objects/tests/nonreg_tests/bug_13510.tst [new file with mode: 0644]

index 32789bb..94452ee 100644 (file)
@@ -166,6 +166,8 @@ Scilab Bug Fixes
 
 * Bug #13509 fixed - It was not possible to have an empty prefix with xmlNs.
 
+* Bug #13510 fixed - Datatip callback cleared 'd'.
+
 
 Xcos Bug Fixes
 ==============
index 14813fd..8194544 100755 (executable)
@@ -350,14 +350,14 @@ public class Datatip extends Text {
 
         String errMsg =  Messages.gettext("Wrong value for ''%s'' property: A valid function name expected.\n");
         String updateCommand = "try;" +
-                               "    d = getcallbackobject(" + getIdentifier() + ");" +
-                               "    d.text = " + fnc + "(d);" +
-                               "    clear(\"d\");" +
+                               "GDZa786XBSq7899SHKp=getcallbackobject(" + getIdentifier() + ");" +
+                               "set(GDZa786XBSq7899SHKp,\"text\"," + fnc + "(GDZa786XBSq7899SHKp));" +
+                               "clear(\"GDZa786XBSq7899SHKp\");" +
                                "catch;" +
-                               "    d.display_function = \"\";" +
-                               "    d.parent.display_function = \"\";" +
-                               "    clear(\"d\");" +
-                               "    error(msprintf(\"" + errMsg + "\", \"display_function\"));" +
+                               "set(GDZa786XBSq7899SHKp,\"display_function\",\"\");" +
+                               "set(GDZa786XBSq7899SHKp.parent,\"display_function\",\"\");" +
+                               "clear(\"GDZa786XBSq7899SHKp\");" +
+                               "error(msprintf(\"" + errMsg + "\", \"display_function\"));" +
                                "end;";
         InterpreterManagement.requestScilabExec(updateCommand);
     }
diff --git a/scilab/modules/graphic_objects/tests/nonreg_tests/bug_13510.dia.ref b/scilab/modules/graphic_objects/tests/nonreg_tests/bug_13510.dia.ref
new file mode 100644 (file)
index 0000000..e4288fe
--- /dev/null
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 13510 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13510
+//
+// <-- Short Description -->
+// Datatip callback cleared 'd'
+clear("pl", "ax", "h", "s", "d", "d1");
+s = poly(0,"s");
+h = syslin("c", 1 / (s + 1));
+nyquist(h);
+d = 123;
+ax = gca();
+pl = ax.children(1).children(2);
+d1 = datatipCreate(pl, 200);
+assert_checkequal(d, 123);
diff --git a/scilab/modules/graphic_objects/tests/nonreg_tests/bug_13510.tst b/scilab/modules/graphic_objects/tests/nonreg_tests/bug_13510.tst
new file mode 100644 (file)
index 0000000..9da575f
--- /dev/null
@@ -0,0 +1,28 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Calixte DENIZET
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 13510 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13510
+//
+// <-- Short Description -->
+// Datatip callback cleared 'd'
+
+clear("pl", "ax", "h", "s", "d", "d1");
+s = poly(0,"s");
+h = syslin("c", 1 / (s + 1));
+nyquist(h);
+
+d = 123;
+ax = gca();
+pl = ax.children(1).children(2);
+d1 = datatipCreate(pl, 200);
+
+assert_checkequal(d, 123);
\ No newline at end of file