主要内容

dismissAlertDialog

类: matlab.uitest.TestCase
命名空间: matlab.uitest

(不推荐)关闭图窗窗口中最前面的警报对话框

自 R2021a 起

不推荐使用 dismissAlertDialog。请改用 dismissDialog。有关更新代码的信息,请参阅版本历史记录

说明

dismissAlertDialog(testCase,fig) 关闭指定图窗窗口中最前面的警报对话框。

示例

输入参数

全部展开

测试用例,指定为 matlab.uitest.TestCase 对象。

目标图窗,指定为 matlab.ui.Figure 对象。图窗必须使用 uifigure 函数创建。

属性

Sealedtrue

要了解方法的属性,请参阅方法属性

示例

全部展开

创建一个模态警告对话框。在关闭该对话框之前,无法访问对话框后面的图窗。

fig = uifigure;
uialert(fig,"File not found","Invalid File")

A figure window behind an alert dialog box

创建一个交互式测试用例,并关闭警报对话框。对话框消失,该对话框后面的图窗重新处于可访问状态。

testCase = matlab.uitest.TestCase.forInteractiveUse;
testCase.dismissAlertDialog(fig)

A figure window after closing the alert dialog box

版本历史记录

在 R2021a 中推出

全部折叠