本文整理汇总了Java中com.intellij.testFramework.EditorTestUtil.performTypingAction方法的典型用法代码示例。如果您正苦于以下问题:Java EditorTestUtil.performTypingAction方法的具体用法?Java EditorTestUtil.performTypingAction怎么用?Java EditorTestUtil.performTypingAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.testFramework.EditorTestUtil
的用法示例。
在下文中一共展示了EditorTestUtil.performTypingAction方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInsertDeleteParenth
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testInsertDeleteParenth() throws Exception {
configureByFile(BASE_PATH + "InsertDeleteParenth.cs");
EditorTestUtil.performTypingAction(getEditor(), '(');
checkResultByFile(BASE_PATH + "InsertDeleteParenth_after.cs");
configureByFile(BASE_PATH+"InsertDeleteParenth_after.cs");
EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR);
checkResultByFile(BASE_PATH+"InsertDeleteParenth.cs");
configureByFile(BASE_PATH+"InsertDeleteParenth_after.cs");
EditorTestUtil.performTypingAction(getEditor(), ')');
checkResultByFile(BASE_PATH+"InsertDeleteParenth_after2.cs");
configureByFile(BASE_PATH + "InsertDeleteParenth2_2.cs");
EditorTestUtil.performTypingAction(getEditor(), '(');
checkResultByFile(BASE_PATH + "InsertDeleteParenth2_2_after.cs");
configureByFile(BASE_PATH + "InsertDeleteParenth2.cs");
EditorTestUtil.performTypingAction(getEditor(), '(');
checkResultByFile(BASE_PATH + "InsertDeleteParenth2_after.cs");
}
示例2: testHardWrap
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testHardWrap() throws Exception {
configureFromFileText("a.xml",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" +
"<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
"<g>\n" +
" <path clip-path=\"url(#SVGID_2_)\" fill=\"#ffffff\" stroke=\"<selection>#000000</selection>\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\"M19.333,8.333V12c0,1.519-7.333,4-7.333,4s-7.333-2.481-7.333-4V8.333\"/>\n" +
"</g>\n" +
"</svg>");
CodeStyleSettings clone = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings().clone();
clone.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
try {
CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(clone);
EditorTestUtil.performTypingAction(getEditor(), 'x');
}
finally {
CodeStyleSettingsManager.getInstance(getProject()).dropTemporarySettings();
}
checkResultByText("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" +
"<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
"<g>\n" +
" <path clip-path=\"url(#SVGID_2_)\" fill=\"#ffffff\" stroke=\"x\" stroke-width=\"2\" stroke-linecap=\"round\" \n" +
" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" d=\"M19.333,8.333V12c0,1.519-7.333,4-7.333,4s-7.333-2.481-7.333-4V8.333\"/>\n" +
"</g>\n" +
"</svg>");
}
示例3: testHardWrapInComment
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testHardWrapInComment() throws Exception {
configureFromFileText("a.xml",
"<!-- Some very long and informative xml comment to trigger hard wrapping indeed. Too short? Dave, let me ask you something. Are hard wraps working? What do we live for? What ice-cream do you like? Who am I?????????????????????????????????????????????????????????????????????????????????????????????????<caret>-->");
CodeStyleSettings clone = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings().clone();
clone.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
try {
CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(clone);
EditorTestUtil.performTypingAction(getEditor(), '?');
}
finally {
CodeStyleSettingsManager.getInstance(getProject()).dropTemporarySettings();
}
checkResultByText("<!-- Some very long and informative xml comment to trigger hard wrapping indeed. Too short? Dave, let me ask you \n" +
"something. Are hard wraps working? What do we live for? What ice-cream do you like? Who am I??????????????????????????????????????????????????????????????????????????????????????????????????-->");
}
示例4: testInsertDeleteQuotes
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testInsertDeleteQuotes() throws Exception {
configureByFile(BASE_PATH + "InsertDeleteQuote.cs");
EditorTestUtil.performTypingAction(getEditor(), '"');
checkResultByFile(BASE_PATH + "InsertDeleteQuote_after.cs");
configureByFile(BASE_PATH+"InsertDeleteQuote_after.cs");
EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR);
checkResultByFile(BASE_PATH+"InsertDeleteQuote.cs");
FileType extension = FileTypeManager.getInstance().getFileTypeByExtension("pl");
assertTrue("Test is not set up correctly:"+extension, extension instanceof AbstractFileType);
configureByFile(BASE_PATH + "InsertDeleteQuote.pl");
EditorTestUtil.performTypingAction(getEditor(), '"');
checkResultByFile(BASE_PATH + "InsertDeleteQuote_after.pl");
configureByFile(BASE_PATH+"InsertDeleteQuote_after.pl");
EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR);
checkResultByFile(BASE_PATH+"InsertDeleteQuote.pl");
configureByFile(BASE_PATH + "InsertDeleteQuote.aj");
EditorTestUtil.performTypingAction(getEditor(), '"');
checkResultByFile(BASE_PATH + "InsertDeleteQuote_after.aj");
configureByFile(BASE_PATH+"InsertDeleteQuote_after.aj");
EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR);
checkResultByFile(BASE_PATH+"InsertDeleteQuote.aj");
}
示例5: testInsertDeleteBracket
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testInsertDeleteBracket() throws Exception {
configureByFile(BASE_PATH + "InsertDeleteBracket.cs");
EditorTestUtil.performTypingAction(getEditor(), '[');
checkResultByFile(BASE_PATH + "InsertDeleteBracket_after.cs");
configureByFile(BASE_PATH+"InsertDeleteBracket_after.cs");
EditorTestUtil.performTypingAction(getEditor(), BACKSPACE_FAKE_CHAR);
checkResultByFile(BASE_PATH+"InsertDeleteBracket.cs");
configureByFile(BASE_PATH+"InsertDeleteBracket_after.cs");
EditorTestUtil.performTypingAction(getEditor(), ']');
checkResultByFile(BASE_PATH + "InsertDeleteBracket_after2.cs");
}
示例6: doTest
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void doTest() {
DetectableIndentOptionsProvider provider = DetectableIndentOptionsProvider.getInstance();
assertNotNull("DetectableIndentOptionsProvider not found", provider);
String testName = getTestName(true);
provider.setEnabledInTest(true);
try {
configureByFile(BASE_PATH + testName + ".java");
EditorTestUtil.performTypingAction(getEditor(), '\n');
checkResultByFile(BASE_PATH + testName + "_after.java");
}
finally {
provider.setEnabledInTest(false);
}
}
示例7: testEnterPerformance
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testEnterPerformance() throws Exception {
configureByFile(getTestFilePath(true));
EditorTestUtil.performTypingAction(myEditor, '\n');
PlatformTestUtil.assertTiming("Xml editor enter", 7500, 1, new Runnable() {
public void run() {
for (int i = 0; i < 3; i ++) {
EditorTestUtil.performTypingAction(myEditor, '\n');
}
}
});
checkResultByFile(getTestFilePath(false));
}
示例8: checkTyping
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void checkTyping(String fileName, String before, char typed, String after) throws IOException {
configureFromFileText(fileName, before);
EditorTestUtil.performTypingAction(getEditor(), typed);
checkResultByText(after);
}
示例9: testClosingBraceInPlainText
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testClosingBraceInPlainText() throws Exception {
configureFromFileText("a.txt", "<caret>");
EditorTestUtil.performTypingAction(getEditor(), '(');
EditorTestUtil.performTypingAction(getEditor(), ')');
checkResultByText("()<caret>");
}
示例10: testInsertBraceOnEnter
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testInsertBraceOnEnter() throws Exception {
configureByFile(BASE_PATH + "InsertBraceOnEnter.cs");
EditorTestUtil.performTypingAction(getEditor(), '\n');
checkResultByFile(BASE_PATH + "InsertBraceOnEnter_after.cs");
}
示例11: testInsertBraceOnEnterJavaFx
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
public void testInsertBraceOnEnterJavaFx() throws Exception {
String testName = getTestName(false);
configureByFile(BASE_PATH + testName + ".fx");
EditorTestUtil.performTypingAction(getEditor(), '\n');
checkResultByFile(BASE_PATH + testName + "_after.fx");
}
示例12: doTest
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
private void doTest() {
String testName = getTestName(true);
configureByFile(BASE_PATH + testName + ".java");
EditorTestUtil.performTypingAction(getEditor(), '\n');
checkResultByFile(BASE_PATH + testName + "_after.java");
}
示例13: performTypingAction
import com.intellij.testFramework.EditorTestUtil; //导入方法依赖的package包/类
/** Simulates a user typing action, at current caret position of document. */
public void performTypingAction(Editor editor, char typedChar) {
EditorTestUtil.performTypingAction(editor, typedChar);
project.getComponent(PostprocessReformattingAspect.class).doPostponedFormatting();
PsiDocumentManager.getInstance(project).commitAllDocuments();
}