use of com.sldeditor.tool.batchupdatefont.MultipleFont in project sldeditor by robward-scisys.
the class MultipleFontTest method testParseList.
/**
* Test method for {@link com.sldeditor.tool.batchupdatefont.MultipleFont#parseList(java.util.List)}. Test method for
* {@link com.sldeditor.tool.batchupdatefont.MultipleFont#getFont()}.
*/
@Test
public void testParseList() {
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
List<Font> entries = new ArrayList<Font>();
MultipleFont testObj = new MultipleFont();
testObj.parseList(null);
assertNotNull(testObj.getFont());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
String originalFontname = "Serif";
String originalFontStyle = "normal";
String originalFontWeight = "normal";
int originalFontSize = 24;
Font font = styleFactory.createFont(ff.literal(originalFontname), ff.literal(originalFontStyle), ff.literal(originalFontWeight), ff.literal(originalFontSize));
entries.add(font);
testObj.parseList(entries);
Font actualFont = testObj.getFont();
assertNotNull(actualFont.getSize());
assertNotNull(actualFont.getStyle());
assertNotNull(actualFont.getWeight());
assertTrue(!actualFont.getFamily().isEmpty());
// 2nd font is completely different
String newFontname = "Serif2";
String newFontStyle = "italic";
String newFontWeight = "bold";
int newFontSize = 25;
Font font2 = styleFactory.createFont(ff.literal(newFontname), ff.literal(newFontStyle), ff.literal(newFontWeight), ff.literal(newFontSize));
entries.add(font2);
testObj.parseList(entries);
actualFont = testObj.getFont();
assertNull(actualFont.getSize());
assertNull(actualFont.getStyle());
assertNull(actualFont.getWeight());
assertTrue(actualFont.getFamily().isEmpty());
// Change family, style, weight and size
entries.clear();
entries.add(font);
Font font3 = styleFactory.createFont(ff.literal(originalFontname), ff.literal(originalFontStyle), ff.literal(originalFontWeight), ff.literal(originalFontSize));
entries.add(font3);
testObj.parseList(entries);
actualFont = testObj.getFont();
assertNotNull(actualFont.getSize());
assertNotNull(actualFont.getStyle());
assertNotNull(actualFont.getWeight());
assertTrue(!actualFont.getFamily().isEmpty());
}
Aggregations