帮助中心帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
类: matlab.uitest.TestCase 命名空间: matlab.uitest
对 UI 组件执行悬停手势
hover(testcase,comp)
hover(testcase,comp,location)
hover(testcase,comp) 对支持悬停手势的 UI 组件 comp 执行悬停手势。
testcase
comp
示例
hover(testcase,comp,location) 指定在组件内悬停的位置。如果不指定位置,MATLAB® 将悬停在 comp 的中心。
location
全部展开
matlab.uitest.TestCase
测试用例的实例,指定为 matlab.uitest.TestCase 对象。
测试期间要在其上悬停的组件,指定为支持悬停手势的 UI 组件对象。支持悬停手势的组件包括 Axes、UIAxes、PolarAxes、Panel 和 Figure 对象。
Axes
UIAxes
PolarAxes
Panel
Figure
axes
uipanel
polaraxes
uiaxes
uifigure
悬停位置,指定为悬停点的坐标:
坐标区和 UI 坐标区 - 1×2 或 1×3 数值数组,其中包含 x、y 以及可选的 z 坐标。
极坐标区 - 1×2 数值数组,其中包含 θ 和 r 坐标。
面板和 UI 图窗 - 1×2 数值数组,其中包含 x 和 y 坐标。指定悬停点的坐标,以组件左下角为起点测量(以像素为单位)。
示例: [32.5 13 0.25](UI 坐标区)
示例: [pi/2 0.5](极坐标区)
示例: [100 200](UI 图窗)
Sealed
true
要了解方法的属性,请参阅方法属性。
创建一个 UI 坐标区和一个交互式测试用例实例。
uiAx = uiaxes; testCase = matlab.uitest.TestCase.forInteractiveUse;
悬停在坐标区坐标 (0.2, 0.4) 定义的点上。
testCase.hover(uiAx,[0.2 0.4])
创建一个 UI 图窗和一个交互式测试用例实例。
uiFig = uifigure; testCase = matlab.uitest.TestCase.forInteractiveUse;
悬停在由像素坐标 (100, 200) 定义的点上。
testCase.hover(uiFig,[100 200])
您可以在针对面板的测试中执行悬停手势。
您可以在针对极坐标区上的测试中执行悬停手势。
uiaxes | uifigure | axes | polaraxes | press
press
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office