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