1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

Remove field in test

The field implies that the fSourceViewer has a longer life
than it does. But reality is that the viewer is only
valid until the editor gets reopened while the test is
running.
This commit is contained in:
Jonah Graham 2023-01-30 12:00:07 -05:00
parent e157c2fbfe
commit 8ff58a5262

View file

@ -80,8 +80,6 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
private ICProject fCProject;
private final String fTestFilename = "/" + PROJECT + "/src/this.cpp";
private static SourceViewer fSourceViewer;
public static Test suite() {
return new TestSuite(DocCommentHighlightingTest.class);
}
@ -99,11 +97,11 @@ public class DocCommentHighlightingTest extends BaseUITestCase {
preferenceStore.setValue(PreferenceConstants.EDITOR_FOLDING_ENABLED, false);
AbstractTextEditor fEditor = (CEditor) EditorTestHelper.openInEditor(ResourceTestHelper.findFile(fTestFilename),
true);
fSourceViewer = EditorTestHelper.getSourceViewer(fEditor);
SourceViewer sourceViewer = EditorTestHelper.getSourceViewer(fEditor);
// Source positions depend on Windows line separator
adjustLineSeparator(fSourceViewer.getDocument(), "\r\n");
adjustLineSeparator(sourceViewer.getDocument(), "\r\n");
fEditor.doSave(new NullProgressMonitor());
assertTrue(EditorTestHelper.joinReconciler(fSourceViewer, 0, 10000, 100));
assertTrue(EditorTestHelper.joinReconciler(sourceViewer, 0, 10000, 100));
}
@Override