Author: lfryc(a)redhat.com
Date: 2011-02-07 11:23:01 -0500 (Mon, 07 Feb 2011)
New Revision: 21518
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenu/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/AbstractPanelMenuTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/PanelMenuAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuDOMEvents.java
Log:
rich:panelMenu - automated testing of icons (RFPL-950)
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenu/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenu/simple.xhtml 2011-02-07
15:32:02 UTC (rev 21517)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richPanelMenu/simple.xhtml 2011-02-07
16:23:01 UTC (rev 21518)
@@ -58,8 +58,8 @@
groupCollapsedLeftIcon="#{richPanelMenuBean.attributes['groupCollapsedLeftIcon'].value}"
groupCollapsedRightIcon="#{richPanelMenuBean.attributes['groupCollapsedRightIcon'].value}"
groupDisabledClass="#{richPanelMenuBean.attributes['groupDisabledClass'].value}"
-
groupDisabledLeftIcon="#{richPanelMenuBean.attributes['groupDisabledRightIcon'].value}"
-
groupDisabledRightIcon="#{richPanelMenuBean.attributes['groupRightIconDisabled'].value}"
+
groupDisabledLeftIcon="#{richPanelMenuBean.attributes['groupDisabledLeftIcon'].value}"
+
groupDisabledRightIcon="#{richPanelMenuBean.attributes['groupDisabledRightIcon'].value}"
groupExpandedLeftIcon="#{richPanelMenuBean.attributes['groupExpandedLeftIcon'].value}"
groupExpandedRightIcon="#{richPanelMenuBean.attributes['groupExpandedRightIcon'].value}"
groupMode="#{richPanelMenuBean.attributes['groupMode'].value}"
@@ -68,8 +68,8 @@
itemDisabledClass="#{richPanelMenuBean.attributes['itemDisabledClass'].value}"
itemDisabledLeftIcon="#{richPanelMenuBean.attributes['itemDisabledLeftIcon'].value}"
itemDisabledRightIcon="#{richPanelMenuBean.attributes['itemDisabledRightIcon'].value}"
-
itemLeftIcon="#{richPanelMenuBean.attributes['topItemLeftIconDisabled'].value}"
-
itemRightIcon="#{richPanelMenuBean.attributes['topItemRightIconDisabled'].value}"
+
itemLeftIcon="#{richPanelMenuBean.attributes['itemLeftIcon'].value}"
+
itemRightIcon="#{richPanelMenuBean.attributes['itemRightIcon'].value}"
itemMode="#{richPanelMenuBean.attributes['itemMode'].value}"
limitRender="#{richPanelMenuBean.attributes['limitRender'].value}"
onclick="#{richPanelMenuBean.attributes['onclick'].value}"
@@ -96,8 +96,8 @@
topItemDisabledClass="#{richPanelMenuBean.attributes['topItemDisabledClass'].value}"
topItemDisabledLeftIcon="#{richPanelMenuBean.attributes['topItemDisabledLeftIcon'].value}"
topItemDisabledRightIcon="#{richPanelMenuBean.attributes['topItemDisabledRightIcon'].value}"
-
topItemLeftIcon="#{richPanelMenuBean.attributes['topItemLeftIconDisabled'].value}"
-
topItemRightIcon="#{richPanelMenuBean.attributes['topItemRightIconDisabled'].value}"
+
topItemLeftIcon="#{richPanelMenuBean.attributes['topItemLeftIcon'].value}"
+
topItemRightIcon="#{richPanelMenuBean.attributes['topItemRightIcon'].value}"
width="#{richPanelMenuBean.attributes['width'].value}"
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/AbstractPanelMenuTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/AbstractPanelMenuTest.java 2011-02-07
15:32:02 UTC (rev 21517)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/AbstractPanelMenuTest.java 2011-02-07
16:23:01 UTC (rev 21518)
@@ -47,6 +47,7 @@
PanelMenu.Group group24 = group2.getGroupContains("Group 2.4");
PanelMenu.Group group26 = group2.getGroupContains("Group 2.6");
PanelMenu.Item item242 = group24.getItemContains("Item 2.4.2");
+ PanelMenu.Group group4 = menu.getGroupContains("Group 4");
@Override
public URL getTestUrl() {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/PanelMenuAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/PanelMenuAttributes.java 2011-02-07
15:32:02 UTC (rev 21517)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/PanelMenuAttributes.java 2011-02-07
16:23:01 UTC (rev 21518)
@@ -101,8 +101,8 @@
setProperty("itemDisabledRightIcon", itemDisabledRightIcon);
}
- public void setLeftIcon(String leftIcon) {
- setProperty("leftIcon", leftIcon);
+ public void setItemLeftIcon(String itemLeftIcon) {
+ setProperty("itemLeftIcon", itemLeftIcon);
}
public void setItemMode(PanelMenuMode itemMode) {
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuDOMEvents.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuDOMEvents.java 2011-02-07
15:32:02 UTC (rev 21517)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuDOMEvents.java 2011-02-07
16:23:01 UTC (rev 21518)
@@ -49,7 +49,7 @@
public class TestPanelMenuDOMEvents extends AbstractPanelMenuTest {
@Inject
- PanelMenuMode mode = PanelMenuMode.client;
+ PanelMenuMode mode;
@Inject
@Use("events")
@@ -77,9 +77,11 @@
@BeforeMethod
public void setup() {
- attributes.setGroupMode(mode);
- menu.setGroupMode(mode);
waitToggle = waitModel.timeout(5000).interval(500);
+ if (mode != null) {
+ attributes.setGroupMode(mode);
+ menu.setGroupMode(mode);
+ }
}
@Test
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPanelMenu/TestPanelMenuIcon.java 2011-02-07
16:23:01 UTC (rev 21518)
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest.richPanelMenu;
+
+import static org.testng.Assert.assertTrue;
+
+import org.richfaces.tests.metamer.ftest.model.PanelMenu.Icon;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestPanelMenuIcon extends AbstractPanelMenuTest {
+
+ private static String CUSTOM_URL = "/resources/images/loading.gif";
+
+ @Test
+ public void testGroupCollapsedLeftIcon() {
+ attributes.setGroupCollapsedLeftIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(group24.getLeftIcon());
+ }
+
+ @Test
+ public void testGroupCollapsedRightIcon() {
+ attributes.setGroupCollapsedRightIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(group24.getRightIcon());
+ }
+
+ @Test
+ public void testGroupDisabledLeftIcon() {
+ attributes.setGroupDisabledLeftIcon(CUSTOM_URL);
+ group2.toggle();
+ assertTrue(group26.getLeftIcon().isCustomURL());
+ assertTrue(group26.getLeftIcon().getCustomURL().endsWith(CUSTOM_URL));
+ verifyIcon(group26.getLeftIcon());
+ }
+
+ @Test
+ public void testDisabledRightIcon() {
+ attributes.setGroupDisabledRightIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(group26.getRightIcon());
+ }
+
+ @Test
+ public void testGroupExpandedLeftIcon() {
+ attributes.setGroupExpandedLeftIcon(CUSTOM_URL);
+ group2.toggle();
+ group24.toggle();
+ verifyIcon(group24.getLeftIcon());
+ }
+
+ @Test
+ public void testGroupExpandedRightIcon() {
+ attributes.setGroupExpandedRightIcon(CUSTOM_URL);
+ group2.toggle();
+ group24.toggle();
+ verifyIcon(group24.getRightIcon());
+ }
+
+ @Test
+ public void testItemDisabledLeftIcon() {
+ attributes.setItemDisabledLeftIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(item25.getLeftIcon());
+ }
+
+ @Test
+ public void testItemDisabledRightIcon() {
+ attributes.setItemDisabledRightIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(item25.getRightIcon());
+ }
+
+ @Test
+ public void testItemLeftIcon() {
+ attributes.setItemLeftIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(item22.getLeftIcon());
+ }
+
+ @Test
+ public void testItemRightIcon() {
+ attributes.setItemRightIcon(CUSTOM_URL);
+ group2.toggle();
+ verifyIcon(item22.getRightIcon());
+ }
+
+ @Test
+ public void testTopGroupCollapsedLeftIcon() {
+ attributes.setTopGroupCollapsedLeftIcon(CUSTOM_URL);
+ verifyIcon(group1.getLeftIcon());
+ }
+
+ @Test
+ public void testTopGroupCollapsedRightIcon() {
+ attributes.setTopGroupCollapsedRightIcon(CUSTOM_URL);
+ verifyIcon(group1.getRightIcon());
+ }
+
+ @Test
+ public void testTopGroupDisabledLeftIcon() {
+ attributes.setTopGroupDisabledLeftIcon(CUSTOM_URL);
+ verifyIcon(group4.getLeftIcon());
+ }
+
+ @Test
+ public void testTopGroupDisabledRightIcon() {
+ attributes.setTopGroupDisabledRightIcon(CUSTOM_URL);
+ verifyIcon(group4.getRightIcon());
+ }
+
+ @Test
+ public void testTopGroupExpandedLeftIcon() {
+ attributes.setTopGroupExpandedLeftIcon(CUSTOM_URL);
+ group1.toggle();
+ verifyIcon(group1.getLeftIcon());
+ }
+
+ @Test
+ public void testTopGroupExpandedRightIcon() {
+ attributes.setTopGroupExpandedRightIcon(CUSTOM_URL);
+ group1.toggle();
+ verifyIcon(group1.getRightIcon());
+ }
+
+ @Test
+ public void testTopItemDisabledLeftIcon() {
+ attributes.setTopItemDisabledLeftIcon(CUSTOM_URL);
+ verifyIcon(item4.getLeftIcon());
+ }
+
+ @Test
+ public void testTopItemDisabledRightIcon() {
+ attributes.setTopItemDisabledRightIcon(CUSTOM_URL);
+ verifyIcon(item4.getRightIcon());
+ }
+
+ @Test
+ public void testTopItemLeftIcon() {
+ attributes.setTopItemLeftIcon(CUSTOM_URL);
+ verifyIcon(item3.getLeftIcon());
+ }
+
+ @Test
+ public void testTopItemRightIcon() {
+ attributes.setTopItemRightIcon(CUSTOM_URL);
+ verifyIcon(item3.getRightIcon());
+ }
+
+ private void verifyIcon(Icon icon) {
+ assertTrue(icon.isCustomURL());
+ assertTrue(icon.getCustomURL().endsWith(CUSTOM_URL));
+ }
+}