Search in sources :

Example 6 with MarkerSet

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());
}
Also used : MarkerSet(org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet) Test(org.junit.Test)

Example 7 with MarkerSet

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());
}
Also used : MarkerSet(org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet) File(java.io.File) Test(org.junit.Test)

Example 8 with MarkerSet

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());
}
Also used : MarkerSet(org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet) Test(org.junit.Test)

Example 9 with MarkerSet

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());
}
Also used : MarkerSet(org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet) PeriodicMarker(org.eclipse.tracecompass.internal.tmf.core.markers.Marker.PeriodicMarker) Marker(org.eclipse.tracecompass.internal.tmf.core.markers.Marker) PeriodicMarker(org.eclipse.tracecompass.internal.tmf.core.markers.Marker.PeriodicMarker) Test(org.junit.Test)

Example 10 with MarkerSet

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);
    }
}
Also used : MarkerSet(org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) RGBAColor(org.eclipse.tracecompass.tmf.core.presentation.RGBAColor) PeriodicMarker(org.eclipse.tracecompass.internal.tmf.core.markers.Marker.PeriodicMarker) Marker(org.eclipse.tracecompass.internal.tmf.core.markers.Marker) PeriodicMarker(org.eclipse.tracecompass.internal.tmf.core.markers.Marker.PeriodicMarker) WeightedMarker(org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker.WeightedMarker) SubMarker(org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker) SplitMarker(org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker.SplitMarker) Annotation(org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.Annotation) Test(org.junit.Test)

Aggregations

MarkerSet (org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSet)14 Test (org.junit.Test)10 PeriodicMarker (org.eclipse.tracecompass.internal.tmf.core.markers.Marker.PeriodicMarker)7 Marker (org.eclipse.tracecompass.internal.tmf.core.markers.Marker)6 SplitMarker (org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker.SplitMarker)6 WeightedMarker (org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker.WeightedMarker)6 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 Annotation (org.eclipse.tracecompass.internal.provisional.tmf.core.model.annotations.Annotation)5 SubMarker (org.eclipse.tracecompass.internal.tmf.core.markers.SubMarker)5 RGBAColor (org.eclipse.tracecompass.tmf.core.presentation.RGBAColor)4 File (java.io.File)3 FileWriter (java.io.FileWriter)2 MarkerSegment (org.eclipse.tracecompass.internal.tmf.core.markers.MarkerSegment)2 TmfModelResponse (org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)2 IFileStore (org.eclipse.core.filesystem.IFileStore)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1