Main Content

hover

Class: matlab.uitest.TestCase
Namespace: matlab.uitest

Perform hover gesture on UI component

Description

hover(testCase,comp) performs a hover gesture on the UI component comp that supports this gesture.

hover(testCase,comp,location) specifies the location to hover at within the component. If you do not specify the location, MATLAB® hovers at the center of comp.

example

Input Arguments

expand all

Test case, specified as a matlab.uitest.TestCase object.

Component to hover on during test, specified as a UI component object that supports a hover gesture. Components that support hover gestures include Axes, UIAxes, PolarAxes, Panel, and Figure objects.

Supported ComponentTypical Creation Function
Axesaxes
Paneluipanel
Polar Axespolaraxes
UI Axesuiaxes
UI Figureuifigure

Location to hover at, specified as the coordinates of the hover point:

  • Axes and UI Axes — A 1-by-2 or 1-by-3 numeric array containing x-, y-, and optionally z-coordinates.

  • Polar Axes — A 1-by-2 numeric array containing θ- and r-coordinates.

  • Panel — A 1-by-2 numeric array containing x- and y-coordinates. Specify the coordinates of the point measured in pixels from the lower-left corner of the component.

  • UI Figure — A 1-by-2 numeric array containing x- and y-coordinates. Specify the coordinates of the point from the lower-left corner of the component.

Example: [32.5 13 0.25] (UI axes)

Example: [pi/2 0.5] (Polar axes)

Example: [100 200] (UI figure)

Attributes

Sealedtrue

To learn about attributes of methods, see Method Attributes.

Examples

expand all

Create a UI axes and an interactive test case instance.

uiAx = uiaxes;
testCase = matlab.uitest.TestCase.forInteractiveUse;

Hover over the point defined by the axes coordinates (0.2, 0.4).

testCase.hover(uiAx,[0.2 0.4])

Create a UI figure and an interactive test case instance.

uiFig = uifigure;
testCase = matlab.uitest.TestCase.forInteractiveUse;

Hover over the point defined by the pixel coordinates (100, 200).

testCase.hover(uiFig,[100 200])

Version History

Introduced in R2019a

expand all