use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class TimeGraphViewTest method testZoomToSelection.
/**
* Test zoom to selection
*/
@Test
public void testZoomToSelection() {
resetTimeRange();
SWTBotTimeGraph timegraph = fTimeGraph;
TimeGraphViewStub view = getView();
timegraph.setFocus();
assertEquals(80, getDuration(view.getWindowRange()));
/* set selection to trace start time */
ITmfTimestamp selStartTime = TmfTimestamp.fromNanos(30L);
ITmfTimestamp selEndTime = TmfTimestamp.fromNanos(80L);
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, selStartTime, selEndTime));
timeGraphIsReadyCondition(new TmfTimeRange(selStartTime, selEndTime));
fireKeyInGraph(timegraph, 'z');
fViewBot.bot().waitUntil(new WindowRangeCondition(view, 50));
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class TimeGraphViewTest method testKeyboardNavigation.
/**
* Test 'a' and 'd' navigation
*/
@Test
public void testKeyboardNavigation() {
resetTimeRange();
SWTBotTimeGraph timegraph = fTimeGraph;
TimeGraphViewStub view = getView();
timegraph.setFocus();
assertEquals(80, getDuration(view.getWindowRange()));
TmfTimeRange updatedWindowRange = new TmfTimeRange(TmfTimestamp.fromNanos(40), TmfTimestamp.fromNanos(120));
// move to the right
fireKeyInGraph(timegraph, 'd');
fViewBot.bot().waitUntil(new TgConditionHelper(t -> updatedWindowRange.equals(view.getWindowRange())));
// move to the left
fireKeyInGraph(timegraph, 'a');
fViewBot.bot().waitUntil(new TgConditionHelper(t -> INITIAL_WINDOW_RANGE.equals(view.getWindowRange())));
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class TimeGraphViewTest method setWindowRange.
private void setWindowRange(long start, long end) {
ITmfTimestamp startTime = TmfTimestamp.fromNanos(start);
ITmfTimestamp endTime = TmfTimestamp.fromNanos(end);
TmfTimeRange range = new TmfTimeRange(startTime, endTime);
UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)));
fViewBot.bot().waitUntil(ConditionHelpers.timeGraphRangeCondition(getView(), Objects.requireNonNull(fTrace), range));
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class XYChartViewTest method testZoomToSelection.
/**
* Test zoom to selection
*/
@Test
public void testZoomToSelection() {
SWTBotEclipseSwtChart xyChart = new SWTBotEclipseSwtChart(fViewBot.bot());
xyChart.setFocus();
assertEquals(80, fXyViewer.getWindowDuration());
/* set selection to trace start time */
ITmfTimestamp selStartTime = TmfTimestamp.fromNanos(30L);
ITmfTimestamp selEndTime = TmfTimestamp.fromNanos(80L);
TmfTimeRange range = new TmfTimeRange(selStartTime, selEndTime);
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, selStartTime, selEndTime));
// Wait till selection is finished
fViewBot.bot().waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
return (fXyViewer.getSelectionEndTime() - fXyViewer.getSelectionBeginTime()) == getDuration(range);
}
@Override
public String getFailureMessage() {
return "SWT Chart is null";
}
});
fireKeyInGraph(xyChart, 'z');
fViewBot.bot().waitUntil(new SeriesCondition(fXyViewer, getDuration(range)));
}
use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.
the class HistogramDataModelTest method testLostEventsScaleTo_4.
/**
* Test method for {@link HistogramDataModel#scaleTo(int,int,int)}.
*/
@Test
public void testLostEventsScaleTo_4() {
final int nbBuckets = 10;
final int maxHeight = 10;
final int nbEvents = 3 * nbBuckets;
final int nbLostEvents_0 = 4;
final int nbLostEvents_1 = 9;
final int nbCombinedEvents = nbEvents + 2;
final HistogramBucket[] expectedResult = new HistogramBucket[] { _3, _4, _4, _4, _4, _4, _4, _4, _4, _3 };
final int[] expectedLostEventsResult = new int[] { 3, 1, 0, 0, 3, 3, 3, 3, 0, 0 };
HistogramDataModel model = new HistogramDataModel(nbBuckets);
final TmfTimeRange timeRange_0 = new TmfTimeRange(TmfTimestamp.fromNanos(5L), TmfTimestamp.fromNanos(10L));
model.countLostEvent(timeRange_0, nbLostEvents_0, false);
int firstNonLostEventTime = 6;
countEventsInModel(nbEvents, model, 0, firstNonLostEventTime);
final TmfTimeRange timeRange_1 = new TmfTimeRange(TmfTimestamp.fromNanos(18L), TmfTimestamp.fromNanos(27L));
model.countLostEvent(timeRange_1, nbLostEvents_1, false);
HistogramScaledData result = model.scaleTo(nbBuckets, maxHeight, 1);
testModelConsistency(model, nbBuckets, nbCombinedEvents, 4, 5, 5, nbEvents + firstNonLostEventTime - 1, 4 * nbBuckets + firstNonLostEventTime - 1);
assertArrayEquals(expectedResult, result.fData);
assertArrayEquals(expectedLostEventsResult, result.fLostEventsData);
assertEquals(7, result.fMaxCombinedValue);
}
Aggregations