From c776a34fab4ea71d0baf045112e45ecf90832dca Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Tue, 24 Mar 2015 13:29:53 -0400 Subject: [PATCH] swtbot: fix colorsetting instability Waits for table to be populated before selecting event. Reset colors after test. Fix typo in comments. Change-Id: I166681c827e311c9d7d2ee8aa35ce429679b1c37 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/44510 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- .../swtbot/tests/viewers/events/ColorsViewTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/ColorsViewTest.java b/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/ColorsViewTest.java index 88f7a99425..f0d9374b0b 100644 --- a/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/ColorsViewTest.java +++ b/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/viewers/events/ColorsViewTest.java @@ -237,7 +237,7 @@ public class ColorsViewTest { viewBot.toolbarButton(delete).click(); final RGB foreground = new RGB(0, 0, 0); final RGB background = new RGB(255, 255, 0); - // Simulate the site effects of picking a color because we cannot + // Simulate the side effects of picking a color because we cannot // control native Color picker dialog in SWTBot. final ColorSetting[] cs = new ColorSetting[1]; UIThreadRunnable.syncExec(new VoidResult() { @@ -248,6 +248,8 @@ public class ColorsViewTest { } }); final SWTBotTable eventsEditor = fBot.activeEditor().bot().table(); + // should fix race condition of loading the trace + SWTBotUtils.waitForJobs(); eventsEditor.select(2); final SWTBotTableItem tableItem = eventsEditor.getTableItem(2); RGB fgc = UIThreadRunnable.syncExec(new Result() { @@ -264,5 +266,12 @@ public class ColorsViewTest { }); assertEquals("Fg", foreground, fgc); assertEquals("Bg", background, bgc); + // reset color settings + UIThreadRunnable.syncExec(new VoidResult() { + @Override + public void run() { + ColorSettingsManager.setColorSettings(new ColorSetting[0]); + } + }); } } -- 2.34.1