use of limelight.styles.StyleObserver 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));
}
use of limelight.styles.StyleObserver in project limelight by slagyr.
the class StyledTextTest method shouldNotBuildStylesMoreThanOnce.
@Test
public void shouldNotBuildStylesMoreThanOnce() throws Exception {
makeSampleStyles();
StyleObserver observer = new MockStyleObserver();
styledText = new StyledText("Some Text", "fizz", "bang");
styledText.setupStyles(styles, defaultStyle, observer);
styledText.setupStyles(styles, defaultStyle, observer);
RichStyle style = styledText.getStyle();
assertEquals(3, style.getExtentions().size());
assertEquals(1, style.getObservers().size());
}
use of limelight.styles.StyleObserver in project limelight by slagyr.
the class TextPanelTest method teardownStyledTextBeforeDiscarding.
@Test
public void teardownStyledTextBeforeDiscarding() throws Exception {
panel.setText("Original Text", parent);
Layouts.on(panel, panel.getDefaultLayout());
List<StyleObserver> observers = panel.getStyle().getObservers();
assertEquals(1, observers.size());
StyleObserver observer = observers.get(0);
Layouts.on(panel, panel.getDefaultLayout());
List<StyleObserver> newObservers = panel.getStyle().getObservers();
assertEquals(1, newObservers.size());
StyleObserver newObserver = newObservers.get(0);
assertNotSame(newObserver, observer);
}
Aggregations