Author: dsakovich
Date: 2008-03-17 12:47:48 -0400 (Mon, 17 Mar 2008)
New Revision: 6972
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1730/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1730/JBIDE-1730.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pictures/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pictures/pic1.jpg
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1730Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
Add JUnit test for
http://jira.jboss.org/jira/browse/JBIDE-1730
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1730/JBIDE-1730.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1730/JBIDE-1730.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/1730/JBIDE-1730.jsp 2008-03-17
16:47:48 UTC (rev 6972)
@@ -0,0 +1,75 @@
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<f:loadBundle var="mgs" basename="demo.Messages" />
+
+<html>
+ <head>
+ <title> Test h:pannelGrid and h:pannelGroup in VPE </title>
+ <style type="text/css">
+ .myStyle0 {background: aqua;}
+ .myStyle1 {background: yellow;}
+ .myStyle2 {background: lime;}
+ </style>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:panelGrid
+ id="gridId1"
+ dir="RTL"
+ columns="2" border="5" width="250"
+ rules="all" frame="above"
+ cellpadding="4" cellspacing="6"
+ bgcolor="silver"
+ style=""
+ styleClass=""
+ captionStyle="color : red;" captionClass="myStyle0"
+ columnClasses="" rowClasses=""
+ headerClass="" footerClass="" >
+ <f:facet name="caption">
+ <h:outputText value="Caption"/>
+ </f:facet>
+ <f:facet name="header">
+ <h:panelGroup
+ id="groupId1_1"
+ layout="block"
+ style=""
+ styleClass="" >
+ <h:outputText value="Header"/>
+ <br/>
+ <h:graphicImage value="/pictures/pic1.jpg" />
+ </h:panelGroup>
+ </f:facet>
+ <h:panelGroup
+ id="groupId1_2"
+ layout="block"
+ style=""
+ styleClass="" >
+ <h:outputLabel for="username1" value="name" />
+ </h:panelGroup>
+ <h:panelGroup
+ id="groupId1_3"
+ layout="block"
+ style=""
+ styleClass="" >
+ <h:inputText id="username1" value="#{user.name}" />
+ </h:panelGroup>
+ <h:outputLabel for="surname1" value="surname" />
+ <h:inputText id="surname1" value="#{user.surname}" />
+ <f:facet name="footer">
+ <h:panelGroup
+ id="groupId1_4"
+ layout="block"
+ style=""
+ styleClass="" >
+ <h:outputText value="Footer"/>
+ <br/>
+ <h:graphicImage value="/pictures/pic1.jpg"/>
+ </h:panelGroup>
+ </f:facet>
+ </h:panelGrid>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pictures/pic1.jpg
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pictures/pic1.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-03-17
16:43:01 UTC (rev 6971)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-03-17
16:47:48 UTC (rev 6972)
@@ -22,6 +22,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1484Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1615Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1720Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1730Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE1744Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
@@ -43,7 +44,7 @@
public static Test suite() {
- TestSuite suite = new TestSuite("Tests for Vpe Jsf components"); //
$NON-NLS-1$
+ TestSuite suite = new TestSuite("Tests for Vpe Jsf components"); //
$NON-NLS-1$ //$NON-NLS-1$
// $JUnit-BEGIN$
suite.addTestSuite(JsfComponentTest.class);
suite.addTestSuite(JsfJbide1467Test.class);
@@ -54,30 +55,31 @@
suite.addTestSuite(JBIDE1479Test.class);
suite.addTestSuite(JBIDE788Test.class);
suite.addTestSuite(JBIDE1105Test.class);
- suite.addTestSuite(JBIDE1744Test.class);
+ suite.addTestSuite(JBIDE1744Test.class);
suite.addTestSuite(JBIDE675Test.class);
suite.addTestSuite(JBIDE1460Test.class);
suite.addTestSuite(JBIDE1720Test.class);
- suite.addTestSuite(JsfJbide1718Test.class) ;
+ suite.addTestSuite(JsfJbide1718Test.class);
+ suite.addTestSuite(JBIDE1730Test.class);
// $JUnit-END$
- //added by Max Areshkau
- //add here projects which should be imported for junit tests
+ // added by Max Areshkau
+ // add here projects which should be imported for junit tests
List<ImportBean> projectToImport = new ArrayList<ImportBean>();
ImportBean importBean = new ImportBean();
importBean.setImportProjectName(JsfComponentTest.IMPORT_PROJECT_NAME);
- importBean.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
- projectToImport.add(importBean);
-
- // Perfomance Tests
- //TODO dsakovich adjust perfomance tests
-// suite.addTestSuite(PerfomanceTest.class);
-// ImportBean importPerfomanceBean = new ImportBean();
-// importPerfomanceBean.setImportProjectName(PerfomanceTest.IMPORT_PROJECT_NAME);
-// importPerfomanceBean.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
-// projectToImport.add(importPerfomanceBean);
-
- return new VpeTestSetup(suite,projectToImport);
+ importBean.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
+ projectToImport.add(importBean);
+ // Perfomance Tests
+ // TODO dsakovich adjust perfomance tests
+ // suite.addTestSuite(PerfomanceTest.class);
+ // ImportBean importPerfomanceBean = new ImportBean();
+ // importPerfomanceBean.setImportProjectName(PerfomanceTest.IMPORT_PROJECT_NAME);
+ // importPerfomanceBean.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
+ // projectToImport.add(importPerfomanceBean);
+
+ return new VpeTestSetup(suite, projectToImport);
+
}
}
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1730Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1730Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE1730Test.java 2008-03-17
16:47:48 UTC (rev 6972)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+
+/**
+ * Test JBIDE-1730
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ *
+ */
+public class JBIDE1730Test extends VpeTest {
+
+ public static final String IMPORT_PROJECT_NAME = "jsfTest"; //$NON-NLS-1$
+
+ private static final String TEST_PAGE_NAME1 = "JBIDE/1730/JBIDE-1730.jsp";
//$NON-NLS-1$
+
+ public JBIDE1730Test(String name) {
+ super(name);
+ }
+
+ // test method for JBIDE 1730 selectOneRadio component
+ public void testJBIDE_1730() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+
+ // get test page path
+ IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME1,
+ IMPORT_PROJECT_NAME);
+
+ assertNotNull("Could not open specified file " + file.getFullPath(),
//$NON-NLS-1$
+ file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(part);
+ nsIDOMElement element = document.getDocumentElement();
+
+ // check that element is not null
+ assertNotNull(element);
+
+ // get root node
+ nsIDOMNode node = (nsIDOMNode) element
+ .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "table" elements
+ TestUtil.findAllElementsByName(node, elements, HTML.TAG_TABLE);
+
+ assertEquals(3, elements.size());
+
+ nsIDOMElement table = (nsIDOMElement) elements.get(2).queryInterface(
+ nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ // test border attribute
+ String border = table.getAttribute(HTML.ATTR_BORDER);
+
+ assertNotNull(border);
+ assertEquals("5", border.trim()); //$NON-NLS-1$
+
+ // test dir attribute
+ String dir = table.getAttribute(HTML.ATTR_DIR);
+
+ assertNotNull(dir);
+ assertEquals("rtl", dir.trim().toLowerCase()); //$NON-NLS-1$
+
+ // test cellspacing attribute
+ String cellspacing = table.getAttribute(HTML.ATTR_CELLSPACING);
+
+ assertNotNull(cellspacing);
+ assertEquals("6", cellspacing.trim()); //$NON-NLS-1$
+
+ // test frame attribute
+ String frame = table.getAttribute(HTML.ATTR_FRAME);
+
+ assertNotNull(frame);
+ assertEquals("above", frame.trim().toLowerCase()); //$NON-NLS-1$
+
+ elements.clear();
+
+ // find "caption" elements
+ TestUtil.findAllElementsByName(node, elements, HTML.TAG_CAPTION);
+
+ assertEquals(1, elements.size());
+
+ // Test captionClass
+ nsIDOMElement caption = (nsIDOMElement) elements.get(0).queryInterface(
+ nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ String captionClass = caption.getAttribute(HTML.ATTR_CLASS);
+
+ assertNotNull(captionClass);
+ assertEquals("myStyle0", captionClass.trim()); //$NON-NLS-1$
+
+ // Test captionStyle
+
+ String captionStyle = caption.getAttribute(HTML.ATTR_STYLE);
+
+ assertNotNull(captionStyle);
+ assertEquals("color: red;", captionStyle.trim()); //$NON-NLS-1$
+
+ if (getException() != null) {
+ throw getException();
+ }
+ }
+
+}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-03-17
16:43:01 UTC (rev 6971)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2008-03-17
16:47:48 UTC (rev 6972)
@@ -56,9 +56,9 @@
public static final String TAG_B = "B"; //$NON-NLS-1$
public static final String TAG_I = "I"; //$NON-NLS-1$
public static final String TAG_U = "U"; //$NON-NLS-1$
- public static final String TAG_LABEL = "LABEL";
- public static final String TAG_A = "A";
- public static final String TAG_H1 = "H1";
+ public static final String TAG_LABEL = "LABEL"; //$NON-NLS-1$
+ public static final String TAG_A = "A"; //$NON-NLS-1$
+ public static final String TAG_H1 = "H1"; //$NON-NLS-1$
public static final String ATTR_ID = "ID"; //$NON-NLS-1$
public static final String ATTR_TYPE = "TYPE"; //$NON-NLS-1$
@@ -76,8 +76,8 @@
public static final String ATTR_WIDTH = "WIDTH"; //$NON-NLS-1$
public static final String ATTR_HEIGHT = "HEIGHT"; //$NON-NLS-1$
public static final String ATTR_BORDER = "border"; //$NON-NLS-1$
- public static final String ATTR_FOR = "FOR";
- public static final String ATTR_DIR = "dir";
- public static final String ATTR_DISABLED = "disabled";
-
+ public static final String ATTR_FOR = "FOR"; //$NON-NLS-1$
+ public static final String ATTR_DIR = "dir"; //$NON-NLS-1$
+ public static final String ATTR_DISABLED = "disabled"; //$NON-NLS-1$
+ public static final String ATTR_FRAME = "frame"; //$NON-NLS-1$
}
\ No newline at end of file