2017-01-09 1 views
0

に新しいOnTouchListenerを設定したとき、私は、このテストエスプレッソのクリックアクションが動作しない、私はボタン

@Test 
public void theTimeViewMustBeDisplayedAfterRecordButtonClick(){ 
    onView(withId(R.id.btn_record)).perform(click()); 
    onView(withId(R.id.tempo)).check(matches(isDisplayed())); 
} 

を持っていますが、私のR.id.btn_recordは私のテストを実行すると、このテストはロックオンこのOnTouchListener

public View.OnTouchListener getOnTouchListener(){ 
    return new View.OnTouchListener() { 

     @Override 
     public boolean onTouch(View view, MotionEvent event) { 

      switch (event.getAction()){ 
       case MotionEvent.ACTION_DOWN: 

        status.setText(R.string.record_status_message); 
        status.setTextColor(Color.BLUE); 

        tempo.setAnimation(getPulse()); 
        presenter.startRecord(getActivity().getFilesDir().getPath(), UUID.randomUUID().toString()); 

        return true; 
       case MotionEvent.ACTION_UP: 

        status.setText(R.string.default_status_message); 
        status.setTextColor(Color.BLACK); 

        tempo.clearAnimation(); 
        presenter.stopRecord(); 

        return true; 
      } 

      return false; 
     } 

    }; 
} 

を持っていますこの行

と何も起こりませんが、OnTouchListenerを削除すると、テストは正常に実行されます、なぜですか?何か案が?

完全なコード:おそらく、この問題を解決することができますUiControllerからMotionEventを使用してhttps://github.com/faeldix/faeldix-android-microphone-mvp

+0

があなたのケースを壊し、そして試してください – W4R10CK

答えて

0

は、私は申し訳ありませんが、私はそれをどのように使うことができます。.. here

+0

を参照してください?私は本当に本当にundestandをしない – user155542

関連する問題