[richfaces-svn-commits] JBoss Rich Faces SVN: r350 - in trunk/richfaces/suggestionbox/src/test/java/org/richfaces: component and 2 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 11 06:40:30 EDT 2007


Author: A.Skokov
Date: 2007-04-11 06:40:30 -0400 (Wed, 11 Apr 2007)
New Revision: 350

Added:
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/AjaxSuggestionEventTest.java
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionEventTest.java
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/renderkit/
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/renderkit/html/
   trunk/richfaces/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java
Log:
test updated

Added: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/AjaxSuggestionEventTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/AjaxSuggestionEventTest.java	                        (rev 0)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/AjaxSuggestionEventTest.java	2007-04-11 10:40:30 UTC (rev 350)
@@ -0,0 +1,72 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * Unit test for AjaxSuggestionEvent.
+ */
+public class AjaxSuggestionEventTest extends AbstractAjax4JsfTestCase {
+
+    private AjaxSuggestionEvent event1;
+    private AjaxSuggestionEvent event2;
+    private UISuggestionBox sb;
+
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AjaxSuggestionEventTest(String testName) {
+        super(testName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+     */
+    public void setUp() throws Exception {
+        super.setUp();
+
+        sb = (UISuggestionBox)application.createComponent("org.richfaces.SuggestionBox");
+        event1 = new AjaxSuggestionEvent(sb);
+        event2 = new AjaxSuggestionEvent(sb, "VALUE2");
+    }
+
+    /* (non-Javadoc)
+     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+     */
+    public void tearDown() throws Exception {
+        super.tearDown();
+        event1 = null;
+        event2 = null;
+        sb = null;
+    }
+
+    public void testEvent() throws Exception {
+        assertNull(event1.getSubmittedValue());
+        event1.setSubmittedValue("VALUE1");
+        assertEquals("VALUE1", event1.getSubmittedValue());
+
+        assertEquals("VALUE2", event2.getSubmittedValue());
+    }
+}

Added: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionEventTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionEventTest.java	                        (rev 0)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionEventTest.java	2007-04-11 10:40:30 UTC (rev 350)
@@ -0,0 +1,72 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.component;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * Unit test for SuggestionEvent.
+ */
+public class SuggestionEventTest extends AbstractAjax4JsfTestCase {
+
+    private SuggestionEvent event1;
+    private SuggestionEvent event2;
+    private UISuggestionBox sb;
+
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public SuggestionEventTest(String testName) {
+        super(testName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+     */
+    public void setUp() throws Exception {
+        super.setUp();
+
+        sb = (UISuggestionBox)application.createComponent("org.richfaces.SuggestionBox");
+        event1 = new SuggestionEvent(sb);
+        event2 = new SuggestionEvent(sb, "VALUE2");
+    }
+
+    /* (non-Javadoc)
+     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+     */
+    public void tearDown() throws Exception {
+        super.tearDown();
+        event1 = null;
+        event2 = null;
+        sb = null;
+    }
+
+    public void testEvent() throws Exception {
+        assertNull(event1.getSubmittedValue());
+        event1.setSubmittedValue("VALUE1");
+        assertEquals("VALUE1", event1.getSubmittedValue());
+
+        assertEquals("VALUE2", event2.getSubmittedValue());
+    }
+}

Added: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java	                        (rev 0)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/renderkit/html/SuggestionBoxRendererTest.java	2007-04-11 10:40:30 UTC (rev 350)
@@ -0,0 +1,117 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.UISuggestionBox;
+
+/**
+ * Unit test for SuggestionBox renderer.
+ */
+public class SuggestionBoxRendererTest extends AbstractAjax4JsfTestCase {
+
+    private SuggestionBoxRenderer renderer;
+    private UISuggestionBox sb;
+
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public SuggestionBoxRendererTest(String testName) {
+        super(testName);
+    }
+
+    /* (non-Javadoc)
+     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+     */
+    public void setUp() throws Exception {
+        super.setUp();
+
+        renderer = new SuggestionBoxRenderer();
+        sb = (UISuggestionBox)application.createComponent("org.richfaces.SuggestionBox");
+    }
+
+    /* (non-Javadoc)
+     * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+     */
+    public void tearDown() throws Exception {
+        super.tearDown();
+        renderer = null;
+    }
+
+    public void testOpacityStyle() throws Exception {
+        String opacity = renderer.opacityStyle(facesContext, sb);
+        assertEquals("opacity:0.1; filter:alpha(opacity=10);", opacity);
+
+        sb.getAttributes().put("shadowOpacity", "3");
+        opacity = renderer.opacityStyle(facesContext, sb);
+        assertEquals("opacity:0.3; filter:alpha(opacity=30);", opacity);
+    }
+
+    public void testBorder() throws Exception {
+        String border = renderer.border(facesContext, sb);
+        assertEquals("; border-width: null  null  null  null ;", border);
+
+        sb.getAttributes().put("border", "3");
+        border = renderer.border(facesContext, sb);
+        assertEquals("; border-width: 3px  3px  3px  3px ;", border);
+    }
+
+    public void testBgcolor() throws Exception {
+        String bgcolor = renderer.bgcolor(facesContext, sb);
+        assertEquals(";", bgcolor);
+
+        sb.getAttributes().put("bgcolor", "red");
+        bgcolor = renderer.bgcolor(facesContext, sb);
+        assertEquals("background-color: red;", bgcolor);
+    }
+
+    public void testCellPadding() throws Exception {
+        String cellPadding = renderer.cellPadding(facesContext, sb);
+        assertEquals(";", cellPadding);
+
+        sb.setCellpadding("10");
+        cellPadding = renderer.cellPadding(facesContext, sb);
+        assertEquals("padding: 10px;", cellPadding);
+    }
+
+    public void testContentId() throws Exception {
+        sb.setId("suggestionBox");
+        String contentId = renderer.getContentId(facesContext, sb);
+        assertEquals("suggestionBox:suggest", contentId);
+    }
+
+    public void testOverflowSize() throws Exception {
+        String overflowSize = renderer.overflowSize(facesContext, sb);
+        assertEquals("width:196px;height:196px;", overflowSize);
+    }
+
+    public void testShadowDepth() throws Exception {
+        String shadowDepth = renderer.shadowDepth(facesContext, sb);
+        assertEquals("top: 4; left: 4", shadowDepth);
+
+        sb.getAttributes().put("shadowDepth", "2");
+        shadowDepth = renderer.shadowDepth(facesContext, sb);
+        assertEquals("top: 2; left: 2", shadowDepth);
+    }
+}




More information about the richfaces-svn-commits mailing list