use of limelight.styles.RichStyle in project limelight by slagyr.
the class StyledText method setupStyles.
public void setupStyles(Map<String, RichStyle> styleMap, RichStyle defaultStyle, StyleObserver observer) {
if (style.hasObserver(observer))
return;
for (String styleName : styleNames) {
RichStyle extension = styleMap.get(styleName);
if (extension != null)
style.addExtension(extension);
}
style.addExtension(defaultStyle);
style.addObserver(observer);
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class JavaProductionTest method loadRealStylesForScene.
@Test
public void loadRealStylesForScene() throws Exception {
fs.createTextFile("/testProduction/aScene/styles.xml", "<styles><high x='0' y='99' float='on'/><far x='99' y='0' float='off'/></styles>");
final Scene scene = production.loadScene("aScene", Opts.with("name", "aScene", "path", "aScene"));
final Map<String, RichStyle> styles = production.loadStyles(scene, new HashMap<String, RichStyle>());
assertEquals(2, styles.size());
final RichStyle high = styles.get("high");
assertEquals("0", high.getX());
assertEquals("99", high.getY());
assertEquals("on", high.getFloat());
final RichStyle far = styles.get("far");
assertEquals("99", far.getX());
assertEquals("0", far.getY());
assertEquals("off", far.getFloat());
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class XmlTest method checkMultipleExtensions.
private void checkMultipleExtensions() {
final HashMap<String, RichStyle> styles = new HashMap<String, RichStyle>();
Xml.toStyles("/styles.xml", styles, new HashMap<String, RichStyle>());
assertEquals(3, styles.size());
final RichStyle one = styles.get("one");
final RichStyle two = styles.get("two");
final RichStyle three = styles.get("three");
assertEquals("100", three.getWidth());
assertEquals("200", three.getHeight());
assertEquals(true, three.hasExtension(one));
assertEquals(true, three.hasExtension(two));
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class ProductionTest method openSceneLoadsStylesExtendingProductionStyles.
@Test
public void openSceneLoadsStylesExtendingProductionStyles() throws Exception {
production.loadProduction();
production.getTheater().add(new MockStage("mock"));
production.getStyles().put("newStyle", new RichStyle());
Scene scene = new FakeScene();
production.stubbedScene = scene;
production.openScene("scenePath", "mock", Util.toMap());
assertEquals(HashMap.class, scene.getStyles().getClass());
assertEquals(true, scene.getStyles().containsKey("limelight_builtin_curtains"));
assertEquals(true, scene.getStyles().containsKey("newStyle"));
}
use of limelight.styles.RichStyle in project limelight by slagyr.
the class StyledTextTest method shouldBuildStyles.
@Test
public void shouldBuildStyles() throws Exception {
makeSampleStyles();
StyleObserver observer = new MockStyleObserver();
styledText = new StyledText("Some Text", "fizz", "bang");
styledText.setupStyles(styles, defaultStyle, observer);
RichStyle style = styledText.getStyle();
assertSame(style1, style.getExtention(0));
assertSame(style2, style.getExtention(1));
assertSame(defaultStyle, style.getExtention(2));
assertEquals(true, style.hasObserver(observer));
}
Aggregations