com.intellij.testFramework.TestActionEvent Java Examples
The following examples show how to use
com.intellij.testFramework.TestActionEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataSourceListPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Test public void shouldRemoveEntryAfterRemoveButtonClicked() { panel.populateWithConfigurations(asList(defaultDataSource)); final AnActionButton action = getAnActionButton(REMOVE); final AnActionEvent event = new TestActionEvent(action); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { action.actionPerformed(event); } }); window.list().requireNoSelection(); assertThat(window.list().contents().length, is(0)); }
Example #2
Source File: SelectedTestRunLineMarkerContributorTest.java From buck with Apache License 2.0 | 6 votes |
private AnAction findActionAtCaretWithText(Predicate<String> textMatcher) { List<GutterMark> gutterMarks = myFixture.findGuttersAtCaret(); for (GutterMark gutterMark : gutterMarks) { if (!(gutterMark instanceof GutterIconRenderer)) { continue; } GutterIconRenderer renderer = (GutterIconRenderer) gutterMark; ActionGroup group = renderer.getPopupMenuActions(); for (AnAction action : group.getChildren(new TestActionEvent())) { TestActionEvent actionEvent = new TestActionEvent(); action.update(actionEvent); String actualText = actionEvent.getPresentation().getText(); if (actualText == null) { actualText = action.getTemplatePresentation().getText(); if (actualText == null) { continue; } } if (textMatcher.test(actualText)) { return action; } } } return null; }
Example #3
Source File: DataSourceListPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
private void clickAdd() { final AnActionButton action = getAnActionButton(ADD); final AnActionEvent event = new TestActionEvent(action); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { action.actionPerformed(event); } }); }
Example #4
Source File: UserDefinedLibraryPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldShowAddPathDialogAfterActioningAddButton() { setUpPanelWithUserLibrary(ENABLED); final AnActionButton action = getAnActionButton(ADD); final AnActionEvent event = new TestActionEvent(action); simulateAction(action, event); assertThat(fileChooserUsedToChooseFiles, is(true)); }
Example #5
Source File: UserDefinedLibraryPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldRemoveSelectedPositionAfterActioningRemoveButton() { cfg.USER_DEFINED_LIBRARY_PATHS = asList(PATH_JAR); setUpPanelWithUserLibrary(ENABLED); final AnActionButton action = getAnActionButton(REMOVE); final AnActionEvent event = new TestActionEvent(action); panel.getPathList().setSelectedIndex(0); simulateAction(action, event); assertThat(window.list(PATH_LIST_NAME).contents().length, is(0)); }
Example #6
Source File: UserDefinedLibraryPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldInvokeChangeListenerAfterChangeOfPathListContents() { cfg.USER_DEFINED_LIBRARY_PATHS = asList(PATH_JAR); setUpPanelWithUserLibrary(ENABLED); panel.setUpChangeListeners(aggregatingPanel, listener); final AnActionButton action = getAnActionButton(REMOVE); final AnActionEvent event = new TestActionEvent(action); panel.getPathList().setSelectedIndex(0); simulateAction(action, event); verifyChangeListenerInvokedForCurrentConfigurationState(); }
Example #7
Source File: VariablesPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
private void clickButton(CommonActionsPanel.Buttons button) { final AnActionButton action = getAnActionButton(button); final AnActionEvent event = new TestActionEvent(action); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { action.actionPerformed(event); } }); }
Example #8
Source File: RunTest.java From phpstorm-plugin with MIT License | 4 votes |
public void testGetCurrentTestMethod() { Run action = new Run(); TestActionEvent e = new TestActionEvent(action); CaretModel cursor = CommonDataKeys.EDITOR.getData(e.getDataContext()).getCaretModel(); // Ensure cursor is at position 0 cursor.moveToOffset(0); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run test : TestWithMethods", e.getPresentation().getText()); // Move cursor on the class declaration cursor.moveToOffset(190); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run test : TestWithMethods", e.getPresentation().getText()); // Move cursor on method declaration: beforeTestMethod cursor.moveToOffset(230); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run test : TestWithMethods", e.getPresentation().getText()); // Move cursor in method body: beforeTestMethod cursor.moveToOffset(345); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run test : TestWithMethods", e.getPresentation().getText()); // Move cursor on method declaration: test__construct_bad cursor.moveToOffset(420); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run TestWithMethods::test__construct_bad", e.getPresentation().getText()); // Move cursor in method body: test__construct_bad cursor.moveToOffset(580); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run TestWithMethods::test__construct_bad", e.getPresentation().getText()); // Move cursor on method declaration: test__construct_ok cursor.moveToOffset(740); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run TestWithMethods::test__construct_ok", e.getPresentation().getText()); // Move cursor in method body: test__construct_ok cursor.moveToOffset(815); action.update(e); assertTrue(e.getPresentation().isEnabledAndVisible()); assertEquals("atoum - run TestWithMethods::test__construct_ok", e.getPresentation().getText()); }