buffer.initialise();
Pane pane = new Pane(canvasLayout);
pane.setName(PANE_NAME);
PaneAttributes paneAttributes = new PaneAttributes();
Styles paneStyles = StylesBuilder.getSparseStyles("padding: 10px");
paneAttributes.setStyles(paneStyles);
paneAttributes.setPane(pane);
protocol.openPaneTable(buffer, paneAttributes);
Element tableElement = (Element) buffer.getRoot().getHead();
assertTrue("Root element should be a table", "table".equals(tableElement.getName()));
String cellPadding = tableElement.getAttributeValue("cellpadding");
assertNotNull("Table should have cell padding attribute set", cellPadding);
assertEquals("Cell padding should be 10 pixels", "10", cellPadding);
Styles tableStyles = tableElement.getStyles();
assertNull("Table should have no padding (bottom)",
tableStyles.getPropertyValues().
getSpecifiedValue(StylePropertyDetails.PADDING_BOTTOM));
assertNull("Table should have no padding (top)",
tableStyles.getPropertyValues().
getSpecifiedValue(StylePropertyDetails.PADDING_TOP));
assertNull("Table should have no padding (left)",
tableStyles.getPropertyValues().
getSpecifiedValue(StylePropertyDetails.PADDING_LEFT));
assertNull("Table should have no padding (right)",
tableStyles.getPropertyValues().
getSpecifiedValue(StylePropertyDetails.PADDING_RIGHT));
// We test for the computed values being null - the current
// implementation sets them to null. In theory having the default value
// for the computed value here should be acceptable.
assertNull("Table should have no padding (bottom)",
tableStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_BOTTOM));
assertNull("Table should have no padding (top)",
tableStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_TOP));
assertNull("Table should have no padding (left)",
tableStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_LEFT));
assertNull("Table should have no padding (right)",
tableStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_RIGHT));
Element rowElement = (Element) tableElement.getHead();
Element cellElement = (Element) rowElement.getHead();
Styles cellStyles = cellElement.getStyles();
StyleValue expectedPadding = StyleValueFactory.getDefaultInstance().
getLength(null, 10, LengthUnit.PX);
// Check the computed values for the table cell (since these are the
// values that will be displayed
assertEquals("Cell should have 10px padding (bottom)", expectedPadding,
cellStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_BOTTOM));
assertEquals("Cell should have 10px padding (top)", expectedPadding,
cellStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_TOP));
assertEquals("Cell should have 10px padding (left)", expectedPadding,
cellStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_LEFT));
assertEquals("Cell should have 10px padding (right)", expectedPadding,
cellStyles.getPropertyValues().
getComputedValue(StylePropertyDetails.PADDING_RIGHT));
}