Author: mareshkau
Date: 2008-02-22 09:57:10 -0500 (Fri, 22 Feb 2008)
New Revision: 6540
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testUserInputOnTag.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testChangeOnUserInputTextNode.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-675, junit tests
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testChangeOnUserInputTextNode.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testChangeOnUserInputTextNode.xhtml 2008-02-22
14:56:56 UTC (rev 6539)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testChangeOnUserInputTextNode.xhtml 2008-02-22
14:57:10 UTC (rev 6540)
@@ -6,9 +6,7 @@
<input type="text" src=""/>
<div>
<h2>here tests Input of Plain Text by user</h2>
- <img
src="#{facesContext.externalContext.requestContextPath}/images/header.gif"/>
Txt1 Txt2
</div>
- </form>
</body>
</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testUserInputOnTag.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testUserInputOnTag.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/675/testUserInputOnTag.xhtml 2008-02-22
14:57:10 UTC (rev 6540)
@@ -0,0 +1,11 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ <body>
+ <form action="">
+ <h1>Tag Input</h1>
+ <test />
+ </form>
+ </body>
+</html>
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2008-02-22
14:56:56 UTC (rev 6539)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2008-02-22
14:57:10 UTC (rev 6540)
@@ -1,13 +1,13 @@
/*******************************************************************************
-* 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
-******************************************************************************/
+ * 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 org.eclipse.core.resources.IFile;
@@ -29,18 +29,19 @@
* @author mareshkau
*
*/
-public class JBIDE675Test extends VpeTest{
+public class JBIDE675Test extends VpeTest {
private static final String IMPORT_PROJECT_NAME = "jsfTest";
-
+
private static final String TEST_PAGE_NAME =
"JBIDE/675/testChangeOnUserInputTextNode.xhtml";
-
+
public JBIDE675Test(String name) {
super(name);
}
-
+
/**
* Tests Base Input on Source Page
+ *
* @throws Throwable
*/
public void testBaseTextInputOnPage() throws Throwable {
@@ -48,51 +49,109 @@
TestUtil.waitForJobs();
// set exception
setException(null);
- //Tests CA
+ // Tests CA
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME,
IMPORT_PROJECT_NAME);
- assertNotNull("Could not open specified file " + TEST_PAGE_NAME,
- file);
+ assertNotNull("Could not open specified file " + TEST_PAGE_NAME, file);
IEditorInput input = new FileEditorInput(file);
assertNotNull("Editor input is null", input);
-
+
// open and get editor
JSPMultiPageEditor part = openEditor(input);
-
- StyledText styledText = part.getSourceEditor().getTextViewer().getTextWidget();
-
- for(int i=0;i<20;i++) {
+
+ StyledText styledText = part.getSourceEditor().getTextViewer()
+ .getTextWidget();
+
+ for (int i = 0; i < 20; i++) {
+
+ styledText.setCaretOffset(339);
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(part
+ .getSourceEditor().getTextViewer(), 339);
+ Node node = (Node) treeNode;
+ assertNotNull(node);
+
+ VpeController vpeController = getVpeController(part);
+
+ VpeDomMapping domMapping = vpeController.getDomMapping();
+
+ VpeNodeMapping nodeMapping = domMapping.getNodeMapping(node);
+
+ assertNotNull(nodeMapping);
+
+ nsIDOMNode span = nodeMapping.getVisualNode();
+
+ nsIDOMNode textNode = span.getFirstChild();
+
+ assertEquals(textNode.getNodeType(), nsIDOMNode.TEXT_NODE);
+
+ assertNotNull(textNode.getNodeValue());
+
+ assertEquals(textNode.getNodeValue().trim(), node.getNodeValue()
+ .trim());
+
+ styledText.insert("t");
+ }
+ }
+ /**
+ * Tests tag Input on Source Page
+ *
+ * @throws Throwable
+ */
+ public void testBaseTagInputOnPage() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+ // Tests CA
+ // get test page path
+ IFile file = (IFile)
TestUtil.getComponentPath("JBIDE/675/testUserInputOnTag.xhtml",
+ IMPORT_PROJECT_NAME);
+ assertNotNull("Could not open specified file " +
"JBIDE/675/testUserInputOnTag.xhtml", file);
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input);
+
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ StyledText styledText = part.getSourceEditor().getTextViewer()
+ .getTextWidget();
+
+ for (int i = 0; i < 20; i++) {
+
+ styledText.setCaretOffset(311);
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(part
+ .getSourceEditor().getTextViewer(), 311);
+ Node node = (Node) treeNode;
+ assertNotNull(node);
+
+ VpeController vpeController = getVpeController(part);
+
+ VpeDomMapping domMapping = vpeController.getDomMapping();
+
+ VpeNodeMapping nodeMapping = domMapping.getNodeMapping(node);
+
+ assertNotNull(nodeMapping);
+
+ nsIDOMNode div = nodeMapping.getVisualNode();
+
+ nsIDOMNode span = div.getFirstChild();
+ nsIDOMNode textNode = span.getFirstChild();
- styledText.setCaretOffset(339);
- IndexedRegion treeNode =
ContentAssistUtils.getNodeAt(part.getSourceEditor().getTextViewer(), 339);
- Node node = (Node) treeNode;
- assertNotNull(node);
-
- VpeController vpeController = getVpeController(part);
-
- VpeDomMapping domMapping = vpeController.getDomMapping();
-
- VpeNodeMapping nodeMapping = domMapping.getNodeMapping(node);
-
- assertNotNull(nodeMapping);
-
- nsIDOMNode span = nodeMapping.getVisualNode();
-
- nsIDOMNode textNode = span.getFirstChild();
-
- assertEquals(textNode.getNodeType(), nsIDOMNode.TEXT_NODE);
-
- assertNotNull(textNode.getNodeValue());
-
- assertEquals(textNode.getNodeValue().trim(), node.getNodeValue().trim());
-
- styledText.insert("t");
+ assertEquals(textNode.getNodeType(), nsIDOMNode.TEXT_NODE);
+
+ assertNotNull(textNode.getNodeValue());
+ assertNotNull(node.getNodeName());
+ assertEquals(textNode.getNodeValue().trim(), node.getNodeName()
+ .trim());
+
+ styledText.insert("t");
+ }
}
-
- TestUtil.delay(5000L);
- }
+
}