/**
* Test that the doMenu method creates the correct vxml markup
*/
public void testDoMenuWithCSSEmulationStyle() throws Exception {
final DOMOutputBuffer buffer = new DOMOutputBuffer();
buffer.initialise();
testable.setCurrentBuffer(null, buffer);
TestMarinerPageContext context = new TestMarinerPageContext();
PaneInstance paneInstance = new TestPaneInstance() {
public OutputBuffer getCurrentBuffer() {
return buffer;
}
};
context.setFormatInstance(paneInstance);
TestDeviceLayoutContext layoutContext = new TestDeviceLayoutContext();
context.pushDeviceLayoutContext(layoutContext);
protocol.setMarinerPageContext(context);
MenuAttributes menuAttrs = new MenuAttributes();
menuAttrs.setStyles(StylesBuilder.getCompleteStyles(
"mcs-aural-dtmf-allocation: automatic; " +
"mcs-aural-menu-scope: document"));
// We use Strings for errmsg, prompt, and help to avoid having to
// resolve TextComponentIdentity which would require a repository
menuAttrs.setErrmsg(new LiteralTextAssetReference(
"<noinput>Sorry I did not hear you</noinput>" +
"<nomatch>Sorry I did not understand you</nomatch>"));
menuAttrs.setHelp(new LiteralTextAssetReference("<help>Please select an option from the menu</help>"));
menuAttrs.setPrompt(new LiteralTextAssetReference("<prompt>Welcome home.<enumerate>For <value " +
"expr=\"_prompt\"/>, press <value expr=\"_dtmf\"/> or say " +
"<value expr=\"_prompt\"/></enumerate></prompt>"));
MenuItem item1 = new MenuItem();
item1.setText("Sports News");
item1.setHref("http://www.volantis.com:8080/volantis/sports.jsp");
menuAttrs.addItem(item1);
MenuItem item2 = new MenuItem();
item2.setText("Astrology");
item2.setHref("http://www.volantis.com:8080/volantis/astrology.jsp");
item2.setPrompt(new LiteralTextAssetReference("<prompt><audio src=\"rtsp://www.volantis.com/" +
"mysticmeg.wav\">Mystic Megs Astrology</audio></prompt>"));
menuAttrs.addItem(item2);
MenuItem item3 = new MenuItem();
item3.setText("Fun and Games");
item3.setHref("http://www.volantis.com:8080/volantis/games.jsp");
item3.setShortcut(new LiteralTextAssetReference("9"));
menuAttrs.addItem(item3);
protocol.doMenu(menuAttrs);
String actual = DOMUtilities.toString(
buffer.getRoot(), protocol.getCharacterEncoder());
String expected =
"<menu dtmf=\"true\" scope=\"document\">" +
"<prompt>Welcome home.<enumerate>" +
"For <value expr=\"_prompt\"/>, press " +