From: steer Date: Wed, 30 Nov 2011 16:13:15 +0000 (+0100) Subject: bug 10298 fixed - Example of datatipSetDisplay generated an error. X-Git-Tag: 5.4.0-alpha-1~68 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=9459361f0d7982ae9afc1d0f906f33ec5b78c1ab;hp=c96cce8b415437f794eda2edb7891ce8de14ce6c bug 10298 fixed - Example of datatipSetDisplay generated an error. Change-Id: If2b644530d139d703e2b8e4e0ecde3a70881b58b --- diff --git a/scilab/CHANGES_5.4.X b/scilab/CHANGES_5.4.X index 64cfba7..ff80b6c 100644 --- a/scilab/CHANGES_5.4.X +++ b/scilab/CHANGES_5.4.X @@ -587,6 +587,7 @@ Graphics: * bug 10121 fixed - polyline.interp_color_vector where not saved/recoverabled by xsave/xload. Thanks to Samuel Gougeon for the fix. +* bug 10298 fixed - Example of datatipSetDisplay generated an error. ATOMS: ====== diff --git a/scilab/modules/graphics/macros/datatips/datatipSetDisplay.sci b/scilab/modules/graphics/macros/datatips/datatipSetDisplay.sci index 8cf052e..a3a2382 100644 --- a/scilab/modules/graphics/macros/datatips/datatipSetDisplay.sci +++ b/scilab/modules/graphics/macros/datatips/datatipSetDisplay.sci @@ -36,12 +36,12 @@ function datatipSetDisplay(curve_handle,fun) if ~datatipCheckFunction(fun) then return,end ds.formatfunction=fun datatipSetStruct(curve_handle,ds) - for k=1:size(ds.tips,'*') - tip_handle=ds.tips(k) - point_handle=tip_handle.children(1) - string_handle=tip_handle.children(2) + for k=1:size(ds.tips.children,'*') + tip_handle=ds.tips.children(k) + point_handle=tip_handle.children(1); + string_handle=tip_handle.children(2); tip_index=point_handle.user_data(2) - string_handle.text=fun(curve_handle,point_handle.data) + string_handle.text=fun(curve_handle,point_handle.data,tip_index) datatipSetTipStyle(tip_handle,ds.style) end diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_10298.dia.ref b/scilab/modules/graphics/tests/nonreg_tests/bug_10298.dia.ref new file mode 100644 index 0000000..7944a39 --- /dev/null +++ b/scilab/modules/graphics/tests/nonreg_tests/bug_10298.dia.ref @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - INRIA - Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- TEST WITH GRAPHIC --> +// <-- Non-regression test for bug 10298 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10298 +// +// <-- Short Description --> +// Example of datatipSetDisplay generates an error +x=linspace(-1,1,1000); +clf() +plot(x,sinc(20*x),x,1-x^2); +e=gce();e=e.children; +d21=datatipCreate(e(2),600); +d22=datatipCreate(e(2),200); +d1=datatipCreate(e(1),700); +function str=mydisplay(curve, pt, index) + str=msprintf('sinc(%-0.2g)=%-0.2g', 20*pt(1),pt(2)) +endfunction +assert_checktrue(execstr("datatipSetDisplay(e(2),mydisplay)","errcatch")==0); diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_10298.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_10298.tst new file mode 100644 index 0000000..d7f09f5 --- /dev/null +++ b/scilab/modules/graphics/tests/nonreg_tests/bug_10298.tst @@ -0,0 +1,30 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2011 - INRIA - Serge Steer +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= + +// <-- TEST WITH GRAPHIC --> + +// <-- Non-regression test for bug 10298 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=10298 +// +// <-- Short Description --> +// Example of datatipSetDisplay generates an error + +x=linspace(-1,1,1000); +clf() +plot(x,sinc(20*x),x,1-x^2); +e=gce();e=e.children; +d21=datatipCreate(e(2),600); +d22=datatipCreate(e(2),200); +d1=datatipCreate(e(1),700); + +function str=mydisplay(curve, pt, index) + str=msprintf('sinc(%-0.2g)=%-0.2g', 20*pt(1),pt(2)) +endfunction +assert_checktrue(execstr("datatipSetDisplay(e(2),mydisplay)","errcatch")==0); +