Mercurial > hg > octave-lojdl
changeset 13215:cb8fd692b600
Add tests for scripts/plot
(plot/uigetdir.m, plot/uigetfile.m, plot/uiputfile.m, plot/uimenu.m): Add tests.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Sun, 25 Sep 2011 19:11:02 +0200 |
parents | 7715aca4bce1 |
children | 434e227b100b |
files | scripts/plot/uigetdir.m scripts/plot/uigetfile.m scripts/plot/uimenu.m scripts/plot/uiputfile.m |
diffstat | 4 files changed, 50 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/uigetdir.m +++ b/scripts/plot/uigetdir.m @@ -51,3 +51,7 @@ %!demo %! uigetdir(pwd, "Select Directory") + +## Remove from test statistics. No real tests possible. +%!test +%! assert (1);
--- a/scripts/plot/uigetfile.m +++ b/scripts/plot/uigetfile.m @@ -159,3 +159,7 @@ %!demo %! uigetfile({"*.gif;*.png;*.jpg", "Supported Picture Formats"}) + +## Remove from test statistics. No real tests possible. +%!test +%! assert (1);
--- a/scripts/plot/uimenu.m +++ b/scripts/plot/uimenu.m @@ -108,3 +108,41 @@ %! e = uimenu("label", "&Edit", "accelerator", "e"); %! uimenu(f, "label", "Close", "accelerator", "q", "callback", "close (gcf)"); %! uimenu(e, "label", "Toggle &Grid", "accelerator", "g", "callback", "grid (gca)"); + +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! ui = uimenu ("label", "mylabel"); +%! assert (findobj (hf, "type", "uimenu"), ui); +%! assert (get (ui, "label"), "mylabel"); +%! assert (get (ui, "checked"), "off"); +%! assert (get (ui, "separator"), "off"); +%! assert (get (ui, "enable"), "on"); +%! assert (get (ui, "position"), 9); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%% check for top level menus file, edit, and help +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! uif = findall (hf, "label", "&file"); +%! assert (ishghandle (uif)) +%! uie = findall (hf, "label", "&edit"); +%! assert (ishghandle (uie)) +%! uih = findall (hf, "label", "&help"); +%! assert (ishghandle (uih)) +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! uie = findall (hf, "label", "&edit") +%! myui = uimenu (uie, "label", "mylabel"); +%! assert (ancestor (myui, "uimenu", "toplevel"), uie) +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect