java direction_Java Direction类代码示例
import android.support.test.uiautomator.Direction; //导入依赖的package包/类
/**
* Navigates through the focus items in a container returning the container child that has a
* descendant matching the {@code selector}.
*
* The navigation starts in the {@code direction} specified and
* {@link Direction#reverse(Direction) reverses} once if needed. Fails if there is not a
* focused
* descendant, or if after completing both directions no focused child has a descendant
* matching
* {@code selector}.
*
* Fails if the menu item can not be navigated to.
*
* @param uiDevice the device under test.
* @param container contains children to navigate over.
* @param selector the selector for the object to navigate to.
* @param direction the direction to start navigating.
* @return the object navigated to.
*/
public static UiObject2 assertNavigateTo(UiDevice uiDevice, UiObject2 container,
BySelector selector, Direction direction) {
int count = 0;
while (count < 2) {
BySelector hasFocusedDescendant = By.hasDescendant(FOCUSED_VIEW);
UiObject2 focusedChild = null;
SearchCondition untilHasFocusedDescendant = Until
.hasObject(hasFocusedDescendant);
boolean result = container.wait(untilHasFocusedDescendant,
UiObject2Asserts.getAdjustedTimeout(Constants.MAX_SHOW_DELAY_MILLIS));
if (!result) {
// HACK: Try direction anyways because play control does not always have a
// focused item.
UiDeviceUtils.pressDpad(uiDevice, direction);
UiObject2Asserts.assertWaitForCondition(container, untilHasFocusedDescendant);
}
for (UiObject2 c : container.getChildren()) {
if (c.isFocused() || c.hasObject(hasFocusedDescendant)) {
focusedChild = c;
break;
}
}
if (focusedChild == null) {
Assert.fail("No focused item found in container " + container);
}
if (focusedChild.hasObject(selector)) {
return focusedChild;
}
if (!UiObject2Utils.hasSiblingInDirection(focusedChild, direction)) {
direction = Direction.reverse(direction);
count++;
}
UiDeviceUtils.pressDpad(uiDevice, direction);
}
Assert.fail("Could not find item with " + selector);
return null;
}
java direction_Java Direction类代码示例相关推荐
- java dataconvert_Java DateConverter类代码示例
import org.apache.commons.beanutils.converters.DateConverter; //导入依赖的package包/类 /** * Register array ...
- java parseexception_Java ParseException类代码示例
import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException; //导入依赖的package包/类 @Overri ...
- java link_Java Link类代码示例
import org.nodes.Link; //导入依赖的package包/类 public static double sizeBetaCopying(DGraph graph, DGraph s ...
- java bar_Java Bar类代码示例
import com.db.chart.model.Bar; //导入依赖的package包/类 @Override protected void onCreate(Bundle savedInsta ...
- java backoff_Java BackOff类代码示例
import org.apache.beam.sdk.util.BackOff; //导入依赖的package包/类 /** * Writes a batch of mutations to Clou ...
- java widget_Java FavoritesWidget类代码示例
import com.google.gwt.sample.dynatablerf.client.widgets.FavoritesWidget; //导入依赖的package包/类 /** * Thi ...
- java plugin_Java Plugin类代码示例
import org.apache.logging.log4j.core.config.plugins.Plugin; //导入依赖的package包/类 /** * @since 2.1 */ pu ...
- java jsonresult_Java JsonResult类代码示例
import eu.socialsensor.framework.client.search.visual.JsonResultSet.JsonResult; //导入依赖的package包/类 @O ...
- postgresql java demo_Java PostgreSQL9Dialect类代码示例
import org.hibernate.dialect.PostgreSQL9Dialect; //导入依赖的package包/类 private void addDialects(Strategy ...
最新文章
- java 网络编程简单聊天_网络编程之 TCP 实现简单聊天
- AWS SDK for Java 2.0 使用的基础入门
- [转]史上最全的CSS hack方式一览
- python -- join()
- 已经没有再谈话再培养的飞秋必要了
- 前端:JS/19/特殊运算符,运算符优先级,if条件判断语句,switch分支语句,while循环语句,for循环语句,break和continue循环控制语句,实例:九九乘法表
- 【C#】读取Excel中嵌套的Json对象,Json带斜杠的问题(其三)
- PHP开发入行真功夫(含DVD光盘1张)
- MyEclipse取消验证Js的两种方法
- hdu 1698 Just a Hook
- 算法交流:分享我的一个算法,实现项目需求
- 软件各项会议评审意见模版
- 客服坐席聊天页面html,WebSocket实现简单客服聊天系统
- 如何使用百度统计监测网站流量
- 捋一捋Kafka中的消费者API
- 字节题--雀魂启动!
- 最新车载以太网解决方案,你知多少?
- 线性回归中的L1与L2正则化
- JAVA-动态代理和AOP
- information about btcoin
热门文章
- 【乐鑫ESP32】腾讯云平台项目创建以及MQTT协议连接
- 计算机毕设(附源码)JAVA-SSM金牛社区疫情防控系统
- HoloLens增强现实: Vuforia + Unity3D + SolidWorks + 3ds Max 的一个例子 (网络摄像头也可以)
- 基于Matlab实现微波带低通高通带通滤波器设计
- 比程序员更好的职业_立即成为更好的程序员的20条技巧
- python内置模块re_13.python内置模块之re模块
- 校园广播系统应用案例-柴达木职业技术学院
- smba简单设置共享
- 影响PCB电路板焊接质量的原因有哪些?
- JetBrains系列pycharm等设置主题皮肤