use of org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphMarkerAxis in project tracecompass by tracecompass.
the class ResourcesViewTest method testMarkerAxis.
/**
* Test the marker axis
*/
@Test
public void testMarkerAxis() {
SWTBotView viewBot = getViewBot();
/* center window range of first lost event range */
ITmfTimestamp startTime = LOST_EVENT_TIME1.normalize(-10000000L, ITmfTimestamp.NANOSECOND_SCALE);
ITmfTimestamp endTime = LOST_EVENT_END1.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE);
TmfTimeRange range = new TmfTimeRange(startTime, endTime);
TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range));
fBot.waitUntil(ConditionHelpers.windowRange(range));
/* set selection to window start time */
TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, startTime));
timeGraphIsReadyCondition(new TmfTimeRange(startTime, startTime), startTime);
/* get marker axis size with one category */
final TimeGraphMarkerAxis markerAxis = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphMarkerAxis.class));
final Point size1 = getSize(markerAxis);
/* add bookmark at window start time */
viewBot.toolbarButton(ADD_BOOKMARK).click();
SWTBot dialogBot = fBot.shell(ADD_BOOKMARK_DIALOG).bot();
dialogBot.text().setText("B");
dialogBot.button(OK).click();
/* get marker axis size with two categories */
final Point size2 = getSize(markerAxis);
final int rowHeight = size2.y - size1.y;
/*
* get the state area bounds, since we don't know the name space width
*/
final TimeGraphControl timeGraph = viewBot.bot().widget(WidgetOfType.widgetOfType(TimeGraphControl.class));
int x0 = getXForTime(timeGraph, startTime.toNanos());
int x1 = getXForTime(timeGraph, endTime.toNanos());
/*
* click at the center of the marker axis width and first row height, it
* should be within the lost event range
*/
final SWTBotCanvas markerAxisCanvas = new SWTBotCanvas(markerAxis);
markerAxisCanvas.click((x0 + x1) / 2, TOP_MARGIN + rowHeight / 2);
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(LOST_EVENT_TIME1, LOST_EVENT_END1)));
/*
* click near the left of the marker axis width and center of second row
* height, it should be on the bookmark label
*/
markerAxisCanvas.click(x0 + 2, TOP_MARGIN + rowHeight + rowHeight / 2);
fBot.waitUntil(ConditionHelpers.selectionRange(new TmfTimeRange(startTime, startTime)));
/* click "Remove Bookmark" */
viewBot.toolbarButton(REMOVE_BOOKMARK).click();
assertEquals(size1, getSize(markerAxis));
/* click the 'expanded' icon to collapse */
markerAxisCanvas.click(TOGGLE_SIZE.x / 2, TOGGLE_SIZE.y / 2);
assertEquals(TOGGLE_SIZE.y, getSize(markerAxis).y);
/* click the 'collapsed' icon to expand */
markerAxisCanvas.click(TOGGLE_SIZE.x / 2, TOGGLE_SIZE.y / 2);
assertEquals(size1, getSize(markerAxis));
/* click on the 'X' icon to hide the 'Lost Events' marker category */
markerAxisCanvas.click(TOGGLE_SIZE.x + HIDE_SIZE.x / 2, TOP_MARGIN + HIDE_SIZE.y / 2);
assertEquals(0, getSize(markerAxis).y);
/* show Lost Events markers */
viewBot.viewMenu(LOST_EVENTS).click();
SWTBotUtils.waitUntil(ma -> size1.equals(getSize(ma)), markerAxis, "Lost Events did not reappear");
}
Aggregations