Exemplo n.º 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);
  }
Exemplo n.º 2
0
 @Implementation
 public void postInvalidateDelayed(long delayMilliseconds) {
   Robolectric.getUiThreadScheduler()
       .postDelayed(
           new Runnable() {
             @Override
             public void run() {
               realView.invalidate();
             }
           },
           delayMilliseconds);
 }
Exemplo n.º 3
0
 @Implementation
 public void postDelayed(Runnable action, long delayMills) {
   Robolectric.getUiThreadScheduler().postDelayed(action, delayMills);
 }
Exemplo n.º 4
0
 @Implementation
 public void post(Runnable action) {
   Robolectric.getUiThreadScheduler().post(action);
 }