Author: dmaliarevich
Date: 2010-12-30 10:54:13 -0500 (Thu, 30 Dec 2010)
New Revision: 27833
Added:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/commands/
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/commands/NewEditorSideBySideCommandTest.java
Removed:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ExternalizeCommandTest.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/NewEditorSideBySideCommandTest.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7902 , ExternalizeCommandTest was removed from the
org.jboss.tools.jst.jsp.test.ca package.
SWTBotTest was added instead (in
org.jboss.tools.vpe.ui.bot.test.wizard.ExternalizeStringsDialogTest).
NewEditorSideBySideCommandTest was moved to the org.jboss.tools.jst.jsp.test.commands
package.
Modified:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java 2010-12-30
15:42:46 UTC (rev 27832)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/JstJspAllTests.java 2010-12-30
15:54:13 UTC (rev 27833)
@@ -13,7 +13,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.jboss.tools.jst.jsp.test.ca.ExternalizeCommandTest;
import org.jboss.tools.jst.jsp.test.ca.JstJspJbide1585Test;
import org.jboss.tools.jst.jsp.test.ca.JstJspJbide1641Test;
import org.jboss.tools.jst.jsp.test.selbar.SelectionBarTest;
@@ -33,9 +32,7 @@
suite.addTestSuite(Jbide1791Test.class);
*/
suite.addTestSuite(JspPreferencesPageTest.class);
-
suite.addTestSuite(SelectionBarTest.class);
- suite.addTestSuite(ExternalizeCommandTest.class);
return suite;
}
Deleted:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ExternalizeCommandTest.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ExternalizeCommandTest.java 2010-12-30
15:42:46 UTC (rev 27832)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ExternalizeCommandTest.java 2010-12-30
15:54:13 UTC (rev 27833)
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.test.ca;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.TestProjectProvider;
-import org.jboss.tools.test.util.WorkbenchUtils;
-
-/**
- * Junit for JBIDE-7060
- *
- * @author mareshkau
- *
- */
-public class ExternalizeCommandTest extends TestCase {
- protected IProject project = null;
- private TestProjectProvider provider = null;
- private Command externalizeCommand;
-
- public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test",
null, "JsfJbide1791Test",false); //$NON-NLS-1$ //$NON-NLS-2$
- project = provider.getProject();
- ICommandService commandService =
- (ICommandService) PlatformUI.getWorkbench()
- .getService(ICommandService.class);
- externalizeCommand = commandService.getCommand(
- "org.jboss.tools.jst.jsp.commands.i18"); //$NON-NLS-1$
- }
-
- protected void tearDown() throws Exception {
- if(provider != null) {
- provider.dispose();
- }
- }
- /**
- * Test behaviour of externalize string command
- */
- public void testExternalizeCommand(){
- IEditorPart editorPart =
WorkbenchUtils.openEditor(project.getName()+"/WebContent/pages/extCommandTest.xhtml");
//$NON-NLS-1$
-
- assertTrue("Should be opened JSPMultiPage Editor", editorPart instanceof
JSPMultiPageEditor); //$NON-NLS-1$
-
- JSPMultiPageEditor jspMultiPageEditor= (JSPMultiPageEditor) editorPart;
- StructuredTextViewer textViewer =
jspMultiPageEditor.getSourceEditor().getTextViewer();
-
- textViewer.setSelectedRange(0, 0);
- checkExternalizeCommand(false);
- textViewer.setSelectedRange(2, 0);
- checkExternalizeCommand(false);
- textViewer.setSelectedRange(15, 0);
- checkExternalizeCommand(true);
- textViewer.setSelectedRange(2, 0);
- checkExternalizeCommand(false);
-
- TestUtil.closeAllEditors();
- checkExternalizeCommand(false);
- }
-
- private void checkExternalizeCommand(boolean requiredState) {
- TestUtil.waitForIdle(TestUtil.MAX_IDLE);
- assertEquals("Externalize Command has incorrect enabled state",
//$NON-NLS-1$
- requiredState,externalizeCommand.isEnabled());
- }
-}
Deleted:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/NewEditorSideBySideCommandTest.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/NewEditorSideBySideCommandTest.java 2010-12-30
15:42:46 UTC (rev 27832)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/NewEditorSideBySideCommandTest.java 2010-12-30
15:54:13 UTC (rev 27833)
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.test.ca;
-
-import junit.framework.TestCase;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.jboss.tools.test.util.TestProjectProvider;
-import org.jboss.tools.test.util.WorkbenchUtils;
-
-/**
- *
- * Junit test for
https://jira.jboss.org/browse/JBIDE-6685 command
- * @author mareshkau
- *
- */
-public class NewEditorSideBySideCommandTest extends TestCase {
-
- public static final String
NEW_EDITOR_SIDE_BY_SIDE_COMMAND_ID="org.jboss.tools.sidebyside.newEditor";
//$NON-NLS-1$
- protected IProject project = null;
- private TestProjectProvider provider = null;
- private Command newEditorSideBySideCmd;
- public void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test",
null, "JsfJbide1791Test",false); //$NON-NLS-1$ //$NON-NLS-2$
- project = provider.getProject();
- ICommandService commandService =
- (ICommandService) PlatformUI.getWorkbench()
- .getService(ICommandService.class);
- newEditorSideBySideCmd = commandService.getCommand(
- NEW_EDITOR_SIDE_BY_SIDE_COMMAND_ID);
- }
-
- protected void tearDown() throws Exception {
- if(provider != null) {
- provider.dispose();
- }
- }
- /**
- * Test Side by Side command
- * @throws NotDefinedException
- * @throws NotHandledException
- * @throws NotEnabledException
- * @throws ExecutionException
- */
- public void testNewEditorSideBySideCommand() throws Exception {
- assertEquals(newEditorSideBySideCmd.getName()+ " should be disabled without
opened editor",false,newEditorSideBySideCmd.isEnabled()); //$NON-NLS-1$
-
WorkbenchUtils.openEditor(project.getName()+"/WebContent/pages/newSideBySideEditorTest.txt");
//$NON-NLS-1$
- assertEquals(newEditorSideBySideCmd.getName()+ " should be enabled when editor
opened",true,newEditorSideBySideCmd.isEnabled()); //$NON-NLS-1$
- }
-}
Copied:
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/commands/NewEditorSideBySideCommandTest.java
(from rev 27820,
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/NewEditorSideBySideCommandTest.java)
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/commands/NewEditorSideBySideCommandTest.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/commands/NewEditorSideBySideCommandTest.java 2010-12-30
15:54:13 UTC (rev 27833)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.test.commands;
+
+import junit.framework.TestCase;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.jboss.tools.test.util.TestProjectProvider;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+/**
+ *
+ * Junit test for
https://jira.jboss.org/browse/JBIDE-6685 command
+ * @author mareshkau
+ *
+ */
+public class NewEditorSideBySideCommandTest extends TestCase {
+
+ public static final String
NEW_EDITOR_SIDE_BY_SIDE_COMMAND_ID="org.jboss.tools.sidebyside.newEditor";
//$NON-NLS-1$
+ protected IProject project = null;
+ private TestProjectProvider provider = null;
+ private Command newEditorSideBySideCmd;
+ public void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.tools.jst.jsp.test",
null, "JsfJbide1791Test",false); //$NON-NLS-1$ //$NON-NLS-2$
+ project = provider.getProject();
+ ICommandService commandService =
+ (ICommandService) PlatformUI.getWorkbench()
+ .getService(ICommandService.class);
+ newEditorSideBySideCmd = commandService.getCommand(
+ NEW_EDITOR_SIDE_BY_SIDE_COMMAND_ID);
+ }
+
+ protected void tearDown() throws Exception {
+ if(provider != null) {
+ provider.dispose();
+ }
+ }
+ /**
+ * Test Side by Side command
+ * @throws NotDefinedException
+ * @throws NotHandledException
+ * @throws NotEnabledException
+ * @throws ExecutionException
+ */
+ public void testNewEditorSideBySideCommand() throws Exception {
+ assertEquals(newEditorSideBySideCmd.getName()+ " should be disabled without
opened editor",false,newEditorSideBySideCmd.isEnabled()); //$NON-NLS-1$
+
WorkbenchUtils.openEditor(project.getName()+"/WebContent/pages/newSideBySideEditorTest.txt");
//$NON-NLS-1$
+ assertEquals(newEditorSideBySideCmd.getName()+ " should be enabled when editor
opened",true,newEditorSideBySideCmd.isEnabled()); //$NON-NLS-1$
+ }
+}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-12-30
15:42:46 UTC (rev 27832)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-12-30
15:54:13 UTC (rev 27833)
@@ -12,8 +12,10 @@
import java.awt.event.KeyEvent;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.utils.Position;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
@@ -29,10 +31,12 @@
public class ExternalizeStringsDialogTest extends VPEAutoTestCase {
+ private final String ENABLED_TEST_TEXT = "<html>Externalize
Text</html>"; //$NON-NLS-1$
private final String TOOL_TIP = "Externalize Strings... (Ctrl+7)";
//$NON-NLS-1$
private final String FOLDER_TEXT_LABEL = "Enter or select the parent folder:";
//$NON-NLS-1$
private final String INCORRECT_TABLE_VALUE = "Table value is incorrect";
//$NON-NLS-1$
- private final String TOOLBAR_ICON_ENABLED = "Toolbar buttion should be
enabled"; //$NON-NLS-1$
+ private final String TOOLBAR_ICON_ENABLED = "Toolbar button should be
enabled"; //$NON-NLS-1$
+ private final String TOOLBAR_ICON_DISABLED = "Toolbar button should be
disabled"; //$NON-NLS-1$
private final String CANNOT_FIND_PROPERTY_VALUE = "Cannot find 'Property
Value' text field"; //$NON-NLS-1$
private final String CANNOT_FIND_RADIO_BUTTON = "Cannot find radio button with
name: "; //$NON-NLS-1$
private final String COMPLEX_TEXT = "!! HELLO ~ Input User, Name.Page ?"
//$NON-NLS-1$
@@ -889,6 +893,34 @@
editor.toTextEditor().getSelection());
}
+ public void testToolBarIconEnableState() throws Throwable {
+ isUnusedDialogOpened = false;
+ SWTBotEditor editor = SWTTestExt.packageExplorer.openFile(FACELETS_TEST_PROJECT_NAME,
+ "WebContent", "pages", FACELETS_TEST_PAGE); //$NON-NLS-1$
//$NON-NLS-2$
+ editor.setFocus();
+ editor.toTextEditor().setText(ENABLED_TEST_TEXT);
+ navigateToAndTestIcon(editor.toTextEditor(), new Position(0, 1), false);
+ navigateToAndTestIcon(editor.toTextEditor(), new Position(0, 3), false);
+ navigateToAndTestIcon(editor.toTextEditor(), new Position(0, 16), true);
+ navigateToAndTestIcon(editor.toTextEditor(), new Position(0, 3), false);
+ }
+
+ private void navigateToAndTestIcon(SWTBotEclipseEditor editor, Position pos, boolean
enabled) {
+ /*
+ * Select some text
+ */
+ editor.navigateTo(pos);
+ /*
+ * Send key press event to fire VPE listeners
+ */
+ KeyboardHelper.typeKeyCodeUsingAWT(KeyEvent.VK_LEFT);
+ /*
+ * Get toolbar button
+ */
+ assertEquals(enabled ? TOOLBAR_ICON_ENABLED : TOOLBAR_ICON_DISABLED,
+ enabled, bot.toolbarButtonWithTooltip(TOOL_TIP).isEnabled());
+ }
+
/**
* Creates the new bundle till last page.
*
@@ -953,4 +985,6 @@
return editor;
}
+
+
}