Search in sources :

Example 6 with Player

use of limelight.model.api.Player in project limelight by slagyr.

the class JavaPlayerTest method playerCanAddEvents.

@Test
public void playerCanAddEvents() throws Exception {
    final Document doc = Xml.stringToDoc("<player class='SamplePlayer'><onMouseClicked>sampleAction</onMouseClicked></player>");
    final Player player = new JavaPlayer("foo", "/testProduction/aScene/players/foo.xml", samplePlayerClass, doc.getDocumentElement(), "limelight.ui.events.panel.");
    Object playerObj = player.cast(prop);
    assertEquals("SamplePlayer", playerObj.getClass().getName());
    assertEquals(1, prop.getEventHandler().getActions(MouseClickedEvent.class).size());
    new MouseClickedEvent(0, null, 1).dispatch(prop);
    assertEquals(1, samplePlayerClass.getField("invocations").get(lastSamplePlayer()));
}
Also used : Player(limelight.model.api.Player) MouseClickedEvent(limelight.ui.events.panel.MouseClickedEvent) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

Player (limelight.model.api.Player)6 Test (org.junit.Test)4 Document (org.w3c.dom.Document)2 MouseClickedEvent (limelight.ui.events.panel.MouseClickedEvent)1 Scene (limelight.ui.model.Scene)1