context.setDeviceName("Master");
protocol.setMarinerPageContext(context);
MutablePropertyValues properties = createPropertyValues();
Element element = domFactory.createElement();
ColumnIteratorPaneAttributes attrs =
new ColumnIteratorPaneAttributes();
Pane pane = new Pane(new CanvasLayout());
// Mimic an element created by openColumnIteratorPane and assign
// an optimization level
element.setName("table");
pane.setOptimizationLevel(
FormatConstants.OPTIMIZATION_LEVEL_VALUE_LITTLE_IMPACT);
attrs.setPane(pane);
protocol.addColumnIteratorPaneAttributes(element, attrs);
// String cellpadding = element.getAttributeValue("cellpadding");
// assertNull("cellpadding attribute should not have been set as " +
// "stylesheets are supported.", cellpadding);
String cellspacing = element.getAttributeValue("cellspacing");
assertNull("cellspacing attribute should not have been set as " +
"stylesheets are supported.", cellspacing);
String border = element.getAttributeValue("border");
assertNull("border attribute should not have been set as " +
"stylesheets are supported.", border);
// Test for optimization - attributes should have been applied if
// format optimization is supported, and should not have been
// applied otherwise.
String optimizationLevel = element.getAttributeValue(
OptimizationConstants.OPTIMIZATION_ATTRIBUTE);
Field inlineSupport = VolantisProtocol.
class.getDeclaredField("supportsInlineStyles");
boolean inlineAccessible = inlineSupport.isAccessible();
inlineSupport.setAccessible(true);
boolean inlineOrigValue = inlineSupport.getBoolean(protocol);
inlineSupport.setBoolean(protocol, false);
Field externalSupport = VolantisProtocol.
class.getDeclaredField("supportsExternalStyleSheets");
boolean externalAccessible = externalSupport.isAccessible();
externalSupport.setAccessible(true);
boolean externalOrigValue = externalSupport.getBoolean(protocol);
externalSupport.setBoolean(protocol, false);
element = domFactory.createElement();
protocol.addColumnIteratorPaneAttributes(element, attrs);
// cellpadding = element.getAttributeValue("cellpadding");
// assertNull("cellpadding attribute should have not have been set as " +
// "cell padding is not supported in i-mode", cellpadding);
cellspacing = element.getAttributeValue("cellspacing");
assertNull("cellspacing attribute should have not have been set as " +
"cellspacing is not supported in i-mode.", cellspacing);
border = element.getAttributeValue("border");
assertNull("border attribute should have not have been set as " +
"border is not supported in i-mode.", border);
element = domFactory.createElement();
attrs = new ColumnIteratorPaneAttributes();
attrs.setStyles(StylesBuilder.getStyles(
"border-width: 2px; " +
"border-spacing: 2px"));
// attrs.setBorderWidth("2");
// attrs.setCellPadding("2");
// attrs.setCellSpacing("2");