當前位置: 首頁>>代碼示例>>Java>>正文


Java UiObject.swipeUp方法代碼示例

本文整理匯總了Java中android.support.test.uiautomator.UiObject.swipeUp方法的典型用法代碼示例。如果您正苦於以下問題:Java UiObject.swipeUp方法的具體用法?Java UiObject.swipeUp怎麽用?Java UiObject.swipeUp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.test.uiautomator.UiObject的用法示例。


在下文中一共展示了UiObject.swipeUp方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: credits

import android.support.test.uiautomator.UiObject; //導入方法依賴的package包/類
/**
 * Test if the item about credits in the Settings activity starts the credits activity
 */
@Test
public void credits(){

    l(this, "@Test credits");

    try {

        // Swipe to the bottom of the view to get the credits field
        UiObject list = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.ListView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/list")
        );
        list.swipeUp(100);
        list.swipeUp(100);

        // Clicks on the credits row
        String s = InstrumentationRegistry.getTargetContext().getString(R.string.pref_key_credit_title);
        UiObject creditsRow = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.TextView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/title")
                        .text(s)
        );
        creditsRow.click();
        w(1000);

        assertEquals(CreditsActivity.class.getSimpleName(), getActivityInstance().getClass().getSimpleName());

    } catch ( UiObjectNotFoundException uonfe ){
        fail(uonfe.getMessage());
        uonfe.printStackTrace();
    }

}
 
開發者ID:pylapp,項目名稱:SmoothClicker,代碼行數:41,代碼來源:ItSettingsActivity.java

示例2: longClickOnArcMenuNewPointItem

import android.support.test.uiautomator.UiObject; //導入方法依賴的package包/類
/**
 * Tests the long clicks on the floating action button for new point in the arc menu
 *
 * <i>A long click on the button to use to add points to click on should display a snackbar with an explain message</i>
 */
@Test
public void longClickOnArcMenuNewPointItem(){

    l(this, "@Test longClickOnArcMenuNewPointItem");

    String expectedString = InstrumentationRegistry.getTargetContext().getString(R.string.info_message_new_point);
    try {

        /*
         * Display the floating action buttons in the arc menu
         */
        UiObject arcMenu = mDevice.findObject(
                new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/fabAction")
        );
        arcMenu.click();
        arcMenu.waitForExists(WAIT_FOR_EXISTS_TIMEOUT);

        /*
         * The floating action button
         */
        UiObject fab = mDevice.findObject(
                new UiSelector().resourceId(PACKAGE_APP_PATH+":id/fabSelectPoint")
        );
        fab.waitForExists(WAIT_FOR_EXISTS_TIMEOUT);
        assertTrue(fab.isLongClickable());
        fab.swipeUp(100); //fab.longClick() makes clicks sometimes, so swipeUp() is a trick to make always a longclick
        UiObject snack = mDevice.findObject(
                new UiSelector().resourceId(PACKAGE_APP_PATH + ":id/snackbar_text")
        );

        assertEquals(expectedString, snack.getText());

    } catch ( UiObjectNotFoundException uonfe ){
        uonfe.printStackTrace();
        fail( uonfe.getMessage() );
    }

}
 
開發者ID:pylapp,項目名稱:SmoothClicker,代碼行數:44,代碼來源:ItClickerActivity.java

示例3: help

import android.support.test.uiautomator.UiObject; //導入方法依賴的package包/類
/**
 * Test if the item about help in the Settings activity starts the intro screens activity
 */
@Test
public void help(){

    l(this, "@Test help");

    try {

        // Swipe to the bottom of the view to get the credits field in an inner preference screen
        UiObject list = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.ListView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/list")
        );

        list.swipeUp(100);
        list.swipeUp(100);

        String innerPreferenceScreenTitle = InstrumentationRegistry.getTargetContext().getString(R.string.pref_about_subtitle);
        UiObject aboutRow = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.TextView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/title")
                        .text(innerPreferenceScreenTitle)
        );
        aboutRow.click();

        // Clicks on the credits row
        String s = InstrumentationRegistry.getTargetContext().getString(R.string.pref_key_help_title);
        UiObject helpRow = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.TextView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/title")
                        .text(s)
        );
        helpRow.click();
        w(1000);

        assertEquals(IntroScreensActivity.class.getSimpleName(), getActivityInstance().getClass().getSimpleName());

    } catch ( UiObjectNotFoundException uonfe ){
        fail(uonfe.getMessage());
        uonfe.printStackTrace();
    }

}
 
開發者ID:pylapp,項目名稱:SmoothClicker,代碼行數:52,代碼來源:ItSettingsActivity.java

示例4: filesNames

import android.support.test.uiautomator.UiObject; //導入方法依賴的package包/類
/**
 * Tests the files names fields
 *
 * <i>If we change the name of the file in sue, we have to see the summary of the dedicated field be updated</i>
 */
@Test
public void filesNames(){

    l(this, "@Test filesNames");

    try {

        // Swipe to the bottom of the view to get the fields field in an inner preference screen
        UiObject list = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.ListView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/list")
        );

        list.swipeUp(100);

        String innerPreferenceScreenTitle = InstrumentationRegistry.getTargetContext().getString(R.string.pref_app_files_title);
        UiObject filesRow = mDevice.findObject(
                new UiSelector()
                        .className("android.widget.TextView")
                        .packageName(PACKAGE_APP_PATH)
                        .resourceId("android:id/title")
                        .text(innerPreferenceScreenTitle)
        );
        filesRow.click();

        // Update the name of file containing the points
        testFieldWithName(0, InstrumentationRegistry.getTargetContext().getString(R.string.pref_app_files_points_name));
        // Update the name of file containing the config
        testFieldWithName(1, InstrumentationRegistry.getTargetContext().getString(R.string.pref_app_files_config_name));
        // Update the name of file containing the unlock script
        testFieldWithName(2, InstrumentationRegistry.getTargetContext().getString(R.string.pref_app_files_unlock_name));
        // Update the name of file containing the picture
        testFieldWithName(3, InstrumentationRegistry.getTargetContext().getString(R.string.pref_app_files_trigger_name));

    } catch ( UiObjectNotFoundException uonfe ){
        uonfe.printStackTrace();
        fail(uonfe.getMessage());
    }

}
 
開發者ID:pylapp,項目名稱:SmoothClicker,代碼行數:48,代碼來源:ItSettingsActivity.java


注:本文中的android.support.test.uiautomator.UiObject.swipeUp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。