Main Content

matlab.uitest.unlock

Unlock figure locked by app testing framework

Description

matlab.uitest.unlock(fig) unlocks a figure that the app testing framework locked so that you can interact with the figure components.

example

Examples

collapse all

Create a class-based unit test that derives from matlab.uitest.TestCase and contains a keyboard statement.

classdef SimpleUITest < matlab.uitest.TestCase
    methods (Test)
        function test1(testCase)
            fig = uifigure;
            testCase.addTeardown(@delete,fig)
            button = uibutton(fig);
            keyboard;
        end
    end
end

Run the test. MATLAB® enters debug mode at the keyboard command. The figure is locked and you cannot interactively press the button.

runtests("SimpleUITest")

While in debug mode, unlock the figure. You can interact with the button.

K>> matlab.uitest.unlock(fig);

Continue execution of the test. The test completes and closes the figure during teardown.

K>> dbcont

Input Arguments

collapse all

Figure to unlock, specified as a figure handle or an array of figure handles. Each figure handle must correspond to a figure created with the uifigure function.

Example: fh

Example: [fh1 fh2]

Data Types: matlab.ui.Figure

Version History

Introduced in R2018a