use of org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet in project tracecompass by tracecompass.
the class MarkerConfigXmlParserTest method testExtensionPoint.
/**
* Test that the definitions from the extension point are loaded.
*/
@Test
public void testExtensionPoint() {
List<MarkerSet> markerSet = MarkerConfigXmlParser.getMarkerSets();
assertEquals("Extension point markers should be loaded", 1, markerSet.size());
MarkerSet set = markerSet.get(0);
assertEquals("Wrong MarkerSet name", "Example", set.getName());
assertEquals("Wrong MarkerSet Id", "example.id", set.getId());
}
use of org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet in project tracecompass by tracecompass.
the class MarkerConfigXmlParserTest method testParseInvalidFile.
/**
* Test the parse method with a non-existing file
*/
@Test
public void testParseInvalidFile() {
File file = new File("invalid");
List<MarkerSet> markerSets = MarkerConfigXmlParser.parse(file.getAbsolutePath());
assertEquals(0, markerSets.size());
}
use of org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet in project tracecompass by tracecompass.
the class MarkerSetTest method testConstructor.
/**
* Test the constructor
*/
@Test
public void testConstructor() {
MarkerSet markerSet = new MarkerSet("name", "id");
assertEquals("name", markerSet.getName());
assertEquals("id", markerSet.getId());
assertEquals(0, markerSet.getMarkers().size());
}
use of org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet in project tracecompass by tracecompass.
the class MarkerSetTest method testAddMarker.
/**
* Test the method addMarker
*/
@Test
public void testAddMarker() {
MarkerSet markerSet = new MarkerSet("name", "id");
Marker markerA = new PeriodicMarker("A", "A %d", "a", "ref.a", "color1", 1.0, "ms", Range.atLeast(1L), 1L, ImmutableRangeSet.of(Range.atLeast(1L)));
markerSet.addMarker(markerA);
Marker markerB = new PeriodicMarker("B", "B %d", "b", "ref.b", "color2", 2.0, "ns", Range.atLeast(2L), 2L, ImmutableRangeSet.of(Range.atLeast(2L)));
markerSet.addMarker(markerB);
assertEquals(Arrays.asList(markerA, markerB), markerSet.getMarkers());
}
use of org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet in project tracecompass by tracecompass.
the class CustomAnnotationProviderTest method testSimple.
/**
* Test simple
*/
@Test
public void testSimple() {
List<Annotation> annotationList;
MarkerSet set = new MarkerSet("name", "id");
fProvider.configure(set);
assertAnnotationCategoriesModelResponse(Collections.emptyList(), fProvider.fetchAnnotationCategories(Collections.emptyMap(), new NullProgressMonitor()));
/*
* period: 10 ms, offset: 20 ms, range: 0..4
*
* requested range: 100 ms-200 ms
*
* expected annotations: 90 ms[2] 100 ms[3] 110 ms[4] 120 ms[0] ... 200
* ms[3] 210 ms[4]
*/
Marker markerA = new PeriodicMarker("A", "A %d", "a", "ref.a", COLOR_STR, 10.0, "ms", Range.closed(0L, 4L), 20L, ImmutableRangeSet.of(Range.all()));
set.addMarker(markerA);
fProvider.configure(set);
assertAnnotationCategoriesModelResponse(Arrays.asList("A"), fProvider.fetchAnnotationCategories(Collections.emptyMap(), new NullProgressMonitor()));
annotationList = getAnnotationList("A", 100000000L, 200000000L, 1000L, new NullProgressMonitor());
assertEquals(annotationList.toString(), 13, annotationList.size());
for (int i = 0; i < annotationList.size(); i++) {
long t = (i + 9) * 10000000L;
int index = (i + 9) - 2;
int labelIndex = index % 5;
RGBAColor color = index % 2 == 0 ? COLOR : ODD_COLOR;
validateAnnotation(annotationList.get(i), t, 10000000L, "A", String.format("A %d", labelIndex), color);
}
}
Aggregations