Author: lzoubek(a)redhat.com
Date: 2010-04-15 08:13:35 -0400 (Thu, 15 Apr 2010)
New Revision: 21492
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
Log:
SWTBot extensions, added support for Hyperlink
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-04-15 12:10:31
UTC (rev 21491)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-04-15 12:13:35
UTC (rev 21492)
@@ -19,7 +19,8 @@
org.jboss.tools.common.text.ext,
org.eclipse.ui.ide;bundle-version="3.5.1",
org.jboss.tools.common.model,
- org.jboss.tools.common.model.ui;bundle-version="3.1.0"
+ org.jboss.tools.common.model.ui;bundle-version="3.1.0",
+ org.eclipse.ui.forms;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Eclipse-RegisterBuddy: org.apache.log4j
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java 2010-04-15
12:10:31 UTC (rev 21491)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java 2010-04-15
12:13:35 UTC (rev 21492)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.jboss.tools.ui.bot.ext;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withText;
import static org.junit.Assert.fail;
import java.util.List;
@@ -26,8 +28,10 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.ui.forms.widgets.Hyperlink;
import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
/**
@@ -132,7 +136,29 @@
"Could not find widget of type Browser", ex);
}
}
-
+ @SuppressWarnings("unchecked")
+ public SWTBotHyperlinkExt hyperlink(String text) {
+ try {
+ List<Hyperlink> bsrs = (List<Hyperlink>)
widgets(allOf(widgetOfType(Hyperlink.class),withText(text)));
+ return new SWTBotHyperlinkExt(bsrs.get(0));
+ } catch (WidgetNotFoundException ex) {
+ throw new WidgetNotFoundException(
+ "Could not find widget of type Hyperlink", ex);
+ }
+ }
+ @SuppressWarnings("unchecked")
+ public SWTBotHyperlinkExt hyperlink(int index) {
+ try {
+ List<Hyperlink> bsrs = (List<Hyperlink>)
widgets(widgetOfType(Hyperlink.class));
+ return new SWTBotHyperlinkExt(bsrs.get(index));
+ } catch (WidgetNotFoundException ex) {
+ throw new WidgetNotFoundException(
+ "Could not find widget of type Hyperlink", ex);
+ }
+ }
+ public SWTBotHyperlinkExt hyperlink() {
+ return hyperlink(0);
+ }
public SWTBotButton clickButton(String text) {
return button(text).click();
}
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-04-15
12:10:31 UTC (rev 21491)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2010-04-15
12:13:35 UTC (rev 21492)
@@ -24,7 +24,7 @@
*/
public class SWTTestExt extends SWTBotTestCase{
- public static final Logger log = Logger.getLogger(SWTTestExt.class);
+ public static Logger log = Logger.getLogger(SWTTestExt.class);
public static final SWTBotExt bot = new SWTBotExt();
public static final SWTEclipseExt eclipse = new SWTEclipseExt(bot);
public static final SWTUtilExt util = new SWTUtilExt(bot);
@@ -35,6 +35,7 @@
public static final PackageExplorer packageExplorer = new PackageExplorer();
public static final ProjectExplorer projectExplorer = new ProjectExplorer();
public static final ServersView servers = new ServersView();
+
public static Properties properties;
/**
* Get properties for hibernate tests
Added:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java 2010-04-15
12:13:35 UTC (rev 21492)
@@ -0,0 +1,35 @@
+package org.jboss.tools.ui.bot.ext.parts;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+/**
+ *
+ * @author lzoubek
+ *
+ */
+public class SWTBotHyperlinkExt extends AbstractSWTBotControl<Hyperlink> {
+
+ public SWTBotHyperlinkExt(Hyperlink w) throws WidgetNotFoundException {
+ super(w);
+ }
+
+ /**
+ * activates hyper-link by sending special key do widget
+ * @return
+ */
+ public AbstractSWTBot<Hyperlink> activate() {
+ setFocus();
+ keyboard().typeCharacter('\r');
+ return this;
+ }
+ /**
+ * clicks on hyper-link (not real click, but {@link SWTBotHyperlinkExt#activate()}
+ */
+ public AbstractSWTBot<Hyperlink> click() {
+ return activate();
+
+ }
+
+}
Property changes on:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotHyperlinkExt.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Show replies by date