Java 类org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo 实例源码

项目:gw4e.project    文件:RunAsManualWizard.java   
public void feed(boolean exportAsTest, String workbookfile, String workbooktitle, String caseid,
        boolean updatemode, String componentname, String priority, String dateformat) {
    if (exportAsTest) {
        getExportAsTestResultButton().click();
    } else {
        getExportAsTestTemplateButton().click();
    }

    try {
        SWTBotCombo combo = getComboWorkBook();
        combo.setSelection(workbookfile);
    } catch (Exception e) {
        getTextWorkBook().setText(workbookfile);
    }

    getTextWorkbookTitle().setText(workbooktitle);
    getTextCaseId().setText(caseid);
    if (updatemode) {
        getBtnUpdateIfTestcaseid().click();
    }
    getTextComponentName().setText(componentname);
    getComboPriority().setSelection(priority);
    if (dateformat != null)
        getTextDateFormat().setText(dateformat);
}
项目:gw4e.project    文件:GW4EManualRunner.java   
private void setPathGenerator (String pathGenerator) {
    ICondition condition = new DefaultCondition () {

        @Override
        public boolean test() throws Exception {
            try {
                SWTBotCombo combo = bot.comboBoxWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_COMBO_PATH_GENERATOR);
                combo.setSelection(pathGenerator);
            } catch (Exception e) {
                return false;
            }
            return true;
        }

        @Override
        public String getFailureMessage() {
            return "Unable to set " + pathGenerator+ " in the combo";
        }
    };
    bot.waitUntil(condition);
}
项目:gw4e.project    文件:GW4EOfflineRunner.java   
public void validateRun (String configurationName,String projectName,String filepath,boolean printUnvisited,boolean verbose,String startElement,String generator) {
    SWTBotShell shell = openExistingRun (configurationName);

    SWTBotText projectText = shell.bot().textWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_TEXT_ID_PROJECT);
    assertEquals("Wrong project name",projectName,projectText.getText());

    SWTBotText modelText = shell.bot().textWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_TEXT_ID_MODEL);
    assertEquals("Wrong model name",filepath,modelText.getText());

    SWTBotCheckBox verboseButton  = shell.bot().checkBoxWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_BUTTON_ID_VERBOSE);
    assertEquals("Wrong verbose value",verbose,verboseButton.isChecked());

    SWTBotCheckBox unvisitedButton  = shell.bot().checkBoxWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_BUTTON_ID_PRINT_UNVISITED);
    assertEquals("Wrong verbose value",verbose,unvisitedButton.isChecked());

    SWTBotText startElementText = shell.bot().textWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_TEXT_ID_START_ELEMENT);
    assertEquals("Wrong start element",startElement,startElementText.getText());

    SWTBotCombo generatorCombo = shell.bot().comboBoxWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_COMBO_PATH_GENERATOR_ID_MODEL);
    assertEquals("Wrong generator value",generator,generatorCombo.getText());

    SWTBotButton closeButton = bot.button("Close");
    closeButton.click();

    bot.waitUntil(Conditions.shellCloses(shell));
}
项目:gw4e.project    文件:GW4EOfflineRunner.java   
private void selectComboPathGenerator (String path) {
    DefaultCondition condition = new DefaultCondition() {
        @Override
        public boolean test() throws Exception {
            try {

                SWTBotCombo combo = bot.comboBoxWithId(GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,GW4ELaunchConfigurationTab.GW4E_LAUNCH_CONFIGURATION_COMBO_PATH_GENERATOR_ID_MODEL);
                combo.setSelection(path);
                return true;
            } catch (Exception e) {
                e.printStackTrace();
                return false;
            }
        }

        @Override
        public String getFailureMessage() {
            return "Unable to open the path generator combo";
        }
    };
    bot.waitUntil(condition);
}
项目:google-cloud-eclipse    文件:RunOptionsDefaultsComponentTest.java   
private void assertStagingLocationCombo(final String... buckets) {
  bot.waitUntil(new DefaultCondition() {

    @Override
    public boolean test() throws Exception {
      spinEvents();
      return new SWTBotCombo(stagingLocations).itemCount() == buckets.length;
    }

    @Override
    public String getFailureMessage() {
      return "missing staging buckets";
    }
  });
  Assert.assertArrayEquals(buckets, stagingLocations.getItems());
}
项目:scenarioo-example-swtbot-e4    文件:PositionDetailPageObject.java   
public void selectArticleAndGenerateDocu(final int indexArticleCB) {
    final SWTBotCombo combo = bot.comboBoxWithLabel("&Article Number");
    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            combo.widget.setListVisible(true);
            bot.waitUntil(new PopUpOpenedCondition(combo));
        }
    });
    generateDocu("combo_popup_opened");
    combo.setSelection(indexArticleCB);

    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            combo.widget.setListVisible(false);
            bot.waitUntil(new ComboListClosedCondition(combo));
        }
    });
    generateDocu("article_combo_box_selected");
}
项目:scenarioo-example-swtbot-e4    文件:ChangeArticleUpdatesTheOrderOverviewTest.java   
private void selectArticleAndGenerateDocu(final String existingAssignedArticle) {
    final SWTBotCombo combo = bot.comboBoxWithLabel("&Article Number");
    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            combo.widget.setListVisible(true);
            bot.waitUntil(new PopUpOpenedCondition(combo));
        }
    });
    bot.sleep(500);
    scenariooWriterHelper.writeStep("combo_popup_opened", PageName.POSITION_DETAIL, screenshot());
    combo.setSelection(1); // General Ackbar

    Display.getDefault().syncExec(new Runnable() {

        @Override
        public void run() {
            combo.widget.setListVisible(false);
            bot.waitUntil(new PopUpDisappearedCondition(combo));
        }
    });
    bot.sleep(100);
    scenariooWriterHelper.writeStep("article_selected", PageName.POSITION_DETAIL, screenshot());
}
项目:gw4e.project    文件:StaticGeneratorWizard.java   
public void assertExtensionValue(int index,String value) {
    SWTBotCombo combo = bot.comboBoxWithId(ExecutionContextSelectionUIPage.GW4E_CONVERSION_WIDGET_ID,
            ExecutionContextSelectionUIPage.GW4E_CONVERSION_COMBO_ANCESTOR_EXTEND_TEST);
    String[] items = combo.items();
    try {
        org.junit.Assert.assertEquals (value, items[index]);
    } catch (Exception ex) {
        String all = "";
        for (String string : items) {
            all = all + string + ",";
        }
        org.junit.Assert.fail(" Cannot find " + value + " in " + all);
    }
}
项目:dsl-devkit    文件:SwtBotControlUtils.java   
/**
 * Gets the item count.
 *
 * @param control
 *          the control
 * @return the item count
 */
