use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class ExpandCollapseTest method testCollapse.
@Test
public void testCollapse() throws Exception {
// Expand the element first
testExpand();
// Then collapse it
IValgrindMessage[] messages = (IValgrindMessage[]) viewer.getTreeViewer().getInput();
IValgrindMessage element = messages[0];
TreeSelection selection = new TreeSelection(new TreePath(new Object[] { element }));
viewer.getTreeViewer().setSelection(selection);
contextMenu.notifyListeners(SWT.Show, null);
contextMenu.getItem(1).notifyListeners(SWT.Selection, null);
checkExpanded(element, false);
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class LaunchConfigTabTest method testValgrindError.
@Test
public void testValgrindError() throws Exception {
// $NON-NLS-1$
String notExistentFile = "DOES NOT EXIST";
ILaunchConfigurationWorkingCopy wc = initConfig();
tab.getSuppFileList().add(notExistentFile);
tab.performApply(wc);
config = wc.doSave();
assertFalse(tab.isValid(config));
// $NON-NLS-1$
doLaunch(config, "testValgrindError");
ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
IValgrindMessage[] messages = view.getMessages();
assertTrue(messages.length > 0);
String text = messages[0].getText();
assertTrue(text.contains(notExistentFile));
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class LinkedResourceMarkerTest method testLinkedMarkers.
@Test
public void testLinkedMarkers() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testLinkedMarkers");
ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
IValgrindMessage[] errors = view.getMessages();
ArrayList<IMarker> markers = new ArrayList<>(Arrays.asList(proj.getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE, true, IResource.DEPTH_INFINITE)));
assertEquals(5, markers.size());
for (IValgrindMessage error : errors) {
findMarker(markers, error);
}
assertEquals(0, markers.size());
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class MarkerTest method testMarkers.
@Test
public void testMarkers() throws Exception {
ILaunchConfiguration config = createConfiguration(proj.getProject());
// $NON-NLS-1$
doLaunch(config, "testDefaults");
ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
IValgrindMessage[] errors = view.getMessages();
ArrayList<IMarker> markers = new ArrayList<>(Arrays.asList(proj.getProject().findMarkers(ValgrindLaunchPlugin.MARKER_TYPE, true, IResource.DEPTH_INFINITE)));
assertEquals(5, markers.size());
for (IValgrindMessage error : errors) {
findMarker(markers, error);
}
assertEquals(0, markers.size());
}
use of org.eclipse.linuxtools.valgrind.core.IValgrindMessage in project linuxtools by eclipse.
the class MarkerTest method findMarker.
private void findMarker(ArrayList<IMarker> markers, IValgrindMessage error) throws Exception, CoreException {
ValgrindStackFrame frame = null;
IValgrindMessage[] children = error.getChildren();
for (int i = 0; i < children.length; i++) {
if (frame == null && children[i] instanceof ValgrindStackFrame && isWorkspaceFrame((ValgrindStackFrame) children[i])) {
frame = (ValgrindStackFrame) children[i];
} else if (children[i] instanceof ValgrindError) {
findMarker(markers, children[i]);
}
}
int ix = -1;
for (int i = 0; i < markers.size(); i++) {
IMarker marker = markers.get(i);
if (marker.getAttribute(IMarker.MESSAGE).equals(error.getText()) && marker.getResource().getName().equals(frame.getFile()) && marker.getAttribute(IMarker.LINE_NUMBER).equals(frame.getLine())) {
ix = i;
}
}
assertFalse(ix < 0);
markers.remove(ix);
}
Aggregations