* Tests that when there is an aspect ratio parameter, it is removed from
* the urlc.
*/
public void testAspectRatioRemoval() throws Exception {
final String rule = "cj24";
final PluggableAssetTranscoder transcoder = new ICSWithoutGIF();
final int width = 369;
final String urlc = "http://www.volantis.com/myImage.jpg?mcs.ar=5:4";
TestMarinerRequestContext requestContext =
createRequestContext(transcoder, rule, width);
// Create the urlc attribute for the image element implementation.
ImageAttributes papiImageAttributes = new ImageAttributes();
papiImageAttributes.setUrlc(urlc);
// Create the image element implementation.
ImageElementImpl element = new ImageElementImpl();
// Generate the pane output for this image element.
element.elementStartImpl(requestContext, papiImageAttributes);
// Retrieve the image attributes so that the src can be checked for the
// removal of the aspect ratio parameter.
com.volantis.mcs.protocols.ImageAttributes protocolImageAttributes =
(com.volantis.mcs.protocols.ImageAttributes)
PrivateAccessor.getField(element, "pattributes");
final String urlcNoAspectRatio = protocolImageAttributes.getSrc();
assertEquals("There should be no ratio parameter",
"http://www.volantis.com/" + rule + "/myImage.jpg?" +
transcoder.getWidthParameter() + "=" + width,
urlcNoAspectRatio);
}