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


Java Solo類代碼示例

本文整理匯總了Java中com.robotium.solo.Solo的典型用法代碼示例。如果您正苦於以下問題:Java Solo類的具體用法?Java Solo怎麽用?Java Solo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
public void setUp() throws Exception {

        Profile profile = new TestProfile("xyz");
        Habit habit = new Habit("T1", "", new Date(), Arrays.asList(1, 2, 3), "x");
        habit.setId("one");
        habit.addHabitEvent(new HabitEvent(""));
        habit.getEvents().get(0).setId("two");

        profile.addHabit(habit);
        Habit habit2 = new Habit("T2", "", new Date(), Arrays.asList(1, 2, 3), "y");
        habit2.setId("two");
        profile.addHabit(habit2);

        Intent intent = new Intent();
        intent.putExtra(HomeTabbedActivity.ID_PROFILE, profile);
        setActivityIntent(intent);

        solo = new Solo(getInstrumentation(), getActivity());
        Log.d("SETUP", "setUp()");
    }
 
開發者ID:CMPUT301F17T15,項目名稱:CIA,代碼行數:21,代碼來源:ViewHabitIntentTests.java

示例2: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
public void setUp() throws Exception {

        List<Integer> allDays = new ArrayList<>();
        for (int i = 1; i <= 7; ++i){
            allDays.add(i);
        }

        Profile profile = new TestProfile("xyz");
        Habit habit = new Habit("T1", "", new Date(), allDays, "");
        habit.setId("one");
        profile.setFirstTimeUse(false);
        profile.addHabit(habit);

        Habit habit2 = new Habit("T55", "", new Date(), allDays, "");
        habit2.setId("h2");
        profile.addHabit(habit2);

        Intent intent = new Intent();
        intent.putExtra(HomeTabbedActivity.ID_PROFILE, profile);
        setActivityIntent(intent);

        solo = new Solo(getInstrumentation(), getActivity());
        Log.d("SETUP", "setUp()");

    }
 
開發者ID:CMPUT301F17T15,項目名稱:CIA,代碼行數:26,代碼來源:CreateHabitEventIntentTests.java

示例3: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
public void setUp() throws Exception {

        List<Integer> allDays = new ArrayList<>();
        for (int i = 1; i <= 7; ++i){
            allDays.add(i);
        }

        Profile profile = new TestProfile("xyz");
        Habit habit = new Habit("T1", "", new Date(), allDays, "");
        habit.setId("one");
        profile.addHabit(habit);

        Habit habit2 = new Habit("T55", "", new Date(), allDays, "");
        habit2.setId("h2");
        habit2.addHabitEvent(new HabitEvent("one"));
        profile.addHabit(habit2);

        Intent intent = new Intent();
        intent.putExtra(HistoryActivity.ID_PROFILE, profile);
        setActivityIntent(intent);

        solo = new Solo(getInstrumentation(), getActivity());
        Log.d("SETUP", "setUp()");

        solo.sleep(1000);
        solo.clickOnButton("Habits");
        solo.sleep(2000);
    }
 
開發者ID:CMPUT301F17T15,項目名稱:CIA,代碼行數:29,代碼來源:FilterEventsIntentTests.java

示例4: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
public void setUp() throws Exception {

        List<Integer> allDays = new ArrayList<>();
        for (int i = 1; i <= 7; ++i){
            allDays.add(i);
        }

        Profile profile = new TestProfile("xyz");
        Habit habit = new Habit("T1", "", new Date(), allDays, "x");
        habit.setId("one");
        profile.addHabit(habit);

        Habit habit2 = new Habit("T55", "", new Date(), allDays, "y");
        habit2.setId("h2");
        profile.addHabit(habit2);

        Intent intent = new Intent();
        intent.putExtra(StatisticActivity.ID_USER, profile);
        setActivityIntent(intent);

        solo = new Solo(getInstrumentation(), getActivity());
        Log.d("SETUP", "setUp()");
    }
 
開發者ID:CMPUT301F17T15,項目名稱:CIA,代碼行數:24,代碼來源:StatisticsIntentTests.java

示例5: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
/**Runs before starting tests
 *
 * @throws Exception
 */
public void setUp() throws Exception{
    // get user info
    ElasticSearchController.GetUser getUser = new ElasticSearchController.GetUser();
    getUser.execute("tatata");
    UserAccount user = new UserAccount("tatata","tatata",null);
    try {
        user = getUser.get().get(0);
    }
    catch (Exception e) {
        //nothing here
    }
    HabitUpApplication.setCurrentUser(user);

    solo = new Solo(getInstrumentation(),getActivity());
}
 
開發者ID:CMPUT301F17T29,項目名稱:HabitUp,代碼行數:20,代碼來源:EditProfileActivityTest.java

