Package limelight.builtin.players

Source Code of limelight.builtin.players.DropDownTest

package limelight.builtin.players;

import limelight.model.api.FakePropProxy;
import limelight.model.api.FakeSceneProxy;
import limelight.ui.events.panel.CastEvent;
import limelight.ui.model.FakeScene;
import limelight.ui.model.PropPanel;
import limelight.ui.model.ScenePanel;
import org.junit.Before;
import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class DropDownTest
{                      
  public DropDown dropDown;
  public PropPanel propPanel;

  @Before
  public void setUp() throws Exception
  {
    dropDown = new DropDown();
    propPanel = new PropPanel(new FakePropProxy());
    new FakeScene().add(propPanel);
    dropDown.install(new CastEvent(propPanel));
  }

  @Test
  public void installation() throws Exception
  {
    assertEquals(propPanel, dropDown.getPropPanel());
    assertNotNull(dropDown.getDropDownPanel());
    assertEquals(dropDown.getDropDownPanel(), propPanel.getChildren().get(0));
    assertEquals(true, propPanel.isSterilized());
    assertNotNull(propPanel.getBackstage().get("drop-down"));
    assertEquals(DropDown.class, propPanel.getBackstage().get("drop-down").getClass());
  }

  @Test
  public void choices() throws Exception
  {
    dropDown.setChoices(Arrays.asList("one", "two", "three"));

    assertEquals("one", dropDown.getDropDownPanel().getChoices().get(0));
    assertEquals("one", dropDown.getChoices().get(0));
    assertEquals("two", dropDown.getDropDownPanel().getChoices().get(1));
    assertEquals("two", dropDown.getChoices().get(1));
    assertEquals("three", dropDown.getDropDownPanel().getChoices().get(2));
    assertEquals("three", dropDown.getChoices().get(2));
  }

  @Test
  public void settingValue() throws Exception
  {
    dropDown.setChoices(Arrays.asList("one", "two", "blue"));
    dropDown.setValue("blue");
    assertEquals("blue", dropDown.getValue());

    dropDown.setValue("red");
    assertEquals("blue", dropDown.getValue());
  }

}
TOP

Related Classes of limelight.builtin.players.DropDownTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.