Added a simple builtin names highlighting test.

This commit is contained in:
Dmitry Cheryasov
2010-03-01 05:41:26 +02:00
parent ebe1b63fa3
commit 6a4bc5643e
2 changed files with 41 additions and 2 deletions

View File

@@ -17,6 +17,24 @@ import java.awt.*;
* @author yole
*/
public class PythonHighlightingTest extends PyLightFixtureTestCase {
private static final String TEST_PATH = "/highlighting/";
public void testBuiltins() throws Exception {
EditorColorsManager manager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = (EditorColorsScheme)manager.getGlobalScheme().clone();
manager.addColorsScheme(scheme);
EditorColorsManager.getInstance().setGlobalScheme(scheme);
TextAttributesKey xKey;
TextAttributes xAttributes;
xKey = TextAttributesKey.find("PY.BUILTIN_NAME");
xAttributes = new TextAttributes(Color.green, Color.black, Color.white, EffectType.BOXED, Font.BOLD);
scheme.setAttributes(xKey, xAttributes);
doTest();
}
public void testDeclarations() throws Exception {
EditorColorsManager manager = EditorColorsManager.getInstance();
EditorColorsScheme scheme = (EditorColorsScheme)manager.getGlobalScheme().clone();
@@ -133,11 +151,12 @@ public class PythonHighlightingTest extends PyLightFixtureTestCase {
}
private void doTest() throws Exception {
myFixture.testHighlighting(true, true, false, "/highlighting/" + getTestName(true) + PyNames.DOT_PY);
final String TEST_PATH = "/highlighting/";
myFixture.testHighlighting(true, true, false, TEST_PATH + getTestName(true) + PyNames.DOT_PY);
}
private void doTest(boolean checkWarnings, boolean checkInfos) throws Exception {
myFixture.testHighlighting(checkWarnings, checkInfos, false, "/highlighting/" + getTestName(true) + PyNames.DOT_PY);
myFixture.testHighlighting(checkWarnings, checkInfos, false, TEST_PATH + getTestName(true) + PyNames.DOT_PY);
}
}