From jbosstools-commits at lists.jboss.org Mon Jan 14 13:08:48 2008 Content-Type: multipart/mixed; boundary="===============3092590683269562945==" MIME-Version: 1.0 From: jbosstools-commits at lists.jboss.org To: jbosstools-commits at lists.jboss.org Subject: [jbosstools-commits] JBoss Tools SVN: r5667 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test: src/org/jboss/tools/jsf/vpe/richfaces/test and 1 other directory. Date: Mon, 14 Jan 2008 13:08:48 -0500 Message-ID: --===============3092590683269562945== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: dsakovich Date: 2008-01-14 13:08:47 -0500 (Mon, 14 Jan 2008) New Revision: 5667 Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFac= esTest/WebContent/pages/components/contextMenu.xhtml Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/too= ls/jsf/vpe/richfaces/test/RichFacesComponentTest.java Log: JUnit test for http://jira.jboss.com/jira/browse/JBIDE-1581 Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/ric= hFacesTest/WebContent/pages/components/contextMenu.xhtml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFa= cesTest/WebContent/pages/components/contextMenu.xhtml = (rev 0) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFa= cesTest/WebContent/pages/components/contextMenu.xhtml 2008-01-14 18:08:47 U= TC (rev 5667) @@ -0,0 +1,18 @@ + + + + + + + + + + + + \ No newline at end of file Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jb= oss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/to= ols/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2008-01-14 17:44:21 = UTC (rev 5666) +++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/to= ols/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2008-01-14 18:08:47 = UTC (rev 5667) @@ -10,10 +10,21 @@ *************************************************************************= *****/ package org.jboss.tools.jsf.vpe.richfaces.test; = +import java.util.ArrayList; +import java.util.List; + import org.eclipse.core.resources.IFile; +import org.eclipse.ui.IEditorInput; import org.eclipse.ui.PartInitException; +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; +import org.mozilla.interfaces.nsIDOMText; = /** * Class for testing all RichFaces components @@ -23,183 +34,250 @@ */ public class RichFacesComponentTest extends VpeTest { = - // import project name - public static final String IMPORT_PROJECT_NAME =3D "richFacesTest"; + // import project name + public static final String IMPORT_PROJECT_NAME =3D "richFacesTest"; = - public RichFacesComponentTest(String name) { - super(name); - setCheckWarning(false); - } + public RichFacesComponentTest(String name) { + super(name); + setCheckWarning(false); + } = - public void testAllComponentsOnSinglePage() throws PartInitException, - Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/richFacesTest.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testAllComponentsOnSinglePage() throws PartInitException, + Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/richFacesTest.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testCalendar() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/calendar.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testCalendar() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/calendar.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDataDefinitionList() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataDefinitionList.xhtml", IMPORT_PROJECT_NAME)); // $NON-= NLS-1$ - } + public void testDataDefinitionList() throws PartInitException, Throwab= le { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataDefinitionList.xhtml", IMPORT_PROJECT_NAME)); // $NON-NL= S-1$ + } = - public void testDataFilterSlider() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataFilterSlider.xhtml", IMPORT_PROJECT_NAME)); // $NON-NL= S-1$ - } + public void testDataFilterSlider() throws PartInitException, Throwable= { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataFilterSlider.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-= 1$ + } = - public void testDataGrid() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataGrid.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testDataGrid() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataGrid.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDataList() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataList.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testDataList() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataList.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDataOrderedList() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataOrderedList.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS= -1$ - } + public void testDataOrderedList() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataOrderedList.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDataScroller() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataScroller.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testDataScroller() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataScroller.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDataTable() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dataTable.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testDataTable() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dataTable.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDragAndDrop() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dragAndDrop.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testDragAndDrop() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dragAndDrop.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testDropDawnMenu() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/dropDawnMenu.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testDropDawnMenu() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/dropDawnMenu.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testEffect() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/effect.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testEffect() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/effect.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testGoogleMap() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/googleMap.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testGoogleMap() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/googleMap.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testInputNumberSlider() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/inputNumberSlider.xhtml", IMPORT_PROJECT_NAME)); // $NON-N= LS-1$ - } + public void testInputNumberSlider() throws PartInitException, Throwabl= e { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/inputNumberSlider.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS= -1$ + } = - public void testInputNumberSpinner() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/inputNumberSpinner.xhtml", IMPORT_PROJECT_NAME)); // $NON-= NLS-1$ - } + public void testInputNumberSpinner() throws PartInitException, Throwab= le { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/inputNumberSpinner.xhtml", IMPORT_PROJECT_NAME)); // $NON-NL= S-1$ + } = - public void testInsert() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/insert.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testInsert() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/insert.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testMessage() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/message.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testMessage() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/message.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testMessages() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/messages.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testMessages() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/messages.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testModalPanel() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/modalPanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testModalPanel() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/modalPanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testPaint2D() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/paint2D.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testPaint2D() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/paint2D.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testPanel() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/panel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testPanel() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/panel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testPanelBar() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/panelBar.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testPanelBar() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/panelBar.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testPanelMenu() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/panelMenu.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testPanelMenu() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/panelMenu.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testScrollableDataTable() throws PartInitException, Throwable= { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/scrollableDataTable.xhtml", IMPORT_PROJECT_NAME)); // $NON= -NLS-1$ - } + public void testScrollableDataTable() throws PartInitException, Throwa= ble { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/scrollableDataTable.xhtml", IMPORT_PROJECT_NAME)); // $NON-N= LS-1$ + } = - public void testSeparator() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/separator.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testSeparator() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/separator.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testSimpleTogglePanel() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/simpleTogglePanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-N= LS-1$ - } + public void testSimpleTogglePanel() throws PartInitException, Throwabl= e { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/simpleTogglePanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS= -1$ + } = - public void testSpacer() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/spacer.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testSpacer() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/spacer.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testSuggestionBox() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/suggestionbox.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testSuggestionBox() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/suggestionbox.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testTabPanel() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/tabPanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testTabPanel() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/tabPanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testTogglePanel() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/togglePanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testTogglePanel() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/togglePanel.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testToolBar() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/toolBar.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testToolBar() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/toolBar.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testTree() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/tree.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } + public void testTree() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/tree.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = - public void testVirtualEarth() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/virtualEarth.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ - } - = - public void testComponentControl() throws PartInitException, Throwable { - performTestForVpeComponent((IFile) TestUtil.getComponentPath( - "components/componentControl.xhtml", IMPORT_PROJECT_NAME)); // $NON-NL= S-1$ - } + public void testVirtualEarth() throws PartInitException, Throwable { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/virtualEarth.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-1$ + } = + public void testComponentControl() throws PartInitException, Throwable= { + performTestForVpeComponent((IFile) TestUtil.getComponentPath( + "components/componentControl.xhtml", IMPORT_PROJECT_NAME)); // $NON-NLS-= 1$ + } + + public void testcontextMenu() throws Throwable { + nsIDOMElement element =3D performTestForRichFacesComponent("components/co= ntextMenu.xhtml"); + + nsIDOMNode node =3D (nsIDOMNode) element + .queryInterface(nsIDOMNode.NS_IDOMNODE_IID); + + List elements =3D new ArrayList(); + + // find "span" elements + TestUtil.findElementsByName(node, elements, HTML.TAG_SPAN); + + assertEquals("Component's content is not shown", 4, elements.size()); + + nsIDOMElement elementSpan =3D (nsIDOMElement) elements.get(1) + .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID); + + nsIDOMText text =3D (nsIDOMText) elementSpan.getFirstChild() + .queryInterface(nsIDOMText.NS_IDOMTEXT_IID); + + nsIDOMElement elementSpan1 =3D (nsIDOMElement) elements.get(3) + .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID); + + nsIDOMText text1 =3D (nsIDOMText) elementSpan1.getFirstChild() + .queryInterface(nsIDOMText.NS_IDOMTEXT_IID); + + assertEquals("Component's content is not shown", text.getNodeValue(), + "Zoom In"); + assertEquals("Component's content is not shown", text1.getNodeValue(), + "Zoom Out"); + + } + + /** + * = + * @param componentPage + * @return + * @throws Throwable + */ + private nsIDOMElement performTestForRichFacesComponent(String componen= tPage) + throws Throwable { + TestUtil.waitForJobs(); + // set exception + setException(null); + + // get test page path + IFile file =3D (IFile) TestUtil.getComponentPath(componentPage, + IMPORT_PROJECT_NAME); + + assertNotNull("Could not open specified file " + file.getFullPath(), + file); + + IEditorInput input =3D new FileEditorInput(file); + + assertNotNull("Editor input is null", input); + // open and get editor + JSPMultiPageEditor part =3D openEditor(input); + + // get dom document + nsIDOMDocument document =3D getVpeVisualDocument(part); + nsIDOMElement element =3D document.getDocumentElement(); + + // check that element is not null + assertNotNull(element); + + return element; + } + } --===============3092590683269562945==--