Author: nbelaevski
Date: 2008-05-23 09:22:24 -0400 (Fri, 23 May 2008)
New Revision: 8725
Modified:
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
Log:
http://jira.jboss.com/jira/browse/RF-3483
Modified:
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java
===================================================================
---
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-05-23
13:11:53 UTC (rev 8724)
+++
trunk/ui/orderingList/src/test/java/org/richfaces/renderkit/OrderingListRenderingTest.java 2008-05-23
13:22:24 UTC (rev 8725)
@@ -53,7 +53,6 @@
*/
public class OrderingListRenderingTest extends AbstractAjax4JsfTestCase {
private static Set<String> javaScripts = new HashSet<String>();
- private static Set<String> imageClasses = new HashSet<String>();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
@@ -63,18 +62,6 @@
javaScripts.add("scripts/Control.js");
javaScripts.add("scripts/OrderingList.js");
javaScripts.add("scripts/ListBase.js");
-
- imageClasses.add("org.richfaces.renderkit.html.images.TriangleIconUp");
- imageClasses.add("org.richfaces.renderkit.html.images.TriangleIconDown");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTop");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottom");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconUpDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconDownDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconTopDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled");
- imageClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient");
- imageClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient");
- imageClasses.add("org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient");
}
/**
@@ -182,6 +169,23 @@
assertEquals(foundCount, javaScripts.size());
}
+ private void checkResource(String clazz, int format) throws Exception {
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ builder.createResource(null, clazz);
+ InternetResource resource = builder.getResource(clazz);
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, null);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+ ImageInfo info = new ImageInfo();
+ info.setInput(page.getWebResponse().getContentAsStream());
+
+ assertTrue(clazz, info.check());
+ assertEquals(clazz, format, info.getFormat());
+ assertTrue(clazz, info.getHeight() > 0);
+ assertTrue(clazz, info.getWidth() > 0);
+ }
+
/**
* Test default images rendering
*
@@ -191,24 +195,30 @@
HtmlPage view = renderView();
assertNotNull(view);
- InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ String[] pngResources = new String[] {
+
"org.richfaces.renderkit.html.gradientimages.OrderingListClickedGradient",
+
"org.richfaces.renderkit.html.gradientimages.OrderingListHeaderGradient",
+ "org.richfaces.renderkit.html.gradientimages.OrderingListButtonGradient"
+ };
+
+ for (int i = 0; i < pngResources.length; i++) {
+ checkResource(pngResources[i], ImageInfo.FORMAT_PNG);
+ }
- for (Iterator<String> it = imageClasses.iterator(); it.hasNext(); ) {
- String clazz = it.next();
- builder.createResource(null, clazz);
- InternetResource resource = builder.getResource(clazz);
- assertNotNull(resource);
- String uri = "http:" + resource.getUri(facesContext, null);
- Page page = webClient.getPage(uri);
- assertTrue(page.getWebResponse().getStatusCode() ==
HttpServletResponse.SC_OK);
- ImageInfo info = new ImageInfo();
- info.setInput(page.getWebResponse().getContentAsStream());
-
- assertTrue(info.check());
- assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
- assertTrue(info.getHeight() > 0);
- assertTrue(info.getWidth() > 0);
- }
+ String[] gifResources = new String[] {
+ "org.richfaces.renderkit.html.images.TriangleIconUp",
+ "org.richfaces.renderkit.html.images.TriangleIconDown",
+ "org.richfaces.renderkit.html.images.OrderingListIconTop",
+ "org.richfaces.renderkit.html.images.OrderingListIconBottom",
+ "org.richfaces.renderkit.html.images.OrderingListIconUpDisabled",
+ "org.richfaces.renderkit.html.images.OrderingListIconDownDisabled",
+ "org.richfaces.renderkit.html.images.OrderingListIconTopDisabled",
+ "org.richfaces.renderkit.html.images.OrderingListIconBottomDisabled"
+ };
+
+ for (int i = 0; i < gifResources.length; i++) {
+ checkResource(gifResources[i], ImageInfo.FORMAT_GIF);
+ }
}
/**