[jbosstools-commits] JBoss Tools SVN: r22854 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Jun 17 08:15:13 EDT 2010
Author: dmaliarevich
Date: 2010-06-17 08:15:13 -0400 (Thu, 17 Jun 2010)
New Revision: 22854
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6287 , SWTBot test was updated to be able to test Empty Selection.
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-06-17 11:48:17 UTC (rev 22853)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2010-06-17 12:15:13 UTC (rev 22854)
@@ -25,6 +25,7 @@
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 CANNOT_FIND_PROPERTY_VALUE = "Cannot find 'Property Value' text field"; //$NON-NLS-1$
public ExternalizeStringsDialogTest() {
super();
@@ -68,16 +69,14 @@
SWTBotText defKeyText = bot.textWithLabelInGroup(
VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_KEY,
VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
- if (null != defKeyText) {
- assertText(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_DEFAULT_KEY,
- defKeyText);
- }
+ assertNotNull("Cannot find 'Property Key' text field", defKeyText); //$NON-NLS-1$
+ assertText(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_DEFAULT_KEY,
+ defKeyText);
SWTBotText defValueText = bot.textWithLabelInGroup(
VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_VALUE,
VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
- if (null != defValueText) {
- assertText("User", defValueText); //$NON-NLS-1$
- }
+ assertNotNull(CANNOT_FIND_PROPERTY_VALUE, defValueText);
+ assertText("User", defValueText); //$NON-NLS-1$
SWTBotCheckBox checkBox = bot.checkBox();
assertNotNull("Cannot find checkbox '" //$NON-NLS-1$
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_NEW_FILE + "'", //$NON-NLS-1$
@@ -110,7 +109,7 @@
* Press OK and replace the text in the editor
*/
assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.OK_BUTTON).isEnabled());
+ bot.button(WidgetVariables.OK_BUTTON).isEnabled());
bot.button(WidgetVariables.OK_BUTTON).click();
/*
* Check replaced text
@@ -169,7 +168,7 @@
assertNotNull("'File Name:' text field is not found", fileName); //$NON-NLS-1$
fileName.setText("externalize.properties"); //$NON-NLS-1$
assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
- bot.button(WidgetVariables.OK_BUTTON).isEnabled());
+ bot.button(WidgetVariables.OK_BUTTON).isEnabled());
bot.button(WidgetVariables.OK_BUTTON).click();
/*
* Check that the text was replaced
@@ -186,4 +185,85 @@
String line = editor2.toTextEditor().getSelection();
assertEquals("Created file is incorrect", "key=Input", line); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+ public void testóEmptySelectionInExternalizeStringsDialog() throws Throwable {
+ /*
+ * Open simple html file in order to get the VPE toolbar
+ */
+ SWTBotEditor editor = SWTTestExt.packageExplorer.openFile(JBT_TEST_PROJECT_NAME,
+ "WebContent", "pages", TEST_PAGE); //$NON-NLS-1$ //$NON-NLS-2$
+ editor.setFocus();
+ /*
+ * Select some text
+ */
+ editor.toTextEditor().selectRange(13, 0, 1);
+ /*
+ * Activate the dialog
+ */
+ bot.toolbarButtonWithTooltip(VpeUIMessages.EXTERNALIZE_STRINGS).click();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
+ /*
+ * Check that the property value text is empty
+ */
+ SWTBotText defValueText = bot.textWithLabelInGroup(
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_VALUE,
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
+ assertNotNull(CANNOT_FIND_PROPERTY_VALUE, defValueText);
+ assertText("", defValueText); //$NON-NLS-1$
+ /*
+ * Close the dialog
+ */
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).close();
+ /*
+ * Type some text outside the tag
+ */
+ editor.toTextEditor().typeText(13, 0, "Plain text in the JSP file"); //$NON-NLS-1$
+ /*
+ * Select nothing and call the dialog --
+ * the whole text should be selected.
+ */
+ editor.toTextEditor().selectRange(13, 3, 0);
+ /*
+ * Activate the dialog
+ */
+ bot.toolbarButtonWithTooltip(VpeUIMessages.EXTERNALIZE_STRINGS).click();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
+ /*
+ * Check that the property value text is empty
+ */
+ defValueText = bot.textWithLabelInGroup(
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_VALUE,
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
+ assertNotNull(CANNOT_FIND_PROPERTY_VALUE, defValueText);
+ assertText("Plain text in the JSP file", defValueText); //$NON-NLS-1$
+ /*
+ * Close the dialog
+ */
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).close();
+
+ /*
+ * Check selection in the attribute's value
+ */
+ editor.toTextEditor().selectRange(18, 50, 0);
+ /*
+ * Activate the dialog
+ */
+ bot.toolbarButtonWithTooltip(VpeUIMessages.EXTERNALIZE_STRINGS).click();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
+ /*
+ * Check that the property value text is empty
+ */
+ defValueText = bot.textWithLabelInGroup(
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_VALUE,
+ VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
+ assertNotNull(CANNOT_FIND_PROPERTY_VALUE, defValueText);
+ assertText("true", defValueText); //$NON-NLS-1$
+ /*
+ * Close the dialog
+ */
+ bot.shell(VpeUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).close();
+ }
}
More information about the jbosstools-commits
mailing list