Author: nbelaevski
Date: 2008-05-23 09:31:12 -0400 (Fri, 23 May 2008)
New Revision: 8727
Modified:
trunk/ui/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
Log:
http://jira.jboss.com/jira/browse/RF-3483
Modified:
trunk/ui/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
===================================================================
---
trunk/ui/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2008-05-23
13:27:15 UTC (rev 8726)
+++
trunk/ui/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2008-05-23
13:31:12 UTC (rev 8727)
@@ -214,6 +214,21 @@
}
}
+ private void checkResource(String path, int format) throws Exception {
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ 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());
+ //image recognizable?
+ assertTrue(info.check());
+ assertEquals(format, info.getFormat());
+
+ }
+
public void testRenderImages() throws Exception {
HtmlPage view = renderView();
assertNotNull(view);
@@ -226,23 +241,15 @@
Page page = webClient.getPage(uri);
assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
- String[] resources = new String[]{
+ String[] pngResources = new String[]{
"org.richfaces.renderkit.images.TabGradientA",
- "org.richfaces.renderkit.images.TabGradientB",
- "org.richfaces.renderkit.images.TabStripeImage"
+ "org.richfaces.renderkit.images.TabGradientB"
};
+
+ for (int i = 0; i < pngResources.length; i++) {
+ checkResource(pngResources[i], ImageInfo.FORMAT_PNG);
+ }
- for (int i = 0; i < resources.length; i++) {
- resource = builder.getResource(resources[i]);
- assertNotNull(resource);
- uri = "http:" + resource.getUri(facesContext, null);
- page = webClient.getPage(uri);
- assertTrue(page.getWebResponse().getStatusCode() ==
HttpServletResponse.SC_OK);
- ImageInfo info = new ImageInfo();
- info.setInput(page.getWebResponse().getContentAsStream());
- //image recognizable?
- assertTrue(info.check());
- assertEquals(ImageInfo.FORMAT_GIF, info.getFormat());
- }
+ checkResource("org.richfaces.renderkit.images.TabStripeImage",
ImageInfo.FORMAT_GIF);
}
}