Turn off UIFigure visibility during unit test
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rich006
am 8 Okt. 2025 um 13:25
Beantwortet: Adam Danz
am 13 Okt. 2025 um 17:29
How can I run unit tests on an app without displaying the UIFigure during the tests? Rendering the graphics makes the tests take 10 times longer.
classdef UI < matlab.apps.AppBase
...
end
classdef tUI < matlab.uitest.TestCase
...
% many tests involving UI gestures
...
end
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 13 Okt. 2025 um 17:29
Interaction tests using press, drag, etc, require figure visibility to be on in the App Testing Framework.
Make sure you're not unnecessarily creating/destroying the uifigure repeatedly between tests. In most cases, the figure/app only needs to be generated once during TestClassSetup and removed via a teardown. Reducinge the figure size may also help with performance.
0 Kommentare
Weitere Antworten (1)
Anjaneyulu Bairi
am 13 Okt. 2025 um 9:20
Hi,
In your code, you can create a function which turn on/off the visibilty of the figures. See the below code for example
function app = TurnOff(fig)
fig.Visible = 'off';
end
This way, you can show or hide any figure by changing its Visible property.
Hope this helps
Siehe auch
Kategorien
Mehr zu App Testing Framework finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!