use of org.jivesoftware.smackx.xdatalayout.packet.DataLayout.Reportedref in project Smack by igniterealtime.
the class DataLayoutTest method testLayoutSpecialCharacters.
@Test
public void testLayoutSpecialCharacters() throws XmlPullParserException, IOException {
DataLayout layout = new DataLayout("Label - & é á ");
Fieldref reffield = new Fieldref("testField1");
layout.getPageLayout().add(reffield);
Section section = new Section("section Label - & é á ");
section.getSectionLayout().add(new Text("SectionText - & é á "));
layout.getPageLayout().add(section);
layout.getPageLayout().add(new Text("PageText - & é á "));
section = new Section("<html>Number of Persons by<br/> Nationality and Status</html>");
section.getSectionLayout().add(new Reportedref());
layout.getPageLayout().add(section);
layout.getPageLayout().add(new Text("<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>"));
assertNotNull(layout.toXML());
String output = layout.toXML().toString();
assertEquals(TEST_OUTPUT_SPECIAL, output);
XmlPullParser parser = PacketParserUtils.getParserFor(output);
layout = DataLayoutProvider.parse(parser);
assertEquals(5, layout.getPageLayout().size());
assertEquals("Label - & é á ", layout.getLabel());
section = (Section) layout.getPageLayout().get(1);
assertEquals("section Label - & é á ", section.getLabel());
Text text = (Text) layout.getPageLayout().get(2);
assertEquals("PageText - & é á ", text.getText());
section = (Section) layout.getPageLayout().get(3);
assertEquals("<html>Number of Persons by<br/> Nationality and Status</html>", section.getLabel());
text = (Text) layout.getPageLayout().get(4);
assertEquals("<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>", text.getText());
assertNotNull(layout.toXML());
output = layout.toXML().toString();
assertEquals(TEST_OUTPUT_SPECIAL, output);
}
Aggregations