[richfaces-svn-commits] JBoss Rich Faces SVN: r400 - trunk/richfaces/toolBar/src/test/java/org/richfaces/component.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Fri Apr 13 08:36:35 EDT 2007
Author: A.Skokov
Date: 2007-04-13 08:36:35 -0400 (Fri, 13 Apr 2007)
New Revision: 400
Modified:
trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java
Log:
test updated
Modified: trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java
===================================================================
--- trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java 2007-04-13 12:26:52 UTC (rev 399)
+++ trunk/richfaces/toolBar/src/test/java/org/richfaces/component/ToolBarComponentTest.java 2007-04-13 12:36:35 UTC (rev 400)
@@ -21,15 +21,21 @@
package org.richfaces.component;
+import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import junit.framework.Assert;
+import org.ajax4jsf.framework.resource.InternetResource;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.resource.ResourceBuilderImpl;
+import org.ajax4jsf.framework.util.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.html.HtmlToolBarGroup;
+import javax.faces.component.UICommand;
import javax.faces.component.UIForm;
import javax.faces.component.html.HtmlCommandButton;
import javax.faces.component.html.HtmlForm;
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -38,9 +44,6 @@
public class ToolBarComponentTest extends AbstractAjax4JsfTestCase {
private UIToolBar toolBar;
- private UIToolBarGroup toolBarGroup;
- private HtmlCommandButton button1;
- private HtmlCommandButton button2;
private UIForm form;
/**
@@ -62,20 +65,48 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- toolBar = (UIToolBar)application.createComponent("org.richfaces.ToolBar");
+ toolBar = (UIToolBar) application.createComponent("org.richfaces.ToolBar");
toolBar.setId("toolBar");
+ toolBar.setItemSeparator("square");
form.getChildren().add(toolBar);
- button1 = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
- button1.setValue("Change 1");
- toolBar.getChildren().add(button1);
+ UICommand button = (UICommand) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBar.getChildren().add(button);
- toolBarGroup = (HtmlToolBarGroup)application.createComponent("org.richfaces.ToolBarGroup");
- button2 = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
- button2.setValue("Change 2");
- toolBarGroup.getChildren().add(button2);
+ button = (UICommand) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBar.getChildren().add(button);
+ UIToolBarGroup toolBarGroup = (UIToolBarGroup) application.createComponent("org.richfaces.ToolBarGroup");
+ toolBarGroup.setItemSeparator("disc");
+ button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBarGroup.getChildren().add(button);
+ button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBarGroup.getChildren().add(button);
toolBar.getChildren().add(toolBarGroup);
+
+ toolBarGroup = (UIToolBarGroup) application.createComponent("org.richfaces.ToolBarGroup");
+ toolBarGroup.setItemSeparator("grid");
+ button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBarGroup.getChildren().add(button);
+ button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBarGroup.getChildren().add(button);
+ toolBar.getChildren().add(toolBarGroup);
+
+ toolBarGroup = (UIToolBarGroup) application.createComponent("org.richfaces.ToolBarGroup");
+ toolBarGroup.setItemSeparator("line");
+ button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBarGroup.getChildren().add(button);
+ button = (HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
+ button.setValue("Change");
+ toolBarGroup.getChildren().add(button);
+ toolBar.getChildren().add(toolBarGroup);
}
/* (non-Javadoc)
@@ -84,7 +115,6 @@
public void tearDown() throws Exception {
super.tearDown();
toolBar = null;
- toolBarGroup = null;
form = null;
}
@@ -120,4 +150,34 @@
HtmlElement link = (HtmlElement) links.get(0);
assertTrue(link.getAttributeValue("href").contains("org/richfaces/renderkit/html/css/toolBar.xcss"));
}
+
+ public void testRenderImages() throws Exception {
+ renderView();
+ InternetResourceBuilder builder = ResourceBuilderImpl.getInstance();
+ InternetResource resource = builder.getResource("org/richfaces/renderkit/html/css/toolBar.xcss");
+ assertNotNull(resource);
+ String uri = "http:" + resource.getUri(facesContext, null);
+ Page page = webClient.getPage(uri);
+ assertTrue(page.getWebResponse().getStatusCode() == HttpServletResponse.SC_OK);
+
+ String[] resources = new String[]{
+ "org.richfaces.renderkit.html.images.DotSeparatorImage",
+ "org.richfaces.renderkit.html.images.GridSeparatorImage",
+ "org.richfaces.renderkit.html.images.LineSeparatorImage",
+ "org.richfaces.renderkit.html.images.SquareSeparatorImage"
+ };
+
+ 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());
+ }
+ }
}
More information about the richfaces-svn-commits
mailing list