From 17e632821b503c61585a5be87aaa594131799d1d Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Tue, 24 Dec 2013 12:56:37 +0400 Subject: [PATCH] added test for IDEA-111701 (2 editors for 1 document) --- .../actions/KillToWordEndActionTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/KillToWordEndActionTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/KillToWordEndActionTest.java index 31b8aaae3de5..8217a6c165de 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/KillToWordEndActionTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/KillToWordEndActionTest.java @@ -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 = "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); + } }