diff --git a/python/testData/wrap/wrapRightMargin.after.py b/python/testData/wrap/wrapRightMargin.after.py new file mode 100644 index 000000000000..b7ed9d5c2e6c --- /dev/null +++ b/python/testData/wrap/wrapRightMargin.after.py @@ -0,0 +1,4 @@ +def do_stuff(): + another_long_variable = a_really_long_function_name_with_parameters(12, + this_is_the_first_param=23, + this_is_the_second=45).do_more_stuff_to_the_result() diff --git a/python/testData/wrap/wrapRightMargin.py b/python/testData/wrap/wrapRightMargin.py new file mode 100644 index 000000000000..5d84299ddf2b --- /dev/null +++ b/python/testData/wrap/wrapRightMargin.py @@ -0,0 +1,3 @@ +def do_stuff(): + another_long_variable = a_really_long_function_name_with_parameters(12, + this_is_the_first_param=23, this_is_the_second=45).do_more_stuff_to_the_result() diff --git a/python/testSrc/com/jetbrains/python/PyWrapTest.java b/python/testSrc/com/jetbrains/python/PyWrapTest.java index 861d1b56d229..a8150de2b676 100644 --- a/python/testSrc/com/jetbrains/python/PyWrapTest.java +++ b/python/testSrc/com/jetbrains/python/PyWrapTest.java @@ -49,6 +49,28 @@ public class PyWrapTest extends PyTestCase { doTest(" AND field"); } + + public void testWrapRightMargin() { + final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings(); + int oldValue = settings.RIGHT_MARGIN; + boolean oldMarginValue = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN; + settings.RIGHT_MARGIN = 100; + settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true; + try { + final String testName = "wrap/" + getTestName(true); + myFixture.configureByFile(testName + ".py"); + for (int i = 0; i != 45; ++i) { + myFixture.type(' '); + } + myFixture.checkResultByFile(testName + ".after.py"); + } + finally { + settings.RIGHT_MARGIN = oldValue; + settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = oldMarginValue; + } + + } + private void doTest(final String textToType) { myFixture.configureByFile("wrap/" + getTestName(false) + ".py"); myFixture.type(textToType);