protocol.setMarinerPageContext(pageContext);
// Now can actually do the test.
String paneName = "caption-pane";
CanvasLayout canvasLayout =
new CanvasLayout();
TestPane pane = new TestPane(canvasLayout);
pane.setName(paneName);
// Activate the device layout.
RuntimeDeviceLayout runtimeDeviceLayout =
RuntimeDeviceLayoutTestHelper.activate(canvasLayout);
pageContext.addPaneMapping(pane);
pageContext.setDeviceLayout(runtimeDeviceLayout);
TestPaneInstance fContext = new TestPaneInstance();
pageContext.setFormatInstance(fContext);
int result = element.checkPaneInstances(pageContext, null, null);
assertEquals(result, PAPIConstants.SKIP_ELEMENT_BODY);
String value = "{layout:getPaneInstance('" + paneName + "',0)}";
result = element.checkPaneInstances(pageContext, value, null);
assertEquals(result, PAPIConstants.PROCESS_ELEMENT_BODY);
PaneInstance captionPaneInstance = (PaneInstance) PrivateAccessor.getField(
element, "captionPaneInstance");
PaneInstance entryPaneInstance = (PaneInstance) PrivateAccessor.getField(
element, "entryPaneInstance");
assertNotNull(entryPaneInstance);
assertNotNull(captionPaneInstance);
assertTrue("Panes should be exactly the same",
entryPaneInstance == captionPaneInstance);
FormDescriptor descriptor = new FormDescriptor();
XFFormElementImpl formElement = new XFFormElementImpl();
Form form = new Form(new CanvasLayout());
form.setName("form-name");
FormInstance formInstance = new FormInstance(
NDimensionalIndex.ZERO_DIMENSIONS);
formInstance.setFormat(form);