当前位置: 首页>>代码示例>>Java>>正文


Java JButtonFixture类代码示例

本文整理汇总了Java中org.fest.swing.fixture.JButtonFixture的典型用法代码示例。如果您正苦于以下问题:Java JButtonFixture类的具体用法?Java JButtonFixture怎么用?Java JButtonFixture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JButtonFixture类属于org.fest.swing.fixture包,在下文中一共展示了JButtonFixture类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: popdownButtonTortureTest

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@GUITest
@Test
public void popdownButtonTortureTest() {
  window.textBox("searchField").enterText("calf");
  window.button("searchButton").click();
  window.label("statusLabel").requireText(overviewFor("calf"));
  // triggers Noun RelationTypeComboBox to show JPopupMenu
  final JButtonFixture nounButton = window.button("RelationTypeComboBox::Noun");
  nounButton.click();
  final JPopupMenu popupMenu = nounButton.component().getComponentPopupMenu();
  final JPopupMenuFixture popup = new JPopupMenuFixture(window.robot, popupMenu);
  popup.requireVisible();
  nounButton.click();
  popup.requireNotVisible();
  nounButton.pressAndReleaseKeys(KeyEvent.VK_ENTER);
  popup.requireVisible();
  nounButton.click(); // 1
  nounButton.pressAndReleaseKeys(KeyEvent.VK_SPACE); // 2
  nounButton.click(); // 3
  nounButton.pressAndReleaseKeys(KeyEvent.VK_ENTER); // 4
  nounButton.click(); // 5
  // odd number of "clicks" should leave popup not visible
  popup.requireNotVisible();
}
 
开发者ID:nezda,项目名称:yawni,代码行数:25,代码来源:BrowserFESTTest.java

示例2: hyponymsThenNoMatchTest

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@GUITest
  @Test
  public void hyponymsThenNoMatchTest() {
    final JTextComponentFixture searchField = window.textBox("searchField");
    searchField.enterText("kid").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    final JButtonFixture nounButton = window.button("RelationTypeComboBox::Noun");
    nounButton.click();
    final JPopupMenu popupMenu = nounButton.component().getComponentPopupMenu();
    final JPopupMenuFixture popup = new JPopupMenuFixture(window.robot, popupMenu);
//    popup.menuItemWithPath("Hypernyms (kid is a kind of...)").click();

    // key stroke goes to popup
    window.robot.type('h');
    window.robot.type('y');
    window.robot.type('p');
    window.robot.type('e');
    window.robot.pressAndReleaseKeys(KeyEvent.VK_ENTER);
    
    searchField.enterText("performant").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    window.label("statusLabel").requireText("No matches found.");
    searchField.enterText("").pressAndReleaseKeys(KeyEvent.VK_ENTER);
//    searchField.enterText(" ").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    window.label("statusLabel").requireText("No matches found.");
//    window.label("statusLabel").requireText("Enter search word and press return");
  }
 
开发者ID:nezda,项目名称:yawni,代码行数:26,代码来源:BrowserFESTTest.java

示例3: click

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
/**
 * Click button
 * @throws VerificationException if the element doesn't exist
 */
