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

项目: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));
}
项目:google-cloud-eclipse    文件:OptInDialogTest.java   
private void closeDialog(CloseAction closeAction) {
  switch (closeAction) {
    case PRESS_OK:
      Button okButton = CompositeUtil.findButton(dialog.getShell(), "Share");
      assertNotNull(okButton);
      new SWTBotButton(okButton).click();
      break;

    case PRESS_CANCEL:
      Button cancelButton = CompositeUtil.findButton(dialog.getShell(), "Do Not Share");
      assertNotNull(cancelButton);
      new SWTBotButton(cancelButton).click();
      break;

    case CLOSE_SHELL:
      dialog.getShell().close();
      break;

    case DISPOSE_SHELL:
      dialog.getShell().dispose();
      break;

    default:
      throw new RuntimeException("bug");
  }
}
项目:emfstore-rest    文件:UIAddTagControllerTest.java   
private ESPathQuery createTag() throws ESException {
    ESPrimaryVersionSpec baseVersion = localProject.getBaseVersion();
    createPlayerAndCommit();
    ESPathQuery pathQuery = ESHistoryQuery.FACTORY
        .pathQuery(baseVersion, localProject.getBaseVersion(), true, true);
    List<ESHistoryInfo> historyInfos = localProject.getHistoryInfos(pathQuery, new NullProgressMonitor());
    assertEquals(2, historyInfos.size());
    final ESHistoryInfo historyInfo = historyInfos.get(1);
    assertEquals(2, historyInfo.getTagSpecs().size());
    UIThreadRunnable.asyncExec(
        new VoidResult() {
            public void run() {
                UIAddTagController addTagController = new UIAddTagController(bot.getDisplay().getActiveShell(),
                    localProject, historyInfo);
                addTagController.execute();
            }
        });

    bot.table(0).select(0);
    SWTBotButton button = bot.button("OK");
    button.click();
    return pathQuery;
}
项目:gw4e.project    文件:GW4EProject.java   
public boolean prepareconvertTo(String project, String packageRootFragment, String pkg, String targetFilename,
        String targetFormat, String checkTestBox,String annotationStartElement,
        String targetvertex,String startElement,String [] contexts, String... nodes) {
    ConvertDialog cd = prepareConvertTo(project, packageRootFragment, pkg, targetFilename, targetFormat, nodes);
    boolean ret = cd.create(project, packageRootFragment, pkg, targetFilename, targetFormat, checkTestBox, false);
    if (!ret) {
        SWTBotShell shell = bot.shell("GW4E Conversion File");
        shell.bot().button("Cancel").click();
        bot.waitUntil(Conditions.shellCloses(shell));
        return false;
    }

    SWTBotButton fbutton = bot.button("Next >");
    fbutton.click();

    GraphWalkerTestUIPageTest gwid = new GraphWalkerTestUIPageTest(cd.getShell());
    gwid.completeFullPage("random(edge_coverage(100))", "GROUP1;GROUP2", annotationStartElement);
    gwid.nextPage();

    JUnitGraphWalkerTestUIPageTest jugw = new JUnitGraphWalkerTestUIPageTest(cd.getShell());
    jugw.completeFullPage(targetvertex, startElement, contexts);
    jugw.nextPage();

    GraphWalkerTestHookPageTest gwth = new GraphWalkerTestHookPageTest(cd.getShell());
    gwth.completeFullPage();
    gwth.finish();

    bot.waitUntil(Conditions.shellCloses(cd.getShell()), 6 * SWTBotPreferences.TIMEOUT);

    return true;
}
项目:gw4e.project    文件:RunAsManualWizard.java   
public void assertNextStepPage(SWTBotShell page, String description, String result) {
    SWTBotButton nextButton = bot.button("&Next >");
    nextButton.click();
    String defaultResult = MessageUtil.getString("enter_a_result_if_verification_failed");
    if (result != null && result.trim().length() > 0 && !result.equals(defaultResult)) {
        new StepPage().setResult(page, result).setFailed(page);
    }
    new StepPage().assertActionAndResult(page, description, result);
}
项目:gw4e.project    文件:RunAsManualWizard.java   
public void feed(boolean exportAsTest, String workbookfile, String workbooktitle, String caseid, boolean updatemode,
        String componentname, String priority, String dateformat) {
    SWTBotButton nextButton = bot.button("&Next >");
    nextButton.click();
    SavePage page = new SavePage();
    page.feed(exportAsTest, workbookfile, workbooktitle, caseid, updatemode, componentname, priority, dateformat);
}
项目:gw4e.project    文件:ConvertDialog.java   
public boolean create (String project,String packageRootFragment, String pkg,String targetFilename,String targetFormat,String checkTestBox,boolean finish) {
    try {
        prepare  (project,packageRootFragment,pkg,targetFilename,targetFormat,  checkTestBox);
        if (!finish) return true;
        SWTBotButton fbutton  = bot.button("Finish");
        fbutton.click();
        bot.waitUntil(Conditions.shellCloses(this.shell), 10 * SWTBotPreferences.TIMEOUT);
        return true;
    } catch (TimeoutException e) {
        return false;
    }
}
项目:gw4e.project    文件:GW4EProjectProperties.java   
public void ok ( ) {
    String name="OK";
    if (GW4EPlatform.isEclipse47()) {
        name = "Apply and Close";
    }
    SWTBotButton button = shell.bot().button(name);
    button.click();
    parentBot.waitUntil(Conditions.shellCloses(shell)); 
}
项目:gw4e.project    文件:ImportHelper.java   
public static void importProjectFromZip(SWTWorkbenchBot bot, String path) {
    int timeout = 10000;
    bot.menu("File").menu("Import...").click();
    bot.waitUntil(Conditions.shellIsActive("Import"));
    SWTBotShell shell = bot.shell("Import").activate();

    shell.bot().tree().expandNode("General").select("Existing Projects into Workspace");
    shell.bot().button("Next >").click();
    shell.bot().radio("Select archive file:").click();

    shell.bot().comboBox(1).setText(path);
    shell.bot().comboBox(1).pressShortcut(SWT.CR, SWT.LF);
    SWTBotButton finishButton = shell.bot().button("Finish");
    ICondition buttonEnabled = new DefaultCondition() {
        @Override
        public boolean test() throws Exception {
            return finishButton.isEnabled();
        }

        @Override
        public String getFailureMessage() {
            return "Finish button not enabled";
        }
    };

    shell.bot().waitUntil(buttonEnabled, timeout);
    finishButton.click();

    bot.waitUntil(Conditions.shellCloses(shell), timeout);
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
void addRowValue(final String stringtoadd) {
    SWTBotTable table = getTable();
    bot.waitUntil(waitForTable());

    int currentCount = table.rowCount();
    SWTBotButton addButton = getAddButton();
    addButton.click();
    waitForRowAdded(table, currentCount + 1);
    int row = 0;

    editRowWithValue (table,MessageUtil.getString("enteranewvalue"), stringtoadd);

    leaveEditingCellClickingOnAnotherCell(table, row + 1);
    waitForExpectedValueAtRowCol(table,stringtoadd);
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
void removeRow( String stringtoremove) {
    SWTBotTable table = getTable();
    bot.waitUntil(waitForTable());

    selectRowWithValue(table,stringtoremove);
    waitForExpectedValueAtRowCol(table,stringtoremove);

    int currentCount = table.rowCount();
    SWTBotButton removeButton = getRemoveButton();

    removeButton.click();
    waitForRowAdded(table, currentCount - 1);
    waitForNotExpectedValueAtRowCol(table,stringtoremove);
}
项目:google-cloud-eclipse    文件:SwtBotTestingUtilities.java   
/** Click the button, wait for the window change. */
public static void clickButtonAndWaitForWindowChange(SWTBot bot, final SWTBotButton button) {
  performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      button.click();
    }
  });
}
项目:google-cloud-eclipse    文件:SwtBotTestingUtilities.java   
/** Click the button, wait for the window close. */
public static void clickButtonAndWaitForWindowClose(SWTBot bot, final SWTBotButton button) {
  performAndWaitForWindowClose(bot, new Runnable() {
    @Override
    public void run() {
      button.click();
    }
  });
}
项目:dsl-devkit    文件:SwtWorkbenchBot.java   
/**
 * Click the given button as soon as it is enabled.
 *
 * @param button
 *          the {@link SWTBotButton} to be clicked
 * @param timeout
 *          the timeout to wait for. When timeout is reached, a WrappedException is thrown.
 */
public void clickButton(final SWTBotButton button, final long timeout) {
  final long endTimeMillis = System.currentTimeMillis() + timeout;
  while (!button.isEnabled() && System.currentTimeMillis() < endTimeMillis) {
    sleep(SWTBotPreferences.DEFAULT_POLL_DELAY);
  }
  if (button.isEnabled()) {
    new SwtBotButton(button).click();
  } else {
    throw new WrappedException(NLS.bind(TIMEOUT_MSG, timeout, button.getText()), null);
  }
}
项目:tlaplus    文件:AddSpecWizardTest.java   
/**
 * Test to make sure the "Add Spec" wizard does not accept invalid spec names
 */
@Test
public void doNotAcceptInvalidSpecNames() {

    // Open specA 
    SWTBotMenu fileMenu = bot.menu("File");
    SWTBotMenu openSpecMenu = fileMenu.menu("Open Spec");
    SWTBotMenu addNewSpecMenu = openSpecMenu.menu("Add New Spec...");
    addNewSpecMenu.click();

    // get a handle for the button before invoking the UI (widget not found exception otherwise)
    SWTBotButton button = bot.button("Finish");

    // create a valid path
    String path = System.getProperty("java.io.tmpdir");
    path += File.separator + "Invalid-Name.tla";

    // set an invalid spec name
    bot.textWithLabel("Root-module file:").setText(path);

    // check if the wizard can finish
    Assert.assertTrue(
            "Finish button must not be enabled with invalid spec name",
            !button.isEnabled());

    //TODO could change the wizard marker/error area for the correct string too
}
项目: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;
}
项目:gwt-eclipse-plugin    文件:SwtBotUtils.java   
public static void clickButtonAndWaitForWindowChange(SWTBot bot, final SWTBotButton button) {
  performAndWaitForWindowChange(bot, new Runnable() {
    @Override
    public void run() {
      button.click();
    }
  });
}
项目:gwt-eclipse-plugin    文件:SwtBotSdkActions.java   
private static void setupSdk(final SWTWorkbenchBot bot, String treeItemText,
    String sdkDirEnvVariableName, String sdkDisplayName) {
  SwtBotWorkbenchActions.openPreferencesDialog(bot);

  SWTBotTreeItem prefGwtTreeItem =
      SwtBotTreeActions.getUniqueTreeItem(bot, bot.tree(),
          SwtBotProjectActions.GWT_MENU_LABELS, "GWT Settings").expand();
  SwtBotTreeActions.selectTreeItem(bot, prefGwtTreeItem, treeItemText);

  SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Add..."));

  // Remove, use the included sdks
  bot.textWithLabel("Installation directory:").setText(System.getenv(sdkDirEnvVariableName));
  bot.textWithLabel("Display name:").setText(sdkDisplayName);

  SWTBotButton okButton = bot.button("OK");
  if (okButton.isEnabled()) {
    // Close add SDK dialog
    SwtBotUtils.clickButtonAndWaitForWindowChange(bot, okButton);
  } else {
    // Already setup, in the case of running multiple tests together
    SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("Cancel"));
  }

  // Close Preferences dialog
  SwtBotUtils.clickButtonAndWaitForWindowChange(bot, bot.button("OK"));
}
项目:eclipse-plugin    文件:ProjectWizardPageTest.java   
@Test
public void testThatCheckingAddToWorkingSetSelectButtonIsEnabled() {
    openImportProjectWizardPage();

    final SWTBotButton workingSetSelectButton = bot.button("Select...");
    final SWTBotCheckBox addToWorkingSetCheckBox = bot.checkBox(0);

    addToWorkingSetCheckBox.click();

    Assert.assertTrue(workingSetSelectButton.isEnabled());
}
项目:emfstore-rest    文件:UIShareProjectControllerTest.java   
private void shareProject() {
    final ESShareObserver observer = createShareObserver();
    ESWorkspaceProviderImpl.getInstance();
    ESWorkspaceProviderImpl.getObserverBus().register(observer);

    UIThreadRunnable.asyncExec(new VoidResult() {
        public void run() {
            final UIShareProjectController shareProjectController = new UIShareProjectController(
                bot.getDisplay().getActiveShell(),
                localProject);
            shareProjectController.execute();
        }
    });

    bot.waitUntil(new DefaultCondition() {
        // BEGIN SUPRESS CATCH EXCEPTION
        public boolean test() throws Exception {
            return didShare;
        }

        // END SUPRESS CATCH EXCEPTION

        public String getFailureMessage() {
            return "Share did not succeed.";
        }
    }, timeout());
    final SWTBotButton confirmButton = bot.button("OK");
    confirmButton.click();
    ESWorkspaceProviderImpl.getInstance();
    ESWorkspaceProviderImpl.getObserverBus().unregister(observer);
}
项目:emfstore-rest    文件:UIShareProjectControllerTest.java   
private void createLocalProject() {
    final int localProjectsSize = ESWorkspaceProvider.INSTANCE.getWorkspace().getLocalProjects().size();
    UIThreadRunnable.asyncExec(new VoidResult() {
        public void run() {
            final UICreateLocalProjectController localProjectController = new UICreateLocalProjectController(
                bot.getDisplay().getActiveShell());
            localProject = localProjectController.execute();
        }
    });
    final SWTBotText text = bot.text(0);
    text.setText("quux");
    final SWTBotButton button = bot.button("OK");
    button.click();
    bot.waitUntil(new DefaultCondition() {

        // BEGIN SUPRESS CATCH EXCEPTION
        public boolean test() throws Exception {
            return localProjectsSize + 1 == ESWorkspaceProvider.INSTANCE.getWorkspace().getLocalProjects().size();
        }

        // END SURPRESS CATCH EXCEPTION

        public String getFailureMessage() {
            return "Create local project did not succeed.";
        }
    });
}
项目:emfstore-rest    文件:UICreateRemoteProjectControllerTest.java   
@Override
@Test
public void testController() throws ESException {
    final int remoteProjectsSize = server.getRemoteProjects(usersession).size();
    UIThreadRunnable.asyncExec(new VoidResult() {
        public void run() {
            createRemoteProjectController = new UICreateRemoteProjectController(
                bot.getDisplay().getActiveShell(),
                usersession);
            createRemoteProjectController.execute();
        }
    });
    final SWTBotText text = bot.text(0);
    text.setText("foo");
    final SWTBotButton okButton = bot.button("OK");
    okButton.click();
    bot.waitUntil(new DefaultCondition() {
        // BEGIN SUPRESS CATCH EXCEPTION
        public boolean test() throws Exception {
            return server.getRemoteProjects(usersession).size() == remoteProjectsSize + 1;
        }

        // END SUPRESS CATCH EXCEPTION

        public String getFailureMessage() {
            return "Create remote project did not succeed.";
        }
    }, timeout());
    assertEquals(remoteProjectsSize + 1, server.getRemoteProjects(usersession).size());
}
项目:gw4e.project    文件:ProblemView.java   
public void executeQuickFixForErrorMessage(String expectedErrorMessageInProblemView, String quickfixmessage,
        ICondition[] conditions) throws CoreException {

    print ();

    bot.waitUntil(new ErrorIsInProblemView(this, expectedErrorMessageInProblemView));

    SWTBotTreeItem item = findErrorItemWithText(expectedErrorMessageInProblemView);
    item.setFocus();
    item.click();
    bot.waitUntil(new IsItemSelectedInErrors(this, item));

    ICondition condition = new DefaultCondition () {
        @Override
        public boolean test() throws Exception {
            item.contextMenu().menu("Quick Fix").click();
            try {
                bot.waitUntil(Conditions.shellIsActive("Quick Fix"), 2 * 1000 );
            } catch (Exception e) {
                return false;
            }
            return true;
        }

        @Override
        public String getFailureMessage() {
            return "Unable to open the Quick fix";
        }

    };

    bot.waitUntil(condition, 15 * 1000);

    SWTBotShell shell = bot.shell("Quick Fix");

    SWTBotTable table = shell.bot().tableWithLabel("Select a fix:");

    SWTBotTableItem thequickFixItem = table.getTableItem(quickfixmessage);
    thequickFixItem.click();
    thequickFixItem.select();

    SWTBotButton button = shell.bot().button("Finish");
    button.click();
    bot.waitUntil(Conditions.shellCloses(shell),TIMEOUT);

    bot.saveAllEditors();

    GW4EProject.fullBuild();

    if (conditions != null) {
        for (int i = 0; i < conditions.length; i++) {
            bot.waitUntil(conditions[i], TIMEOUT);
        }
    }

}
项目:gw4e.project    文件:RunAsManualWizard.java   
public void assertSummaryExecution(SWTBotShell page, SummaryExecutionRow[] rows) {
    SWTBotButton nextButton = bot.button("&Next >");
    nextButton.click();
    new SummaryExecutionPage().assertContext(page, rows);
}
项目:gw4e.project    文件:RunAsManualWizard.java   
public void finish() {
    SWTBotButton finishButton = bot.button("&Finish");
    finishButton.click();
}
项目:gw4e.project    文件:OfflineTestUIPageTest.java   
public void finish () {
    SWTBotButton button = bot.button("Finish");
    button.click();
}
项目:gw4e.project    文件:GW4EProjectProperties.java   
public void apply ( ) {
    SWTBotButton button = shell.bot().button("Apply");
    button.click();
}
项目:gw4e.project    文件:GW4EProjectProperties.java   
public void cancel ( ) {
    SWTBotButton button = shell.bot().button("Cancel");
    button.click();
    parentBot.waitUntil(Conditions.shellCloses(shell)); 
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
public void apply() {
    SWTBotButton applyButton = getApplyButton();
    applyButton.click();
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
public void restoreDefaults () {
    SWTBotButton button = getRestoreDefaultsButton();
    button.click();
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
private SWTBotButton getAddButton() {
    SWTBotButton addButton = bot.buttonWithId("id.button.add",this.id);
    return addButton;
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
private SWTBotButton getRemoveButton() {
    SWTBotButton removeButton = bot.buttonWithId("id.button.remove",this.id);
    return removeButton;
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
private SWTBotButton getApplyButton() {
    SWTBotButton applyButton = bot.button("Apply");
    return applyButton;
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
private SWTBotButton getRestoreDefaultsButton() {
    SWTBotButton button = bot.button("Restore &Defaults");
    return button;
}
项目:gw4e.project    文件:GW4EPreferencePage.java   
private void cancelGW4EPreference (String title) {
     SWTBotButton cancelButton = bot.button("Cancel");  
     cancelButton.click();
     bot.waitWhile(Conditions.shellIsActive(title));
}
项目:dsl-devkit    文件:SwtBotButton.java   
public SwtBotButton(final SWTBotButton button) {
  this(button.widget, null);
}
项目:eavp    文件:TimeSliderCompositeTester.java   
/**
 * Checks that, when any of the time widgets are updated, the active play
 * action is cancelled.
 */
@Test
public void checkPauseOnNewSelectionByWidget() {

    SWTBotButton playButton = getPlayPauseButton();

    SWTBotText text = getTimeText();
    String firstTime = text.getText();

    // Set the framerate to 1 frame every 10 seconds.
    getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            timeComposite.setFPS(0.1);
        }
    });

    // Pause by clicking the play button.
    playButton.click();
    assertTrue(isPlaying());
    playButton.click();
    assertFalse(isPlaying());

    // Pause by clicking the time scale.
    playButton.click();
    assertTrue(isPlaying());
    getTimeScale().setValue(1);
    assertFalse(isPlaying());

    // Pause by typing text.
    playButton.click();
    assertTrue(isPlaying());
    text.selectAll();
    text.typeText(firstTime + SWT.CR + SWT.LF);
    assertFalse(isPlaying());

    // Pause by clicking the next button.
    playButton.click();
    assertTrue(isPlaying());
    getNextButton().click();
    assertFalse(isPlaying());

    // Pause by clicking the previous button.
    playButton.click();
    assertTrue(isPlaying());
    getPrevButton().click();
    assertFalse(isPlaying());

    return;
}
项目:eavp    文件:TimeSliderCompositeTester.java   
/**
 * Checks that listeners are periodically updated when the play button is
 * clicked, and that notifications stop when the same (pause) button is
 * clicked.
 * <p>
 * The times should also loop from last to first when the play button is
 * clicked.
 * </p>
 */
@Test
public void checkPlayWidgetNotifiesSelectionListeners() {

    // Get the specific widget that will be used to set the time.
    SWTBotButton widget = getPlayPauseButton();

    // Set the time to the last timestep. This will ensure the play action
    // hits the last timestep, then loops back around to the first.
    getTimeScale().setValue(orderedTimes.size() - 2);

    // Set the FPS to 20.
    getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            timeComposite.setFPS(20);
        }
    });

    // Play.
    widget.click();

    // The listener should have been notified at least three times, which
    // means the play button looped back around.
    assertTrue(fakeListener1.wasNotified(3));

    // Pause to stop notifications.
    widget.click();

    // Check the notification count and the times sent with each
    // notification.
    Queue<Double> times = fakeListener1.notificationTimes;
    assertTrue(times.size() >= 3);
    // Ignore the first value, as it is the second to last value which was
    // sent out when setting the time with the scale widget.
    times.poll();
    assertEquals(orderedTimes.last(), times.poll(), epsilon);
    assertEquals(orderedTimes.first(), times.poll(), epsilon);

    return;
}