Search in sources :

Example 1 with JPanelFixture

use of org.fest.swing.fixture.JPanelFixture in project aspro by JMMC-OpenDev.

the class AsproDocJUnitTest method m003_captureWindCompass.

/**
 * Capture the main panel with wind compass enabled
 */
@Test
@GUITest
public void m003_captureWindCompass() {
    // enable wind restriction:
    window.checkBox("jCheckBoxWind").check();
    final WindWidget windWidget = robot().finder().findByName("WindWidget", WindWidget.class);
    GuiActionRunner.execute(new GuiTask() {

        @Override
        protected void executeInEDT() {
            windWidget.setValue(60d);
        }
    });
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // Capture observability plot :
    getMainTabbedPane().selectTab(SettingPanel.TAB_OBSERVABILITY);
    saveScreenshot(window, "Aspro2-wind-obs.png");
    final JPanelFixture panel = window.panel("observabilityPanel");
    // enable detailed plot :
    panel.checkBox("jCheckBoxDetailedOutput").check();
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // see HD 1234
    panel.scrollBar("scroller").scrollToMaximum();
    // Capture observability plot of detailed plot :
    saveScreenshot(getMainTabbedPane(), "Aspro2-wind-obs-det.png");
    // see ETA TAU (moon) [0 to 14]
    panel.scrollBar("scroller").scrollTo(8);
    // Capture observability plot of detailed plot :
    saveScreenshot(getMainTabbedPane(), "Aspro2-moon-obs-det.png");
    // disable detailed plot :
    panel.checkBox("jCheckBoxDetailedOutput").uncheck();
    // disable wind restriction:
    GuiActionRunner.execute(new GuiTask() {

        @Override
        protected void executeInEDT() {
            windWidget.setValue(0d);
        }
    });
    window.checkBox("jCheckBoxWind").uncheck();
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
}
Also used : GuiTask(org.fest.swing.edt.GuiTask) JPanelFixture(org.fest.swing.fixture.JPanelFixture) WindWidget(fr.jmmc.aspro.gui.util.WindWidget) GUITest(org.fest.swing.annotation.GUITest) Test(org.junit.Test) GUITest(org.fest.swing.annotation.GUITest)

Example 2 with JPanelFixture

use of org.fest.swing.fixture.JPanelFixture in project aspro by JMMC-OpenDev.

the class AsproDocJUnitTest method m099_captureMoon.

/**
 * Capture the moon details
 */
@Test
@GUITest
public void m099_captureMoon() {
    openObservation("Aspro2_sample_moon.asprox");
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // Capture observability plot :
    getMainTabbedPane().selectTab(SettingPanel.TAB_OBSERVABILITY);
    final JPanelFixture panel = window.panel("observabilityPanel");
    // enable detailed plot :
    panel.checkBox("jCheckBoxDetailedOutput").check();
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // see ETA TAU (moon) [0 to 14]
    panel.scrollBar("scroller").scrollTo(8);
    // Capture observability plot of detailed plot :
    saveScreenshot(getMainTabbedPane(), "Aspro2-moon-obs-det.png");
    // disable detailed plot :
    panel.checkBox("jCheckBoxDetailedOutput").uncheck();
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
}
Also used : JPanelFixture(org.fest.swing.fixture.JPanelFixture) GUITest(org.fest.swing.annotation.GUITest) Test(org.junit.Test) GUITest(org.fest.swing.annotation.GUITest)

Example 3 with JPanelFixture

use of org.fest.swing.fixture.JPanelFixture in project aspro by JMMC-OpenDev.

the class AsproDocJUnitTest method m023_shouldOpenSampleWithUserModel.

/**
 * Test Open file "Aspro2_sample_spiral.asprox" (User model)
 */
@Test
@GUITest
public void m023_shouldOpenSampleWithUserModel() {
    try {
        Preferences.getInstance().setPreference(Preferences.MODEL_IMAGE_LUT, ColorModels.COLOR_MODEL_HEAT);
        openObservation("Aspro2_sample_spiral.asprox");
        // target editor with calibrators :
        window.button("jButtonTargetEditor").click();
        final DialogFixture dialog = window.dialog(withTitle("Target Editor").andShowing());
        dialog.requireVisible();
        dialog.moveToFront();
        dialog.tabbedPane().selectTab(TargetEditorDialog.TAB_MODELS);
        dialog.tree().selectPath("Models/HD 1234");
        // waits for computation to finish :
        AsproTestUtils.checkRunningTasks();
        saveScreenshot(dialog, "Aspro2-UserModel.png");
        // close dialog :
        dialog.button(JButtonMatcher.withText("Cancel")).click();
        window.list("jListTargets").selectItem("HD 1234");
        // select UV tab:
        getMainTabbedPane().selectTab(SettingPanel.TAB_UV_COVERAGE);
        final JPanelFixture panel = window.panel("uvCoveragePanel");
        // disable Compute OIFits data :
        panel.checkBox("jCheckBoxDoOIFits").uncheck();
        // zoom uv max (trigger uv model to compute again):
        panel.textBox("jFieldUVMax").setText("40.00");
        // select UV tab to let fields lost focus (trigger change listeners):
        getMainTabbedPane().selectTab(SettingPanel.TAB_UV_COVERAGE);
        // waits for computation to finish :
        AsproTestUtils.checkRunningTasks();
        // Capture UV Coverage plot :
        showPlotTab(SettingPanel.TAB_UV_COVERAGE, "Aspro2-UserModel-uv.png");
    } catch (PreferencesException pe) {
        logger.error("setPreference failed", pe);
    } finally {
        try {
            Preferences.getInstance().setPreference(Preferences.MODEL_IMAGE_LUT, Preferences.DEFAULT_IMAGE_LUT);
        } catch (PreferencesException pe) {
            logger.error("setPreference failed", pe);
        }
    }
}
Also used : DialogFixture(org.fest.swing.fixture.DialogFixture) JPanelFixture(org.fest.swing.fixture.JPanelFixture) PreferencesException(fr.jmmc.jmcs.data.preference.PreferencesException) GUITest(org.fest.swing.annotation.GUITest) Test(org.junit.Test) GUITest(org.fest.swing.annotation.GUITest)