示例6: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
/**Runs before starting tests
 *
 * @throws Exception
 */
public void setUp() throws Exception{
    // get user info
    UserAccount user = new UserAccount("tatata2", "tatata2", null);
    ElasticSearchController.GetUser getUser = new ElasticSearchController.GetUser();
    getUser.execute("tatata2");

    try {
        user = getUser.get().get(0);
    } catch (Exception e) {
        HabitUpApplication.addUserAccount(user);
    }

    HabitUpApplication.setCurrentUser(user);

    solo = new Solo(getInstrumentation(),getActivity());
}
 
開發者ID:CMPUT301F17T29,項目名稱:HabitUp,代碼行數:21,代碼來源:ViewHabitEventActivityTest.java

示例7: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
public void setUp() throws Exception {
    // get user info

    UserAccount user = new UserAccount("tatata2", "tatata2", null);
    ElasticSearchController.GetUser getUser = new ElasticSearchController.GetUser();
    getUser.execute("tatata2");

    try {
        user = getUser.get().get(0);
    } catch (Exception e) {
        HabitUpApplication.addUserAccount(user);
    }

    HabitUpApplication.setCurrentUser(user);

    solo = new Solo(getInstrumentation(), getActivity());
}
 
開發者ID:CMPUT301F17T29,項目名稱:HabitUp,代碼行數:18,代碼來源:ViewHabitActivityTest.java

示例8: setUp

import com.robotium.solo.Solo; //導入依賴的package包/類
@Override
public void setUp() throws Exception {
  //setUp() is run before a test case is started.
  //This is where the solo object is created.
  Solo.Config config = new Solo.Config();
  config.shouldScroll = false;

  solo = new Solo(getInstrumentation(), config);
  getActivity();
}
 
開發者ID:Esri,項目名稱:ecological-marine-unit-android,代碼行數:11,代碼來源:EMUAppTest.java

示例9: execute

import com.robotium.solo.Solo; //導入依賴的package包/類
public RPCMessage execute(RPCMessage request, Solo solo, Map<Integer, Object> varCache){
    RPCMessage response = checkArgs(request);
    if(response == null){
        response = handleRequest(request, solo, varCache);
    }
    return response;
}
 
開發者ID:IfengAutomation,項目名稱:test_agent_android,代碼行數:8,代碼來源:RPCMethod.java

示例10: handleRequest

import com.robotium.solo.Solo; //導入依賴的package包/類
@Override
public RPCMessage handleRequest(RPCMessage request, Solo solo, Map varCache) {
    RPCMessage response;
    int hash = Integer.parseInt((String) request.getArgs().get(0));//獲取hashcode
    View view = (View) varCache.get(hash);
    if (view != null) {
        solo.clickOnView(view);
        response = RPCMessage.makeSuccessResult();
    } else {
        response = ErrorResponseHelper.makeViewNotFoundErrorResponse(getClass());
    }

    return response;
}
 
開發者ID:IfengAutomation,項目名稱:test_agent_android,代碼行數:15,代碼來源:ClickOnView.java

示例11: handleRequest

import com.robotium.solo.Solo; //導入依賴的package包/類
@Override
public RPCMessage handleRequest(RPCMessage request, Solo solo, Map<Integer, Object> varCache) {
    try {
        String player_name = (String) request.getArgs().get(0);
        String state = (String) request.getArgs().get(1);
        ViewGroup videoSkin = (ViewGroup) solo.getView(videoIdsMap.get(player_name));
        View view = videoSkin.getChildAt(0);
        solo.clickOnView(view);
        solo.clickOnView(view);
        boolean isPlay = PlayerCommon.isPlay(solo, player_name);
        String message = state + "失敗";
        boolean result = ((pause_state.equals(state) && isPlay == false) || (play_state.equals(state) && isPlay == true));
        Assert.assertTrue(message, result);
        return RPCMessage.makeSuccessResult();
    }catch(Throwable e) {
        return ErrorResponseHelper.errorResponse(getClass(),e.getMessage());
    }
}
 
開發者ID:IfengAutomation,項目名稱:test_agent_android,代碼行數:19,代碼來源:ChangeVideoState.java

示例12: handleRequest

import com.robotium.solo.Solo; //導入依賴的package包/類
@Override
public RPCMessage handleRequest(RPCMessage request, Solo solo, Map varCache) {
    RPCMessage response;
    int hash = Integer.parseInt((String) request.getArgs().get(0));//獲取hashcode
    TabWidget tabWidget = (TabWidget) varCache.get(hash);
    if (tabWidget != null) {

        solo.clickOnView(tabWidget.getChildAt(Integer.parseInt((String) request.getArgs().get(1))));
        response = RPCMessage.makeSuccessResult();
    } else {
        response = ErrorResponseHelper.makeViewNotFoundErrorResponse(getClass());
    }

    return response;
}
 
