Skip to content

Use TestUtil.cleanUp across the tests #3029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/org.eclipse.ui.editors.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.editors.tests;singleton:=true
Bundle-Version: 3.13.800.qualifier
Bundle-Version: 3.13.900.qualifier
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jface.text.tests.codemining,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;

import org.eclipse.ui.editors.tests.TestUtil;

public class CodeMiningTest {
private static String PROJECT_NAME = "test_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());

Expand All @@ -78,6 +80,7 @@ public void after() {
drainEventQueue();
CodeMiningTestProvider.provideContentMiningAtOffset = -1;
CodeMiningTestProvider.provideHeaderMiningAtLine = -1;
TestUtil.cleanUp();
}

private static void closeAllEditors() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void after() {
window.close();
page = null;
processEvents();
TestUtil.cleanUp();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ public void setUpBeforeClass() throws IOException, PartInitException, CoreExcept

@After
public void tearDown() {
editor.dispose();
editor.close(false);
file.delete();
TestUtil.cleanUp();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ public void setUpBeforeClass() throws IOException, PartInitException, CoreExcept

@After
public void tearDown() {
editor.dispose();
editor.close(false);
file.delete();
TestUtil.cleanUp();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public void setUp() throws IOException, PartInitException, CoreException {

@After
public void tearDown() {
editor.dispose();
editor.close(false);
file.delete();
TestUtil.cleanUp();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -41,6 +42,8 @@
import org.eclipse.ui.texteditor.stickyscroll.IStickyLine;
import org.eclipse.ui.texteditor.stickyscroll.IStickyLinesProvider.StickyLinesProperties;

import org.eclipse.ui.editors.tests.TestUtil;

public class DefaultStickyLinesProviderTest {

private Shell shell;
Expand All @@ -61,6 +64,11 @@ public void setup() {
stickyLinesProperties = new StickyLinesProperties(4, editorPart);
}

@After
public void teardown() {
TestUtil.cleanUp();
}

@Test
public void testEmptySourceCode() {
List<IStickyLine> stickyLines = stickyLinesProvider.getStickyLines(sourceViewer, 0, stickyLinesProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -19,6 +20,8 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.stickyscroll.IStickyLinesProvider;

import org.eclipse.ui.editors.tests.TestUtil;

public class StickyLinesProviderRegistryTest {

private StickyLinesProviderDescriptor stickyLinesProviderDescriptor;
Expand All @@ -40,6 +43,11 @@ public void setup() {
cut = new StickyLinesProviderRegistry(extensionRegistry, e -> stickyLinesProviderDescriptor);
}

@After
public void teardown() {
TestUtil.cleanUp();
}

@Test
public void testGetDefaultProviderIfNoMatch() {
when(stickyLinesProviderDescriptor.matches(viewer, editor)).thenReturn(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

import org.eclipse.ui.texteditor.stickyscroll.IStickyLine;

import org.eclipse.ui.editors.tests.TestUtil;

public class StickyScrollingControlTest {

private Shell shell;
Expand Down Expand Up @@ -86,6 +88,7 @@ public void teardown() {
lineNumberColor.dispose();
hoverColor.dispose();
backgroundColor.dispose();
TestUtil.cleanUp();
}

@Test
Expand Down Expand Up @@ -183,13 +186,17 @@ public void testCopyStyleRangesWithLimitedStickyLines() {

@Test
public void testWithoutVerticalRuler() {
sourceViewer = new SourceViewer(shell, null, SWT.None);
settings = new StickyScrollingControlSettings(5, lineNumberColor, hoverColor, backgroundColor, separatorColor,
true);
stickyScrollingControl = new StickyScrollingControl(sourceViewer, settings);

StyledText stickyLineNumber = getStickyLineNumber();
assertFalse(stickyLineNumber.isVisible());
SourceViewer sourceViewerWithoutRuler = new SourceViewer(shell, null, SWT.None);
StickyScrollingControl stickyScrollingControlWithoutRuler = new StickyScrollingControl(sourceViewerWithoutRuler,
new StickyScrollingControlSettings(5, lineNumberColor, hoverColor, backgroundColor, separatorColor,
true));
try {
StyledText stickyLineNumber = getStickyLineNumber();
assertFalse(stickyLineNumber.isVisible());
} finally {
sourceViewerWithoutRuler.getControl().dispose();
stickyScrollingControlWithoutRuler.dispose();
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
import org.eclipse.ui.texteditor.stickyscroll.IStickyLinesProvider;
import org.eclipse.ui.texteditor.stickyscroll.IStickyLinesProvider.StickyLinesProperties;

import org.eclipse.ui.editors.tests.TestUtil;

public class StickyScrollingHandlerTest {

private Shell shell;
Expand Down Expand Up @@ -99,6 +101,7 @@ public void setup() {
@After
public void teardown() {
shell.dispose();
TestUtil.cleanUp();
}

@Test
Expand Down
Loading