private static int getItemCount(final AbstractSWTBotControl<?> control) {
  int itemCount;
  if (control instanceof SWTBotCCombo) {
    itemCount = ((SWTBotCCombo) control).itemCount();
  } else if (control instanceof SWTBotList) {
    itemCount = ((SWTBotList) control).itemCount();
  } else if (control instanceof SWTBotCombo) {
    itemCount = ((SWTBotCombo) control).itemCount();
  } else {
    throw new WrappedException("Control not supported", null);
  }
  return itemCount;
}
项目:dsl-devkit    文件:SwtWizardBot.java   
/**
 * Makes a selection in the combo box with given label. Selects element of given index.
 *
 * @param boxLabel
 *          the box label
 * @param selectionIndex
 *          the selection index
 */
public void selectInComboBox(final String boxLabel, final int selectionIndex) {
  SWTBotCombo combo = comboBoxWithLabel(boxLabel);
  if (selectionIndex >= combo.itemCount()) {
    throw new IndexOutOfBoundsException(NLS.bind("Illegal selection provided, {0} items exist", combo.itemCount()));
  } else if (selectionIndex == UNDEFINED_COMBO_BOX_INDEX) {
    return; // Do nothing, nothing should be selected
  }
  combo.setSelection(selectionIndex);
}
项目:eavp    文件:ComboDialogTester.java   
/**
 * Checks the default appearance for
 */
@Test
public void checkDefaults() {
    // Create a basic, default dialog.
    dialog = new ComboDialog(getShell(), false);

    // Open the dialog and get an SWTBot for it.
    openDialog();

    // Get the widgets.
    SWTBotLabel label = getInfoLabel();
    SWTBotCombo combo = getCombo();
    SWTBotButton okButton = getOKButton();
    SWTBotButton cancelButton = getCancelButton();

    // Check the default appearance.
    assertEquals("", getBot().activeShell().getText()); // Check the title.
    assertEquals("Please select a value.", label.getText());
    assertEnabled(combo);
    assertEquals("", getCombo().getText());
    assertEquals(0, getCombo().itemCount());
    assertNotEnabled(okButton);
    assertEnabled(cancelButton);
    // Check the default value.
    assertNull(dialog.getValue());

    // Close the dialog.
    closeDialog();

    return;
}
项目:eavp    文件:ComboDialogTester.java   
/**
 * Checks that setting the allowed values properly updates the contents of
 * the underlying combo widget.
 */
@Test
public void checkSetAllowedValues() {

    // Set up some invalid input.
    List<String> listWithNulls = new ArrayList<String>(allowedValues);
    List<String> nullList = null;
    listWithNulls.add(2, null);

    dialog = new ComboDialog(getShell(), false);

    // Trying to set a valid list of allowed values should return true.
    // Trying to set the same set or invalid sets should return false.
    assertTrue(dialog.setAllowedValues(allowedValues));
    assertFalse(dialog.setAllowedValues(allowedValues));
    assertFalse(dialog.setAllowedValues(listWithNulls));
    assertFalse(dialog.setAllowedValues(nullList));

    openDialog();

    SWTBotCombo combo = getCombo();

    // The combo should be enabled.
    assertEnabled(combo);
    // Check all of the items in the combo.
    assertEquals(allowedValues.size(), combo.itemCount());
    String[] items = combo.items();
    for (int i = 0; i < items.length; i++) {
        assertEquals(allowedValues.get(i), items[i]);
    }

    closeDialog();

    return;
}
项目:translationstudio8    文件:XlfEditor.java   
/**
 * @return SWTBotCombo 编辑器中的语言对下拉列表
 */
public SWTBotCombo getLangCombo() {
    Pattern langCode = Pattern.compile("[a-z]{2}(-[A-Z]{2})? -> [a-z]{2}(-[A-Z]{2})?");
    int index = 0;
    while (true) {
        Matcher m = langCode.matcher(editorBot.comboBox(index).getText());
        if (m.find()) {
            return editorBot.comboBox(index);
        }
        index++;
    }
}
项目:translationstudio8    文件:XlfEditor.java   
/**
 * 选择指定的语言对
 * @param srcLang
 *            源语言代码
 * @param tgtLang
 *            目标语言代码
 */
public void selectLangPair(String srcLang, String tgtLang) {
    String langPair = srcLang + " -> " + tgtLang;
    SWTBotCombo langCombo = getLangCombo();
    langCombo.setSelection(langPair);
    bot.waitUntil(new IsComboEquals(langCombo, langPair));
    SWTBotAssert.assertText(langPair, langCombo);
}
项目:translationstudio8    文件:XlfEditor.java   
/**
 * 得到文本段过滤器下拉列表
 * @return SWTBotCombo 文本段过滤器下拉列表
 */
