Search in sources :

Example 6 with JPanelFixture

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

the class AsproNoiseTest method openObservationAndCaptureOIFitsFiles.

/* 
     --- Utility methods  ---------------------------------------------------------
     */
private void openObservationAndCaptureOIFitsFiles(final String obsFileName) {
    openObservation("noise/" + obsFileName + ".asprox");
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    selectTab(SettingPanel.TAB_OIFITS_VIEWER);
    final JPanelFixture oifitsView = window.panel("plotView");
    final JComboBoxFixture comboPlotDef = oifitsView.comboBox("plotDefinitionComboBox");
    final String[] plotDefNames = comboPlotDef.contents();
    // System.out.println("plotDefNames: " + Arrays.toString(plotDefNames));
    // select preset Residuals:
    // last-3 corresponds to Residuals
    comboPlotDef.selectItem(plotDefNames.length - 3);
    final JPanelFixture mainForm = window.panel("observationForm");
    final JSpinnerFixture dateSpinner = mainForm.spinner("jDateSpinner");
    final JPanelFixture plot = window.panel("plotChartPanel");
    int i = 1;
    do {
        // Capture plot screenshot :
        saveScreenshot(plot, obsFileName + "-SNR_" + i + ".png");
        // Export OIFits :
        exportOIFits(obsFileName + "_" + i + ".oifits");
        dateSpinner.increment();
        dateSpinner.decrement();
        // waits for computation to finish :
        AsproTestUtils.checkRunningTasks();
        // let plot update:
        pauseShort();
    } while (i++ <= 10);
}
Also used : JComboBoxFixture(org.fest.swing.fixture.JComboBoxFixture) JPanelFixture(org.fest.swing.fixture.JPanelFixture) JSpinnerFixture(org.fest.swing.fixture.JSpinnerFixture)

Example 7 with JPanelFixture

use of org.fest.swing.fixture.JPanelFixture in project android by JetBrains.

the class MessagesFixture method findByTitle.

@NotNull
public static MessagesFixture findByTitle(@NotNull Robot robot, @NotNull String title) {
    if (Messages.canShowMacSheetPanel()) {
        JPanelFixture panelFixture = findMacSheetByTitle(robot, title);
        JDialog dialog = (JDialog) SwingUtilities.getWindowAncestor(panelFixture.target());
        return new MessagesFixture(panelFixture, dialog);
    }
    MessageDialogFixture dialog = MessageDialogFixture.findByTitle(robot, title);
    return new MessagesFixture(dialog, dialog.target());
}
Also used : JPanelFixture(org.fest.swing.fixture.JPanelFixture) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with JPanelFixture

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

the class AsproDocJUnitTest method m020_shouldShowCharaPoPs.

/**
 * Test Chara PoPs
 */
@Test
@GUITest
public void m020_shouldShowCharaPoPs() {
    // show observability plot :
    getMainTabbedPane().selectTab(SettingPanel.TAB_OBSERVABILITY);
    window.list("jListTargets").selectItem("HIP1234");
    final JPanelFixture form = window.panel("observationForm");
    // select CHARA interferometer :
    form.comboBox("jComboBoxInterferometer").selectItem("CHARA");
    final int left = 5 + window.panel("jPanelTargets").component().getWidth();
    final int width = 5 + window.panel("jPanelMain").component().getWidth() + window.panel("jPanelConfigurations").component().getWidth();
    // Get plot's title to show PoPs in use:
    final int height = getMainFormHeight(window) + 50;
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    saveCroppedScreenshotOf("popsAuto.png", left, 0, width, height);
    // set PoPs to '34' (manual):
    final JFormattedTextField jTextPoPs = (JFormattedTextField) form.textBox("jTextPoPs").component();
    GuiActionRunner.execute(new GuiTask() {

        @Override
        protected void executeInEDT() {
            // Integer field :
            jTextPoPs.setValue(NumberUtils.valueOf(34));
        }
    });
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // show observability plot (force plot refresh) :
    getMainTabbedPane().selectTab(SettingPanel.TAB_OBSERVABILITY);
    saveCroppedScreenshotOf("popsUser.png", left, 0, width, height);
}
Also used : GuiTask(org.fest.swing.edt.GuiTask) JPanelFixture(org.fest.swing.fixture.JPanelFixture) JFormattedTextField(javax.swing.JFormattedTextField) Point(java.awt.Point) GUITest(org.fest.swing.annotation.GUITest) Test(org.junit.Test) GUITest(org.fest.swing.annotation.GUITest)

Example 9 with JPanelFixture

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

the class AsproDocJUnitTest method m005_shouldShowObservability.

/**
 * Test observability plot
 */
@Test
@GUITest
public void m005_shouldShowObservability() {
    // Capture observability plot :
    getMainTabbedPane().selectTab(SettingPanel.TAB_OBSERVABILITY);
    try {
        enableTooltips(true);
        // move the mouse on the first observability interval (top right corner):
        // note: check window margin issue (gnome3):
        robot().moveMouse(window.component(), 390, 410);
        // let tooltip appear:
        pauseMedium();
        saveScreenshotWithMousePointer(window, "Aspro2-obs.png");
    } finally {
        enableTooltips(false);
    }
    // export PDF :
    exportPDF();
    final JPanelFixture panel = window.panel("observabilityPanel");
    // enable baseline limits :
    panel.checkBox("jCheckBoxBaseLineLimits").check();
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // Capture observability plot of  baseline limits :
    saveScreenshot(getMainTabbedPane(), "Aspro2-obs-bl.png");
    // disable baseline limits :
    panel.checkBox("jCheckBoxBaseLineLimits").uncheck();
    // enable detailed plot :
    panel.checkBox("jCheckBoxDetailedOutput").check();
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    // Capture observability plot of detailed plot :
    saveScreenshot(getMainTabbedPane(), "Aspro2-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 10 with JPanelFixture

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

the class AsproNightBoundsTest method shouldChangeDateForVLTI.

/**
 * Test observability plot when updating the observation date
 */
@Test
@GUITest
public void shouldChangeDateForVLTI() {
    initTest();
    final JPanelFixture form = window.panel("observationForm");
    // select VLTI interferometer :
    form.comboBox("jComboBoxInterferometer").selectItem("VLTI");
    // waits for computation to finish :
    AsproTestUtils.checkRunningTasks();
    final JSpinnerFixture dateSpinner = form.spinner("jDateSpinner");
    traverseDays(dateSpinner);
}
Also used : JPanelFixture(org.fest.swing.fixture.JPanelFixture) 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