mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-58977 Regression in Copy Line behavior
refactor existing tests
This commit is contained in:
+2
-23
@@ -18,12 +18,12 @@ package com.intellij.openapi.editor.impl.softwrap.mapping;
|
||||
import com.intellij.codeInsight.folding.CodeFoldingManager;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.impl.AbstractEditorProcessingOnDocumentModificationTest;
|
||||
import com.intellij.openapi.editor.impl.DefaultEditorTextRepresentationHelper;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.TestFileType;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntProcedure;
|
||||
@@ -1055,28 +1055,7 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorP
|
||||
|
||||
private void init(final int visibleWidth, @NotNull String fileText, @NotNull TestFileType fileType, final int symbolWidth) throws IOException {
|
||||
init(fileText, fileType);
|
||||
myEditor.getSettings().setUseSoftWraps(true);
|
||||
SoftWrapModelImpl model = (SoftWrapModelImpl)myEditor.getSoftWrapModel();
|
||||
model.reinitSettings();
|
||||
|
||||
SoftWrapApplianceManager applianceManager = model.getApplianceManager();
|
||||
applianceManager.setWidthProvider(new SoftWrapApplianceManager.VisibleAreaWidthProvider() {
|
||||
@Override
|
||||
public int getVisibleAreaWidth() {
|
||||
return visibleWidth;
|
||||
}
|
||||
});
|
||||
|
||||
if (symbolWidth > 0) {
|
||||
applianceManager.setRepresentationHelper(new DefaultEditorTextRepresentationHelper(myEditor) {
|
||||
@Override
|
||||
public int charWidth(char c, int fontType) {
|
||||
return symbolWidth;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
applianceManager.registerSoftWrapIfNecessary();
|
||||
EditorTestUtil.configureSoftWraps(myEditor, visibleWidth, symbolWidth);
|
||||
}
|
||||
|
||||
private static void checkSoftWraps(int... startOffsets) {
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
@@ -29,15 +27,7 @@ public class SoftWrapTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
public void testSoftWrapInInjection() throws Exception {
|
||||
|
||||
myFixture.configureByFile("softWrap.html");
|
||||
Editor editor = myFixture.getEditor();
|
||||
editor.getSettings().setUseSoftWraps(true);
|
||||
((SoftWrapModelImpl)editor.getSoftWrapModel()).getApplianceManager().setWidthProvider(new SoftWrapApplianceManager.VisibleAreaWidthProvider() {
|
||||
@Override
|
||||
public int getVisibleAreaWidth() {
|
||||
return 600;
|
||||
}
|
||||
});
|
||||
|
||||
EditorTestUtil.configureSoftWraps(myFixture.getEditor(), 85);
|
||||
myFixture.type('j');
|
||||
myFixture.checkResultByFile("softWrap_after.html");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user