Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2015-09-25 07:04:52 +0000
committerMarvin Mueller2015-09-25 13:07:05 +0000
commitc1128b23ba85bdf0c2c189de3740d470595f2955 (patch)
treea28165424a9d6a72e3da418e5824b972222f83a5 /org.eclipse.jubula.rc.rcp.e3/src
parentb41d6598c3021ea4e19db22eec64933059ffeb9f (diff)
downloadorg.eclipse.jubula.core-c1128b23ba85bdf0c2c189de3740d470595f2955.tar.gz
org.eclipse.jubula.core-c1128b23ba85bdf0c2c189de3740d470595f2955.tar.xz
org.eclipse.jubula.core-c1128b23ba85bdf0c2c189de3740d470595f2955.zip
Sprint task - add CAP checkAnchorCount to GEF JUB-1229
Diffstat (limited to 'org.eclipse.jubula.rc.rcp.e3/src')
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IExtendedEditPartIdentifier.java37
-rw-r--r--org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java61
2 files changed, 95 insertions, 3 deletions
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IExtendedEditPartIdentifier.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IExtendedEditPartIdentifier.java
new file mode 100644
index 000000000..c03d128a8
--- /dev/null
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/identifier/IExtendedEditPartIdentifier.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.jubula.rc.rcp.e3.gef.identifier;
+
+import java.util.Map;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+/**
+ * Extended part Identifier which can differentiate between incoming and outgoing
+ * {@link ConnectionAnchor}s
+ *
+ * @author BREDEX GmbH
+ */
+public interface IExtendedEditPartIdentifier extends IEditPartIdentifier {
+
+ /**
+ *
+ * @return a map that correlates identifiers (<code>String</code>s) with
+ * incoming <code>ConnectionAnchor</code>s.
+ */
+ public Map<String, ConnectionAnchor> getIncomingConnectionAnchors();
+
+ /**
+ *
+ * @return a map that correlates identifiers (<code>String</code>s) with
+ * outgoing <code>ConnectionAnchor</code>s.
+ */
+ public Map<String, ConnectionAnchor> getOutgoingConnectionAnchors();
+}
diff --git a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java
index 3b665d694..7b90e8b67 100644
--- a/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java
+++ b/org.eclipse.jubula.rc.rcp.e3/src/org/eclipse/jubula/rc/rcp/e3/gef/tester/FigureCanvasTester.java
@@ -36,17 +36,20 @@ import org.eclipse.jubula.rc.common.driver.IRobot;
import org.eclipse.jubula.rc.common.driver.IRunnable;
import org.eclipse.jubula.rc.common.exception.StepExecutionException;
import org.eclipse.jubula.rc.common.tester.WidgetTester;
+import org.eclipse.jubula.rc.common.util.Comparer;
import org.eclipse.jubula.rc.common.util.MatchUtil;
import org.eclipse.jubula.rc.common.util.MenuUtilBase;
import org.eclipse.jubula.rc.common.util.Verifier;
import org.eclipse.jubula.rc.rcp.e3.gef.factory.DefaultEditPartAdapterFactory;
import org.eclipse.jubula.rc.rcp.e3.gef.identifier.IEditPartIdentifier;
+import org.eclipse.jubula.rc.rcp.e3.gef.identifier.IExtendedEditPartIdentifier;
import org.eclipse.jubula.rc.rcp.e3.gef.listener.GefPartListener;
import org.eclipse.jubula.rc.swt.driver.DragAndDropHelperSwt;
import org.eclipse.jubula.rc.swt.driver.RobotFactoryConfig;
import org.eclipse.jubula.rc.swt.tester.CAPUtil;
import org.eclipse.jubula.rc.swt.tester.adapter.ControlAdapter;
-import org.eclipse.jubula.toolkit.enums.ValueSets;
+import org.eclipse.jubula.toolkit.enums.ValueSets.AnchorType;
+import org.eclipse.jubula.toolkit.enums.ValueSets.Unit;
import org.eclipse.jubula.tools.internal.objects.event.EventFactory;
import org.eclipse.jubula.tools.internal.objects.event.TestErrorEvent;
import org.eclipse.swt.graphics.Rectangle;
@@ -431,9 +434,9 @@ public class FigureCanvasTester extends WidgetTester {
ClickOptions.create().setScrollToVisible(false)
.setClickCount(count).setMouseButton(button),
xPos, xUnits.equalsIgnoreCase(
- ValueSets.Unit.pixel.rcValue()),
+ Unit.pixel.rcValue()),
yPos, yUnits.equalsIgnoreCase(
- ValueSets.Unit.pixel.rcValue()));
+ Unit.pixel.rcValue()));
}
/**
@@ -907,4 +910,56 @@ public class FigureCanvasTester extends WidgetTester {
return null;
// this is still valid since there are simple connections
}
+
+ /**
+ *
+ * @param textPath
+ * the textpath to the {@link GraphicalEditPart}
+ * @param operator
+ * the operator to find the editpart should be a rcValue from
+ * {@link org.eclipse.jubula.toolkit.enums.ValueSets.Operator}
+ * @param anchorType
+ * the anchor type should be a rc value from {@link AnchorType}
+ * @param count
+ * the count to compare
+ * @param comparisonMethod
+ * the comparison method should be a rc value from
+ * {@link org.eclipse.jubula.toolkit.enums.ValueSets.NumberComparisonOperator}
+ */
+ public void rcCheckNumberOfAnchors(String textPath, String operator,
+ String anchorType, int count, String comparisonMethod) {
+ GraphicalEditPart editPart =
+ findEditPart(textPath, operator);
+ if (editPart == null) {
+ throw new StepExecutionException(
+ "No Edit Part could be found for the given text path.", //$NON-NLS-1$
+ EventFactory.createActionError(TestErrorEvent.NOT_FOUND));
+ }
+ IEditPartIdentifier editPartIdentifier =
+ DefaultEditPartAdapterFactory.loadFigureIdentifier(
+ editPart);
+ int connectionCount = 0;
+
+ if (anchorType
+ .equals(AnchorType.both.rcValue())) {
+ connectionCount = editPartIdentifier.getConnectionAnchors().size();
+ } else if (editPartIdentifier instanceof IExtendedEditPartIdentifier) {
+ IExtendedEditPartIdentifier extended =
+ (IExtendedEditPartIdentifier) editPartIdentifier;
+
+ if (anchorType.equals(AnchorType.incoming.rcValue())) {
+ connectionCount = extended
+ .getIncomingConnectionAnchors().size();
+ } else if (anchorType
+ .equals(AnchorType.outgoing.rcValue())) {
+ connectionCount = extended
+ .getOutgoingConnectionAnchors().size();
+ }
+ } else {
+ throw new StepExecutionException("GraphicalEditPart does not support the anchor type" + anchorType, //$NON-NLS-1$
+ EventFactory.createActionError());
+ }
+ Comparer.compare(Integer.toString(connectionCount),
+ Integer.toString(count), comparisonMethod);
+ }
}

Back to the top