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 | ||
15 | import static org.junit.Assert.assertEquals; | |
16 | import static org.junit.Assert.assertTrue; | |
17 | ||
18 | import java.util.List; | |
19 | ||
20 | import org.eclipse.jdt.annotation.NonNull; | |
21 | import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; | |
22 | import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; | |
23 | import org.eclipse.swtbot.swt.finder.keyboard.Keyboard; | |
24 | import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory; | |
25 | import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; | |
26 | import org.eclipse.swtbot.swt.finder.matchers.WidgetOfType; | |
27 | import org.eclipse.swtbot.swt.finder.results.VoidResult; | |
28 | import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; | |
29 | import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; | |
30 | import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal; | |
31 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; | |
32 | import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal; | |
33 | import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp; | |
34 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfNanoTimestamp; | |
35 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; | |
36 | import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; | |
37 | import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; | |
38 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ILinkEvent; | |
39 | import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl; | |
40 | import org.junit.Before; | |
41 | import org.junit.Test; | |
42 | ||
43 | /** | |
44 | * SWTBot tests for Control Flow view | |
45 | * | |
46 | * @author Patrick Tasse | |
47 | */ | |
48 | public class ControlFlowViewTest extends KernelTest { | |
49 | ||
50 | private static final String FOLLOW_CPU_BACKWARD = "Follow CPU Backward"; | |
51 | private static final String FOLLOW_CPU_FORWARD = "Follow CPU Forward"; | |
52 | private static final String SELECT_PREVIOUS_EVENT = "Select Previous Event"; | |
53 | private static final String SELECT_NEXT_EVENT = "Select Next Event"; | |
54 | private static final Keyboard KEYBOARD = KeyboardFactory.getSWTKeyboard(); | |
55 | private static final @NonNull ITmfTimestamp START_TIME = new TmfNanoTimestamp(1368000272650993664L); | |
56 | private static final @NonNull ITmfTimestamp TID1_TIME1 = new TmfNanoTimestamp(1368000272651208412L); | |
57 | private static final @NonNull ITmfTimestamp TID1_TIME2 = new TmfNanoTimestamp(1368000272656147616L); | |
58 | private static final @NonNull ITmfTimestamp TID1_TIME3 = new TmfNanoTimestamp(1368000272656362364L); | |
59 | private static final @NonNull ITmfTimestamp TID1_TIME4 = new TmfNanoTimestamp(1368000272663234300L); | |
60 | private static final @NonNull ITmfTimestamp TID1_TIME5 = new TmfNanoTimestamp(1368000272663449048L); | |
61 | private static final @NonNull ITmfTimestamp TID1_TIME6 = new TmfNanoTimestamp(1368000272665596528L); | |
62 | private static final @NonNull ITmfTimestamp TID2_TIME1 = new TmfNanoTimestamp(1368000272651852656L); | |
63 | private static final @NonNull ITmfTimestamp TID2_TIME2 = new TmfNanoTimestamp(1368000272652067404L); | |
64 | private static final @NonNull ITmfTimestamp TID2_TIME3 = new TmfNanoTimestamp(1368000272652282152L); | |
65 | private static final @NonNull ITmfTimestamp TID2_TIME4 = new TmfNanoTimestamp(1368000272652496900L); | |
66 | private static final @NonNull ITmfTimestamp TID5_TIME1 = new TmfNanoTimestamp(1368000272652496900L); | |
67 | ||
68 | private SWTBotView fViewBot; | |
69 | ||
70 | /** | |
71 | * Before Test | |
72 | */ | |
73 | @Override | |
74 | @Before | |
75 | public void before() { | |
76 | super.before(); | |
77 | fViewBot = fBot.viewByTitle("Control Flow"); | |
78 | } | |
79 | ||
80 | /** | |
81 | * Test keyboard navigation using ARROW_RIGHT and ARROW_LEFT | |
82 | */ | |
83 | @Test | |
84 | public void testKeyboardLeftRight() { | |
85 | /* change window range to 10 ms */ | |
86 | TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); | |
87 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
88 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
89 | ||
90 | /* set selection to trace start time */ | |
91 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
92 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
93 | ||
94 | /* select first item */ | |
95 | final SWTBotTree tree = fViewBot.bot().tree(); | |
96 | tree.pressShortcut(Keystrokes.HOME); | |
97 | ||
98 | /* set focus on time graph */ | |
99 | final TimeGraphControl timegraph = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); | |
100 | UIThreadRunnable.syncExec(new VoidResult() { | |
101 | @Override | |
102 | public void run() { | |
103 | timegraph.setFocus(); | |
104 | } | |
105 | }); | |
106 | ||
107 | /* press ARROW_RIGHT 3 times */ | |
108 | KEYBOARD.pressShortcut(Keystrokes.RIGHT); | |
109 | KEYBOARD.pressShortcut(Keystrokes.RIGHT); | |
110 | KEYBOARD.pressShortcut(Keystrokes.RIGHT); | |
111 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME3))); | |
112 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME3)); | |
113 | ||
114 | /* press Shift-ARROW_RIGHT 3 times */ | |
115 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
116 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
117 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
118 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME6))); | |
119 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME6)); | |
120 | ||
121 | /* press Shift-ARROW_LEFT 4 times */ | |
122 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
123 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
124 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
125 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
126 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME2))); | |
127 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME2)); | |
128 | ||
129 | /* press ARROW_RIGHT 2 times */ | |
130 | KEYBOARD.pressShortcut(Keystrokes.RIGHT); | |
131 | KEYBOARD.pressShortcut(Keystrokes.RIGHT); | |
132 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME4))); | |
133 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME4)); | |
134 | ||
135 | /* press Shift-ARROW_LEFT 3 times */ | |
136 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
137 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
138 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.LEFT); | |
139 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME1))); | |
140 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1)); | |
141 | ||
142 | /* press Shift-ARROW_RIGHT 4 times */ | |
143 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
144 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
145 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
146 | KEYBOARD.pressShortcut(Keystrokes.SHIFT, Keystrokes.RIGHT); | |
147 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME5))); | |
148 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME5)); | |
149 | ||
150 | /* press ARROW_LEFT 5 times */ | |
151 | KEYBOARD.pressShortcut(Keystrokes.LEFT); | |
152 | KEYBOARD.pressShortcut(Keystrokes.LEFT); | |
153 | KEYBOARD.pressShortcut(Keystrokes.LEFT); | |
154 | KEYBOARD.pressShortcut(Keystrokes.LEFT); | |
155 | KEYBOARD.pressShortcut(Keystrokes.LEFT); | |
156 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
157 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME)); | |
158 | } | |
159 | ||
160 | /** | |
161 | * Test tool bar buttons "Select Next Event" and "Select Previous Event" | |
162 | */ | |
163 | @Test | |
164 | public void testToolBarSelectNextPreviousEvent() { | |
165 | /* change window range to 10 ms */ | |
166 | TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); | |
167 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
168 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
169 | ||
170 | /* set selection to trace start time */ | |
171 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
172 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
173 | ||
174 | /* select first item */ | |
175 | final SWTBotTree tree = fViewBot.bot().tree(); | |
176 | tree.pressShortcut(Keystrokes.HOME); | |
177 | ||
178 | /* set focus on time graph */ | |
179 | final TimeGraphControl timegraph = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); | |
180 | UIThreadRunnable.syncExec(new VoidResult() { | |
181 | @Override | |
182 | public void run() { | |
183 | timegraph.setFocus(); | |
184 | } | |
185 | }); | |
186 | ||
187 | /* click "Select Next Event" 3 times */ | |
188 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
189 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
190 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
191 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME3))); | |
192 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME3)); | |
193 | ||
194 | // /* shift-click "Select Next Event" 3 times */ | |
195 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
196 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
197 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
198 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME6))); | |
199 | /* click "Select Next Event" 3 times */ | |
200 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
201 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
202 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
203 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME6, TID1_TIME6))); | |
204 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME6)); | |
205 | ||
206 | // /* shift-click "Select Previous Event" 4 times */ | |
207 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
208 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
209 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
210 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
211 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME3, TID1_TIME2))); | |
212 | /* click "Select Previous Event" 4 times */ | |
213 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
214 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
215 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
216 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
217 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME2, TID1_TIME2))); | |
218 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME2)); | |
219 | ||
220 | /* click "Select Next Event" 2 times */ | |
221 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
222 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
223 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME4))); | |
224 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME4)); | |
225 | ||
226 | // /* shift-click "Select Previous Event" 3 times */ | |
227 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
228 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
229 | // fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(SWT.SHIFT); | |
230 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME1))); | |
231 | /* click "Select Previous Event" 3 times */ | |
232 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
233 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
234 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
235 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME1, TID1_TIME1))); | |
236 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1)); | |
237 | ||
238 | // /* shift-click "Select Next Event" 4 times */ | |
239 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
240 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
241 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
242 | // fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(SWT.SHIFT); | |
243 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME4, TID1_TIME5))); | |
244 | /* click "Select Next Event" 4 times */ | |
245 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
246 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
247 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
248 | fViewBot.toolbarButton(SELECT_NEXT_EVENT).click(); | |
249 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME5, TID1_TIME5))); | |
250 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME5)); | |
251 | ||
252 | /* click "Select Previous Event" 5 times */ | |
253 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
254 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
255 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
256 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
257 | fViewBot.toolbarButton(SELECT_PREVIOUS_EVENT).click(); | |
258 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
259 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME)); | |
260 | } | |
261 | ||
262 | /** | |
263 | * Test tool bar buttons "Follow CPU Forward" and "Follow CPU Backward" | |
264 | */ | |
265 | @Test | |
266 | public void testToolBarFollowCPUForwardBackward() { | |
267 | /* change window range to 10 ms */ | |
268 | TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); | |
269 | TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); | |
270 | fBot.waitUntil(ConditionHelpers.windowRange(range)); | |
271 | ||
272 | /* set selection to trace start time */ | |
273 | TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME)); | |
274 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
275 | ||
276 | /* select first item */ | |
277 | final SWTBotTree tree = fViewBot.bot().tree(); | |
278 | tree.pressShortcut(Keystrokes.HOME); | |
279 | ||
280 | /* set focus on time graph */ | |
281 | final TimeGraphControl timegraph = fViewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class)); | |
282 | UIThreadRunnable.syncExec(new VoidResult() { | |
283 | @Override | |
284 | public void run() { | |
285 | timegraph.setFocus(); | |
286 | } | |
287 | }); | |
288 | ||
289 | /* make sure arrows have been computed */ | |
290 | fBot.waitUntil(new DefaultCondition() { | |
291 | @Override | |
292 | public boolean test() throws Exception { | |
293 | List<ILinkEvent> arrows = timegraph.getArrows(); | |
294 | return arrows.size() >= 3 && | |
295 | arrows.get(0).getTime() == TID1_TIME1.getValue() && | |
296 | arrows.get(1).getTime() == TID2_TIME2.getValue() && | |
297 | arrows.get(2).getTime() == TID2_TIME4.getValue(); | |
298 | } | |
299 | @Override | |
300 | public String getFailureMessage() { | |
301 | return "Arrows not found"; | |
302 | } | |
303 | }); | |
304 | ||
305 | /* click "Follow CPU Forward" 3 times */ | |
306 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
307 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
308 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
309 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME2))); | |
310 | assertEquals("2", tree.selection().get(0, 1)); | |
311 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME2)); | |
312 | ||
313 | // /* shift-click "Follow CPU Forward" 3 times */ | |
314 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
315 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
316 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
317 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID5_TIME1))); | |
318 | /* click "Follow CPU Forward" 3 times */ | |
319 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
320 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
321 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
322 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID5_TIME1, TID5_TIME1))); | |
323 | assertEquals("5", tree.selection().get(0, 1)); | |
324 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID5_TIME1)); | |
325 | ||
326 | // /* shift-click "Follow CPU Backward" 4 times */ | |
327 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
328 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
329 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
330 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
331 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME2, TID2_TIME1))); | |
332 | /* click "Follow CPU Backward" 4 times */ | |
333 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
334 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
335 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
336 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
337 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME1, TID2_TIME1))); | |
338 | assertEquals("2", tree.selection().get(0, 1)); | |
339 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME1)); | |
340 | ||
341 | /* click "Follow CPU Forward" 2 times */ | |
342 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
343 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
344 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME3))); | |
345 | assertEquals("2", tree.selection().get(0, 1)); | |
346 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME3)); | |
347 | ||
348 | // /* shift-click "Follow CPU Backward" 3 times */ | |
349 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
350 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
351 | // fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(SWT.SHIFT); | |
352 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID1_TIME1))); | |
353 | /* click "Follow CPU Backward" 3 times */ | |
354 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
355 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
356 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
357 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID1_TIME1, TID1_TIME1))); | |
358 | assertEquals("1", tree.selection().get(0, 1)); | |
359 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID1_TIME1)); | |
360 | ||
361 | // /* shift-click "Follow CPU Forward" 4 times */ | |
362 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
363 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
364 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
365 | // fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(SWT.SHIFT); | |
366 | // fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME3, TID2_TIME4))); | |
367 | /* click "Follow CPU Forward" 4 times */ | |
368 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
369 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
370 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
371 | fViewBot.toolbarButton(FOLLOW_CPU_FORWARD).click(); | |
372 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(TID2_TIME4, TID2_TIME4))); | |
373 | assertEquals("2", tree.selection().get(0, 1)); | |
374 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(TID2_TIME4)); | |
375 | ||
376 | /* click "Follow CPU Backward" 5 times */ | |
377 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
378 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
379 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
380 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
381 | fViewBot.toolbarButton(FOLLOW_CPU_BACKWARD).click(); | |
382 | fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(START_TIME, START_TIME))); | |
383 | assertTrue(TmfTraceManager.getInstance().getCurrentTraceContext().getWindowRange().contains(START_TIME)); | |
384 | } | |
385 | } |