mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Remove usages of deprecated CodeStyleSettings.RIGHT_MARGIN field
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,8 @@ public class PyFillParagraphTest extends PyTestCase {
|
||||
}
|
||||
|
||||
public void testEnter() {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
final CommonCodeStyleSettings settings =
|
||||
CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings().getCommonSettings(PythonLanguage.getInstance());
|
||||
int oldValue = settings.RIGHT_MARGIN;
|
||||
settings.RIGHT_MARGIN = 80;
|
||||
try {
|
||||
|
||||
@@ -273,19 +273,19 @@ public class PyFormatterTest extends PyTestCase {
|
||||
}
|
||||
|
||||
public void testWrapDefinitionWithLongLine() { // IDEA-92081
|
||||
settings().RIGHT_MARGIN = 30;
|
||||
settings().setRightMargin(PythonLanguage.getInstance(), 30);
|
||||
settings().WRAP_LONG_LINES = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testWrapAssignment() { // PY-8572
|
||||
settings().RIGHT_MARGIN = 120;
|
||||
settings().setRightMargin(PythonLanguage.getInstance(), 120);
|
||||
settings().WRAP_LONG_LINES = false;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIndentInSlice() { // PY-8572
|
||||
settings().RIGHT_MARGIN = 120;
|
||||
settings().setRightMargin(PythonLanguage.getInstance(), 120);
|
||||
settings().WRAP_LONG_LINES = false;
|
||||
doTest();
|
||||
}
|
||||
@@ -352,7 +352,7 @@ public class PyFormatterTest extends PyTestCase {
|
||||
}
|
||||
|
||||
public void testWrapInBinaryExpression() { // PY-9032
|
||||
settings().RIGHT_MARGIN = 80;
|
||||
settings().setRightMargin(PythonLanguage.getInstance(), 80);
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ public class PyFormatterTest extends PyTestCase {
|
||||
}
|
||||
|
||||
public void testWrapImports() { // PY-9163
|
||||
settings().RIGHT_MARGIN = 80;
|
||||
settings().setRightMargin(PythonLanguage.getInstance(), 80);
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.jetbrains.python;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
|
||||
/**
|
||||
@@ -30,17 +31,19 @@ public class PyWrapTest extends PyTestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
|
||||
myOldWrap = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
myOldMargin = settings.RIGHT_MARGIN;
|
||||
myOldMargin = pythonSettings.RIGHT_MARGIN;
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
settings.RIGHT_MARGIN = 80;
|
||||
pythonSettings.RIGHT_MARGIN = 80;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myOldWrap;
|
||||
settings.RIGHT_MARGIN = myOldMargin;
|
||||
pythonSettings.RIGHT_MARGIN = myOldMargin;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
@@ -71,9 +74,10 @@ public class PyWrapTest extends PyTestCase {
|
||||
|
||||
public void testWrapRightMargin() {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
|
||||
int oldValue = settings.RIGHT_MARGIN;
|
||||
final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
|
||||
int oldValue = pythonSettings.RIGHT_MARGIN;
|
||||
boolean oldMarginValue = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
|
||||
settings.RIGHT_MARGIN = 100;
|
||||
pythonSettings.RIGHT_MARGIN = 100;
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
|
||||
try {
|
||||
final String testName = "wrap/" + getTestName(true);
|
||||
@@ -84,7 +88,7 @@ public class PyWrapTest extends PyTestCase {
|
||||
myFixture.checkResultByFile(testName + ".after.py");
|
||||
}
|
||||
finally {
|
||||
settings.RIGHT_MARGIN = oldValue;
|
||||
pythonSettings.RIGHT_MARGIN = oldValue;
|
||||
settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = oldMarginValue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user