use of com.android.tools.adtui.Choreographer in project android by JetBrains.
the class LineChartTest method testSnapToDataMaxOnFirstUpdate.
@Test
public void testSnapToDataMaxOnFirstUpdate() throws Exception {
// Test that during the first update, the LineChart will immediately snap to the current data max instead of interpolating.
Range xRange = new Range(0, 100);
Range yRange = new Range(0, 50);
DefaultDataSeries<Long> testSeries = new DefaultDataSeries<>();
for (int i = 0; i < 101; i++) {
testSeries.add(i, (long) i);
}
RangedContinuousSeries rangedSeries = new RangedContinuousSeries("test", xRange, yRange, testSeries);
Choreographer choreographer = new Choreographer(new JPanel());
choreographer.setUpdate(false);
LineChart lineChart = new LineChart();
lineChart.addLine(rangedSeries);
choreographer.register(lineChart);
// before update.
assertThat(yRange.getMax()).isWithin(0.0).of(50);
choreographer.step();
// after update.
assertThat(yRange.getMax()).isWithin(0.0).of(100);
choreographer.stop();
}
use of com.android.tools.adtui.Choreographer in project android by JetBrains.
the class VisualTest method initialize.
protected void initialize() {
mPanel = new JBPanel();
mChoreographer = new Choreographer(mPanel);
mChoreographer.register(createComponentsList());
populateUi(mPanel);
}
use of com.android.tools.adtui.Choreographer in project android by JetBrains.
the class AnimatedComponentImageDiffEntry method setUpBase.
private void setUpBase() {
// TODO: add one more level to the hierarchy and move this to a base class that can be subclassed by generators of different components
myContentPane = new JPanel(new BorderLayout());
myContentPane.setSize(MAIN_COMPONENT_DIMENSION);
myContentPane.setPreferredSize(MAIN_COMPONENT_DIMENSION);
myCurrentTimeUs = TimeUnit.NANOSECONDS.toMicros(System.nanoTime());
myRangeStartUs = myCurrentTimeUs;
myRangeEndUs = myRangeStartUs + TOTAL_VALUES * TIME_DELTA_US;
myXRange = new AnimatedRange(myRangeStartUs, myRangeEndUs);
// We don't need to set a proper FPS to the choreographer, as we're interested in the final image only, not the animation.
myChoreographer = new Choreographer(-1, myContentPane);
myChoreographer.setUpdate(false);
myComponents = new ArrayList<>();
myComponents.add(myXRange);
}
Aggregations