blob: 6ee9d7c837ac5b3afd90f5847b2a6fe073e50a38 [file] [log] [blame]
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.editor.actions;
import com.intellij.testFramework.EditorTestUtil;
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
import java.io.IOException;
public class SelectLineActionTest extends LightPlatformCodeInsightTestCase {
public void test() throws Exception {
prepare("first line\n" +
"second<caret> line\n" +
"third line");
selectLine();
checkResultByText("first line\n" +
"<caret><selection>second line\n" +
"</selection>third line"
);
}
public void testWithSoftWraps() throws Exception {
prepare("first line\n" +
"second line<caret>\n" + // this line will be wrapped and caret is positioned after the wrap
"third line");
assertTrue("Failed to activate soft wrapping", EditorTestUtil.configureSoftWraps(myEditor, 6));
selectLine();
checkResultByText("first line\n" +
"<caret><selection>second line\n" +
"</selection>third line"
);
}
private void prepare(String documentContents) throws IOException {
configureFromFileText(getTestName(false) + ".txt", documentContents);
}
}