@Override
@PublicAtsApi
public void click() {

    new SwingElementState(this).waitToBecomeExisting();

    ((JButtonFixture) SwingElementLocator.findFixture(this)).click();
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:13,代码来源:SwingButton.java

示例4: isEnabled

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
/**
 * Check whether the button is Enabled or Disabled
 * @return <code>true</code> if the button is enabled
 */
@PublicAtsApi
public boolean isEnabled() {

    new SwingElementState(this).waitToBecomeExisting();

    return ((JButtonFixture) SwingElementLocator.findFixture(this)).target.isEnabled();
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:12,代码来源:SwingButton.java

示例5: createNew

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
public AvdEditWizardFixture createNew() {
  JButton newAvdButton = findButtonByText("Create Virtual Device...");
  final JButtonFixture button = new JButtonFixture(robot(), newAvdButton);
  button.requireEnabled();
  button.requireVisible();
  button.click();
  return AvdEditWizardFixture.find(robot());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AvdManagerDialogFixture.java

示例6: click

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
private void click() throws ClassNotFoundException {
  final Class<?> comboBoxButtonClass = getClass().getClassLoader().loadClass(ComboBoxAction.class.getCanonicalName() + "$ComboBoxButton");
  final ActionButtonFixture runButton = projectFrame.findRunApplicationButton();

  Container actionToolbarContainer = execute(new GuiQuery<Container>() {
    @Override
    protected Container executeInEDT() throws Throwable {
      return runButton.target().getParent();
    }
  });
  assertNotNull(actionToolbarContainer);

  JButton comboBoxButton = robot.finder().find(actionToolbarContainer, new GenericTypeMatcher<JButton>(JButton.class) {
    @Override
    protected boolean isMatching(@NotNull JButton component) {
      return comboBoxButtonClass.isInstance(component);
    }
  });

  final JButtonFixture comboBoxButtonFixture = new JButtonFixture(robot, comboBoxButton);
  pause(new Condition("Wait until comboBoxButton is enabled") {
    @Override
    public boolean test() {
      //noinspection ConstantConditions
      return execute(new GuiQuery<Boolean>() {
        @Override
        protected Boolean executeInEDT() throws Throwable {
          return comboBoxButtonFixture.target().isEnabled();
        }
      });
    }
  }, SHORT_TIMEOUT);
  comboBoxButtonFixture.click();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:ComboBoxActionFixture.java

示例7: testShowHideLog

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@Test
public void testShowHideLog() {
    FrameFixture console = createConsole(true);
    try {
        JButtonFixture showHideButton = console.button(LogShowHideComponent.class.getSimpleName());
        try {
            console.scrollPane(LogDisplayComponent.class.getSimpleName());
            showHideButton.click();
            try {
                console.scrollPane(LogDisplayComponent.class.getSimpleName());
                fail("ShowHide scroll pane should now be hidden.");
            } catch (ComponentLookupException e3) {
                showHideButton.click();
                try {
                    console.scrollPane(LogDisplayComponent.class.getSimpleName());
                    assertTrue("Successfully toggling visibility", true);
                } catch (ComponentLookupException e4) {
                    fail("ShowHide scroll pane should now be visible.");
                }
            }
        } catch (ComponentLookupException e2) {
            fail("ShowHide scroll pane should not be hidden at first.");
        }
    } catch (ComponentLookupException e1) {
        fail("ShowHide button is missing.");
    }
}
 
开发者ID:Elegie,项目名称:luchess,代码行数:28,代码来源:ConsoleTest.java

示例8: testStartStopServer

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@Test
public void testStartStopServer() {
    FrameFixture console = createConsole(true);
    JButtonFixture startStopButton = console.button(WebAppStartStopComponent.class.getSimpleName());
    JScrollPaneFixture logViewContainer = console.scrollPane(LogDisplayComponent.class.getSimpleName());
    JTextArea logViewArea = (JTextArea) logViewContainer.component().getViewport().getView();
    assertFalse(serverService.isStarted());
    assertTrue(serverService.isStopped());
    assertTrue(logViewArea.getText().isEmpty());
    startStopButton.click();
    assertTrue(serverService.isStarted());
    assertFalse(serverService.isStopped());
    assertTrue(logViewArea.getText().contains(ServerServiceHelper.STARTED));
    assertTrue(logViewArea.getText().contains(WebAppServiceHelper.CONTEXT_PATH));
    startStopButton.click();
    assertFalse(serverService.isStarted());
    assertTrue(serverService.isStopped());
    assertTrue(logViewArea.getText().contains(ServerServiceHelper.STOPPED));

    serverService.setExceptionOnStart(true);
    String textStopped = startStopButton.component().getText();
    startStopButton.click();
    assertFalse(serverService.isStarted());
    assertTrue(serverService.isStopped());
    assertEquals(textStopped, startStopButton.component().getText());
    serverService.setExceptionOnStart(false);

    serverService.setExceptionOnStop(true);
    startStopButton.click();
    String textStarted = startStopButton.component().getText();
    startStopButton.click();
    assertTrue(serverService.isStarted());
    assertFalse(serverService.isStopped());
    assertEquals(textStarted, startStopButton.component().getText());
    serverService.setExceptionOnStop(false);
    startStopButton.click();
    assertEquals(textStopped, startStopButton.component().getText());
}
 
开发者ID:Elegie,项目名称:luchess,代码行数:39,代码来源:ConsoleTest.java

示例9: unfortunateGerbilTestKeyboardTest

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@GUITest
@Test
public void unfortunateGerbilTestKeyboardTest() {
  final JTextComponentFixture searchField = window.textBox("searchField");
  searchField.focus().requireFocused();
  searchField.enterText("gerbil").pressAndReleaseKeys(KeyEvent.VK_ENTER);
  window.label("statusLabel").requireText(overviewFor("gerbil"));
  final JButtonFixture nounButton = window.button("RelationTypeComboBox::Noun");
  // clear searchField
  searchField.enterText(" ").pressAndReleaseKeys(KeyEvent.VK_ENTER);

  // since Noun triggers an action that looks at the searchField's text
  // and expects it to be compatible with itself, it must be disabled
  nounButton.requireDisabled();
}
 
开发者ID:nezda,项目名称:yawni,代码行数:16,代码来源:BrowserFESTTest.java

示例10: testSyncMissingAppCompat

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@Test @IdeGuiTest
public void testSyncMissingAppCompat() throws IOException {
  if (myAndroidRepoPath.isDirectory()) {
    // Instead of deleting the Android repo folder, we rename it and later on restore it in a @SetUp method, so if this fails, the SDK
    // will be in good state.
    delete(myAndroidRepoTempPath);
    rename(myAndroidRepoPath, myAndroidRepoTempPath);
  }
  assertThat(myAndroidRepoPath).doesNotExist();

  IdeFrameFixture projectFrame = importSimpleApplication();

  projectFrame.requestProjectSync().waitForGradleProjectSyncToFinish();

  MessageFixture message =
    projectFrame.getMessagesToolWindow().getGradleSyncContent().findMessage(ERROR, firstLineStartingWith("Failed to resolve:"));

  HyperlinkFixture hyperlink = message.findHyperlink("Install Repository and sync project");
  hyperlink.clickAndContinue();

  // TODO implement a proper "SDK Quick Fix wizard" fixture that wraps a SdkQuickfixWizard
  DialogFixture quickFixDialog = findDialog(new GenericTypeMatcher<Dialog>(Dialog.class) {
    @Override
    protected boolean isMatching(@NotNull Dialog dialog) {
      return "Install Missing Components".equals(dialog.getTitle());
    }
  }).withTimeout(SHORT_TIMEOUT.duration()).using(myRobot);

  final JButtonFixture finish = quickFixDialog.button(withText("Finish"));

  // Wait until installation is finished. By then the "Finish" button will be enabled.
  pause(new Condition("Android Support Repository is installed") {
    @Override
    public boolean test() {
      //noinspection ConstantConditions
      return execute(new GuiQuery<Boolean>() {
        @Override
        protected Boolean executeInEDT() {
          return finish.target().isEnabled();
        }
      });
    }
  }, LONG_TIMEOUT);

  // Installation finished. Click finish to resync project.
  finish.click();

  projectFrame.waitForGradleProjectSyncToFinish().waitForBackgroundTasksToFinish();

  assertThat(myAndroidRepoPath).as("Android Support Repository must have been reinstalled").isDirectory();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:GradleSyncTest.java

示例11: testDownloadSdkSource

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@Test @IdeGuiTest
public void testDownloadSdkSource() throws IOException {
  if (mySdk == null) {
    printPlatformNotFound();
    skip("testDownloadSdkSource");
    return;
  }

  if (mySdkSourcePath.isDirectory()) {
    delete(mySdkSourceTmpPath);
    rename(mySdkSourcePath, mySdkSourceTmpPath);
  }
  updateSdkSourceRoot(mySdk);

  IdeFrameFixture projectFrame = importSimpleApplication();
  final EditorFixture editor = projectFrame.getEditor();

  final VirtualFile classFile = findActivityClassFile();
  editor.open(classFile, EditorFixture.Tab.EDITOR);

  acceptLegalNoticeIfNeeded();

  // Download the source.
  findNotificationPanel(projectFrame).performAction("Download");

  DialogFixture downloadDialog = findDialog(withTitle("SDK Quickfix Installation")).withTimeout(SHORT_TIMEOUT.duration()).using(myRobot);
  final JButtonFixture finish = downloadDialog.button(withText("Finish"));

  // Wait until installation is finished. By then the "Finish" button will be enabled.
  pause(new Condition("Android source is installed") {
    @Override
    public boolean test() {
      return finish.isEnabled();
    }
  });
  finish.click();

  pause(new Condition("Source file is opened") {
    @Override
    public boolean test() {
      return !classFile.equals(editor.getCurrentFile());
    }
  }, SHORT_TIMEOUT);

  VirtualFile sourceFile = editor.getCurrentFile();
  assertNotNull(sourceFile);
  assertIsActivityJavaFile(sourceFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:AndroidSdkSourceAttachTest.java

示例12: kittenKeyboardTest

import org.fest.swing.fixture.JButtonFixture; //导入依赖的package包/类
@GUITest
  @Test
  public void kittenKeyboardTest() {
    final JTextComponentFixture searchField = window.textBox("searchField");
    final JTextComponent searchFieldComponent = searchField.component();
    assertThat(searchFieldComponent).isNotNull();
    searchField.requireFocused(); // defaults to focused
//    searchField.focus().requireFocused();
    searchField.enterText("kitten").pressAndReleaseKeys(KeyEvent.VK_ENTER);
    window.label("statusLabel").requireText(overviewFor("kitten"));
    final JButtonFixture nounButton = window.button("RelationTypeComboBox::Noun");
    // transfer focus from searchField to Noun button with keyboard
    searchField.pressAndReleaseKeys(KeyEvent.VK_TAB);
    nounButton.requireFocused();
    // triggers Noun RelationTypeComboBox to show JPopupMenu
    nounButton.pressAndReleaseKeys(KeyEvent.VK_ENTER);
    // key stroke goes to popup
    window.robot.type('s');

    // only need popup to verify correctness
    final JPopupMenu popupMenu = nounButton.component().getComponentPopupMenu();
    assertThat(popupMenu).isNotNull();
    final JPopupMenuFixture popup = new JPopupMenuFixture(window.robot, popupMenu);
    window.robot.waitForIdle();
    popup.requireVisible();
    final JMenuItem sensesItem = popup.menuItemWithPath("Senses").component();
    assertThat(sensesItem.isArmed()).isTrue();
    assertThat(sensesItem.hasFocus()).isFalse();
//    assertThat(sensesItem.isSelected()).isFalse();
    
    assertThat(popup.menuItemWithPath("Derivationally related forms").component().isArmed()).isFalse();

    // key stroke goes to popup
    window.robot.type('s');
    window.robot.type('e');
    assertThat(sensesItem.isArmed()).isTrue();

    // hit enter
    window.robot.pressAndReleaseKeys(KeyEvent.VK_ENTER);
    window.label("statusLabel").requireText("Synonyms search for noun \"kitten\"");
  }
 
开发者ID:nezda,项目名称:yawni,代码行数:42,代码来源:BrowserFESTTest.java


注:本文中的org.fest.swing.fixture.JButtonFixture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。