Example 4 with JPanelFixture

use of org.fest.swing.fixture.JPanelFixture in project aspro by JMMC-OpenDev.

the class AsproMatisseTest method openObservationAndCaptureOIFitsSNRPlot.

/* 
     --- Utility methods  ---------------------------------------------------------
     */
private void openObservationAndCaptureOIFitsSNRPlot(final String obsFileName) {
    openObservation(obsFileName);
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    selectTab(SettingPanel.TAB_OIFITS_VIEWER);
    final JPanelFixture form = window.panel("plotView");
    final JComboBoxFixture comboPlotDef = form.comboBox("plotDefinitionComboBox");
    final String[] plotDefNames = comboPlotDef.contents();
    // select preset 'V2_T3_SNR/EFF_WAVE':
    // last corresponds to 'V2_T3_SNR/EFF_WAVE'
    comboPlotDef.selectItem(plotDefNames.length - 1);
    // let plot update:
    pauseMedium();
    // Capture plot screenshot :
    final JPanelFixture plot = window.panel("plotChartPanel");
    saveScreenshot(plot, obsFileName + "-SNR.png");
    // select preset 'V_V2_T3_ERR/EFF_WAVE':
    // last corresponds to 'V2_T3_SNR/EFF_WAVE'
    comboPlotDef.selectItem(plotDefNames.length - 2);
    // let plot update:
    pauseMedium();
    // Capture plot screenshot :
    saveScreenshot(plot, obsFileName + "-ERR.png");
}
Also used : JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) JPanelFixture(org.fest.swing.fixture.JPanelFixture)

Example 5 with JPanelFixture

use of org.fest.swing.fixture.JPanelFixture in project aspro by JMMC-OpenDev.

the class AsproNightBoundsTest method shouldChangeDateForCHARA.

/**
 * Test observability plot when updating the observation date
 */
@Test
@GUITest
public void shouldChangeDateForCHARA() {
    initTest();
    final JPanelFixture form = window.panel("observationForm");
    // select CHARA interferometer :
    form.comboBox("jComboBoxInterferometer").selectItem("CHARA");
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // set PoPs to '54' :
    final JFormattedTextField jTextPoPs = (JFormattedTextField) form.textBox("jTextPoPs").component();
    GuiActionRunner.execute(new GuiTask() {

        @Override
        protected void executeInEDT() {
            // Integer field :
            jTextPoPs.setValue(Integer.valueOf(54));
        }
    });
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    final JSpinnerFixture dateSpinner = form.spinner("jDateSpinner");
    traverseDays(dateSpinner);
}
Also used : GuiTask(org.fest.swing.edt.GuiTask) JPanelFixture(org.fest.swing.fixture.JPanelFixture) JFormattedTextField(javax.swing.JFormattedTextField) JSpinnerFixture(org.fest.swing.fixture.JSpinnerFixture) GUITest(org.fest.swing.annotation.GUITest) Test(org.junit.Test) GUITest(org.fest.swing.annotation.GUITest)

Aggregations

JPanelFixture (org.fest.swing.fixture.JPanelFixture)12 GUITest (org.fest.swing.annotation.GUITest)9 Test (org.junit.Test)9 JSpinnerFixture (org.fest.swing.fixture.JSpinnerFixture)5 GuiTask (org.fest.swing.edt.GuiTask)3 JFormattedTextField (javax.swing.JFormattedTextField)2 JComboBoxFixture (org.fest.swing.fixture.JComboBoxFixture)2 WindWidget (fr.jmmc.aspro.gui.util.WindWidget)1 PreferencesException (fr.jmmc.jmcs.data.preference.PreferencesException)1 Point (java.awt.Point)1 DialogFixture (org.fest.swing.fixture.DialogFixture)1 NotNull (org.jetbrains.annotations.NotNull)1