public SWTBotCombo getSegFilterCombo() {
    String defaultFilter = TsUIConstants.getString("cmbSegFilterAllSegments");
    int index = 0;
    while (true) {
        SWTBotCombo segFilterCombo = editorBot.comboBox(index);
        if (segFilterCombo.getText().equals(defaultFilter)) {
            return segFilterCombo;
        }
        index++;
    }
}
项目:translationstudio8    文件:XlfEditor.java   
/**
 * 选择指定的文本段过滤器
 * @param filterName
 *            过滤器名称
 */
public void selectSegFilter(final String filterName) {
    SWTBotCombo segFilterCombo = getSegFilterCombo();
    segFilterCombo.setSelection(filterName);
    bot.waitUntil(new IsComboEquals(segFilterCombo, filterName));
    SWTBotAssert.assertText(filterName, segFilterCombo);
}
项目:eclipse-plugin    文件:SWTBotBaseTest.java   
public void importCodenvyProject(String workspaceName, String projectName) {
    final SWTBotShell shell = openImportProjectWizardPage();

    final SWTBotCombo workspaceCombo = bot.comboBox(0);
    workspaceCombo.setSelection(workspaceName);

    final SWTBotTable projectTable = bot.table(0);
    bot.waitUntil(new TableHasRows(projectTable));

    for (int i = 0; i < projectTable.rowCount(); i++) {
        if (projectTable.cell(i, 0).equals(projectName)) {
            projectTable.getTableItem(i).check();
        }
    }

    bot.table(0).getTableItem(projectName).check();
    bot.button("Finish").click();

    bot.waitUntil(shellCloses(shell));
    try {

        Job.getJobManager().join(CodenvyPlugin.FAMILY_CODENVY, null);

    } catch (OperationCanceledException | InterruptedException e) {
        throw new RuntimeException(e);
    }
}
项目:eclipse-plugin    文件:ProjectWizardPageTest.java   
@Test
public void testThatAllWorkspacesAreAvailable() {
    openImportProjectWizardPage();

    final SWTBotCombo workspaceComboBox = bot.comboBox(0);

    Assert.assertEquals(MOCK_WORKSPACE_NAME, workspaceComboBox.items()[0]);
    Assert.assertTrue(workspaceComboBox.itemCount() == 4);
}
项目:eclipse-plugin    文件:ProjectWizardPageTest.java   
@Test
public void testThatWorkingSetComboAndButtonAreDisabledByDefault() {
    openImportProjectWizardPage();

    final SWTBotCombo workingSetComboBox = bot.comboBox(1);
    final SWTBotButton workingSetSelectButton = bot.button("Select...");

    Assert.assertFalse(workingSetComboBox.isEnabled());
    Assert.assertFalse(workingSetSelectButton.isEnabled());
}
项目:tmxeditor8    文件:XlfEditor.java   
/**
 * @return SWTBotCombo 编辑器中的语言对下拉列表
 */
public SWTBotCombo getLangCombo() {
    Pattern langCode = Pattern.compile("[a-z]{2}(-[A-Z]{2})? -> [a-z]{2}(-[A-Z]{2})?");
    int index = 0;
    while (true) {
        Matcher m = langCode.matcher(editorBot.comboBox(index).getText());
        if (m.find()) {
            return editorBot.comboBox(index);
        }
        index++;
    }
}
项目:tmxeditor8    文件:XlfEditor.java   
/**
 * 选择指定的语言对
 * @param srcLang
 *            源语言代码
 * @param tgtLang
 *            目标语言代码
 */
public void selectLangPair(String srcLang, String tgtLang) {
    String langPair = srcLang + " -> " + tgtLang;
    SWTBotCombo langCombo = getLangCombo();
    langCombo.setSelection(langPair);
    bot.waitUntil(new IsComboEquals(langCombo, langPair));
    SWTBotAssert.assertText(langPair, langCombo);
}
项目:tmxeditor8    文件:XlfEditor.java   
/**
 * 得到文本段过滤器下拉列表
 * @return SWTBotCombo 文本段过滤器下拉列表
 */
public SWTBotCombo getSegFilterCombo() {
    String defaultFilter = TsUIConstants.getString("cmbSegFilterAllSegments");
    int index = 0;
    while (true) {
        SWTBotCombo segFilterCombo = editorBot.comboBox(index);
        if (segFilterCombo.getText().equals(defaultFilter)) {
            return segFilterCombo;
        }
        index++;
    }
}
项目:tmxeditor8    文件:XlfEditor.java   
/**
 * 选择指定的文本段过滤器
 * @param filterName
 *            过滤器名称
 */
public void selectSegFilter(final String filterName) {
    SWTBotCombo segFilterCombo = getSegFilterCombo();
    segFilterCombo.setSelection(filterName);
    bot.waitUntil(new IsComboEquals(segFilterCombo, filterName));
    SWTBotAssert.assertText(filterName, segFilterCombo);
}
项目:gw4e.project    文件:OutLineView.java   
private void setOperatorComboTo(String value) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_WEIGHT_OPERATOR_COMBO);
    combo.setSelection(value);
}
项目:gw4e.project    文件:OutLineView.java   
public void setBlockedComboToNo () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_BLOCKED_COMBO);
    combo.setSelection(ThreeStateChoice.NO.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setBlockedComboToYes () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_BLOCKED_COMBO);
    combo.setSelection(ThreeStateChoice.YES.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setBlockedComboToNoValue () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_BLOCKED_COMBO);
    combo.setSelection(ThreeStateChoice.NO_VALUE.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setInitScriptComboToNo () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_INITSCRIPT_COMBO);
    combo.setSelection(ThreeStateChoice.NO.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setInitScriptComboToYes () {
    SWTBotCombo combo = bot.comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_INITSCRIPT_COMBO);
    combo.setSelection(ThreeStateChoice.YES.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setInitScriptComboToNoValue () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_INITSCRIPT_COMBO);
    combo.setSelection(ThreeStateChoice.NO_VALUE.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setSharedComboToNo () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_SHARED_COMBO);
    combo.setSelection(ThreeStateChoice.NO.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setSharedComboToYes ( ) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_SHARED_COMBO);
    combo.setSelection(ThreeStateChoice.YES.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setSharedComboToNoValue ( ) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_SHARED_COMBO);
    combo.setSelection(ThreeStateChoice.NO_VALUE.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setGuardComboToNo () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_GUARD_COMBO);
    combo.setSelection(ThreeStateChoice.NO.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setGuardComboToYes ( ) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_GUARD_COMBO);
    combo.setSelection(ThreeStateChoice.YES.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setGuardComboToNoValue ( ) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_GUARD_COMBO);
    combo.setSelection(ThreeStateChoice.NO_VALUE.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setActionComboToNO () {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_ACTION_COMBO);
    combo.setSelection(ThreeStateChoice.NO.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setActionComboToYes ( ) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_ACTION_COMBO);
    combo.setSelection(ThreeStateChoice.YES.getLabel());
}
项目:gw4e.project    文件:OutLineView.java   
public void setActionComboToNoValue ( ) {
    SWTBotCombo combo = botView.bot().comboBoxWithId(OutLineComposite.GW_WIDGET_ID, OutLineComposite.GW_OUTLINE_ACTION_COMBO);
    combo.setSelection(ThreeStateChoice.NO_VALUE.getLabel());
}
项目:gw4e.project    文件:RunAsManualWizard.java   
private SWTBotCombo getComboWorkBook() {
    return bot.comboBoxWithId(org.gw4e.eclipse.wizard.runasmanual.SaveTestPage.GW4E_MANUAL_ELEMENT_ID,
            org.gw4e.eclipse.wizard.runasmanual.SaveTestPage.GW4E_MANUAL_COMBO_WORKBOOK_ID);
}