Search in sources :

Example 26 with SWTBotTimeGraph

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.

the class FindDialogTestBase method before.

/**
 * Initialize the test and open the timegraph view and the find dialog
 */
@Before
public void before() {
    String title = getViewTitle();
    fViewBot = fBot.viewByTitle(title);
    fViewBot.show();
    fTimeGraphBot = new SWTBotTimeGraph(fViewBot.bot());
    TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, START_TIME));
    fBot.waitUntil(ConditionHelpers.timeGraphIsReadyCondition((AbstractTimeGraphView) fViewBot.getViewReference().getPart(false), new TmfTimeRange(START_TIME, START_TIME), START_TIME));
    fViewBot.setFocus();
    openDialog(fViewBot);
    fFindText = getFindText();
}
Also used : AbstractTimeGraphView(org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView) TmfSelectionRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Before(org.junit.Before)

Example 27 with SWTBotTimeGraph

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.

the class TimeGraphViewTest method testHorizontalZoom.

/**
 * Test horizontal zoom, we can see a rounding error
 */
@Test
public void testHorizontalZoom() {
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    TimeGraphViewStub view = getView();
    timegraph.setFocus();
    assertEquals(80, getDuration(view.getWindowRange()));
    fireKeyInGraph(timegraph, '=');
    fViewBot.bot().waitUntil(new WindowRangeCondition(view, 52));
    fireKeyInGraph(timegraph, '+');
    fViewBot.bot().waitUntil(new WindowRangeCondition(view, 34));
    fireKeyInGraph(timegraph, '-');
    fViewBot.bot().waitUntil(new WindowRangeCondition(view, 51));
    fireKeyInGraph(timegraph, '-');
    fViewBot.bot().waitUntil(new WindowRangeCondition(view, 77));
    /*
         * Note that 'w' and 's' zooming is based on mouse position. Just check
         * if window range was increased or decreased to avoid inaccuracy due to
         * the mouse position in test environment.
         */
    long previousRange = getDuration(view.getWindowRange());
    fireKeyInGraph(timegraph, 'w');
    fViewBot.bot().waitUntil(new WindowRangeUpdatedCondition(view, previousRange, false));
    previousRange = getDuration(view.getWindowRange());
    fireKeyInGraph(timegraph, 's');
    fViewBot.bot().waitUntil(new WindowRangeUpdatedCondition(view, previousRange, true));
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) Test(org.junit.Test)

Example 28 with SWTBotTimeGraph

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.

the class TimeGraphViewTest method testExpandAndCollapse.

/**
 * Test expand and collapes of a timegraph view
 */
