1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.tmf
.ui
.tests
.views
.timegraph2
.swtjfx
;
12 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
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
;
26 public class SwtJfxTimeGraphViewerTest
{
28 // private static final double DELTA = 0.1;
30 private static final long FULL_TRACE_START_TIME
= 100000L;
31 private static final long FULL_TRACE_END_TIME
= 200000L;
33 private @Nullable SwtJfxTimeGraphViewerStub fViewer
;
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
);
41 viewer
.getTimeGraphScrollPane().setMinWidth(1000.0);
46 public void tearDown() {
47 if (fViewer
!= null) {
54 public void testSeekVisibleRange() {
55 SwtJfxTimeGraphViewerStub viewer
= checkNotNull(fViewer
);
57 TmfTimeRange range
= createTimeRange(150000L, 160000L);
58 TmfSignal signal
= new TmfWindowRangeUpdatedSignal(this, range
);
59 TmfSignalManager
.dispatchSignal(signal
);
61 double visibleWidth
= viewer
.getTimeGraphScrollPane().getWidth();
62 System
.out
.println("width=" + visibleWidth
);
66 public void testZoomOut() {
70 private static TmfTimeRange
createTimeRange(long start
, long end
) {
71 return new TmfTimeRange(TmfTimestamp
.fromNanos(start
), TmfTimestamp
.fromNanos(end
));