tmf.core: Introduce TmfTimestamp factory methods
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests / src / org / eclipse / tracecompass / lttng2 / kernel / ui / swtbot / tests / ControlFlowViewSortingTest.java
index 01e5dedd8d333c927787e81b42d5c034d136245f..f83d219fe448158b684c9ca188660e198b049396 100644 (file)
@@ -17,6 +17,7 @@ import java.io.IOException;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -30,9 +31,15 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimePreferencesConstants;
+import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimePreferences;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
 import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestampFormat;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers.SWTBotTestCondition;
 import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
+import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.Resolution;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat;
@@ -79,6 +86,8 @@ public class ControlFlowViewSortingTest extends KernelTestBase {
     private static final long LTTNG_CONSUMER_BIRTHTIME = 1361214078963717040L;
     private static final String LTTNG_CONSUMER_TID = "4034";
 
+    private static final @NonNull ITmfTimestamp TRACE_START_TIME = TmfTimestamp.create(1361214078963711320L, ITmfTimestamp.NANOSECOND_SCALE);
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
@@ -113,7 +122,7 @@ public class ControlFlowViewSortingTest extends KernelTestBase {
     @Override
     public void after() {
         IEclipsePreferences defaultPreferences = InstanceScope.INSTANCE.getNode(Activator.PLUGIN_ID);
-        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, "Local Time");
+        defaultPreferences.put(ITmfTimePreferencesConstants.TIME_ZONE, TmfTimePreferences.getDefaultPreferenceMap().get(ITmfTimePreferencesConstants.TIME_ZONE));
         TmfTimestampFormat.updateDefaultFormats();
         super.after();
     }
@@ -128,6 +137,8 @@ public class ControlFlowViewSortingTest extends KernelTestBase {
      */
     @Test
     public void testColumnSorting() {
+        fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(TRACE_START_TIME, TRACE_START_TIME), TRACE_START_TIME));
+
         // Create a known state
         applyFilter();
         final SWTBotTree tree = fViewBot.bot().tree();
@@ -159,20 +170,19 @@ public class ControlFlowViewSortingTest extends KernelTestBase {
         assertEquals("default", 0, checked.intValue());
 
         // select root nodes and their children
-        checkTreeItem(bot, treeBot, SYSTEMD_PROCESS_NAME, 54);
-        checkTreeItem(bot, treeBot, KTHREAD_PROCESS_NAME, 88);
-        checkTreeItem(bot, treeBot, LTTNG_CONSUMER_PROCESS_NAME, 89);
+        checkFilterTreeItems(bot, treeBot, SYSTEMD_PROCESS_NAME);
+        checkFilterTreeItems(bot, treeBot, KTHREAD_PROCESS_NAME);
+        checkFilterTreeItems(bot, treeBot, LTTNG_CONSUMER_PROCESS_NAME);
 
         bot.button(OK_BUTTON).click();
     }
 
-    private static void checkTreeItem(SWTBot bot, SWTBotTree treeBot, String process, int nbChecked) {
+    private static void checkFilterTreeItems(SWTBot bot, SWTBotTree treeBot, String process) {
         SWTBotTreeItem item = SWTBotUtils.getTreeItem(bot, treeBot, process);
         item.select();
         bot.button(CHECK_SUBTREE).click();
         TreeCheckedCounter treeCheckCounter = new TreeCheckedCounter(treeBot);
-        Integer checked = UIThreadRunnable.syncExec(treeCheckCounter);
-        assertEquals(process, nbChecked, checked.intValue());
+        UIThreadRunnable.syncExec(treeCheckCounter);
     }
 
     private static void testProcessSorting(final SWTBotTree tree) {
This page took 0.043246 seconds and 5 git commands to generate.