[jbosstools-commits] JBoss Tools SVN: r23525 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jul 19 03:23:11 EDT 2010


Author: dvinnichek
Date: 2010-07-19 03:23:10 -0400 (Mon, 19 Jul 2010)
New Revision: 23525

Modified:
   trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
Log:
fix assertion in JBIDE788Test.testCAforHtmlFiles()

Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java	2010-07-19 06:02:11 UTC (rev 23524)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java	2010-07-19 07:23:10 UTC (rev 23525)
@@ -14,6 +14,8 @@
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.contentassist.ICompletionProposal;
 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
 import org.eclipse.jface.text.contentassist.IContentAssistant;
@@ -55,9 +57,9 @@
 		setException(null);
 		// Tests CA
 
-		checkOfCAByStartString(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml","s:validateFormat",11,2);    //$NON-NLS-1$//$NON-NLS-2$
-		checkOfCAByStartString(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml","rich:validateA", 14,14); //$NON-NLS-1$ //$NON-NLS-2$
-		checkOfCAByStartString(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml","c:otherwi",18,6);  //$NON-NLS-1$//$NON-NLS-2$
+		checkOfCAByStartString(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml","s:validateFormat",11,2,3);    //$NON-NLS-1$//$NON-NLS-2$
+		checkOfCAByStartString(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml","rich:validateA", 14,14,3); //$NON-NLS-1$ //$NON-NLS-2$
+		checkOfCAByStartString(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml","c:otherwi",18,6,3);  //$NON-NLS-1$//$NON-NLS-2$
 
 		// check exception
 		if (getException() != null) {
@@ -72,7 +74,7 @@
 		TestUtil.waitForJobs();
 		// set exception
 		setException(null);
-		ICompletionProposal[] results = checkOfCAByStartString(CA_NAME, "JBIDE/6131/6131test.xhtml","Common",1,1,false); //$NON-NLS-1$ //$NON-NLS-2$
+		ICompletionProposal[] results = checkOfCAByStartString(CA_NAME, "JBIDE/6131/6131test.xhtml","Common",1,1,false,3); //$NON-NLS-1$ //$NON-NLS-2$
 		boolean proposalExists=false;
 		for (ICompletionProposal completionProposal : results) {
 			String displayString = ((ICompletionProposal) completionProposal).getDisplayString();		
@@ -99,7 +101,7 @@
 		setException(null);
 		// Tests CA
 
-		ICompletionProposal[] results = checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAMessageBundlesAndEL.xhtml","",11,31,false); //$NON-NLS-1$ //$NON-NLS-2$
+		ICompletionProposal[] results = checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAMessageBundlesAndEL.xhtml","",11,31,false,3); //$NON-NLS-1$ //$NON-NLS-2$
 		assertNotNull(results);
 		assertTrue("The length should be more than 0",results.length>0); //$NON-NLS-1$
 		boolean proposalExists=false;
@@ -112,7 +114,7 @@
 		}
 		assertTrue(REQUIRED_PROPOSAL + " should be in proposals", proposalExists); //$NON-NLS-1$
 		proposalExists=false;
-		results = checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAPathProposals.xhtml","",11,41,false);  //$NON-NLS-1$//$NON-NLS-2$
+		results = checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAPathProposals.xhtml","",11,41,false,3);  //$NON-NLS-1$//$NON-NLS-2$
 		assertNotNull(results);
 		for(ICompletionProposal completionProposal : results) {
 			String displayString = ((ICompletionProposal) completionProposal).getDisplayString();
@@ -139,7 +141,7 @@
 		// set exception
 		setException(null);
 		// Tests CA
-		ICompletionProposal[] results =checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAMessageBundlesAndEL.xhtml","",21,58);  //$NON-NLS-1$//$NON-NLS-2$
+		ICompletionProposal[] results =checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAMessageBundlesAndEL.xhtml","",21,58,3);  //$NON-NLS-1$//$NON-NLS-2$
 		assertNotNull(results);
 		assertTrue(results.length>=2);
 		for(ICompletionProposal completionProposal : results) {
@@ -170,7 +172,7 @@
 		// set exception
 		setException(null);
 		// Tests CA
-		ICompletionProposal[] results =checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAforHtml.html", "", 5, 13,false);  //$NON-NLS-1$//$NON-NLS-2$
+		ICompletionProposal[] results = checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAforHtml.html", "", 5, 13,false,3);  //$NON-NLS-1$//$NON-NLS-2$
 
 		assertNotNull(results);
 		assertTrue("The lenft should be more than 0",results.length>0); //$NON-NLS-1$
@@ -206,7 +208,7 @@
 		// Tests CA
 
 		// cursor will set after "outputText" tag
-		ICompletionProposal[] results = checkOfCAByStartString(JSP_CA_NAME, "JBIDE/788/testCAforJSP.jsp", "h:outp",26,14,false); //$NON-NLS-1$ //$NON-NLS-2$
+		ICompletionProposal[] results = checkOfCAByStartString(JSP_CA_NAME, "JBIDE/788/testCAforJSP.jsp", "h:outp",26,14,false,5); //$NON-NLS-1$ //$NON-NLS-2$
 
 		for (ICompletionProposal completionProposal : results) {
 
@@ -237,11 +239,11 @@
 
 		// cursor will set after "<" simbol
 		checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAforXHTML.xhtml", "c", //$NON-NLS-1$ //$NON-NLS-2$
-				15,12);
+				15,12,3);
 
 		// cursor will set after "outputText" tag
 		checkOfCAByStartString(CA_NAME, "JBIDE/788/testCAforXHTML.xhtml", "s",  //$NON-NLS-1$//$NON-NLS-2$
-				19,43);
+				19,43,3);
 
 		// check exception
 		if (getException() != null) {
@@ -262,9 +264,9 @@
 	 * @throws IOException 
 	 */
     private ICompletionProposal[] checkOfCAByStartString(String caName, String testPagePath,
-            String partOfString, int lineIndex, int linePosition)
+            String partOfString, int lineIndex, int linePosition, int proposalPopupTypesNum)
     		throws CoreException, IOException {
-        return this.checkOfCAByStartString(caName, testPagePath, partOfString, lineIndex, linePosition,true);
+        return this.checkOfCAByStartString(caName, testPagePath, partOfString, lineIndex, linePosition, true, proposalPopupTypesNum);
         
     }
 	/**
@@ -280,8 +282,8 @@
 	 * @throws IOException 
 	 */
 	
-	private ICompletionProposal[] checkOfCAByStartString(String caName, String testPagePath,
-            String partOfString, int lineIndex, int linePosition,boolean isCheck) throws CoreException, IOException {
+	private ICompletionProposal[] checkOfCAByStartString(String caName, String testPagePath, String partOfString, 
+			int lineIndex, int linePosition, boolean isCheck, int proposalPopupTypesNum) throws CoreException, IOException {
         // get test page path
         IFile file = (IFile) TestUtil.getComponentPath(testPagePath,
         		JsfAllTests.IMPORT_PROJECT_NAME);
@@ -296,18 +298,17 @@
         ICompletionProposal[] results;
 		try {
 			JSPMultiPageEditor part = openEditor(input);
+			ITextViewer viewer = part.getSourceEditor().getTextViewer();
 			
-			int position = TestUtil.getLinePositionOffcet(part.getSourceEditor().getTextViewer(), lineIndex, linePosition);
+			int position = TestUtil.getLinePositionOffcet(viewer, lineIndex, linePosition);
 
 			// insert string
-			part.getSourceEditor().getTextViewer().getTextWidget()
-			        .replaceTextRange(position, 0, partOfString);
+			viewer.getTextWidget().replaceTextRange(position, 0, partOfString);
 
 			int newPosition = position + partOfString.length();
 
 			// sets cursor position
-			part.getSourceEditor().getTextViewer().getTextWidget().setCaretOffset(
-			        newPosition);
+			viewer.getTextWidget().setCaretOffset(newPosition);
 			
 			TestUtil.waitForJobs();
 			TestUtil.delay(1000);
@@ -327,12 +328,13 @@
 			        .getContentAssistProcessor(caName);
 			assertNotNull(iContentAssistProcessor);
 			
-			results = iContentAssistProcessor
-			        .computeCompletionProposals(part.getSourceEditor()
-			                .getTextViewer(), newPosition);
+			for (int i = 0; i < proposalPopupTypesNum - 1; i++) {
+				iContentAssistProcessor.computeCompletionProposals(viewer, newPosition);
+			}
+			results = iContentAssistProcessor.computeCompletionProposals(viewer, newPosition);//obtain default proposals
 
 			// remove inserted string
-			part.getSourceEditor().getTextViewer().getTextWidget()
+			viewer.getTextWidget()
 			        .replaceTextRange(position, partOfString.length(), ""); //$NON-NLS-1$
 			assertNotNull(results);
 			assertTrue("Number of ca proposals shouldn't be a 0",results.length>0); //$NON-NLS-1$



More information about the jbosstools-commits mailing list