本文整理匯總了Java中android.support.test.uiautomator.UiObject.isChecked方法的典型用法代碼示例。如果您正苦於以下問題:Java UiObject.isChecked方法的具體用法?Java UiObject.isChecked怎麽用?Java UiObject.isChecked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.test.uiautomator.UiObject
的用法示例。
在下文中一共展示了UiObject.isChecked方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: changeDelayOnSwitchChanges
import android.support.test.uiautomator.UiObject; //導入方法依賴的package包/類
/**
* Test if the switch changes (for the start type) modifies well the delay field
*
* <i>If the switch for the start type is ON, the delay field is enabled.</i>
* <i>If the switch for the start type is OFF, the delay field is disabled.</i>
*/
@Test
public void changeDelayOnSwitchChanges(){
l(this, "@Test changeDelayOnSwitchChanges");
try {
UiObject startSwitch = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/sTypeOfStartDelayed")
);
UiObject delayField = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/etDelay")
);
// Check and uncheck the switch
for ( int i = 1; i <= 2; i++ ) {
startSwitch.click();
if (startSwitch.isChecked()) {
assertTrue(delayField.isEnabled());
} else {
assertFalse(delayField.isEnabled());
}
}
} catch ( UiObjectNotFoundException uonfe ){
uonfe.printStackTrace();
fail( uonfe.getMessage() );
}
}
示例2: changeRepeatOnCheckboxChanges
import android.support.test.uiautomator.UiObject; //導入方法依賴的package包/類
/**
* Test if the endless repeat checkbox changes modifies well the repeat field
*
* <i>If the check box for the endless repeat is checked, the repeat field is disabled</i>
* <i>If the check box for the endless repeat is unchecked, the repeat field is enabled</i>
*/
@Test
public void changeRepeatOnCheckboxChanges(){
l(this, "@Test changeRepeatOnCheckboxChanges");
try {
UiObject endlessCheckbox = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/scEndlessRepeat")
);
UiObject repeatField = mDevice.findObject(
new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/etRepeat")
);
// Check and uncheck the switch
for ( int i = 1; i <= 2; i++ ) {
endlessCheckbox.click();
if (endlessCheckbox.isChecked()) {
assertFalse(repeatField.isEnabled());
} else {
assertTrue(repeatField.isEnabled());
}
}
} catch ( UiObjectNotFoundException uonfe ){
uonfe.printStackTrace();
fail( uonfe.getMessage() );
}
}