開發者ID:IfengAutomation,項目名稱:test_agent_android,代碼行數:16,代碼來源:SwitchToTab.java

示例13: handleRequest

import com.robotium.solo.Solo; //導入依賴的package包/類
@Override
public RPCMessage handleRequest(RPCMessage request, Solo solo, Map<Integer, Object> varCache) {
    //獲取listView,so: 參數:listView,count
    RPCMessage response;

    int hash = Integer.parseInt((String) request.getArgs().get(0));//獲取hashcode

    ListView listView = (ListView) varCache.get(hash);

    int []  location=new int[2];
    listView.getLocationOnScreen(location);
    listView.getClipBounds();
    int  listX=location[0];  //listView在界麵上的X位置
    int  listY=location[1];  //listView在界麵上的Y位置

    float startX0=(float)listX+listView.getWidth()/2;
    float startY0=(float)listY+listView.getHeight()-1;   //-1是為了讓拖拽的起點錯開邊界值
    float  endX0=(float)listX+listView.getWidth()/2;
    float  endY0=(float)listY;

    try{
        solo.drag(startX0,endX0,startY0,endY0,30);
    }catch (Throwable e){
        response = ErrorResponseHelper.makeViewNotFoundErrorResponse(getClass());
        return  response;
    }

    return RPCMessage.makeSuccessResult();
}
 
開發者ID:IfengAutomation,項目名稱:test_agent_android,代碼行數:30,代碼來源:LoadMore.java

示例14: mIsPlay

import com.robotium.solo.Solo; //導入依賴的package包/類
public static boolean mIsPlay(Solo solo, String videoPlayerClass) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException {
    solo.sleep(3000);
    Class activityVideoPlayer = Class.forName(videoPlayerClass);
    Field[] declaredFields = activityVideoPlayer.getDeclaredFields();
    Field mPlayerHelperField = null;
    for (Field field : declaredFields) {
        if (field.getType().getName().equals("com.ifeng.newvideo.videoplayer.player.NormalVideoHelper")) {
            mPlayerHelperField = field;
            mPlayerHelperField.setAccessible(true);
            break;
        }
    }
    Object mPlayerHelper = null;
    if (videoPlayerClass.contains("UniversalChannelFragment")) {
        FragmentActivity fragmentActivity = (FragmentActivity) solo.getCurrentActivity();
        List<Fragment> fragments = fragmentActivity.getSupportFragmentManager().getFragments();
        for (android.support.v4.app.Fragment fragment : fragments) {
            if (fragment.getClass().getName().equals("com.ifeng.newvideo.ui.FragmentHomePage")) {
                List<android.support.v4.app.Fragment> childFragments = fragment.getChildFragmentManager().getFragments();
                for (int i = 0; i < childFragments.size(); i++) {
                    if (childFragments.get(i) != null && childFragments.get(i).getClass().getName().equals(("com.ifeng.newvideo.ui.UniversalChannelFragment"))) {
                        mPlayerHelper = mPlayerHelperField.get(childFragments.get(i));
                        break;
                    }
                }
                break;
            }
        }
    } else {
        Activity currentActivity = solo.getCurrentActivity();
        mPlayerHelper = mPlayerHelperField.get(currentActivity);
    }
    Field mPlayerField = mPlayerHelper.getClass().getDeclaredField("mPlayer");
    mPlayerField.setAccessible(true);
    Object mPlayer = mPlayerField.get(mPlayerHelper);
    Method isPlayingMethod = mPlayer.getClass().getDeclaredMethod("isPlaying");
    isPlayingMethod.setAccessible(true);
    boolean isPlay = (boolean) isPlayingMethod.invoke(mPlayer);
    return isPlay;
}
 
開發者ID:IfengAutomation,項目名稱:test_agent_android,代碼行數:41,代碼來源:PlayerCommon.java

示例15: testAddition

import com.robotium.solo.Solo; //導入依賴的package包/類
@Test
public void testAddition() {
    Solo solo = new Solo(getInstrumentation(), mActivity);

    // 1つめのEditTextに1と入力
    solo.enterText(0, "3");
    // ID指定も可能
    // solo.enterText((EditText)mActivity.findViewById(R.id.num1), "3");

    // 2つめのEditTextに30と入力
    solo.enterText(1, "30");

    // 足すと書かれたボタンを押す
    solo.clickOnButton("=");

    // ResultActivity の起動を確認
    solo.assertCurrentActivity("ResultActivity now.", ResultActivity.class);

    // 計算結果である33と書かれたテキストを確認
    assertThat(solo.searchText("33"), is(true));
}
 
開發者ID:shikato,項目名稱:AndroidTestSample,代碼行數:22,代碼來源:RobotiumTest.java


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