MATLAB 帮助中心
解锁被 App 测试框架锁定的图窗
matlab.uitest.unlock(fig)
matlab.uitest.unlock(fig) 解锁被 App 测试框架锁定的图窗,使您能够与图窗组件进行交互。
fig
示例
全部折叠
创建一个从 matlab.uitest.TestCase 派生的基于类的单元测试,并在其中包含 keyboard 语句。
matlab.uitest.TestCase
keyboard
classdef SimpleUITest < matlab.uitest.TestCase methods (Test) function test1(testCase) fig = uifigure; testCase.addTeardown(@delete,fig) button = uibutton(fig); keyboard; end end end
运行测试。MATLAB® 在执行 keyboard 命令时进入调试模式。图窗被锁定,您无法以交互方式按下按钮。
runtests("SimpleUITest")
在调试模式下解锁图窗。之后便可以与按钮进行交互了。
K>> matlab.uitest.unlock(fig);
继续执行测试。测试完成并在拆解过程中关闭图窗。
K>> dbcont
要解锁的图窗,指定为图窗句柄或图窗句柄数组。每个图窗句柄必须对应于使用 uifigure 函数创建的一个图窗。
uifigure
示例: fh
fh
示例: [fh1 fh2]
[fh1 fh2]
数据类型: matlab.ui.Figure
matlab.ui.Figure
在 R2018a 中推出
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处