Search in sources :

Example 1 with TimeGraphModelControl

use of com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl in project lttng-scope by lttng.

the class TimeGraphWidgetTestBase method getControl.

/**
 * Return the control fixture.
 *
 * @return The control
 */
protected TimeGraphModelControl getControl() {
    TimeGraphModelControl control = sfControl;
    assertNotNull(control);
    return control;
}
Also used : TimeGraphModelControl(com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl)

Example 2 with TimeGraphModelControl

use of com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl in project lttng-scope by lttng.

the class TimeGraphWidgetTestBase method setupClass.

/**
 * Class initialization
 */
@BeforeClass
public static void setupClass() {
    StubTrace trace = new StubTrace();
    StubProject stubProject = new StubProject(trace);
    Platform.setImplicitExit(false);
    StubView view = new StubView();
    TimeGraphModelControl control = view.getControl();
    TimeGraphWidget viewer = view.getViewer();
    assertNotNull(viewer);
    JfxUtils.runLaterAndWait(() -> {
        stage = new Stage();
        stage.setScene(new Scene(viewer.getRootNode()));
        stage.show();
        /* Make sure the window has some reasonable dimensions. */
        stage.setHeight(500);
        stage.setWidth(1600);
    });
    JfxTestUtils.updateUI();
    /* Disable automatic redraw. We'll trigger view painting manually. */
    viewer.getDebugOptions().isPaintingEnabled.set(false);
    /* Disable mouse listeners in case the mouse dwells inside the view. */
    viewer.getDebugOptions().isScrollingListenersEnabled.set(false);
    JfxTestUtils.updateUI();
    control.getViewContext().switchProject(stubProject.getTraceProject());
    JfxTestUtils.updateUI();
    sfProject = stubProject;
    sfView = view;
    sfWidget = viewer;
    sfControl = control;
}
Also used : StubTrace(org.lttng.scope.common.tests.StubTrace) Stage(javafx.stage.Stage) StubProject(org.lttng.scope.common.tests.StubProject) TimeGraphModelControl(com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl) Scene(javafx.scene.Scene) BeforeClass(org.junit.BeforeClass)

Example 3 with TimeGraphModelControl

use of com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl in project lttng-scope by lttng.

the class TimeGraphWidgetTestBase method verifyVisibleRange.

/**
 * Verify that both the control and viewer passed as parameters currently
 * report the expected visible time range.
 *
 * @param expectedRange
 *            Expected time range
 */
protected static void verifyVisibleRange(TimeRange expectedRange) {
    TimeGraphModelControl control = sfControl;
    TimeGraphWidget widget = sfWidget;
    assertNotNull(control);
    assertNotNull(widget);
    /* Check the control */
    assertEquals(expectedRange, control.getViewContext().getVisibleTimeRange());
    /* Check the view itself */
    TimeRange timeRange = widget.getTimeGraphEdgeTimestamps(null);
    long tsStart = timeRange.getStartTime();
    long tsEnd = timeRange.getEndTime();
    /* We will tolerate being off by a few pixels, due to rounding. */
    double delta = widget.getCurrentNanosPerPixel() * 2;
    assertEqualsWithin(expectedRange.getStartTime(), tsStart, delta);
    assertEqualsWithin(expectedRange.getEndTime(), tsEnd, delta);
}
Also used : TimeRange(com.efficios.jabberwocky.common.TimeRange) TimeGraphModelControl(com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl)

Example 4 with TimeGraphModelControl

use of com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl in project lttng-scope by lttng.

the class TimeGraphWidgetTestBase method seekVisibleRange.

/**
 * See the timegraph to the given time range.
 *
 * @param timeRange
 *            The target time range
 */
protected void seekVisibleRange(TimeRange timeRange) {
    TimeGraphModelControl control = sfControl;
    assertNotNull(control);
    control.getViewContext().setVisibleTimeRange(timeRange);
    JfxTestUtils.updateUI();
}
Also used : TimeGraphModelControl(com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl)

Aggregations

TimeGraphModelControl (com.efficios.jabberwocky.views.timegraph.control.TimeGraphModelControl)4 TimeRange (com.efficios.jabberwocky.common.TimeRange)1 Scene (javafx.scene.Scene)1 Stage (javafx.stage.Stage)1 BeforeClass (org.junit.BeforeClass)1 StubProject (org.lttng.scope.common.tests.StubProject)1 StubTrace (org.lttng.scope.common.tests.StubTrace)1