Skip to content

Commit

Permalink
Add test cases for loading marker types and categories from extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
travkin79 committed Aug 19, 2024
1 parent f3b3ca3 commit d01e43b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
import org.eclipse.ui.views.markers.MarkerField;
import org.eclipse.ui.views.markers.MarkerSupportView;
import org.eclipse.ui.views.markers.internal.ContentGeneratorDescriptor;
import org.eclipse.ui.views.markers.internal.MarkerGroup;
import org.eclipse.ui.views.markers.internal.MarkerMessages;
import org.eclipse.ui.views.markers.internal.MarkerSupportRegistry;
import org.eclipse.ui.views.markers.internal.MarkerType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand Down Expand Up @@ -147,8 +149,21 @@ public void markerContentGeneratorExtensionLoaded() throws Exception {
break;
}
}

assertTrue(foundAdditionalFieldRegisteredViaExtension);
assertTrue("MarkerFields from marker content generator extensions not loaded.",
foundAdditionalFieldRegisteredViaExtension);

MarkerType markerTypeFromExtension = descriptor.getType("org.eclipse.ui.tests.markers.artificial.problem");
assertNotNull("Marker type from marker content generator extensions not loaded.", markerTypeFromExtension);
assertTrue(descriptor.getMarkerTypes().contains(markerTypeFromExtension));

Collection<MarkerGroup> groups = descriptor.getMarkerGroups();
boolean foundAdditionalMarkerGroup = false;
for (MarkerGroup group : groups) {
if ("org.eclipse.ui.tests.test.extended".equals(group.getId())) {
foundAdditionalMarkerGroup = true;
}
}
assertTrue("Marker groups from marker content generator extensions not loaded.", foundAdditionalMarkerGroup);
}

public static MarkerContentGenerator getMarkerContentGenerator(MarkerSupportView view) {
Expand Down
12 changes: 12 additions & 0 deletions tests/org.eclipse.ui.tests/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3426,10 +3426,17 @@
<markerTypeReference
id="org.eclipse.ui.tests.markers.static.analysis.problem">
</markerTypeReference>
<markerTypeReference
id="org.eclipse.ui.tests.markers.artificial.problem">
</markerTypeReference>
</markerContentGenerator>
<markerContentGeneratorExtension
generatorId="org.eclipse.ui.ide.problemsGenerator"
id="org.eclipse.ui.tests.additionalProblemMarkerContentGenerator">
<markerGrouping
id="org.eclipse.ui.tests.test.extended"
label="Extended Problem Category">
</markerGrouping>
</markerContentGeneratorExtension>
<markerContentGeneratorExtension
generatorId="org.eclipse.ui.ide.allMarkersGenerator"
Expand Down Expand Up @@ -4875,5 +4882,10 @@
name="problemKey">
</attribute>
</extension>
<extension
id="markers.artificial.problem"
name="Artificial Test Problem"
point="org.eclipse.core.resources.markers">
</extension>

</plugin>

0 comments on commit d01e43b

Please sign in to comment.