Java Code Examples for com.badlogic.gdx.scenes.scene2d.ui.Image#getActions()

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.Image#getActions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CCSpriteViewTest.java    From cocos-ui-libgdx with Apache License 2.0 6 votes vote down vote up
@Test
@NeedGL
public void shouldParseSpriteView() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("animation/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    Image image = group.findActor("st_2");
    Array<Action> actions = image.getActions();
    assertThat(actions.size, is(1));
    RepeatAction repeatAction = (RepeatAction) actions.get(0);
    ParallelAction parallelAction = (ParallelAction) repeatAction.getAction();
    assertThat(parallelAction.getActions().size, is(3));
    assertThat(parallelAction.getActions(), (Matcher) everyItem(instanceOf(SequenceAction.class)));
    SequenceAction moveAction = (SequenceAction) parallelAction.getActions().get(0);
    SequenceAction scaleAction = (SequenceAction) parallelAction.getActions().get(1);
    assertThat(moveAction.getActions().size, is(4));
    assertThat(moveAction.getActions(), (Matcher) everyItem(instanceOf(MoveToAction.class)));
    assertThat(scaleAction.getActions().size, is(4));
    assertThat(scaleAction.getActions(), (Matcher) everyItem(instanceOf(ScaleToAction.class)));
}