Author: nbelaevski
Date: 2008-05-23 09:27:15 -0400 (Fri, 23 May 2008)
New Revision: 8726
Modified:
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
Log:
http://jira.jboss.com/jira/browse/RF-3483
Modified:
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java
===================================================================
---
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-05-23
13:22:24 UTC (rev 8725)
+++
trunk/ui/listShuttle/src/test/java/org/richfaces/renderkit/ListShuttleRenderingTest.java 2008-05-23
13:27:15 UTC (rev 8726)
@@ -59,7 +59,6 @@
private UIColumn column2 = null;
private static final Set<String> javaScripts = new HashSet<String>();
- private static final Set<String> imageClasses = new HashSet<String>();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
@@ -70,27 +69,6 @@
javaScripts.add("scripts/OrderingList.js");
javaScripts.add("scripts/ListShuttle.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");
-
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopy");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyAll");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemove");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled");
- imageClasses.add("org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled");
}
/**
@@ -315,6 +293,23 @@
assertEquals(IMAGE_COUNT, foundImages);
}
+ private void checkResource(String path, int format) throws Exception {
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ builder.createResource(null, path);
+ InternetResource resource = builder.getResource(path);
+ 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(format, info.getFormat());
+ assertTrue(info.getHeight() > 0);
+ assertTrue(info.getWidth() > 0);
+ }
+
/**
* Test default images rendering
*
@@ -323,25 +318,41 @@
public void testRenderImages() throws Exception {
HtmlPage view = renderView();
assertNotNull(view);
+
+ 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);
+ }
- InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
-
- 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",
+
+ "org.richfaces.renderkit.html.images.ListShuttleIconCopy",
+ "org.richfaces.renderkit.html.images.ListShuttleIconCopyDisabled",
+ "org.richfaces.renderkit.html.images.ListShuttleIconCopyAll",
+ "org.richfaces.renderkit.html.images.ListShuttleIconCopyAllDisabled",
+ "org.richfaces.renderkit.html.images.ListShuttleIconRemove",
+ "org.richfaces.renderkit.html.images.ListShuttleIconRemoveAll",
+ "org.richfaces.renderkit.html.images.ListShuttleIconRemoveDisabled",
+ "org.richfaces.renderkit.html.images.ListShuttleIconRemoveAllDisabled"
+ };
+
+ for (int i = 0; i < gifResources.length; i++) {
+ checkResource(gifResources[i], ImageInfo.FORMAT_GIF);
+ }
+
}
/**