예제 #1
0
  @Test
  public void shouldPostActionsToTheMessageQueueWithDelay() throws Exception {
    Robolectric.pauseMainLooper();

    TestRunnable runnable = new TestRunnable();
    view.postDelayed(runnable, 1);
    assertFalse(runnable.wasRun);

    Robolectric.getUiThreadScheduler().advanceBy(1);
    assertTrue(runnable.wasRun);
  }
예제 #2
0
 @Implementation
 public void postInvalidateDelayed(long delayMilliseconds) {
   Robolectric.getUiThreadScheduler()
       .postDelayed(
           new Runnable() {
             @Override
             public void run() {
               realView.invalidate();
             }
           },
           delayMilliseconds);
 }
예제 #3
0
 @Implementation
 public void postDelayed(Runnable action, long delayMills) {
   Robolectric.getUiThreadScheduler().postDelayed(action, delayMills);
 }
예제 #4
0
 @Implementation
 public void post(Runnable action) {
   Robolectric.getUiThreadScheduler().post(action);
 }