* Try to recreate an existing StyleTextPropAtom (a) from the empty
* constructor, and setting the required properties
*/
public void testCreateAFromScatch() throws Exception {
// Start with an empty one
StyleTextPropAtom stpa = new StyleTextPropAtom(54);
// Don't need to touch the paragraph styles
// Add two more character styles
LinkedList cs = stpa.getCharacterStyles();
// First char style is boring, and 21 long
TextPropCollection tpca = (TextPropCollection)cs.get(0);
tpca.updateTextSize(21);
// Second char style is coloured, 00 00 00 05, and 17 long
TextPropCollection tpcb = stpa.addCharacterTextPropCollection(17);
TextProp tpb = tpcb.addWithName("font.color");
tpb.setValue(0x05000000);
// Third char style is coloured, FF 33 00 FE, and 16 long
TextPropCollection tpcc = stpa.addCharacterTextPropCollection(16);
TextProp tpc = tpcc.addWithName("font.color");
tpc.setValue(0xFE0033FF);
// Should now be the same as data_a
ByteArrayOutputStream baos = new ByteArrayOutputStream();
stpa.writeOut(baos);
byte[] b = baos.toByteArray();
assertEquals(data_a.length, b.length);
for(int i=0; i<data_a.length; i++) {
assertEquals(data_a[i],b[i]);