new TestRendererContext(assetResolverMock);
TestDeprecatedOutputLocator outputLocator
= new TestDeprecatedOutputLocator();
DOMOutputBuffer buffer = context.getBuffer();
TestDeprecatedImageOutput imageOutput
= (TestDeprecatedImageOutput) outputLocator.getImageOutput();
// Create the renderer to test, using the test objects created above.
OpenwaveMenuItemRendererFactory rendererFactory =
new OpenwaveMenuItemRendererFactory(context, outputLocator);
final StylePropertyResolver stylePropertyResolver =
new DefaultStylePropertyResolver(null, null);
final DefaultMenuSeparatorRendererSelector rendererSelector =
new DefaultMenuSeparatorRendererSelector(
new OpenwaveMenuSeparatorRendererFactory(),
context.getAssetResolver(),
stylePropertyResolver);
DefaultMenuItemRendererSelector selector =
new DefaultMenuItemRendererSelector(
rendererFactory, rendererSelector);
MenuBufferFactory bufferFactory
= new ConcreteMenuBufferFactory(SeparatorRenderer.NULL);
DefaultMenuBufferLocator bufferLocator
= new DefaultMenuBufferLocator(context.getOutputBufferResolver(),
bufferFactory);
OpenwaveMenuRenderer menuRenderer =
new OpenwaveMenuRenderer(selector, bufferLocator);
// Build a simple menu model we can exercise the renderer with.
Menu menu = createSimpleMenu(
imageStyle, textStyle, orderStyle,
menuTitle, itemTitle, itemHref, itemText, itemImageComponent);
// Render the menu model out to the buffer.
menuRenderer.render(menu);
// Extract the output from the menu rendering as a string.
String actual = styledDOMTester.render(buffer.getRoot());
//System.out.println(actual);
// Calculate the image part of the menu items rendered from the
// related mariner menu style property setting, if any.
String imageValue = null;
if (imageStyle == null || imageStyle == MCSMenuImageStyleKeywords.NONE) {
// No image.
} else if (imageStyle == MCSMenuImageStyleKeywords.PLAIN
|| imageStyle == MCSMenuImageStyleKeywords.ROLLOVER) {
imageValue = imageOutput.getLastRenderedText();
} else {
throw new IllegalStateException();
}
// Calculate the text part of the menu items rendered from the