[jbosstools-commits] JBoss Tools SVN: r42865 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: parts and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Aug 6 11:47:49 EDT 2012


Author: vpakan at redhat.com
Date: 2012-08-06 11:47:49 -0400 (Mon, 06 Aug 2012)
New Revision: 42865

Modified:
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java
Log:
Added methods needed for JBT 3.4.x Code Assist testing.

Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java	2012-08-06 15:25:39 UTC (rev 42864)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContentAssistHelper.java	2012-08-06 15:47:49 UTC (rev 42865)
@@ -130,4 +130,41 @@
 
   }
   
+  /**
+   * Checks Content Assist auto proposal. It's case when there is only one
+   * content assist item and that item is automatically inserted into editor
+   * and checks if expectedProposalList is equal to current Proposal List 
+   * @param editorTitle
+   * @param textToSelect
+   * @param selectionOffset
+   * @param selectionLength
+   * @param textToSelectIndex
+   * @param expectedInsertedText
+   */
+  public static SWTBotEditor checkContentAssistAutoProposal(SWTBotExt bot,
+      String editorTitle, String textToSelect, int selectionOffset,
+      int selectionLength, int textToSelectIndex, String expectedInsertedText) {
+
+    SWTJBTExt.selectTextInSourcePane(bot,
+        editorTitle, textToSelect, selectionOffset, selectionLength,
+        textToSelectIndex);
+
+    bot.sleep(Timing.time1S());
+
+    SWTBotEditorExt editor = SWTTestExt.bot.swtBotEditorExtByTitle(editorTitle);
+    String editorLineBeforeInsert = editor.getTextOnCurrentLine();
+    int xPos = editor.cursorPosition().column;
+    String expectedEditorLineAfterInsert = editorLineBeforeInsert.substring(0,xPos) +
+        expectedInsertedText +
+        editorLineBeforeInsert.substring(xPos);
+    ContentAssistBot contentAssist = editor.contentAssist();
+    contentAssist.invokeContentAssist();
+    String editorLineAfterInsert = editor.getTextOnCurrentLine();
+    assertTrue("Text on current line should be:\n" +
+        "but is :\n" + editorLineAfterInsert
+        , editorLineAfterInsert.equals(expectedEditorLineAfterInsert));
+
+    return editor;
+
+  }
 } 

Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java	2012-08-06 15:25:39 UTC (rev 42864)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/ContentAssistBot.java	2012-08-06 15:47:49 UTC (rev 42865)
@@ -132,7 +132,7 @@
 	/*
 	 * Invokes ContentAssistProposal shell action
 	 */
-	private void invokeContentAssist() {
+	public void invokeContentAssist() {
 		String actionId = "ContentAssistProposal";
 		//final IAction action = ((ITextEditor) partReference.getEditor(false)).getAction(actionId);
 		Object oEditor = editor.getReference().getEditor(false);
@@ -282,7 +282,7 @@
 	 * @param s2
 	 * @return
 	 */
-	private SWTBotShell getContentAssistShell(SWTBotShell[] s1, SWTBotShell[] s2) {
+	public SWTBotShell getContentAssistShell(SWTBotShell[] s1, SWTBotShell[] s2) {
 		SWTBotShell ccShell = null;
 		for (SWTBotShell bs2 : s2) {
 			boolean found = false;



More information about the jbosstools-commits mailing list