@Test public void testReplace() throws Exception { Actor screenA = spy(new Actor()); Actor screenB = spy(new Actor()); latch = new CountDownLatch(1); app.postRunnable(() -> { actor.push(screenA); actor.replace(screenB); latch.countDown(); }); assertThat(latch.await(5, TimeUnit.SECONDS)).isTrue(); reset(screenA); Thread.sleep(500); verify(screenA, never()).draw(any(), anyFloat()); verify(screenA, never()).act(anyFloat()); verify(screenB, atLeastOnce()).draw(any(), anyFloat()); verify(screenB, atLeastOnce()).act(anyFloat()); assertThat(stage.getKeyboardFocus()).isEqualTo(screenB); }
public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); } }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); }  }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); }  void replace(Actor screen); void push(Actor screen); void pop(int n); @Override void act(float deltaTime); }
ScreenStack extends Stack { public void replace(Actor screen) { Action runnable = Actions.run(() -> { if (hasChildren()) { getChildren().pop(); } add(screen); getStage().setKeyboardFocus(screen); }); addAction(runnable); }  void replace(Actor screen); void push(Actor screen); void pop(int n); @Override void act(float deltaTime);  }