@Test
public void testExpandAndCollapse() {
    String pg = "Plumber guy";
    String hpc = "Hungry pie chart";
    String element = "row2";
    int totalItems = 17;
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertEquals(totalItems, getVisibleItems(timegraph).size());
    SWTBotTimeGraphEntry[] entries = null;
    entries = timegraph.getEntries();
    assertNotNull(entries);
    assertNotNull(timegraph.getEntry(hpc, element));
    timegraph.collapseAll();
    entries = timegraph.getEntries();
    assertEquals(3, getVisibleItems(timegraph).size());
    timegraph.getEntry(pg).select();
    fireKey(timegraph, true, '+');
    assertEquals(10, getVisibleItems(timegraph).size());
    timegraph.getEntry(pg).select();
    fireKey(timegraph, true, '-');
    assertEquals(3, getVisibleItems(timegraph).size());
    timegraph.getEntry(hpc).select();
    fireKey(timegraph, true, '+');
    assertEquals(10, getVisibleItems(timegraph).size());
    assertNotNull(timegraph.getEntry(hpc, element));
    timegraph.getEntry(pg).select();
    fireKey(timegraph, true, '*');
    timegraph.getEntry(hpc).select();
    fireKey(timegraph, true, '*');
    assertEquals(totalItems, getVisibleItems(timegraph).size());
    assertNotNull(timegraph.getEntry(hpc, element));
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotTimeGraphEntry(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry) Point(org.eclipse.swt.graphics.Point) Test(org.junit.Test)

Example 29 with SWTBotTimeGraph

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.

the class TimeGraphViewTest method testHideEmptyRows.

/**
 * Integration test for the time event filtering dialog
 */
@Test
public void testHideEmptyRows() {
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertTrue("timegraph visible", timegraph.isVisible());
    timegraph.setFocus();
    /* set time range */
    setWindowRange(50L, 75L);
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 17, timegraph, () -> "All entries should be visible here: " + getVisibleItems(timegraph));
    /* hide empty rows (includes a row with only 1 marker) */
    fViewBot.toolbarButton("Hide Empty Rows").click();
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 10, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));
    /* change time range to exclude row with markers */
    setWindowRange(60L, 75L);
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 9, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));
    /* add a time events filter */
    timegraph.setFocus();
    // Move mouse to middle of the timegraph
    timegraph.moveMouseToWidget();
    // Press '/' to open the filter dialog
    timegraph.pressShortcut(KeyStroke.getInstance('/'));
    SWTBot viewBot = fViewBot.bot();
    SWTBotShell dialogShell = viewBot.shell("Time Event Filter").activate();
    SWTBot shellBot = dialogShell.bot();
    SWTBotText text = shellBot.text();
    text.setText("Head3");
    text.setFocus();
    SWTBotUtils.pressShortcut(text, Keystrokes.CR);
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 2, timegraph, () -> "Fewer entries should be visible here: " + getVisibleItems(timegraph));
    /* show also empty rows */
    fViewBot.toolbarButton("Hide Empty Rows").click();
    /* All rows will be filtered by time events filter */
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 2, timegraph, () -> "Same number of entries should be visible here: " + getVisibleItems(timegraph));
    /* remove time events filter */
    dialogShell = viewBot.shell("Time Event Filter").activate();
    shellBot = dialogShell.bot();
    SWTBotButton button = shellBot.buttonWithTooltip("Close (Esc)");
    button.click();
    SWTBotUtils.waitUntil(tg -> getVisibleItems(tg).size() == 17, timegraph, () -> "All entries should be visible here: " + getVisibleItems(timegraph));
}
Also used : SWTBotButton(org.eclipse.swtbot.swt.finder.widgets.SWTBotButton) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test)

Example 30 with SWTBotTimeGraph

use of org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph in project tracecompass by tracecompass.

the class TimeGraphViewTest method testCollapseExpandUsingEnter.

/**
 * Test the enter key, which toggles expand/collapse.
 */
@Test
public void testCollapseExpandUsingEnter() {
    String pg = "Plumber guy";
    resetTimeRange();
    SWTBotTimeGraph timegraph = fTimeGraph;
    assertEquals(0, timegraph.selection().columnCount());
    timegraph.getEntry(pg).select();
    assertEquals(1, timegraph.selection().columnCount());
    assertEquals(17, getVisibleItems(timegraph).size());
    fireKey(timegraph, true, SWT.CR);
    assertEquals(1, timegraph.selection().columnCount());
    assertEquals('[' + pg + ']', timegraph.selection().get(0).toString());
    assertEquals(10, getVisibleItems(timegraph).size());
    fireKey(timegraph, true, SWT.CR);
    assertEquals(1, timegraph.selection().columnCount());
    assertEquals('[' + pg + ']', timegraph.selection().get(0).toString());
    assertEquals(17, getVisibleItems(timegraph).size());
    timegraph.getEntry(pg, "Hat1").select();
    fireKey(timegraph, true, SWT.CR);
    assertEquals(1, timegraph.selection().columnCount());
    assertEquals("[Hat1]", timegraph.selection().get(0).toString());
    assertEquals(17, getVisibleItems(timegraph).size());
}
Also used : SWTBotTimeGraph(org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph) Test(org.junit.Test)

Aggregations

SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)38 Test (org.junit.Test)31 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)17 SWTBotTimeGraphEntry (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraphEntry)16 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)13 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)13 Point (org.eclipse.swt.graphics.Point)10 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)8 SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)7 ImageHelper (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ImageHelper)6 RGB (org.eclipse.swt.graphics.RGB)5 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)5 ArrayList (java.util.ArrayList)4 NonNull (org.eclipse.jdt.annotation.NonNull)4 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)4 IOException (java.io.IOException)3 List (java.util.List)3 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)3