annotate scripts/plot/util/allchild.m @ 21511:e1c5aca1c798

Fix failing tests when building with --without-opengl * graphics.cc, __osmesa_print__.cc, uimenu.m, allchild.m, findall.m, graphics_toolkit.m: Fix failing BIST tests when building with --without-opengl by adding HAVE_OPENGL to the test preconditions.
author Mike Miller <mtmiller@octave.org>
date Mon, 21 Mar 2016 15:01:12 -0700
parents 516bb87ea72e
children bac0d6f07a3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17868
diff changeset
1 ## Copyright (C) 2008-2015 Bill Denney
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
2 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
3 ## This file is part of Octave.
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
4 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
8 ## your option) any later version.
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
9 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
13 ## General Public License for more details.
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
14 ##
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
18
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
19 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20173
diff changeset
20 ## @deftypefn {} {@var{h} =} allchild (@var{handles})
9316
c539ec5726e7 Update some of Advanced Plotting documentation.
Rik <rdrider0-list@yahoo.com>
parents: 8262
diff changeset
21 ## Find all children, including hidden children, of a graphics object.
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
22 ##
17133
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
23 ## This function is similar to @code{get (h, "children")}, but also returns
20173
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 ## hidden objects (HandleVisibility = @qcode{"off"}).
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
25 ##
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 ## If @var{handles} is a scalar, @var{h} will be a vector. Otherwise,
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
27 ## @var{h} will be a cell matrix of the same size as @var{handles} and each
777f26aa8e3e doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19697
diff changeset
28 ## cell will contain a vector of handles.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 17119
diff changeset
29 ## @seealso{findall, findobj, get, set}
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
30 ## @end deftypefn
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
31
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
32 ## Author: Bill Denney <bill@denney.ws>
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
33
11469
c776f063fefe Overhaul m-script files to use common variable name between code and documentation.
Rik <octave@nomad.inbox5.com>
parents: 9316
diff changeset
34 function h = allchild (handles)
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
35
17133
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
36 if (nargin != 1)
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
37 print_usage ();
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
38 endif
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
39
8262
c44db9bad841 allchild.m: move get showhiddenhandles outside of unwind_protect block
John W. Eaton <jwe@octave.org>
parents: 7557
diff changeset
40 shh = get (0, "showhiddenhandles");
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
41 unwind_protect
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
42 set (0, "showhiddenhandles", "on");
13977
08ae07e40d4f Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
43 h = get (handles, "children");
7557
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
44 unwind_protect_cleanup
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
45 set (0, "showhiddenhandles", shh);
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
46 end_unwind_protect
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
47
2ba84879f961 allchild.m, findall.m: new functions
bill@denney.ws
parents:
diff changeset
48 endfunction
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
49
13977
08ae07e40d4f Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
50
21511
e1c5aca1c798 Fix failing tests when building with --without-opengl
Mike Miller <mtmiller@octave.org>
parents: 20852
diff changeset
51 %!testif HAVE_OPENGL, HAVE_FLTK
17107
dbd64c9a16da Restore graphics toolkit after %!tests that alter it.
Rik <rik@octave.org>
parents: 14868
diff changeset
52 %! toolkit = graphics_toolkit ("fltk");
17119
bd50e0660545 test: Add missing semicolons to suppress output in some plot %!tests.
Rik <rik@octave.org>
parents: 17107
diff changeset
53 %! hf = figure ("visible", "off");
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 13124
diff changeset
54 %! unwind_protect
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
55 %! l = line;
17133
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
56 %! kids = allchild (hf);
17868
da3586730ea0 Remove Help menu from FLTK menubar.
Rik <rik@octave.org>
parents: 17744
diff changeset
57 %! assert (get (kids, "type"), {"axes"; "uimenu"; "uimenu"});
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
58 %! unwind_protect_cleanup
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
59 %! close (hf);
13977
08ae07e40d4f Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
60 %! graphics_toolkit (toolkit);
13096
5553412c6614 Tests for scripts/plot
Kai Habel <kai.habel@gmx.de>
parents: 11523
diff changeset
61 %! end_unwind_protect
13977
08ae07e40d4f Only run uimenu tests if FLTK toolkit is available (Bug #34908)
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
62
17133
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
63 %!error allchild ()
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
64 %!error allchild (1, 2)
04c3d56e007a allchild.m: Add input validation, %!test blocks, and more documentation.
Rik <rik@octave.org>
parents: 17122
diff changeset
65