org.fest.swing.edt.GuiTask Java Examples
The following examples show how to use
org.fest.swing.edt.GuiTask.
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: IdeaFrameFixture.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Gets the focus back to Android Studio if it was lost */ public void requestFocusIfLost() { KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Wait.seconds(5).expecting("a component to have the focus").until(() -> { // Keep requesting focus until it is obtained by a component which is showing. Since there is no guarantee that the request focus will // be granted keep asking until it is. This problem has appeared at least when not using a window manager when running tests. The focus // can sometimes temporarily be held by a component that is not showing, when closing a dialog for example. This is a transition state // and we want to make sure to keep going until the focus is held by a stable component. Component focusOwner = keyboardFocusManager.getFocusOwner(); if (focusOwner == null || !focusOwner.isShowing()) { if (SystemInfo.isMac) { robot().click(target(), new Point(1, 1)); // Simulate title bar click } GuiTask.execute(() -> target().requestFocus()); return false; } return true; }); }
Example #2
Source File: BaseGuiTest.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Override @Before public void setUp() throws Exception { super.setUp(); final PanelTestingFrame frame = GuiActionRunner.execute(new GuiQuery<PanelTestingFrame>() { protected PanelTestingFrame executeInEDT() { return getPanelTestingFrame(); } }); GuiActionRunner.execute(new GuiTask() { protected void executeInEDT() { disableTooltipAndBlinkRadeForChildrenToSatisfyIdeasUsefulTestCase(frame); } }); window = new FrameFixture(frame); window.show(); }
Example #3
Source File: DataSourceListPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Test public void shouldAddNewDataSourceAfterExecutionInvoked() { panel.populateWithConfigurations(asList(notDefaultDataSource)); clickAdd(); GuiActionRunner.execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { addDataSourceActionExecutor.execute(XQueryDataSourceType.SAXON); } }); JListFixture list = window.list().cellReader(new DataSourceListCellReader()); list.requireSelection(1); assertThat(list.contents()[1], is(XQueryDataSourceType.SAXON.getPresentableName())); }
Example #4
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 #5
Source File: DataSourceListPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 6 votes |
@Test public void shouldSwapObjectsInModelAndMarkOthersNotDefaultIfUpdatedWithDefault() { panel.populateWithConfigurations(asList(defaultDataSource, defaultDataSource)); window.list().selectItem(0); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { panel.updateCurrentlySelectedItemWithData(defaultDataSource); } }); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { assertThat(panel.getSelectedDataSource(), is(defaultDataSource)); assertThat(panel.getSelectedDataSource().DEFAULT, is(true)); assertThat(panel.getCurrentConfigurations().get(1).DEFAULT, is(false)); } }); }
Example #6
Source File: SwingElementFinder.java From ats-framework with Apache License 2.0 | 5 votes |
private static void appendComponents( final StringBuilder message, final Collection<Component> found ) { execute(new GuiTask() { protected void executeInEDT() { for (Component c : found) message.append(LINE_SEPARATOR).append(format(c)); } }); }
Example #7
Source File: IdeaFrameFixture.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * IJ doesn't always refresh the state of the toolbar buttons. This forces it to refresh. */ @NotNull public IdeaFrameFixture updateToolbars() { execute(new GuiTask() { @Override protected void executeInEDT() { ActionToolbarImpl.updateAllToolbarsImmediately(); } }); return this; }
Example #8
Source File: IdeaFrameFixture.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@NotNull public AvdManagerDialogFixture invokeAvdManager() { // The action button is prone to move during rendering so that robot.click() could miss. // So, we use component's click here directly. ActionButtonFixture actionButtonFixture = findActionButtonByActionId("Android.RunAndroidAvdManager", 30); execute(new GuiTask() { @Override protected void executeInEDT() { actionButtonFixture.target().click(); } }); return AvdManagerDialogFixture.find(robot(), myIdeFrameFixture); }
Example #9
Source File: DataSourceDetailsPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldAddNewPanelAfterDisplayDetailsInvoked() { final XQueryDataSourceConfiguration cfg = new XQueryDataSourceConfiguration("name", XQueryDataSourceType.SAXON); final ConfigurationChangeListener listener = mock(ConfigurationChangeListener.class); GuiActionRunner.execute(new GuiTask() { protected void executeInEDT() { panel.displayDetails(cfg, listener); } }); assertThat(panel.getComponents().length, is(1)); verify(panel).add(isA(JPanel.class), eq(BorderLayout.NORTH)); }
Example #10
Source File: DataSourceListPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldReturnSelectedDataSource() { panel.populateWithConfigurations(asList(notDefaultDataSource, defaultDataSource)); GuiActionRunner.execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { assertThat(panel.getSelectedDataSource(), is(notDefaultDataSource)); } }); }
Example #11
Source File: DataSourceListPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
@Test public void shouldOnlySwapObjectsInModelIfUpdatedWithNotDefault() { panel.populateWithConfigurations(asList(defaultDataSource)); window.list().selectItem(0); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { panel.updateCurrentlySelectedItemWithData(notDefaultDataSource); assertThat(panel.getSelectedDataSource(), is(notDefaultDataSource)); assertThat(panel.getSelectedDataSource().DEFAULT, is(false)); } }); }
Example #12
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 #13
Source File: UserDefinedLibraryPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
private void simulateAction(final AnActionButton action, final AnActionEvent event) { execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { action.actionPerformed(event); } }); }
Example #14
Source File: ContextItemPanelGuiTest.java From intellij-xquery with Apache License 2.0 | 5 votes |
private void initPanel(final boolean isEnabled, final String content, final String filePath, final boolean contextItemFromEditorEnabled, final String type) { GuiActionRunner.execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { XQueryRunConfiguration configuration = mock(XQueryRunConfiguration.class); given(configuration.isContextItemEnabled()).willReturn(isEnabled); given(configuration.getContextItemText()).willReturn(content); given(configuration.getContextItemFile()).willReturn(filePath); given(configuration.isContextItemFromEditorEnabled()).willReturn(contextItemFromEditorEnabled); given(configuration.getContextItemType()).willReturn(type); panel.init(configuration); } }); }
Example #15
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); } }); }