forked from microsoft/copilot-for-eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderingManagerTests.java
More file actions
37 lines (29 loc) · 1.29 KB
/
Copy pathRenderingManagerTests.java
File metadata and controls
37 lines (29 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package com.microsoft.copilot.eclipse.ui.completion;
import static org.junit.jupiter.api.Assertions.assertFalse;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.IEditorPart;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class RenderingManagerTests extends CompletionBaseTests {
@Test
void testShouldNotDisposeJfaceColor() throws Exception {
IFile file = project.getFile("Test.java");
file.create("".getBytes(), IResource.FORCE, null);
IEditorPart editorPart = getEditorPartFor(file);
ITextViewer textViewer = (ITextViewer) editorPart.getAdapter(ITextViewer.class);
RenderingManager manager = new RenderingManager(textViewer);
manager.dispose();
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
Color color = colorRegistry.get("org.eclipse.ui.editors.inlineAnnotationColor");
assertFalse(color.isDisposed());
}
}