@Test
public void testGetSetLanguageParam() {
try {
SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument();
Table table = document.getTableByName("Sheet1");
Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH);
Cell cell = table.getCellByPosition("A1");
cell.setFont(font);
cell.setStringValue("testGetFontStyle.");
TextProperties textProperties = cell.getStyleHandler().getTextPropertiesForWrite();
textProperties.setLanguage("Chinese", Document.ScriptType.CJK);
//validate
String lan = textProperties.getLanguage(Document.ScriptType.CJK);
Assert.assertEquals("Chinese", lan);
textProperties.setLanguage("Chinese", Document.ScriptType.CTL);
//validate
String lan1 = textProperties.getLanguage(Document.ScriptType.CTL);
Assert.assertEquals("Chinese", lan1);
textProperties.setLanguage(null, Document.ScriptType.CTL);
//validate
String lan2 = textProperties.getLanguage(Document.ScriptType.CTL);
Assert.assertEquals(null, lan2);
textProperties.setLanguage(null, Document.ScriptType.WESTERN);
//validate
String lan3 = textProperties.getLanguage(Document.ScriptType.WESTERN);
Assert.assertEquals(null, lan3);
textProperties.setLanguage(null, Document.ScriptType.CJK);
//validate
String lan4 = textProperties.getLanguage(Document.ScriptType.CJK);
Assert.assertEquals(null, lan4);
//save
document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
Assert.fail(e.getMessage());
}
}