Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Deploy plugins to gh-pages (snapshot)
run: |
mkdir -p _site/plugins/snapshot
unzip -q plugin/vstar-plugins.zip -d _site/plugins/snapshot/
unzip -o -q plugin/vstar-plugins.zip -d _site/plugins/snapshot/
- name: Commit and push to gh-pages
working-directory: _site
run: |
Expand Down
15 changes: 13 additions & 2 deletions src/org/aavso/tools/vstar/ui/dialog/DiscrepantReportDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ public class DiscrepantReportDialog extends AbstractOkCancelDialog {
* The observation to be reported as discrepant.
*/
public DiscrepantReportDialog(String auid, ValidObservation ob) {
this(auid, ob, true);
}

/**
* Package-private constructor that optionally suppresses display.
* Pass {@code show=false} to build without calling
* {@code Mediator.getUI()} or {@code setVisible(true)}.
*/
DiscrepantReportDialog(String auid, ValidObservation ob, boolean show) {
super("AAVSO Discrepant Report");
this.auid = auid;
this.name = ob.getName();
Expand All @@ -84,8 +93,10 @@ public DiscrepantReportDialog(String auid, ValidObservation ob) {
contentPane.add(topPane);

this.pack();
setLocationRelativeTo(Mediator.getUI().getContentPane());
this.setVisible(true);
if (show) {
setLocationRelativeTo(Mediator.getUI().getContentPane());
this.setVisible(true);
}
}

public String getComments() {
Expand Down
15 changes: 13 additions & 2 deletions src/org/aavso/tools/vstar/ui/dialog/PolynomialDegreeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public class PolynomialDegreeDialog extends AbstractOkCancelDialog implements
* The maximum degree value.
*/
public PolynomialDegreeDialog(int minDegree, int maxDegree) {
this(minDegree, maxDegree, true);
}

/**
* Package-private constructor that optionally suppresses display.
* Pass {@code show=false} to build without calling
* {@code Mediator.getUI()} or {@code setVisible(true)}.
*/
PolynomialDegreeDialog(int minDegree, int maxDegree, boolean show) {
super(LocaleProps.get("POLYNOMIAL_DEGREE_DLG_TITLE"));

degree = (maxDegree - minDegree) / 2;
Expand All @@ -69,8 +78,10 @@ public PolynomialDegreeDialog(int minDegree, int maxDegree) {
contentPane.add(topPane);

this.pack();
setLocationRelativeTo(Mediator.getUI().getContentPane());
this.setVisible(true);
if (show) {
setLocationRelativeTo(Mediator.getUI().getContentPane());
this.setVisible(true);
}
}

/**
Expand Down
16 changes: 14 additions & 2 deletions src/org/aavso/tools/vstar/ui/dialog/RadioButtonDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public class RadioButtonDialog extends AbstractOkCancelDialog implements ActionL
*/
public RadioButtonDialog(String title, Collection<String> options,
String initialOption) {
this(title, options, initialOption, true);
}

/**
* Package-private constructor that optionally suppresses display.
* Pass {@code show=false} to build without calling
* {@code Mediator.getUI()} or {@code setVisible(true)}.
*/
RadioButtonDialog(String title, Collection<String> options,
String initialOption, boolean show) {
super(title);

this.options = options;
Expand All @@ -75,8 +85,10 @@ public RadioButtonDialog(String title, Collection<String> options,
contentPane.add(topPane);

this.pack();
setLocationRelativeTo(Mediator.getUI().getContentPane());
this.setVisible(true);
if (show) {
setLocationRelativeTo(Mediator.getUI().getContentPane());
this.setVisible(true);
}
}

/**
Expand Down
12 changes: 12 additions & 0 deletions test/AllTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@
import org.aavso.tools.vstar.ui.dialog.AboutBoxTest;
import org.aavso.tools.vstar.ui.dialog.AbstractOkCancelDialogTest;
import org.aavso.tools.vstar.ui.dialog.DateToJdDialogTest;
import org.aavso.tools.vstar.ui.dialog.DiscrepantReportDialogTest;
import org.aavso.tools.vstar.ui.dialog.DoubleFieldTest;
import org.aavso.tools.vstar.ui.dialog.MultiEntryComponentDialogTest;
import org.aavso.tools.vstar.ui.dialog.PeriodAnalysisPluginDialogsTest;
import org.aavso.tools.vstar.ui.dialog.PhaseParameterDialogTest;
import org.aavso.tools.vstar.ui.dialog.PolynomialDegreeDialogTest;
import org.aavso.tools.vstar.ui.dialog.RadioButtonDialogTest;
import org.aavso.tools.vstar.ui.dialog.SeriesTypeCreationDialogTest;
import org.aavso.tools.vstar.ui.dialog.TextDialogTest;
import org.aavso.tools.vstar.ui.model.list.AbstractSyntheticObservationTableModelTest;
import org.aavso.tools.vstar.ui.model.list.PeriodAnalysisDataTableModelTest;
Expand Down Expand Up @@ -140,6 +146,12 @@ public static Test suite() {
suite.addTestSuite(AboutBoxTest.class);
suite.addTestSuite(DoubleFieldTest.class);
suite.addTestSuite(MultiEntryComponentDialogTest.class);
suite.addTestSuite(PolynomialDegreeDialogTest.class);
suite.addTestSuite(RadioButtonDialogTest.class);
suite.addTestSuite(DiscrepantReportDialogTest.class);
suite.addTestSuite(PhaseParameterDialogTest.class);
suite.addTestSuite(SeriesTypeCreationDialogTest.class);
suite.addTestSuite(PeriodAnalysisPluginDialogsTest.class);
// $JUnit-END$

return suite;
Expand Down
100 changes: 100 additions & 0 deletions test/org/aavso/tools/vstar/ui/dialog/DiscrepantReportDialogTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* VStar: a statistical analysis tool for variable star data.
* Copyright (C) 2009 AAVSO (http://www.aavso.org/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.aavso.tools.vstar.ui.dialog;

import java.util.Locale;

import junit.framework.TestCase;

import org.aavso.tools.vstar.data.Magnitude;
import org.aavso.tools.vstar.data.ValidObservation;

/**
* Tests for {@link DiscrepantReportDialog}.
*
* Uses the package-private 3-argument constructor (show=false) to build the
* dialog without displaying it, avoiding the {@code Mediator.getUI()} call and
* the blocking {@code setVisible(true)}.
*
* Part of issue #579 (GUI code coverage).
*/
public class DiscrepantReportDialogTest extends TestCase {

private ValidObservation ob;

@Override
protected void setUp() {
Locale.setDefault(Locale.ENGLISH);
ob = new ValidObservation();
ob.setName("R Car");
ob.setJD(2458000.5);
ob.setMagnitude(new Magnitude(7.8, 0.1));
}

public void testConstruction() {
DiscrepantReportDialog d = new DiscrepantReportDialog("123-CVF", ob, false);
try {
assertNotNull(d);
} finally {
d.dispose();
}
}

public void testTitle() {
DiscrepantReportDialog d = new DiscrepantReportDialog("123-CVF", ob, false);
try {
assertEquals("AAVSO Discrepant Report", d.getTitle());
} finally {
d.dispose();
}
}

public void testIsModal() {
DiscrepantReportDialog d = new DiscrepantReportDialog("123-CVF", ob, false);
try {
assertTrue(d.isModal());
} finally {
d.dispose();
}
}

public void testIsCancelledByDefault() {
DiscrepantReportDialog d = new DiscrepantReportDialog("123-CVF", ob, false);
try {
assertTrue(d.isCancelled());
} finally {
d.dispose();
}
}

public void testInitialCommentsAreEmpty() {
DiscrepantReportDialog d = new DiscrepantReportDialog("123-CVF", ob, false);
try {
assertEquals("", d.getComments());
} finally {
d.dispose();
}
}

public void testCancelActionLeavesDialogCancelled() {
DiscrepantReportDialog d = new DiscrepantReportDialog("123-CVF", ob, false);
d.cancelAction();
assertTrue(d.isCancelled());
d.dispose();
}
}
Loading
Loading