Commit | Line | Data |
---|---|---|
2fe6a9ea PT |
1 | /******************************************************************************* |
2 | * Copyright (c) 2015 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Patrick Tasse - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests; | |
14 | ||
2fe6a9ea PT |
15 | import static org.junit.Assert.assertTrue; |
16 | ||
2fe6a9ea | 17 | import org.eclipse.jdt.annotation.NonNull; |
6e4a07af | 18 | import org.eclipse.swt.SWT; |
2fe6a9ea PT |
19 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; |
20 | import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; | |
21 | import org.eclipse.swtbot.swt.finder.keyboard.Keyboard; | |
22 | import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory; | |
23 | import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; | |
24 | import org.eclipse.swtbot.swt.finder.matchers.WidgetOfType; | |
25 | import org.eclipse.swtbot.swt.finder.results.VoidResult; | |
2fe6a9ea PT |
26 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; |
27 | import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal; | |
28 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; | |
29 | import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal; | |
30 | import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; | |
31 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp; | |
32 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; | |
33 | import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; | |
34 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; | |
156e9ead | 35 | import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView; |
2fe6a9ea | 36 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl; |
156e9ead | 37 | import org.eclipse.ui.IWorkbenchPart; |
2fe6a9ea PT |
38 | import org.junit.Before; |
39 | import org.junit.Test; | |
40 | ||
41 | /** | |
42 | * SWTBot tests for Control Flow view | |
43 | * | |
44 | * @author Patrick Tasse | |
45 | */ | |
46 | public class ControlFlowViewTest extends KernelTest { | |
47 | ||
48 | private static final String FOLLOW_CPU_BACKWARD = "Follow CPU Backward"; | |
49 | private static final String FOLLOW_CPU_FORWARD = "Follow CPU Forward"; | |
50 | private static final String SELECT_PREVIOUS_EVENT = "Select Previous Event"; | |
51 | private static final String SELECT_NEXT_EVENT = "Select Next Event"; | |
52 | private static final Keyboard KEYBOARD = KeyboardFactory.getSWTKeyboard(); | |
53 | private static final @NonNull ITmfTimestamp START_TIME = new TmfNanoTimestamp(1368000272650993664L); | |
54 | private static final @NonNull ITmfTimestamp TID1_TIME1 = new TmfNanoTimestamp(1368000272651208412L); | |
55 | private static final @NonNull ITmfTimestamp TID1_TIME2 = new TmfNanoTimestamp(1368000272656147616L); | |
56 | private static final @NonNull ITmfTimestamp TID1_TIME3 = new TmfNanoTimestamp(1368000272656362364L); | |
57 | private static final @NonNull ITmfTimestamp TID1_TIME4 = new TmfNanoTimestamp(1368000272663234300L); | |
58 | private static final @NonNull ITmfTimestamp TID1_TIME5 = new TmfNanoTimestamp(1368000272663449048L); | |
59 | private static final @NonNull ITmfTimestamp TID1_TIME6 = new TmfNanoTimestamp(1368000272665596528L); | |
60 | private static final @NonNull ITmfTimestamp TID2_TIME1 = new TmfNanoTimestamp(1368000272651852656L); | |
61 | private static final @NonNull ITmfTimestamp TID2_TIME2 = new TmfNanoTimestamp(1368000272652067404L); | |
62 | private static final @NonNull ITmfTimestamp TID2_TIME3 = new TmfNanoTimestamp(1368000272652282152L); | |
63 | private static final @NonNull ITmfTimestamp TID2_TIME4 = new TmfNanoTimestamp(1368000272652496900L); | |
64 | private static final @NonNull ITmfTimestamp TID5_TIME1 = new TmfNanoTimestamp(1368000272652496900L); | |
65 | ||
66 | private SWTBotView fViewBot; | |
67 | ||
68 | /** | |
69 | * Before Test | |
70 | */ | |
71 | @Override | |
72 | @Before | |
73 | public void before() { | |
74 | super.before(); | |
75 | fViewBot = fBot.viewByTitle("Control Flow"); | |
76 | } | |
77 | ||
78 | /** | |
79 | * Test keyboard navigation using ARROW_RIGHT and ARROW_LEFT | |
80 | */ | |
81 | @Test | |
82 | public void testKeyboardLeftRight() { | |
156e9ead MAL |
83 | testNextPreviousEvent(() -> KEYBOARD.pressShortcut(Keystrokes.RIGHT), |
84 | () -> KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT), | |
85 | () -> KEYBOARD.pressShortcut(Keystrokes.LEFT), | |
86 | () -> KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT)); | |
2fe6a9ea PT |
87 | } |
88 | ||
89 | /** | |
90 | * Test tool bar buttons "Select Next Event" and "Select Previous Event" | |
91 | */ | |
92 | @Test | |
93 | public void testToolBarSelectNextPreviousEvent() { | |
156e9ead MAL |
94 | testNextPreviousEvent(() -> fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(), |
95 | () -> fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT), | |
96 | () -> fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(), | |
97 | () -> fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT)); | |
98 | } | |
99 | ||
100 | private void testNextPreviousEvent(Runnable selectNext, Runnable shiftSelectNext, Runnable selectPrevious, Runnable shiftSelectPrevious) { | |
2fe6a9ea PT |
101 | /* change window range to 10 ms */ |
102 | TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); | |
103 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
104 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
105 | ||
106 | /* set selection to trace start time */ | |
107 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
156e9ead | 108 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME)); |
2fe6a9ea PT |
109 | |
110 | /* select first item */ | |
111 | final SWTBotTree tree = fViewBot.bot().tree(); | |
112 | tree.pressShortcut(Keystrokes.HOME); | |
113 | ||
114 | /* set focus on time graph */ | |
115 | final TimeGraphControl timegraph = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); | |
116 | UIThreadRunnable.syncExec(new VoidResult() { | |
117 | @Override | |
118 | public void run() { | |
119 | timegraph.setFocus(); | |
120 | } | |
121 | }); | |
122 | ||
123 | /* click "Select Next Event" 3 times */ | |
156e9ead MAL |
124 | selectNext.run(); |
125 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1)); | |
126 | selectNext.run(); | |
127 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME2, TID1_TIME2)); | |
128 | selectNext.run(); | |
129 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3)); | |
2fe6a9ea PT |
130 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME3))); |
131 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME3)); | |
132 | ||
6e4a07af | 133 | /* shift-click "Select Next Event" 3 times */ |
156e9ead MAL |
134 | shiftSelectNext.run(); |
135 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME4)); | |
136 | shiftSelectNext.run(); | |
137 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME5)); | |
138 | shiftSelectNext.run(); | |
139 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME6)); | |
6e4a07af | 140 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME6))); |
2fe6a9ea PT |
141 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME6)); |
142 | ||
6e4a07af | 143 | /* shift-click "Select Previous Event" 4 times */ |
156e9ead MAL |
144 | shiftSelectPrevious.run(); |
145 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME5)); | |
146 | shiftSelectPrevious.run(); | |
147 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME4)); | |
148 | shiftSelectPrevious.run(); | |
149 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3)); | |
150 | shiftSelectPrevious.run(); | |
151 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME2)); | |
6e4a07af | 152 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME2))); |
2fe6a9ea PT |
153 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME2)); |
154 | ||
155 | /* click "Select Next Event" 2 times */ | |
156e9ead MAL |
156 | selectNext.run(); |
157 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3)); | |
158 | selectNext.run(); | |
159 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME4)); | |
2fe6a9ea PT |
160 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME4))); |
161 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME4)); | |
162 | ||
6e4a07af | 163 | /* shift-click "Select Previous Event" 3 times */ |
156e9ead MAL |
164 | shiftSelectPrevious.run(); |
165 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME3)); | |
166 | shiftSelectPrevious.run(); | |
167 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME2)); | |
168 | shiftSelectPrevious.run(); | |
169 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME1)); | |
6e4a07af | 170 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME1))); |
2fe6a9ea PT |
171 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1)); |
172 | ||
6e4a07af | 173 | /* shift-click "Select Next Event" 4 times */ |
156e9ead MAL |
174 | shiftSelectNext.run(); |
175 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME2)); | |
176 | shiftSelectNext.run(); | |
177 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME3)); | |
178 | shiftSelectNext.run(); | |
179 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME4)); | |
180 | shiftSelectNext.run(); | |
181 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME5)); | |
6e4a07af | 182 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME5))); |
2fe6a9ea PT |
183 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME5)); |
184 | ||
185 | /* click "Select Previous Event" 5 times */ | |
156e9ead MAL |
186 | selectPrevious.run(); |
187 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME4, TID1_TIME4)); | |
188 | selectPrevious.run(); | |
189 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME3, TID1_TIME3)); | |
190 | selectPrevious.run(); | |
191 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME2, TID1_TIME2)); | |
192 | selectPrevious.run(); | |
193 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1)); | |
194 | selectPrevious.run(); | |
195 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME)); | |
2fe6a9ea PT |
196 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); |
197 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME)); | |
198 | } | |
199 | ||
200 | /** | |
201 | * Test tool bar buttons "Follow CPU Forward" and "Follow CPU Backward" | |
202 | */ | |
203 | @Test | |
204 | public void testToolBarFollowCPUForwardBackward() { | |
205 | /* change window range to 10 ms */ | |
206 | TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); | |
207 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
208 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
209 | ||
210 | /* set selection to trace start time */ | |
211 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
212 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
213 | ||
214 | /* select first item */ | |
215 | final SWTBotTree tree = fViewBot.bot().tree(); | |
216 | tree.pressShortcut(Keystrokes.HOME); | |
217 | ||
218 | /* set focus on time graph */ | |
219 | final TimeGraphControl timegraph = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); | |
220 | UIThreadRunnable.syncExec(new VoidResult() { | |
221 | @Override | |
222 | public void run() { | |
223 | timegraph.setFocus(); | |
224 | } | |
225 | }); | |
226 | ||
2fe6a9ea | 227 | /* click "Follow CPU Forward" 3 times */ |
156e9ead | 228 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME)); |
2fe6a9ea | 229 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); |
156e9ead | 230 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1)); |
2fe6a9ea | 231 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); |
156e9ead | 232 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1)); |
2fe6a9ea | 233 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); |
156e9ead | 234 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2)); |
2fe6a9ea | 235 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME2))); |
6e4a07af | 236 | fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2")); |
2fe6a9ea PT |
237 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME2)); |
238 | ||
6e4a07af PT |
239 | /* shift-click "Follow CPU Forward" 3 times */ |
240 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
156e9ead | 241 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3)); |
6e4a07af | 242 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); |
156e9ead | 243 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4)); |
6e4a07af | 244 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); |
156e9ead | 245 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4)); |
6e4a07af PT |
246 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID5_TIME1))); |
247 | fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "5")); | |
2fe6a9ea PT |
248 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID5_TIME1)); |
249 | ||
6e4a07af PT |
250 | /* shift-click "Follow CPU Backward" 4 times */ |
251 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
156e9ead | 252 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME4)); |
6e4a07af | 253 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); |
156e9ead | 254 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME3)); |
6e4a07af | 255 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); |
156e9ead | 256 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2)); |
6e4a07af | 257 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); |
156e9ead | 258 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME1)); |
6e4a07af PT |
259 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME1))); |
260 | fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2")); | |
2fe6a9ea PT |
261 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME1)); |
262 | ||
263 | /* click "Follow CPU Forward" 2 times */ | |
264 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
156e9ead | 265 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2)); |
2fe6a9ea | 266 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); |
156e9ead | 267 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3)); |
2fe6a9ea | 268 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME3))); |
6e4a07af | 269 | fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2")); |
2fe6a9ea PT |
270 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME3)); |
271 | ||
6e4a07af PT |
272 | /* shift-click "Follow CPU Backward" 3 times */ |
273 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
156e9ead | 274 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2)); |
6e4a07af | 275 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); |
156e9ead | 276 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1)); |
6e4a07af | 277 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); |
156e9ead | 278 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID1_TIME1)); |
6e4a07af PT |
279 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID1_TIME1))); |
280 | fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "1")); | |
2fe6a9ea PT |
281 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1)); |
282 | ||
6e4a07af PT |
283 | /* shift-click "Follow CPU Forward" 4 times */ |
284 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
156e9ead | 285 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME1)); |
6e4a07af | 286 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); |
156e9ead | 287 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME2)); |
6e4a07af | 288 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); |
156e9ead | 289 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3)); |
6e4a07af | 290 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); |
156e9ead | 291 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME4)); |
6e4a07af PT |
292 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME4))); |
293 | fBot.waitUntil(ConditionHelpers.treeSelectionContains(tree, 1, "2")); | |
2fe6a9ea PT |
294 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME4)); |
295 | ||
296 | /* click "Follow CPU Backward" 5 times */ | |
297 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
156e9ead | 298 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME3, TID2_TIME3)); |
2fe6a9ea | 299 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); |
156e9ead | 300 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME2, TID2_TIME2)); |
2fe6a9ea | 301 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); |
156e9ead | 302 | timeGraphIsReadyCondition(new TmfTimeRange(TID2_TIME1, TID2_TIME1)); |
2fe6a9ea | 303 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); |
156e9ead | 304 | timeGraphIsReadyCondition(new TmfTimeRange(TID1_TIME1, TID1_TIME1)); |
2fe6a9ea | 305 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); |
156e9ead | 306 | timeGraphIsReadyCondition(new TmfTimeRange(START_TIME, START_TIME)); |
2fe6a9ea PT |
307 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); |
308 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME)); | |
309 | } | |
156e9ead MAL |
310 | |
311 | private void timeGraphIsReadyCondition(@NonNull TmfTimeRange selectionRange) { | |
312 | IWorkbenchPart part = fViewBot.getViewReference().getPart(false); | |
313 | fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) part, selectionRange, selectionRange.getEndTime())); | |
314 | } | |
2fe6a9ea | 315 | } |