Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-09-18 22:17:33 +0000
committerAlexander Kurtakov2014-09-19 05:39:08 +0000
commit31d20a35c72ad8b5e746a52a99bbc5077e343ab7 (patch)
treedcf164b309bfcc34fce49b7dadb0db4ea633097b /systemtap
parentc0a7a2de825820a03a642aa992795bdb67603695 (diff)
downloadorg.eclipse.linuxtools-31d20a35c72ad8b5e746a52a99bbc5077e343ab7.tar.gz
org.eclipse.linuxtools-31d20a35c72ad8b5e746a52a99bbc5077e343ab7.tar.xz
org.eclipse.linuxtools-31d20a35c72ad8b5e746a52a99bbc5077e343ab7.zip
Systemtap: Add method to test graph tooltips.
The current method of testing graph tooltips commonly fails. Add mehtods in an attempt to more safely test this feature. Change-Id: I298acd5203579845cd6a33991d78721b6cdd850f Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/33581 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'systemtap')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/META-INF/MANIFEST.MF2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/pom.xml2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ToolTipChartMouseMoveListener.java25
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/AbstractChartBuilder.java13
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/listeners/AbstractChartMouseMoveListener.java11
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java22
6 files changed, 51 insertions, 24 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/META-INF/MANIFEST.MF
index e235604685..3f25f70f13 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/META-INF/MANIFEST.MF
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: org.eclipse.linuxtools.systemtap.graphing.ui;singleton:=true
-Bundle-Version: 3.1.0.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.linuxtools.internal.systemtap.graphing.ui.GraphingUIPlugin
Bundle-Vendor: %bundleProvider
Bundle-Localization: plugin
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/pom.xml b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/pom.xml
index acfb77d371..d06253bbcf 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/pom.xml
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/pom.xml
@@ -18,7 +18,7 @@
</parent>
<artifactId>org.eclipse.linuxtools.systemtap.graphing.ui</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools SystemTap Graphing UI Plug-In</name>
</project>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ToolTipChartMouseMoveListener.java b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ToolTipChartMouseMoveListener.java
index 4a76bf6803..9a07d55d0e 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ToolTipChartMouseMoveListener.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/internal/systemtap/graphing/ui/charts/listeners/ToolTipChartMouseMoveListener.java
@@ -10,6 +10,11 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.systemtap.graphing.ui.charts.listeners;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.RunnableFuture;
+
import org.eclipse.linuxtools.systemtap.graphing.ui.charts.listeners.AbstractChartMouseMoveListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
@@ -52,4 +57,24 @@ public class ToolTipChartMouseMoveListener extends AbstractChartMouseMoveListene
tipShell.setVisible(true);
}
}
+
+ /**
+ * @return The contents of the mouse tooltip provided by this listener, if it is visible;
+ * a default message otherwise.
+ */
+ @Override
+ public String getMouseMessage() {
+ RunnableFuture<String> f = new FutureTask<>(new Callable<String>() {
+ @Override
+ public String call() {
+ return tipText.isVisible() ? tipText.getText() : ""; //$NON-NLS-1$
+ }
+ });
+ tipText.getDisplay().syncExec(f);
+ try {
+ return f.get();
+ } catch (InterruptedException | ExecutionException e) {
+ return null;
+ }
+ }
} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/AbstractChartBuilder.java b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/AbstractChartBuilder.java
index e41eda4bd1..4139de4692 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/AbstractChartBuilder.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/AbstractChartBuilder.java
@@ -38,7 +38,7 @@ import org.swtchart.ITitle;
*
* @author Qi Liang
*/
-public abstract class AbstractChartBuilder extends Composite implements IUpdateListener{
+public abstract class AbstractChartBuilder extends Composite implements IUpdateListener {
/**
* Font name for all titles, labels, and values.
@@ -100,10 +100,21 @@ public abstract class AbstractChartBuilder extends Composite implements IUpdateL
protected AbstractChartMouseMoveListener chartMouseMoveListener = null;
/**
+ * If a mouse listener is registered, returns a message with details on the mouse's
+ * current position on the chart. This method is primarily used for testing purposes.
+ * @return A String message if a mouse listener is registered; null otherwise.
+ * @since 3.2
+ */
+ public String getMouseMessage() {
+ return chartMouseMoveListener != null ? chartMouseMoveListener.getMouseMessage() : null;
+ }
+
+ /**
* A reference to the SystemTap Graphing preference store.
* @since 3.0
*/
protected IPreferenceStore store;
+
/**
* Updates the chart with properties read from user-set preferences. It is called automatically
* whenever a change is made to SystemTap Graphing preferences.
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/listeners/AbstractChartMouseMoveListener.java b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/listeners/AbstractChartMouseMoveListener.java
index 818bd54bef..7e07dad767 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/listeners/AbstractChartMouseMoveListener.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphing.ui/src/org/eclipse/linuxtools/systemtap/graphing/ui/charts/listeners/AbstractChartMouseMoveListener.java
@@ -78,4 +78,15 @@ public abstract class AbstractChartMouseMoveListener implements MouseMoveListene
public void mouseMove(MouseEvent e) {
lastMouseEvent = e;
}
+
+ /**
+ * Returns a message with details on the mouse's current position on the chart.
+ * This method is primarily used for testing purposes.
+ * @return A default String message. Clients should override this message to describe the
+ * data point the mouse is hovering over, or whatever other kind of information is appropriate.
+ * @since 3.2
+ */
+ public String getMouseMessage() {
+ return ""; //$NON-NLS-1$
+ }
} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java
index 8bc9f6ed87..8f46740e6c 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java
@@ -50,10 +50,8 @@ import org.eclipse.linuxtools.systemtap.structures.TreeNode;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
@@ -63,7 +61,6 @@ import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.ContextMenuHelper;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
-import org.eclipse.swtbot.swt.finder.results.BoolResult;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
@@ -1332,24 +1329,7 @@ public class TestCreateSystemtapScript {
}
bot.sleep(500); // Give some time for the tooltip to appear/change
-
- boolean foundTooltip = UIThreadRunnable.syncExec(new BoolResult() {
- @Override
- public Boolean run() {
- for (SWTBotShell bshell : bot.shells()) {
- Control[] children = bshell.widget.getChildren();
- if (children.length == 1 && children[0] instanceof Text
- && children[0].isVisible()
- && expectedTooltip.equals(((Text) children[0]).getText())) {
-
- return true;
- }
- }
- return false;
- }
- });
-
- if (foundTooltip == shellShouldExist) {
+ if (expectedTooltip.equals(cb.getMouseMessage()) == shellShouldExist) {
return;
}
}

Back to the top