use of org.fest.swing.annotation.GUITest 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();
}
use of org.fest.swing.annotation.GUITest in project aspro by JMMC-OpenDev.
the class AsproDocJUnitTest method m021_shouldOpenSampleWithCalibrators.
/**
* Test Open file "Aspro2_sample_with_calibrators.asprox"
*/
@Test
@GUITest
public void m021_shouldOpenSampleWithCalibrators() {
openObservation("Aspro2_sample_with_calibrators.asprox");
window.list("jListTargets").selectItem("HD 1583 (cal)");
// waits for computation to finish :
AsproTestUtils.checkRunningTasks();
// Capture observability plot :
showPlotTab(SettingPanel.TAB_OBSERVABILITY, "Aspro2-calibrators-obs.png");
// Capture UV Coverage plot :
showPlotTab(SettingPanel.TAB_UV_COVERAGE, "Aspro2-calibrators-uv.png");
// Export OIFits / OB :
exportOIFits();
exportOB();
// 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 1583 (cal)/disk1");
saveScreenshot(dialog, "Aspro2-calibrators-Model.png");
dialog.tabbedPane().selectTab(TargetEditorDialog.TAB_TARGETS);
dialog.tree().selectPath("Targets/HIP1234/HD 1583 (cal)");
saveScreenshot(dialog, "Aspro2-calibrators-Target.png");
// close dialog :
dialog.button(JButtonMatcher.withText("Cancel")).click();
}
use of org.fest.swing.annotation.GUITest in project aspro by JMMC-OpenDev.
the class AsproDocJUnitTest method m024_shouldOpenSampleWithAOTargetGroup.
/**
* Test Open file "Aspro2_sample_AO_on_SiriusB.asprox" (Target Group Form)
*/
@Test
@GUITest
public void m024_shouldOpenSampleWithAOTargetGroup() {
final Frame frame = window.target;
final Point ref = frame.getLocation();
final DisplayMode mode = frame.getGraphicsConfiguration().getDevice().getDisplayMode();
try {
window.moveTo(new Point(mode.getWidth() - frame.getWidth(), ref.y));
Preferences.getInstance().setPreference(Preferences.MODEL_IMAGE_LUT, ColorModels.COLOR_MODEL_ASPRO);
openObservation("Aspro2_sample_AO_on_SiriusB.asprox");
// Capture observability plot :
showPlotTab(SettingPanel.TAB_OBSERVABILITY, "Aspro2-GroupAO-obs.png");
// 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_GROUPS);
dialog.tree(TargetGroupForm.TREE_GROUPS).selectPath("Groups/AO Star/Sirius A");
// highlight group information:
dialog.tree(TargetGroupForm.TREE_GROUPS).selectPath("Groups/AO Star");
// waits for computation to finish :
AsproTestUtils.checkRunningTasks();
saveScreenshot(dialog, "Aspro2-GroupAO.png");
// close dialog :
dialog.button(JButtonMatcher.withText("Cancel")).click();
window.list("jListTargets").selectItem("Sirius B");
// select UV tab:
getMainTabbedPane().selectTab(SettingPanel.TAB_UV_COVERAGE);
// waits for computation to finish :
AsproTestUtils.checkRunningTasks();
enableTooltips(true);
// move the mouse on Status Warning:
// note: check window margin issue (gnome3):
robot().moveMouse(window.component(), 760, 215);
// let tooltip appear:
pauseMedium();
saveScreenshotWithMousePointer(window, "Aspro2-GroupAO-status.png");
} catch (PreferencesException pe) {
logger.error("setPreference failed", pe);
} finally {
enableTooltips(false);
try {
Preferences.getInstance().setPreference(Preferences.MODEL_IMAGE_LUT, Preferences.DEFAULT_IMAGE_LUT);
} catch (PreferencesException pe) {
logger.error("setPreference failed", pe);
}
// restore position:
window.moveTo(ref);
}
}
use of org.fest.swing.annotation.GUITest in project aspro by JMMC-OpenDev.
the class AsproDocJUnitTest method m010_shouldOpenFeedbackReport.
/**
* Test Feedback report
*/
@Test
@GUITest
public void m010_shouldOpenFeedbackReport() {
// hack to solve focus trouble in menu items :
window.menuItemWithPath("Help").focus();
window.menuItemWithPath("Help", "Report Feedback to JMMC...").click();
final DialogFixture dialog = window.dialog(withTitle("Feedback Report ").andShowing());
dialog.requireVisible();
dialog.moveToFront();
final JTextComponentFixture emailField = dialog.textBox(JTextComponentMatcher.withText(FAKE_EMAIL));
// hide my email address :
emailField.setText("type your email address here");
saveScreenshot(dialog, "Aspro2-FeebackReport.png");
// restore my preferences :
emailField.setText(FAKE_EMAIL);
// close dialog :
dialog.close();
// reset email preference:
defineEmailPref(CURRENT_EMAIL);
}
use of org.fest.swing.annotation.GUITest in project aspro by JMMC-OpenDev.
the class AsproDocJUnitTest method m006_shouldShowUVCoverage.
/**
* Test UV coverage plot
*/
@Test
@GUITest
public void m006_shouldShowUVCoverage() {
// Capture UV Coverage plot :
getMainTabbedPane().selectTab(SettingPanel.TAB_UV_COVERAGE);
final BufferedImage image = takeScreenshotOf(window);
saveImage(image, "Aspro2-screen.png");
// TODO : refactor that code :
// miniature for aspro web page : 350px width :
final int width = 350;
final int height = Math.round(1f * width * image.getHeight() / image.getWidth());
// use Lanczos3 resampler and soft unsharp mask :
final ResampleOp resampleOp = new ResampleOp(width, height);
resampleOp.setUnsharpenMask(AdvancedResizeOp.UnsharpenMask.Soft);
final BufferedImage rescaledImage = resampleOp.filter(image, null);
saveImage(rescaledImage, "Aspro2-screen-small.png");
// export PDF :
exportPDF();
try {
enableTooltips(true);
// move the mouse on one uv measurement:
// note: check window margin issue (gnome3):
robot().moveMouse(window.component(), 690, 590);
// let tooltip appear:
pauseMedium();
saveScreenshotWithMousePointer(window, "Aspro2-uv.png");
} finally {
enableTooltips(false);
}
// Export OIFits / OB :
exportOIFits();
exportOB();
}
Aggregations