Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2013-09-03 11:02:14 +0000
committerMarkus Tiede2013-09-03 11:02:14 +0000
commitaef3494f792d468ff234c83c0ebf12cd9c16e38e (patch)
tree3c6e9ffc034c96d4bf0187b17a7d18e7a37bf33d
parente9c401ff9a87ffa62ae3979d475321b53177c89f (diff)
downloadorg.eclipse.jubula.core-aef3494f792d468ff234c83c0ebf12cd9c16e38e.tar.gz
org.eclipse.jubula.core-aef3494f792d468ff234c83c0ebf12cd9c16e38e.tar.xz
org.eclipse.jubula.core-aef3494f792d468ff234c83c0ebf12cd9c16e38e.zip
Sprint task - patch for bug http://bugs.eclipse.org/414672 reviewed and applied.
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java116
-rw-r--r--org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml3
-rw-r--r--org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties6
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties1
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java8
5 files changed, 129 insertions, 5 deletions
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java
index 5f5ef2ac5..d8761c448 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java
@@ -23,6 +23,7 @@ import org.eclipse.jubula.rc.common.implclasses.table.Cell;
import org.eclipse.jubula.rc.common.tester.AbstractTableTester;
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITableComponent;
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITextInputComponent;
+import org.eclipse.jubula.rc.common.util.Verifier;
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
import org.eclipse.jubula.rc.swt.tester.adapter.StyledTextAdapter;
import org.eclipse.jubula.rc.swt.tester.adapter.TableAdapter;
@@ -306,7 +307,7 @@ public class TableTester extends AbstractTableTester {
"getCellBounds", //$NON-NLS-1$
new IRunnable() {
public Object run() {
- TableItem ti = table.getItem(row);
+ TableItem ti = table.getItem(row);
int column = (table.getColumnCount() > 0 || col > 0)
? col : 0;
org.eclipse.swt.graphics.Rectangle r =
@@ -661,4 +662,117 @@ public class TableTester extends AbstractTableTester {
pressOrReleaseModifiers(dndHelper.getModifier(), false);
}
}
+
+ /**
+ * Verifies whether the checkbox in the row of the selected cell
+ * is checked
+ *
+ * @param checked true if checkbox in cell should be selected, false otherwise
+ * @throws StepExecutionException If no cell is selected or the verification fails.
+ */
+ public void rcVerifyCheckboxInSelectedRow(boolean checked)
+ throws StepExecutionException {
+ int row = ((ITableComponent) getComponent()).getSelectedCell().getRow();
+ verifyCheckboxInRow(checked, row);
+ }
+
+ /**
+ * Verifies whether the checkbox in the row under the mouse pointer is checked
+ *
+ * @param checked true if checkbox in cell is selected, false otherwise
+ */
+ public void rcVerifyCheckboxInRowAtMousePosition(boolean checked) {
+ int row = getCellAtMousePosition().getRow();
+ verifyCheckboxInRow(checked, row);
+ }
+
+ /**
+ * Verifies whether the checkbox in the row with the given
+ * <code>index</code> is checked
+ *
+ * @param checked true if checkbox in cell is selected, false otherwise
+ * @param row the row-index of the cell in which the checkbox-state should be verified
+ */
+ private void verifyCheckboxInRow(boolean checked, final int row) {
+ Boolean checkIndex = ((Boolean)getEventThreadQueuer().invokeAndWait(
+ "rcVerifyTableCheckboxIndex", new IRunnable() { //$NON-NLS-1$
+ public Object run() throws StepExecutionException {
+ Table table = getTable();
+ if ((table.getStyle() & SWT.CHECK) == 0) {
+ throw new StepExecutionException(
+ "No checkbox found", //$NON-NLS-1$
+ EventFactory.createActionError(
+ TestErrorEvent.CHECKBOX_NOT_FOUND));
+ }
+ return new Boolean(table.getItem(row).
+ getChecked());
+ }
+ }));
+ Verifier.equals(checked, checkIndex.booleanValue());
+ }
+
+ /**
+ * Toggles the checkbox in the row under the Mouse Pointer
+ */
+ public void rcToggleCheckboxInRowAtMousePosition() {
+ toggleCheckboxInRow(getCellAtMousePosition().getRow());
+ }
+
+ /**
+ * Toggles the checkbox in the selected row
+ */
+ public void rcToggleCheckboxInSelectedRow() {
+ int row = ((Integer) getEventThreadQueuer().invokeAndWait(
+ "get Selection index", new IRunnable() { //$NON-NLS-1$
+ public Object run() throws StepExecutionException {
+ return new Integer(getTable().getSelectionIndex());
+ }
+ })).intValue();
+ toggleCheckboxInRow(row);
+ }
+
+ /**
+ * Toggles the checkbox in the row with the given index
+ * @param row the index
+ */
+ private void toggleCheckboxInRow(final int row) {
+
+ if (row == -1) {
+ getEventThreadQueuer().invokeAndWait(
+ "No Selection", new IRunnable() { //$NON-NLS-1$
+ public Object run() throws StepExecutionException {
+ throw new StepExecutionException(
+ "No Selection found ", //$NON-NLS-1$
+ EventFactory.createActionError(
+ TestErrorEvent.NO_SELECTION));
+ }
+ });
+ }
+
+ ((ITableComponent) getComponent()).scrollCellToVisible(row, 0);
+
+ final Table table = getTable();
+
+ org.eclipse.swt.graphics.Rectangle itemBounds =
+ (org.eclipse.swt.graphics.Rectangle) getEventThreadQueuer().
+ invokeAndWait(
+ "getTableItem", //$NON-NLS-1$
+ new IRunnable() {
+ public Object run() throws StepExecutionException {
+ return table.getItem(row).getBounds();
+ }
+ });
+
+ int itemHeight = itemBounds.height;
+
+ // Creates a Rectangle with bounds around the checkbox of the row
+ org.eclipse.swt.graphics.Rectangle cbxBounds =
+ new org.eclipse.swt.graphics.Rectangle(0,
+ itemBounds.y, itemBounds.x, itemHeight);
+
+ // Performs a click in the middle of the Rectangle
+ getRobot().click(table, cbxBounds, ClickOptions.create().left().
+ setScrollToVisible(false),
+ itemBounds.x / 2, true, itemHeight / 2, true);
+ }
}
diff --git a/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml b/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml
index 2f06f9208..8bc1480aa 100644
--- a/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml
+++ b/org.eclipse.jubula.toolkit.provider.concrete/resources/xml/ComponentConfiguration.xml
@@ -1976,8 +1976,7 @@
<type>java.lang.Integer</type>
<defaultValue>100</defaultValue>
</param>
- </action>
-
+ </action> <action name="CompSystem.VerifyCheckboxInSelectedRow" changed="4.5"> <method>rcVerifyCheckboxInSelectedRow</method> <param name="CompSystem.Checked"> <type>java.lang.Boolean</type> <defaultValue>true</defaultValue> <valueSet> <element name="CompSystem.True" value="true"/> <element name="CompSystem.False" value="false"/> </valueSet> </param> </action> <action name="CompSystem.VerifyCheckboxOfRowAtMousePosition" changed="4.5"> <method>rcVerifyCheckboxInRowAtMousePosition</method> <param name="CompSystem.Checked"> <type>java.lang.Boolean</type> <defaultValue>true</defaultValue> <valueSet> <element name="CompSystem.True" value="true"/> <element name="CompSystem.False" value="false"/> </valueSet> </param> </action> <action name="CompSystem.ToggleCheckboxInSelectedRow" changed="4.5"> <method>rcToggleCheckboxInSelectedRow</method> </action> <action name="CompSystem.ToggleCheckboxOfRowAtMousePosition" changed="4.5"> <method>rcToggleCheckboxInRowAtMousePosition</method> </action>
</concreteComponent>
<concreteComponent type="guidancer.concrete.TextComponent">
diff --git a/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties b/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties
index dedc30978..b8bb4784e 100644
--- a/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties
+++ b/org.eclipse.jubula.toolkit.provider.concrete/src/org/eclipse/jubula/toolkit/provider/concrete/I18nStrings.properties
@@ -73,4 +73,8 @@ CompSystem.Value1=Value 1
CompSystem.Value2=Value 2
CompSystem.ValueOperator=Value Operator
CompSystem.PrepareForShutdown=Prepare for AUT termination
-CompSystem.SyncShutdownAndRestart=Synchronize termination and re-start of AUT \ No newline at end of file
+CompSystem.SyncShutdownAndRestart=Synchronize termination and re-start of AUT
+CompSystem.VerifyCheckboxInSelectedRow=Check Selection of Checkbox in Selected Row
+CompSystem.VerifyCheckboxOfRowAtMousePosition=Check Selection of Checkbox at Mouse Position
+CompSystem.ToggleCheckboxInSelectedRow=Toggle Checkbox in Selected Row
+CompSystem.ToggleCheckboxOfRowAtMousePosition=Toggle Checkbox at Mouse Position \ No newline at end of file
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties
index d4d9ab4f3..49a0285cc 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/i18n/guidancerStrings.properties
@@ -949,6 +949,7 @@ TestErrorEvent.UnsupportedParameterValue=Parameter value "{0}" is not supported
TestErrorEvent.UnsupportedUI=Unsupported UI class\: "{0}"
TestErrorEvent.VerifyFailed=Check Failed
TestErrorEvent.WindowActivationFailed=Window activation failed.
+TestErrorEvent.CheckboxNotFound=Checkbox not found
TestExecutionContributor.AUTNotFound=AUT not found.\nPlease check the AUT configuration.
TestExecutionContributor.AUTStartedRecording=Observation mode
TestExecutionContributor.AUTStartedRecordingCheckMode=Observation mode (Check Mode)
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java
index 1aa134402..2b4d5c023 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/objects/event/TestErrorEvent.java
@@ -22,7 +22,13 @@ import java.util.Map;
* @author BREDEX GmbH
* @created 04.04.2005
*/
-public class TestErrorEvent {
+public class TestErrorEvent {
+ /**
+ * Checkbox has not been found
+ */
+ public static final String CHECKBOX_NOT_FOUND =
+ "TestErrorEvent.CheckboxNotFound"; //$NON-NLS-1$
+
/**
* unsupported keyboard layout.
*/

Back to the top