コード例 #1
0
  private void doLtGtTest(String initText, boolean shouldCloseBeInsert) throws Exception {
    configureFromFileText("a.kt", initText);

    EditorTestUtil.performTypingAction(getEditor(), '<');
    checkResultByText(
        shouldCloseBeInsert
            ? initText.replace("<caret>", "<<caret>>")
            : initText.replace("<caret>", "<<caret>"));

    EditorTestUtil.performTypingAction(getEditor(), EditorTestUtil.BACKSPACE_FAKE_CHAR);
    checkResultByText(initText);
  }
コード例 #2
0
 public void testShiftDragAddsToSelection() throws Exception {
   initText("A quick brown fox");
   EditorTestUtil.setEditorVisibleSize(myEditor, 1000, 1000); // enable drag testing
   mouse().clickAt(0, 1);
   mouse().shift().clickAt(0, 2).dragTo(0, 3).release();
   checkResultByText("A<selection> q<caret></selection>uick brown fox");
 }
 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);
 }
コード例 #4
0
  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);
  }
  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());
  }
コード例 #6
0
ファイル: JetCommenterTest.java プロジェクト: hhariri/kotlin
 private void doNewLineTypingTest() throws Exception {
   configure();
   EditorTestUtil.performTypingAction(getEditor(), '\n');
   check();
 }
コード例 #7
0
 private void doCharTypeTest(char ch, String beforeText, String afterText) {
   configureFromFileText("a.kt", beforeText);
   EditorTestUtil.performTypingAction(getEditor(), ch);
   checkResultByText(afterText);
 }
コード例 #8
0
 public void testMoveThroughGT() throws Exception {
   configureFromFileText("a.kt", "val a: List<Set<Int<caret>>>");
   EditorTestUtil.performTypingAction(getEditor(), '>');
   EditorTestUtil.performTypingAction(getEditor(), '>');
   checkResultByText("val a: List<Set<Int>><caret>");
 }