diff options
| author | Bjoern Ebner | 2016-10-06 08:42:10 +0000 |
|---|---|---|
| committer | Marvin Mueller | 2016-10-17 05:57:58 +0000 |
| commit | eaa975be9206b12cccba8d510e5e8c53e64ecc5a (patch) | |
| tree | 9d45366ee74ca37a2fc077ddb12705caee99374a | |
| parent | e760e59d331b231158ee4bc19f3537c259440427 (diff) | |
| download | org.eclipse.jubula.core-eaa975be9206b12cccba8d510e5e8c53e64ecc5a.tar.gz org.eclipse.jubula.core-eaa975be9206b12cccba8d510e5e8c53e64ecc5a.tar.xz org.eclipse.jubula.core-eaa975be9206b12cccba8d510e5e8c53e64ecc5a.zip | |
Implementation for Bug 484081 - Enable checks from clipboard in the API for all Toolkits
Change-Id: I769a334c2f7892199e106ae002a682900cbac39a
Signed-off-by: Bjoern Ebner <Bjoern.Ebner@bredex.de>
8 files changed, 166 insertions, 3 deletions
diff --git a/org.eclipse.jubula.client.ui.rcp/resources/library/unbound_modules_concrete_8.4.jub b/org.eclipse.jubula.client.ui.rcp/resources/library/unbound_modules_concrete_8.4.jub Binary files differindex cc32acc57..1810a0f38 100644 --- a/org.eclipse.jubula.client.ui.rcp/resources/library/unbound_modules_concrete_8.4.jub +++ b/org.eclipse.jubula.client.ui.rcp/resources/library/unbound_modules_concrete_8.4.jub diff --git a/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/clipboard.xml b/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/clipboard.xml new file mode 100644 index 000000000..9a009ea99 --- /dev/null +++ b/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/clipboard.xml @@ -0,0 +1,43 @@ +<!-- + Copyright (c) 2016 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 +--> + +<section xml:id="actionCheckTextInClipboard" version="5.0" xmlns="http://docbook.org/ns/docbook" + xmlns:xi="http://www.w3.org/2001/XInclude" + xmlns:xl="http://www.w3.org/1999/xlink" > + <title>Check Text in Clipboard</title> + + <para><emphasis>Check Text in Clipboard</emphasis></para> + <para> + <itemizedlist> + <listitem> + <para> + Use this action to check whether the text in the clipboard of the AUT matches a given value. + </para> + </listitem> + <listitem> + <para> + Parameters: + + <itemizedlist> + <listitem> + <para> + <xref linkend="operator" xrefstyle="template:%t"/> + </para> + </listitem> + <listitem> + <para> + <xref linkend="text" xrefstyle="template:%t"/> + </para> + </listitem> + </itemizedlist> + </para> + </listitem> + </itemizedlist> + </para> + +</section>
\ No newline at end of file diff --git a/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/content.xml b/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/content.xml index 76c45ebb9..29d0c753c 100644 --- a/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/content.xml +++ b/org.eclipse.jubula.documentation/reference/en/docbook/actions/usableOnMostApps/thatPerformChecks/checkText/content.xml @@ -12,6 +12,7 @@ <title>Check Text</title> + <xi:include href="clipboard.xml"/> <xi:include href="componentsThatShowText.xml"/> <xi:include href="tabComponents.xml"/> <xi:include href="tableComponents.xml"/> diff --git a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/implclasses/AbstractApplicationImplClass.java b/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/implclasses/AbstractApplicationImplClass.java index 0876195ae..ad7936f89 100644 --- a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/implclasses/AbstractApplicationImplClass.java +++ b/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/implclasses/AbstractApplicationImplClass.java @@ -13,10 +13,13 @@ package org.eclipse.jubula.rc.common.implclasses; import java.awt.AWTException; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.HeadlessException; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -539,7 +542,7 @@ public abstract class AbstractApplicationImplClass implements ITester { * * @param text The text to copy */ - public void rcCopyToClipboard(final String text) { + public void rcCopyToClipboard(final String text) { StringSelection strSel = new StringSelection(text); try { Toolkit.getDefaultToolkit().getSystemClipboard() @@ -549,7 +552,49 @@ public abstract class AbstractApplicationImplClass implements ITester { "Clipboard not available.", //$NON-NLS-1$ EventFactory.createActionError( TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } catch (HeadlessException he) { + throw new StepExecutionException( + "Clipboard not available.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } + } + + /** + * method to compare a string to the system clipboard + * + * @param operator + * the comparison method + * @param text + * the text for comparison + */ + public void rcCheckClipboard(final String operator, final String text) { + String content = null; + try { + content = (String) Toolkit.getDefaultToolkit().getSystemClipboard() + .getData(DataFlavor.stringFlavor); + } catch (IllegalStateException ise) { + throw new StepExecutionException( + "Clipboard not available.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } catch (HeadlessException he) { + throw new StepExecutionException( + "Clipboard not available.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } catch (UnsupportedFlavorException ufe) { + throw new StepExecutionException( + "Unsupported Clipboard content.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_UNSUPPORTED_FLAVOR)); + } catch (IOException ioe) { + throw new StepExecutionException( + "Clipboard could not be compared.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_IO_ERROR)); } + Verifier.match(content, text, operator); } /** diff --git a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/tester/AbstractApplicationTester.java b/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/tester/AbstractApplicationTester.java index 3233e539a..0f4c803bb 100644 --- a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/tester/AbstractApplicationTester.java +++ b/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/tester/AbstractApplicationTester.java @@ -13,10 +13,13 @@ package org.eclipse.jubula.rc.common.tester; import java.awt.AWTException; import java.awt.Dimension; import java.awt.Graphics2D; +import java.awt.HeadlessException; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -570,7 +573,7 @@ public abstract class AbstractApplicationTester implements ITester { * * @param text The text to copy */ - public void rcCopyToClipboard(final String text) { + public void rcCopyToClipboard(final String text) { StringSelection strSel = new StringSelection(text); try { Toolkit.getDefaultToolkit().getSystemClipboard() @@ -580,7 +583,49 @@ public abstract class AbstractApplicationTester implements ITester { "Clipboard not available.", //$NON-NLS-1$ EventFactory.createActionError( TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } catch (HeadlessException he) { + throw new StepExecutionException( + "Clipboard not available.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } + } + + /** + * method to compare a string to the system clipboard + * + * @param operator + * the comparison method + * @param text + * the text for comparison + */ + public void rcCheckClipboard(final String operator, final String text) { + String content = null; + try { + content = (String) Toolkit.getDefaultToolkit().getSystemClipboard() + .getData(DataFlavor.stringFlavor); + } catch (IllegalStateException ise) { + throw new StepExecutionException( + "Clipboard not available.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } catch (HeadlessException he) { + throw new StepExecutionException( + "Clipboard not available.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_NOT_AVAILABLE)); + } catch (UnsupportedFlavorException ufe) { + throw new StepExecutionException( + "Unsupported Clipboard content.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_UNSUPPORTED_FLAVOR)); + } catch (IOException ioe) { + throw new StepExecutionException( + "Clipboard could not be compared.", //$NON-NLS-1$ + EventFactory.createActionError( + TestErrorEvent.CLIPBOARD_IO_ERROR)); } + Verifier.match(content, text, operator); } /** diff --git a/org.eclipse.jubula.toolkit.concrete.provider/resources/xml/ComponentConfiguration.xml b/org.eclipse.jubula.toolkit.concrete.provider/resources/xml/ComponentConfiguration.xml index ad961b80a..5ee66a0d9 100644 --- a/org.eclipse.jubula.toolkit.concrete.provider/resources/xml/ComponentConfiguration.xml +++ b/org.eclipse.jubula.toolkit.concrete.provider/resources/xml/ComponentConfiguration.xml @@ -486,6 +486,24 @@ <type>java.lang.String</type> </param> </action> + <action name="CompSystem.CheckClipboard"> + <method>rcCheckClipboard</method> + <param name="CompSystem.Operator" + descriptionKey="CompSystem.Operator.descr" > + <type>java.lang.String</type> + <defaultValue>equals</defaultValue> + <valueSet> + <element name="CompSystem.Equals" value="equals"/> + <element name="CompSystem.NotEquals" value="not equals"/> + <element name="CompSystem.MatchesRegExp" value="matches"/> + <element name="CompSystem.SimpleMatch" value="simple match"/> + </valueSet> + </param> + <param name="CompSystem.Text" + descriptionKey="CompSystem.Text.descr" > + <type>java.lang.String</type> + </param> + </action> <action name="CompSystem.CheckExistenceOfWindow"> <method>rcCheckExistenceOfWindow</method> <param name="CompSystem.Title" diff --git a/org.eclipse.jubula.toolkit.concrete.provider/src/org/eclipse/jubula/toolkit/concrete/provider/I18nStrings.properties b/org.eclipse.jubula.toolkit.concrete.provider/src/org/eclipse/jubula/toolkit/concrete/provider/I18nStrings.properties index 6c038be0a..bd7b91c6b 100644 --- a/org.eclipse.jubula.toolkit.concrete.provider/src/org/eclipse/jubula/toolkit/concrete/provider/I18nStrings.properties +++ b/org.eclipse.jubula.toolkit.concrete.provider/src/org/eclipse/jubula/toolkit/concrete/provider/I18nStrings.properties @@ -32,6 +32,7 @@ CompSystem.rawArgs.splitChar.descr=the character used to split the arguments str CompSystem.CheckPropertyAtMousePosition=Check Property at Mouse Position CompSystem.CheckValues=Check Numeric Values CompSystem.CheckStringValues=Check String Values +CompSystem.CheckClipboard=Check Text in Clipboard CompSystem.CheckExistenceOfColumn=Check Existence of a Column CompSystem.CheckExistenceOfWindow=Check Existence of Window CompSystem.CheckTooltipText=Check Tooltip Text diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/objects/event/TestErrorEvent.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/objects/event/TestErrorEvent.java index b1037e73a..d1a91491a 100644 --- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/objects/event/TestErrorEvent.java +++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/objects/event/TestErrorEvent.java @@ -221,7 +221,17 @@ public class TestErrorEvent { * Clipboard not available.
*/
public static final String CLIPBOARD_NOT_AVAILABLE = "TestErrorEvent.ClipboardNotAvailable"; //$NON-NLS-1$
- + + /** + * Clipboard not available. + */ + public static final String CLIPBOARD_UNSUPPORTED_FLAVOR = "TestErrorEvent.ClipboardUnsupportedFlavor"; //$NON-NLS-1$ + + /** + * Clipboard not available. + */ + public static final String CLIPBOARD_IO_ERROR = "TestErrorEvent.ClipboardIOError"; //$NON-NLS-1$ + /** * Unsupported parameter value. */ |
