added test for IDEA-111701 (2 editors for 1 document)

This commit is contained in:
Ekaterina Tuzova
2013-12-24 12:56:37 +04:00
parent b83d875e17
commit 17e632821b
@@ -15,6 +15,9 @@
*/
package com.intellij.openapi.editor.actions;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.impl.CaretModelImpl;
import com.intellij.openapi.editor.impl.EditorImpl;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.ide.KillRingTransferable;
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
@@ -121,4 +124,21 @@ public class KillToWordEndActionTest extends LightPlatformCodeInsightTestCase {
Object string = contents.getTransferData(DataFlavor.stringFlavor);
assertEquals("first second", string);
}
public void testDoubleEditors() throws Exception {
String text = "<caret>first second third";
configureFromFileText(getTestName(false) + ".txt", text);
final Document document = myEditor.getDocument();
final CaretModelImpl caretModel = new CaretModelImpl((EditorImpl)myEditor);
document.addDocumentListener(caretModel);
caretModel.moveToOffset(document.getTextLength()-1);
killToWordEnd();
killToWordEnd();
checkResultByText(" third");
Transferable contents = CopyPasteManager.getInstance().getContents();
assertTrue(contents instanceof KillRingTransferable);
Object string = contents.getTransferData(DataFlavor.stringFlavor);
assertEquals("first second", string);
}
}