use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_chartHasSolidColor_theSolidColorIsWrittenAsAttribute.
@Test
public void writeConfiguration_chartHasSolidColor_theSolidColorIsWrittenAsAttribute() {
DesignContext designContext = new DesignContext();
Configuration configuration = new Configuration();
configuration.getChart().setBackgroundColor(new SolidColor("black"));
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<chart background-color=\"black\"></chart>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
use of com.vaadin.addon.charts.model.style.SolidColor in project charts by vaadin.
the class ChartDesignWriterTest method writeConfiguration_chartHasRadialGradientBackgroundColor_theRadialGradientIsWrittenAsElement.
@Test
public void writeConfiguration_chartHasRadialGradientBackgroundColor_theRadialGradientIsWrittenAsElement() {
Configuration configuration = new Configuration();
DesignContext designContext = new DesignContext();
GradientColor gradientColor = GradientColor.createRadial(0.5, 0.3, 0.7);
gradientColor.addColorStop(0, new SolidColor("black"));
gradientColor.addColorStop(1, new SolidColor("white"));
configuration.getChart().setBackgroundColor(gradientColor);
Element parent = new Element(Tag.valueOf("test"), "");
ChartDesignWriter.writeConfigurationToElement(configuration, parent, designContext);
assertEquals("<chart><background-color><radial-gradient cx=\"0.5\" cy=\"0.3\" r=\"0.7\"></radial-gradient>" + "<stops position=\"0\" color=\"black\"></stops>" + "<stops position=\"1\" color=\"white\"></stops>" + "</background-color></chart>", removeWhitespacesBetweenTags(parent.child(0).toString()));
}
Aggregations