Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk2010-06-04 18:50:18 +0000
committerChris Aniszczyk2010-06-04 18:50:18 +0000
commita60b39bc93f5b59c7c930a234edf5cda3faa587c (patch)
treebe0d1cc9a9d8e1c4712782eab411d709df6a0cac
parent972b8155e33244f2cf38cc389d96ffe00e6f3f32 (diff)
downloadorg.eclipse.swtbot-a60b39bc93f5b59c7c930a234edf5cda3faa587c.tar.gz
org.eclipse.swtbot-a60b39bc93f5b59c7c930a234edf5cda3faa587c.tar.xz
org.eclipse.swtbot-a60b39bc93f5b59c7c930a234edf5cda3faa587c.zip
Initial import of SWTBorm Forms support
-rw-r--r--org.eclipse.swtbot.forms.finder.test/.classpath7
-rw-r--r--org.eclipse.swtbot.forms.finder.test/.project28
-rw-r--r--org.eclipse.swtbot.forms.finder.test/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.swtbot.forms.finder.test/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.swtbot.forms.finder.test/build.properties4
-rw-r--r--org.eclipse.swtbot.forms.finder.test/screenshots/findsScrolledFormText(org.eclipse.swtbot.forms.finder.test.widgets.SWTBotScrolledFormTextTest).jpegbin0 -> 125333 bytes
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/AbstractSWTBotFormsTestCase.java67
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/FormView.java211
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotExpandableCompositeTest.java30
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotFormTextTest.java49
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotHyperlinkTest.java29
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotImageHyperlinkTest.java29
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotScrolledFormTextTest.java30
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotSectionTest.java30
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTreeNodeTest.java27
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTwistieTest.java27
16 files changed, 597 insertions, 0 deletions
diff --git a/org.eclipse.swtbot.forms.finder.test/.classpath b/org.eclipse.swtbot.forms.finder.test/.classpath
new file mode 100644
index 00000000..ad32c83a
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.swtbot.forms.finder.test/.project b/org.eclipse.swtbot.forms.finder.test/.project
new file mode 100644
index 00000000..746b6086
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.swtbot.forms.finder.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.swtbot.forms.finder.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.swtbot.forms.finder.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..98a2deaa
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon May 03 06:25:00 CDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.swtbot.forms.finder.test/META-INF/MANIFEST.MF b/org.eclipse.swtbot.forms.finder.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..98dab2ee
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SWTBot Forms Tests
+Bundle-SymbolicName: org.eclipse.swtbot.forms.finder.test;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.swt,
+ org.eclipse.jface,
+ org.eclipse.swt.examples,
+ org.eclipse.swtbot.swt.finder,
+ org.apache.log4j;version="1.2.12",
+ org.junit4,
+ org.hamcrest,
+ org.eclipse.swtbot.junit4_x,
+ org.eclipse.swtbot.forms.finder,
+ org.eclipse.ui.forms,
+ org.eclipse.core.runtime,
+ org.eclipse.ui;bundle-version="3.6.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0"
+Import-Package: com.ibm.icu.text
+Bundle-Vendor: Eclipse SWTBot
diff --git a/org.eclipse.swtbot.forms.finder.test/build.properties b/org.eclipse.swtbot.forms.finder.test/build.properties
new file mode 100644
index 00000000..34d2e4d2
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.swtbot.forms.finder.test/screenshots/findsScrolledFormText(org.eclipse.swtbot.forms.finder.test.widgets.SWTBotScrolledFormTextTest).jpeg b/org.eclipse.swtbot.forms.finder.test/screenshots/findsScrolledFormText(org.eclipse.swtbot.forms.finder.test.widgets.SWTBotScrolledFormTextTest).jpeg
new file mode 100644
index 00000000..d306d08f
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/screenshots/findsScrolledFormText(org.eclipse.swtbot.forms.finder.test.widgets.SWTBotScrolledFormTextTest).jpeg
Binary files differ
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/AbstractSWTBotFormsTestCase.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/AbstractSWTBotFormsTestCase.java
new file mode 100644
index 00000000..ffea4527
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/AbstractSWTBotFormsTestCase.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test;
+
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.forms.finder.finders.SWTFormsBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public abstract class AbstractSWTBotFormsTestCase {
+
+ public static Display display;
+ public static SWTFormsBot bot;
+ public static FormView view;
+ public static Thread thread;
+
+ protected Shell createShell(final String text) {
+ return UIThreadRunnable.syncExec(new WidgetResult<Shell>() {
+ public Shell run() {
+ Shell shell = new Shell(display);
+ shell.setText(text);
+ shell.setLayout(new GridLayout());
+ return shell;
+ }
+ });
+ }
+
+ @Before
+ public void setUp() {
+ display = new Display();
+ bot = new SWTFormsBot();
+ thread = new Thread("UI Thread") {
+ public void run() {
+ while ((display != null) && !display.isDisposed())
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ };
+ thread.start();
+ Shell shell = createShell("Forms Test");
+ view = new FormView(shell);
+ shell.open();
+ }
+
+ @After
+ public void tearDown() {
+ // TODO
+ }
+
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/FormView.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/FormView.java
new file mode 100644
index 00000000..24a918a5
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/FormView.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+// taken from the org.eclipse.ui.forms.examples plug-in
+public class FormView {
+
+ private Composite fComposite;
+ private FormToolkit toolkit;
+ private ScrolledForm form;
+
+ /**
+ * The constructor.
+ */
+ public FormView(Composite composite) {
+ fComposite = composite;
+ createPartControl(fComposite);
+ }
+ /**
+ * This is a callback that will allow us to create the viewer and
+ * initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ toolkit = new FormToolkit(parent.getDisplay());
+ form = toolkit.createScrolledForm(parent);
+ form.setText("Hello, Eclipse Forms");
+ TableWrapLayout layout = new TableWrapLayout();
+ form.getBody().setLayout(layout);
+
+ Hyperlink link = toolkit.createHyperlink(form.getBody(), "Click here.",
+ SWT.WRAP);
+ link.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ System.out.println("Link activated!");
+ }
+ });
+ link.setText("This is an example of a form that is much longer and will need to wrap.");
+ layout.numColumns = 2;
+ TableWrapData td = new TableWrapData();
+ td.colspan = 2;
+ link.setLayoutData(td);
+ toolkit.createLabel(form.getBody(), "Text field label:");
+ Text text = toolkit.createText(form.getBody(), "");
+ td = new TableWrapData(TableWrapData.FILL_GRAB);
+ text.setLayoutData(td);
+ Button button = toolkit.createButton(form.getBody(),
+ "An example of a checkbox in a form", SWT.CHECK);
+ td = new TableWrapData();
+ td.colspan = 2;
+ button.setLayoutData(td);
+
+ ImageHyperlink ih = toolkit.createImageHyperlink(form.getBody(), SWT.NULL);
+ ih.setText("Image link with no image");
+ ih = toolkit.createImageHyperlink(form.getBody(), SWT.NULL);
+ ih.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_ERROR));
+ ih.setText("Link with image and text");
+
+ ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TREE_NODE|ExpandableComposite.CLIENT_INDENT);
+ ImageHyperlink eci = toolkit.createImageHyperlink(ec, SWT.NULL);
+ eci.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_ERROR));
+ ec.setTextClient(eci);
+ ec.setText("Expandable Composite title");
+ String ctext = "We will now create a somewhat long text so that "+
+ "we can use it as content for the expandable composite. "+
+ "Expandable composite is used to hide or show the text using the "+
+ "toggle control";
+ Label client = toolkit.createLabel(ec, ctext, SWT.WRAP);
+ ec.setClient(client);
+ td = new TableWrapData();
+ td.colspan = 2;
+ ec.setLayoutData(td);
+ ec.addExpansionListener(new ExpansionAdapter() {
+ public void expansionStateChanged(ExpansionEvent e) {
+ form.reflow(true);
+ }
+ });
+ Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TWISTIE|Section.EXPANDED);
+ td = new TableWrapData(TableWrapData.FILL);
+ td.colspan = 2;
+ section.setLayoutData(td);
+ section.addExpansionListener(new ExpansionAdapter() {
+ public void expansionStateChanged(ExpansionEvent e) {
+ form.reflow(true);
+ }
+ });
+ section.setText("Section title");
+ toolkit.createCompositeSeparator(section);
+ section.setDescription("This is the description that goes below the title");
+ Composite sectionClient = toolkit.createComposite(section);
+ sectionClient.setLayout(new GridLayout());
+ button = toolkit.createButton(sectionClient, "Radio 1", SWT.RADIO);
+ button = toolkit.createButton(sectionClient, "Radio 2", SWT.RADIO);
+ section.setClient(sectionClient);
+
+ StringBuffer buf = new StringBuffer();
+ buf.append("<form>");
+ buf.append("<p>");
+ buf.append("Here is some plain text for the text to render; ");
+ buf.append("this text is at <a href=\"http://www.eclipse.org\" nowrap=\"true\">http://www.eclipse.org</a> web site.");
+ buf.append("</p>");
+ buf.append("<p>");
+ buf.append("<span color=\"header\" font=\"header\">This text is in header font and color.</span>");
+ buf.append("</p>");
+ buf.append("<p>This line will contain some <b>bold</b> and some <span font=\"code\">source</span> text. ");
+ buf.append("We can also add <img href=\"image\"/> an image. ");
+ buf.append("</p>");
+ buf.append("<li>A default (bulleted) list item.</li>");
+ buf.append("<li>Another bullet list item.</li>");
+ buf.append("<li style=\"text\" value=\"1.\">A list item with text.</li>");
+ buf.append("<li style=\"text\" value=\"2.\">Another list item with text</li>");
+ buf.append("<li style=\"image\" value=\"image\">List item with an image bullet</li>");
+ buf.append("<li style=\"text\" bindent=\"20\" indent=\"40\" value=\"3.\">A list item with text.</li>");
+ buf.append("<li style=\"text\" bindent=\"20\" indent=\"40\" value=\"4.\">A list item with text.</li>");
+ buf.append("<p> leading blanks; more white \n\n new lines <br/><br/><br/> \n more <b> bb </b> white . </p>");
+ buf.append("</form>");
+ FormText rtext = toolkit.createFormText(form.getBody(), false);
+ //rtext.setWhitespaceNormalized(false);
+ td = new TableWrapData(TableWrapData.FILL);
+ td.colspan = 2;
+ rtext.setLayoutData(td);
+ rtext.setImage("image", JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_ERROR));
+ rtext.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE));
+ rtext.setFont("header", JFaceResources.getHeaderFont());
+ rtext.setFont("code", JFaceResources.getTextFont());
+ rtext.setText(buf.toString(), true, false);
+ rtext.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ System.out.println("Link active: "+e.getHref());
+ }
+ });
+/* layout.numColumns = 3;
+ Label label;
+ TableWrapData td;
+
+ label = toolkit.createLabel(form.getBody(), "Some text to put in the first column", SWT.WRAP);
+ label = toolkit.createLabel(form.getBody() ,"Some text to put in the second column and make it a bit longer so that we can see what happens with column distribution. This text must be the longest so that it can get more space allocated to the columns it belongs to.", SWT.WRAP);
+ td = new TableWrapData();
+ td.colspan = 2;
+ label.setLayoutData(td);
+ label = toolkit.createLabel(form.getBody(), "This text will span two rows and should not grow the column.", SWT.WRAP);
+ td = new TableWrapData();
+ td.rowspan = 2;
+ label.setLayoutData(td);
+ label = toolkit.createLabel(form.getBody(), "This text goes into column 2 and consumes only one cell", SWT.WRAP);
+ label.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ label = toolkit.createLabel(form.getBody(), "This text goes into column 3 and consumes only one cell too", SWT.WRAP);
+ label.setLayoutData(new TableWrapData(TableWrapData.FILL));
+ label = toolkit.createLabel(form.getBody(), "This text goes into column 2 and consumes only one cell", SWT.WRAP);
+ label.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ label = toolkit.createLabel(form.getBody(), "This text goes into column 3 and consumes only one cell too", SWT.WRAP);
+ label.setLayoutData(new TableWrapData(TableWrapData.FILL));
+ form.getBody().setBackground(form.getBody().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));*/
+
+ toolkit.paintBordersFor(form.getBody());
+ }
+ /**
+ * Passing the focus request to the form.
+ */
+ public void setFocus() {
+ Control focusControl = form.getDisplay().getFocusControl();
+ if (focusControl!=null) {
+ Composite parent = focusControl.getParent();
+ while (parent!=null) {
+ if (parent==form) {
+ // already have focus
+ return;
+ }
+ parent = parent.getParent();
+ }
+ }
+ form.setFocus();
+ }
+ /**
+ * Disposes the toolkit
+ */
+ public void dispose() {
+ toolkit.dispose();
+ }
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotExpandableCompositeTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotExpandableCompositeTest.java
new file mode 100644
index 00000000..69712469
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotExpandableCompositeTest.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotExpandableComposite;
+import org.junit.Test;
+
+public class SWTBotExpandableCompositeTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findExpandableComposite() throws Exception {
+ String title = "Expandable Composite title";
+ SWTBotExpandableComposite composite = bot.expandableComposite(title);
+ assertNotNull(composite);
+ assertEquals(title, composite.getText());
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotFormTextTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotFormTextTest.java
new file mode 100644
index 00000000..11ba0008
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotFormTextTest.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotFormText;
+import org.junit.Test;
+
+public class SWTBotFormTextTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findsFormText() throws Exception {
+ StringBuffer buf = new StringBuffer();
+ buf.append("<form>");
+ buf.append("<p>");
+ buf.append("Here is some plain text for the text to render; ");
+ buf.append("this text is at <a href=\"http://www.eclipse.org\" nowrap=\"true\">http://www.eclipse.org</a> web site.");
+ buf.append("</p>");
+ buf.append("<p>");
+ buf.append("<span color=\"header\" font=\"header\">This text is in header font and color.</span>");
+ buf.append("</p>");
+ buf.append("<p>This line will contain some <b>bold</b> and some <span font=\"code\">source</span> text. ");
+ buf.append("We can also add <img href=\"image\"/> an image. ");
+ buf.append("</p>");
+ buf.append("<li>A default (bulleted) list item.</li>");
+ buf.append("<li>Another bullet list item.</li>");
+ buf.append("<li style=\"text\" value=\"1.\">A list item with text.</li>");
+ buf.append("<li style=\"text\" value=\"2.\">Another list item with text</li>");
+ buf.append("<li style=\"image\" value=\"image\">List item with an image bullet</li>");
+ buf.append("<li style=\"text\" bindent=\"20\" indent=\"40\" value=\"3.\">A list item with text.</li>");
+ buf.append("<li style=\"text\" bindent=\"20\" indent=\"40\" value=\"4.\">A list item with text.</li>");
+ buf.append("<p> leading blanks; more white \n\n new lines <br/><br/><br/> \n more <b> bb </b> white . </p>");
+ buf.append("</form>");
+ SWTBotFormText text = bot.formText();
+ assertNotNull(text);
+ System.out.println(text.widget.getSelectionText());
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotHyperlinkTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotHyperlinkTest.java
new file mode 100644
index 00000000..25a59ffd
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotHyperlinkTest.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotHyperlink;
+import org.junit.Test;
+
+public class SWTBotHyperlinkTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findHyperlink() throws Exception {
+ SWTBotHyperlink link = bot.hyperlink();
+ assertNotNull(link);
+ assertEquals("This is an example of a form that is much longer and will need to wrap.", link.getText());
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotImageHyperlinkTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotImageHyperlinkTest.java
new file mode 100644
index 00000000..1e1e2d30
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotImageHyperlinkTest.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotImageHyperlink;
+import org.junit.Test;
+
+public class SWTBotImageHyperlinkTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findImageHyperlink() throws Exception {
+ SWTBotImageHyperlink link = bot.imageHyperlink("Image link with no image");
+ assertNotNull(link);
+ assertEquals("Image link with no image", link.getText());
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotScrolledFormTextTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotScrolledFormTextTest.java
new file mode 100644
index 00000000..6c4651d2
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotScrolledFormTextTest.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotScrolledFormText;
+import org.junit.Test;
+
+public class SWTBotScrolledFormTextTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findsScrolledFormText() throws Exception {
+ String title = "Hello, Eclipse Forms";
+ SWTBotScrolledFormText text = bot.scrolledFormText();
+ assertNotNull(text);
+ text.setFocus();
+ System.out.println(text.widget.getFormText().getSelectionText());
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotSectionTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotSectionTest.java
new file mode 100644
index 00000000..9c8fbbea
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotSectionTest.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotSection;
+import org.junit.Test;
+
+public class SWTBotSectionTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findSection() throws Exception {
+ String title = "Section title";
+ SWTBotSection section = bot.section(title);
+ assertNotNull(section);
+ assertEquals(title, section.getText());
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTreeNodeTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTreeNodeTest.java
new file mode 100644
index 00000000..1e2bbf7c
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTreeNodeTest.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotTreeNode;
+import org.junit.Test;
+
+public class SWTBotTreeNodeTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findTreeNode() throws Exception {
+ SWTBotTreeNode node = bot.treeNode();
+ assertNotNull(node);
+ }
+
+}
diff --git a/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTwistieTest.java b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTwistieTest.java
new file mode 100644
index 00000000..311894e9
--- /dev/null
+++ b/org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotTwistieTest.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Chris Aniszczyk and others.
+ * 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:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.forms.finder.test.widgets;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.eclipse.swtbot.forms.finder.test.AbstractSWTBotFormsTestCase;
+import org.eclipse.swtbot.forms.finder.widgets.SWTBotTwistie;
+import org.junit.Test;
+
+public class SWTBotTwistieTest extends AbstractSWTBotFormsTestCase {
+
+ @Test
+ public void findTwistie() throws Exception {
+ SWTBotTwistie twistie = bot.twistie();
+ assertNotNull(twistie);
+ }
+
+}

Back to the top