import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.tracecompass.ctf.core.tests.shared.LttngTraceGenerator;
+import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.controlflow.ControlFlowView;
import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager;
import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils;
import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
import org.eclipse.ui.IWorkbenchPart;
import org.junit.Before;
return fBot.viewByTitle("Control Flow");
}
+ @Override
+ protected SWTBotView openView() {
+ SWTBotUtils.openView(ControlFlowView.ID);
+ return getViewBot();
+ }
+
@Override
protected List<String> getLegendValues() {
return Arrays.asList("UNKNOWN", "WAIT_UNKNOWN", "WAIT_BLOCKED", "WAIT_FOR_CPU", "USERMODE", "SYSCALL", "INTERRUPTED");
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph;
+import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry;
import org.junit.Test;
/**
*/
protected abstract List<String> getLegendValues();
+ /**
+ * Opens the view
+ *
+ * @return the view bot
+ */
+ protected abstract SWTBotView openView();
+
/**
* Test toolbar button order and that all buttons are enabled and visible
*/
bot.button("OK").click();
}
+ /**
+ * Test that re-opening a view repoopulates it properly.
+ */
+ @Test
+ public void testOpenCloseOpen() {
+ SWTBotView viewBot = openView();
+ SWTBotTimeGraph tgBot = new SWTBotTimeGraph(viewBot.bot());
+ Map<String, List<String>> before = getItemNames(tgBot);
+ viewBot.close();
+ viewBot = openView();
+ tgBot = new SWTBotTimeGraph(viewBot.bot());
+ Map<String, List<String>> after = getItemNames(tgBot);
+ assertEquals(before, after);
+ }
+
+ private @NonNull static Map<String, List<String>> getItemNames(SWTBotTimeGraph tgBot) {
+ Map<String, List<String>> returnStructure = new HashMap<>();
+ for (SWTBotTimeGraphEntry element : tgBot.getEntries()) {
+ returnStructure.put(element.getText(),
+ Arrays.stream(
+ element.getEntries())
+ .map(tgEntry -> tgEntry.getText())
+ .collect(Collectors.toList())
+ );
+ }
+ return returnStructure;
+ }
+
}
\ No newline at end of file
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers;
+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.TimeGraphControl;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphMarkerAxis;
return Arrays.asList("IDLE", "USERMODE", "SYSCALL", "IRQ", "SOFT_IRQ", "IRQ_ACTIVE", "SOFT_IRQ_RAISED", "SOFT_IRQ_ACTIVE");
}
+ @Override
+ protected SWTBotView openView() {
+ SWTBotUtils.openView(ResourcesView.ID);
+ return getViewBot();
+ }
+
@Override
protected List<String> getToolbarTooltips() {
return Arrays.asList("Align Views", "Show View Filters", "Show Legend", SEPARATOR,