当前位置: 首页>>代码示例>>Java>>正文


Java EditorTestUtil.configureSoftWraps方法代码示例

本文整理汇总了Java中com.intellij.testFramework.EditorTestUtil.configureSoftWraps方法的典型用法代码示例。如果您正苦于以下问题:Java EditorTestUtil.configureSoftWraps方法的具体用法?Java EditorTestUtil.configureSoftWraps怎么用?Java EditorTestUtil.configureSoftWraps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.testFramework.EditorTestUtil的用法示例。


在下文中一共展示了EditorTestUtil.configureSoftWraps方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSoftWrapsRecalculationInASpecificCase

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testSoftWrapsRecalculationInASpecificCase() throws Exception {
  configureFromFileText(getTestName(false) + ".java",
                        "<selection>class Foo {\n" +
                        "\[email protected]\n" +
                        "\tpublic boolean equals(Object other) {\n" +
                        "\t\treturn this == other;\n" +
                        "\t}\n" +
                        "}</selection>");
  CodeFoldingManager.getInstance(ourProject).buildInitialFoldings(myEditor);
  EditorTestUtil.configureSoftWraps(myEditor, 232, 7); // wrap after 32 characters

  // verify initial state
  assertEquals(4, EditorUtil.getTabSize(myEditor));
  assertEquals("[FoldRegion +(59:64), placeholder=' { ', FoldRegion +(85:88), placeholder=' }']", myEditor.getFoldingModel().toString());
  verifySoftWrapPositions(52, 85);
  
  Document document = myEditor.getDocument();
  for (int i = document.getLineCount() - 1; i >= 0; i--) {
    document.insertString(document.getLineStartOffset(i), "//");
  }

  verifySoftWrapPositions(58, 93);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:EditorImplTest.java

示例2: testOnlyMinimalRangeIsRecalculatedOnDocumentChange

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testOnlyMinimalRangeIsRecalculatedOnDocumentChange() throws IOException {
  init("aa bb cc dd ee<caret> ff gg hh ii jj", TestFileType.TEXT);
  EditorTestUtil.configureSoftWraps(myEditor, 8);
  verifySoftWrapPositions(6, 12, 18, 24);
  
  final IncrementalCacheUpdateEvent[] event = new IncrementalCacheUpdateEvent[1];
  ((SoftWrapModelImpl)myEditor.getSoftWrapModel()).getApplianceManager().addListener(new SoftWrapAwareDocumentParsingListenerAdapter() {
    @Override
    public void onRecalculationEnd(@NotNull IncrementalCacheUpdateEvent e) {
      assertNull(event[0]);
      event[0] = e;
    }
  });
  
  type(' ');
  
  verifySoftWrapPositions(6, 12, 19, 25);
  assertNotNull(event[0]);
  assertEquals(6, event[0].getStartOffset());
  assertEquals(19, event[0].getActualEndOffset());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SoftWrapApplianceOnDocumentModificationTest.java

示例3: testOnlyMinimalRangeIsRecalculatedOnDocumentChange

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testOnlyMinimalRangeIsRecalculatedOnDocumentChange() throws IOException {
  init("aa bb cc dd ee<caret> ff gg hh ii jj", TestFileType.TEXT);
  EditorTestUtil.configureSoftWraps(myEditor, 8);
  verifySoftWrapPositions(6, 12, 18, 24);

  final IncrementalCacheUpdateEvent[] event = new IncrementalCacheUpdateEvent[1];
  ((SoftWrapModelImpl)myEditor.getSoftWrapModel()).getApplianceManager().addListener(new SoftWrapAwareDocumentParsingListenerAdapter() {
    @Override
    public void onRecalculationEnd(@Nonnull IncrementalCacheUpdateEvent e) {
      assertNull(event[0]);
      event[0] = e;
    }
  });

  type(' ');

  verifySoftWrapPositions(6, 12, 19, 25);
  assertNotNull(event[0]);
  assertEquals(6, event[0].getStartOffset());
  assertEquals(19, event[0].getActualEndOffset());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:SoftWrapApplianceOnDocumentModificationTest.java

示例4: doTest

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void doTest(String fileName) {
  configureByFile("/codeInsight/folding/" + fileName);
  EditorTestUtil.configureSoftWraps(myEditor, 120);
  runFoldingPass();
  deleteLine();
  runFoldingPass();
  // we just verify here that the operation completes normally - it was known to fail previously
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FoldingExceptionTest.java

示例5: testCaretPositionsRecalculationOnDocumentChange

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testCaretPositionsRecalculationOnDocumentChange() throws Exception {
  initText("\n" +
           "<selection><caret>word</selection>\n" +
           "some long prefix <selection><caret>word</selection>-suffix");
  EditorTestUtil.configureSoftWraps(myEditor, 17); // wrapping right before 'word-suffix'

  delete();

  checkResultByText("\n" +
                    "<caret>\n" +
                    "some long prefix <caret>-suffix");
  verifySoftWrapPositions(19);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:EditorMultiCaretTest.java

示例6: testDuplicateFirstLineWhenSoftWrapsAreOn

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testDuplicateFirstLineWhenSoftWrapsAreOn() throws Exception {
  init("long long t<caret>ext", TestFileType.TEXT);
  EditorTestUtil.configureSoftWraps(myEditor, 10);

  executeAction("EditorDuplicate");
  checkResultByText("long long text\n" +
                    "long long t<caret>ext");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:EditorActionTest.java

示例7: testSoftWrapInInjection

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testSoftWrapInInjection() throws Exception {

    myFixture.configureByFile("softWrap.html");
    EditorTestUtil.configureSoftWraps(((EditorWindow)myFixture.getEditor()).getDelegate(), 83);
    myFixture.type('j');
    myFixture.checkResultByFile("softWrap_after.html");
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SoftWrapTest.java

示例8: configureSoftWraps

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
protected static void configureSoftWraps(int charCountToWrapAt) {
  EditorTestUtil.configureSoftWraps(myEditor, charCountToWrapAt);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AbstractEditorTest.java

示例9: init

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void init(final int visibleWidth, @NotNull String fileText, @NotNull TestFileType fileType, final int symbolWidth) throws IOException {
  init(fileText, fileType);
  EditorTestUtil.configureSoftWraps(myEditor, visibleWidth, symbolWidth);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:SoftWrapApplianceOnDocumentModificationTest.java

示例10: doTestSoftWraps

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void doTestSoftWraps(int wrapWidth, String text) throws IOException {
  List<MyFoldRegion> foldRegions = new ArrayList<MyFoldRegion>();
  List<Integer> wrapPositions = new ArrayList<Integer>();
  int foldInsertPosition = 0;
  int pos = 0;
  int docPos = 0;
  Matcher matcher = Pattern.compile(TAGS_PATTERN).matcher(text);
  StringBuilder cleanedText = new StringBuilder();
  while(matcher.find()) {
    cleanedText.append(text.substring(pos, matcher.start()));
    docPos += matcher.start() - pos;
    pos = matcher.end();
    if (matcher.group(1) != null) {       // <fold>
      foldRegions.add(foldInsertPosition++, new MyFoldRegion(docPos, matcher.group(3), matcher.group(2) != null));
    }
    else if (matcher.group(4) != null) {  // </fold>
      assertTrue("Misplaced closing fold marker tag: " + text, foldInsertPosition > 0);
      foldRegions.get(--foldInsertPosition).endPos = docPos;
    }
    else {                                // <wrap>
      wrapPositions.add(docPos);
    }
  }
  assertTrue("Missing closing fold marker tag: " + text, foldInsertPosition == 0);
  cleanedText.append(text.substring(pos));

  init(cleanedText.toString(), TestFileType.TEXT);

  for (MyFoldRegion region : foldRegions) {
    FoldRegion r = addFoldRegion(region.startPos, region.endPos, region.placeholder);
    if (region.collapse) {
      toggleFoldRegionState(r, false);
    }
  }

  EditorTestUtil.configureSoftWraps(myEditor, wrapWidth);

  List<Integer> actualWrapPositions = new ArrayList<Integer>();
  for (SoftWrap wrap : myEditor.getSoftWrapModel().getSoftWrapsForRange(0, myEditor.getDocument().getTextLength())) {
    actualWrapPositions.add(wrap.getStart());
  }
  assertEquals("Wrong wrap positions", wrapPositions, actualWrapPositions);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:SoftWrapTest.java

示例11: init

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void init(final int visibleWidth, @Nonnull String fileText, @Nonnull TestFileType fileType, final int symbolWidth) throws IOException {
  init(fileText, fileType);
  EditorTestUtil.configureSoftWraps(myEditor, visibleWidth, symbolWidth);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:SoftWrapApplianceOnDocumentModificationTest.java

示例12: configureSoftWraps

import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
protected static void configureSoftWraps(int charCountToWrapAt)
{
	EditorTestUtil.configureSoftWraps(myEditor, charCountToWrapAt);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:5,代码来源:AbstractEditorTest.java


注:本文中的com.intellij.testFramework.EditorTestUtil.configureSoftWraps方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。