use of com.intellij.testFramework.TestActionEvent in project intellij-community by JetBrains.
the class CCShowPreviewTest method doTest.
private void doTest(String name) {
VirtualFile file = configureByTaskFile(name + CCTestsUtil.BEFORE_POSTFIX);
CCShowPreview action = new CCShowPreview();
TestActionEvent e = getActionEvent(action, PsiManager.getInstance(getProject()).findFile(file));
action.beforeActionPerformedUpdate(e);
assertTrue(e.getPresentation().isEnabled() && e.getPresentation().isVisible());
action.actionPerformed(e);
Editor editor = EditorFactory.getInstance().getAllEditors()[1];
Pair<Document, List<AnswerPlaceholder>> pair = getPlaceholders(name + CCTestsUtil.AFTER_POSTFIX);
assertEquals("Files don't match", editor.getDocument().getText(), pair.getFirst().getText());
for (AnswerPlaceholder placeholder : pair.getSecond()) {
assertNotNull("No highlighter for placeholder:" + CCTestsUtil.getPlaceholderPresentation(placeholder), getHighlighter(editor.getMarkupModel(), placeholder));
}
}
use of com.intellij.testFramework.TestActionEvent in project intellij-community by JetBrains.
the class CCTaskFileActionTest method launchAction.
private void launchAction(VirtualFile virtualFile, AnAction action) {
TestActionEvent e = getActionEvent(virtualFile, action);
action.beforeActionPerformedUpdate(e);
assertTrue(e.getPresentation().isEnabled() && e.getPresentation().isVisible());
action.actionPerformed(e);
}
use of com.intellij.testFramework.TestActionEvent in project android by JetBrains.
the class AndroidGotoRelatedTest method doGotoRelatedFile.
private List<GotoRelatedItem> doGotoRelatedFile(VirtualFile file) {
myFixture.configureFromExistingVirtualFile(file);
final GotoRelatedSymbolAction action = new GotoRelatedSymbolAction();
final TestActionEvent e = new TestActionEvent(action);
action.beforeActionPerformedUpdate(e);
final Presentation presentation = e.getPresentation();
assertTrue(presentation.isEnabled() && presentation.isVisible());
return GotoRelatedSymbolAction.getItems(myFixture.getFile(), myFixture.getEditor(), null);
}
use of com.intellij.testFramework.TestActionEvent in project android by JetBrains.
the class AndroidRenameTest method checkAndRenameUsingHandler.
private void checkAndRenameUsingHandler(String newName) {
final RenameElementAction action = new RenameElementAction();
final AnActionEvent e = new TestActionEvent(DataManager.getInstance().getDataContext(myFixture.getEditor().getComponent()), action);
action.update(e);
assertTrue(e.getPresentation().isEnabled() && e.getPresentation().isVisible());
// Note: This fails when trying to rename XML attribute values: Use myFixture.renameElementAtCaretUsingHandler() instead!
myFixture.renameElementAtCaretUsingHandler(newName);
}
use of com.intellij.testFramework.TestActionEvent in project android by JetBrains.
the class AndroidRenameTest method checkAndRename.
private void checkAndRename(String newName) {
final RenameElementAction action = new RenameElementAction();
final AnActionEvent e = new TestActionEvent(DataManager.getInstance().getDataContext(myFixture.getEditor().getComponent()), action);
action.update(e);
assertTrue(e.getPresentation().isEnabled() && e.getPresentation().isVisible());
// Note: This fails when trying to rename XML attribute values: Use myFixture.renameElementAtCaretUsingHandler() instead!
myFixture.renameElementAtCaret(newName);
}
Aggregations