Mercurial > octave
comparison libinterp/corefcn/graphics.cc @ 28563:5a07c798eb08
avoid function call input or output argument number mismatch
Don't call functions with more inputs or outputs than they are defined
to accept. For example, always define graphics callback functions to
accept at least two arguments. To avoid creating unused variable
names, they may be defined as ignored (~).
* importdata.m: Call fileparts with three outputs, not four.
* inputParser.m: Define default validation function with ignored input.
* odemergeopts.m: Accept additional SOLVER argument.
* annotation.m, legend.m, movfun.m, bug-55321.tst: Define callback
functions with two inputs.
* annotation.m (addbasemenu): Also accept varargin.
* graphics.cc: Fix tests.
* pkg/private/install.m: Don't pass extra global_install argument to
getarchdir.
* sparse/private/__alltohandles__.m: Define function handles with two
inputs where needed.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 11 Jul 2020 10:15:57 -0400 |
parents | aabfd3f51d0b |
children | ffdb29f7baab |
comparison
equal
deleted
inserted
replaced
28562:b0b80efecea1 | 28563:5a07c798eb08 |
---|---|
3610 ## test current callback object have visible handle | 3610 ## test current callback object have visible handle |
3611 %!test | 3611 %!test |
3612 %! hf = figure ("handlevisibility", "off", "visible", "off"); | 3612 %! hf = figure ("handlevisibility", "off", "visible", "off"); |
3613 %! hax = axes ("parent", hf, "handlevisibility", "off"); | 3613 %! hax = axes ("parent", hf, "handlevisibility", "off"); |
3614 %! unwind_protect | 3614 %! unwind_protect |
3615 %! fcn = @(h) setappdata (h, "testdata", gcbo ()); | 3615 %! fcn = @(h, ~) setappdata (h, "testdata", gcbo ()); |
3616 %! addlistener (hf, "color", fcn); | 3616 %! addlistener (hf, "color", fcn); |
3617 %! addlistener (hax, "color", fcn); | 3617 %! addlistener (hax, "color", fcn); |
3618 %! set (hf, "color", "b"); | 3618 %! set (hf, "color", "b"); |
3619 %! set (hax, "color", "b"); | 3619 %! set (hax, "color", "b"); |
3620 %! assert (getappdata (hf, "testdata"), hf) | 3620 %! assert (getappdata (hf, "testdata"), hf) |
12472 } | 12472 } |
12473 | 12473 |
12474 | 12474 |
12475 /* | 12475 /* |
12476 ## Test interruptible/busyaction properties | 12476 ## Test interruptible/busyaction properties |
12477 %!function cb (h) | 12477 %!function cb (h, ~) |
12478 %! setappdata (gcbf (), "cb_exec", [getappdata(gcbf (), "cb_exec") h]); | 12478 %! setappdata (gcbf (), "cb_exec", [getappdata(gcbf (), "cb_exec") h]); |
12479 %! drawnow (); | 12479 %! drawnow (); |
12480 %! setappdata (gcbf (), "cb_exec", [getappdata(gcbf (), "cb_exec") h]); | 12480 %! setappdata (gcbf (), "cb_exec", [getappdata(gcbf (), "cb_exec") h]); |
12481 %!endfunction | 12481 %!endfunction |
12482 %! | 12482 %! |