Commit | Line | Data |
---|---|---|
739b9fec AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir | |
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 | ||
10 | package org.eclipse.tracecompass.tmf.ui.tests.views.timegraph2.swtjfx; | |
11 | ||
12 | import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; | |
13 | ||
14 | import org.eclipse.jdt.annotation.Nullable; | |
15 | import org.eclipse.swt.widgets.Display; | |
16 | import org.eclipse.swt.widgets.Shell; | |
17 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignal; | |
18 | import org.eclipse.tracecompass.tmf.core.signal.TmfSignalManager; | |
19 | import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal; | |
20 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange; | |
21 | import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp; | |
22 | import org.junit.After; | |
23 | import org.junit.Before; | |
24 | import org.junit.Test; | |
25 | ||
26 | public class SwtJfxTimeGraphViewerTest { | |
27 | ||
28 | // private static final double DELTA = 0.1; | |
29 | ||
30 | private static final long FULL_TRACE_START_TIME = 100000L; | |
31 | private static final long FULL_TRACE_END_TIME = 200000L; | |
32 | ||
33 | private @Nullable SwtJfxTimeGraphViewerStub fViewer; | |
34 | ||
35 | @Before | |
36 | public void setup() { | |
37 | Shell shell = checkNotNull(Display.getDefault().getActiveShell()); | |
38 | SwtJfxTimeGraphViewerStub viewer = new SwtJfxTimeGraphViewerStub(shell, new ModelRenderProviderStub()); | |
39 | viewer.setTimeGraphAreaRange(FULL_TRACE_START_TIME, FULL_TRACE_END_TIME); | |
40 | ||
41 | viewer.getTimeGraphScrollPane().setMinWidth(1000.0); | |
42 | fViewer = viewer; | |
43 | } | |
44 | ||
45 | @After | |
46 | public void tearDown() { | |
47 | if (fViewer != null) { | |
48 | fViewer.dispose(); | |
49 | } | |
50 | fViewer = null; | |
51 | } | |
52 | ||
53 | @Test | |
54 | public void testSeekVisibleRange() { | |
55 | SwtJfxTimeGraphViewerStub viewer = checkNotNull(fViewer); | |
56 | ||
57 | TmfTimeRange range = createTimeRange(150000L, 160000L); | |
58 | TmfSignal signal = new TmfWindowRangeUpdatedSignal(this, range); | |
59 | TmfSignalManager.dispatchSignal(signal); | |
60 | ||
61 | double visibleWidth = viewer.getTimeGraphScrollPane().getWidth(); | |
62 | System.out.println("width=" + visibleWidth); | |
63 | } | |
64 | ||
65 | @Test | |
66 | public void testZoomOut() { | |
67 | ||
68 | } | |
69 | ||
70 | private static TmfTimeRange createTimeRange(long start, long end) { | |
71 | return new TmfTimeRange(TmfTimestamp.fromNanos(start), TmfTimestamp.fromNanos(end)); | |
72 | } | |
73 | } |