use of com.android.tools.adtui.common.formatter.TimeAxisFormatter in project android by JetBrains.
the class AxisComponentTest method testBuilder.
@Test
public void testBuilder() throws Exception {
// A simple test to validate that the AxisComponent generated from the Builder has consistent values as the input.
AnimatedRange testRange1 = new AnimatedRange(0, 100);
TimeAxisFormatter testFormatter1 = new TimeAxisFormatter(5, 5, 10);
AxisComponent.Builder builder = new AxisComponent.Builder(testRange1, testFormatter1, AxisComponent.AxisOrientation.BOTTOM);
AxisComponent axis1 = builder.build();
assertThat(axis1.getRange()).isEqualTo(testRange1);
assertThat(axis1.getLabel()).isNull();
assertThat(axis1.getAxisFormatter()).isEqualTo(testFormatter1);
assertThat(axis1.getOrientation()).isEqualTo(AxisComponent.AxisOrientation.BOTTOM);
assertThat(axis1.getGlobalRange()).isNull();
assertThat(axis1.getParentAxis()).isNull();
assertThat(axis1.getClampToMajorTicks()).isFalse();
assertThat(axis1.getShowMin()).isFalse();
assertThat(axis1.getShowMax()).isFalse();
assertThat(axis1.getShowAxisLine()).isTrue();
Range testRange2 = new Range(0, 200);
builder = new AxisComponent.Builder(testRange1, testFormatter1, AxisComponent.AxisOrientation.TOP).setParentAxis(axis1).setGlobalRange(testRange2).setLabel("Axis").showMax(true).showAxisLine(false).clampToMajorTicks(true);
AxisComponent axis2 = builder.build();
assertThat(axis2.getRange()).isEqualTo(testRange1);
assertThat(axis2.getLabel()).isEqualTo("Axis");
assertThat(axis2.getAxisFormatter()).isEqualTo(testFormatter1);
assertThat(axis2.getOrientation()).isEqualTo(AxisComponent.AxisOrientation.TOP);
assertThat(axis2.getGlobalRange()).isEqualTo(testRange2);
assertThat(axis2.getParentAxis()).isEqualTo(axis1);
assertThat(axis2.getClampToMajorTicks()).isTrue();
assertThat(axis2.getShowMin()).isFalse();
assertThat(axis2.getShowMax()).isTrue();
assertThat(axis2.getShowAxisLine()).isFalse();
}
Aggregations