Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferrazzutti2014-08-05 15:37:02 +0000
committerAlexander Kurtakov2014-08-27 15:35:48 +0000
commit3d42d9e18d3fc643f02b2a501af77e3965d752a5 (patch)
treeb5f42726bd0baeb819566960caef20783966fc20 /systemtap
parent15326e0f5fc20dcb8250f6b0e30cce4f004feeaf (diff)
downloadorg.eclipse.linuxtools-3d42d9e18d3fc643f02b2a501af77e3965d752a5.tar.gz
org.eclipse.linuxtools-3d42d9e18d3fc643f02b2a501af77e3965d752a5.tar.xz
org.eclipse.linuxtools-3d42d9e18d3fc643f02b2a501af77e3965d752a5.zip
Systemtap: Attempt to fix failing tooltip test.
TestCreateSystemtaptapScript.testGraphTooltips() often fails because an expected tooltip cannot be found when the mouse hovers over a graph's data point. Attempt to supress this problem by retrying the test multiple times before failing. Change-Id: I5dd5c9f694e9b1be51a01a77aea712059686adfe Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com> Reviewed-on: https://git.eclipse.org/r/31050 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.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java85
1 files changed, 50 insertions, 35 deletions
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 ca714ef538..7927cf8827 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
@@ -59,6 +59,7 @@ 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.waits.Conditions;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
@@ -1282,48 +1283,62 @@ public class TestCreateSystemtapScript {
private void checkTooltipAtDataPoint(final AbstractChartBuilder cb, final int series,
final int dataPoint, final String expectedTooltip,
final boolean shellShouldExist) {
- if (dataPoint >= 0) {
- bot.sleep(500);
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void run() {
- Event event = new Event();
- event.type = SWT.MouseMove;
- event.x = 0;
- event.y = 0;
- bot.getDisplay().post(event);
-
- Point mousePoint = cb.getChart().getPlotArea().toDisplay(
- cb.getChart().getSeriesSet().getSeries()[0].getPixelCoordinates(dataPoint));
- event.x = mousePoint.x;
- event.y = mousePoint.y;
- bot.getDisplay().post(event);
- }
- });
- }
+ for (int retries = 5; retries > 0; retries--) {
- bot.sleep(500); // Give some time for the tooltip to appear/change
+ if (dataPoint >= 0) {
+ final Event event = new Event();
+ event.type = SWT.MouseMove;
+ // Jitter the mouse before moving to the data point
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @Override
+ public void run() {
+ event.x = 0;
+ event.y = 0;
+ bot.getDisplay().post(event);
+ }
+ });
+ bot.sleep(100);
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @Override
+ public void run() {
+ Point mousePoint = cb.getChart().getPlotArea().toDisplay(
+ cb.getChart().getSeriesSet().getSeries()[0].getPixelCoordinates(dataPoint));
+ event.x = mousePoint.x;
+ event.y = mousePoint.y;
+ bot.getDisplay().post(event);
+ }
+ });
+ }
- UIThreadRunnable.syncExec(new VoidResult() {
- @Override
- public void 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())) {
- if (!shellShouldExist) {
- throw new AssertionError("Did not expect to find this tooltip, but found it: " + expectedTooltip);
+ 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;
}
+ return false;
}
- if (shellShouldExist) {
- throw new AssertionError("Didn't find the expected tooltip: " + expectedTooltip);
- }
+ });
+
+ if (foundTooltip == shellShouldExist) {
+ return;
}
- });
+ }
+
+ if (shellShouldExist) {
+ throw new AssertionError("Didn't find the expected tooltip: " + expectedTooltip);
+ } else {
+ throw new AssertionError("Did not expect to find this tooltip, but found it: " + expectedTooltip);
+ }
}
private void openRunConfigurations(String scriptName) {

Back to the top