54 lines
1.6 KiB
Java
54 lines
1.6 KiB
Java
package jmri.jmrit.operations.trains.tools;
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
import org.junit.Assert;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import jmri.jmrit.operations.OperationsTestCase;
|
|
import jmri.util.swing.JemmyUtil;
|
|
|
|
/**
|
|
*
|
|
* @author Paul Bender Copyright (C) 2017
|
|
*/
|
|
public class ExportTrainLineupsActionTest extends OperationsTestCase {
|
|
|
|
@Test
|
|
public void testCTor() {
|
|
ExportTrainLineupsAction t = new ExportTrainLineupsAction();
|
|
Assert.assertNotNull("exists",t);
|
|
}
|
|
|
|
@Test
|
|
@jmri.util.junit.annotations.DisabledIfHeadless
|
|
public void testAction() {
|
|
ExportTrainLineupsAction a = new ExportTrainLineupsAction();
|
|
Assert.assertNotNull("exists", a);
|
|
|
|
// should cause dialog to appear
|
|
Thread doAction = new Thread(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, null));
|
|
}
|
|
});
|
|
doAction.setName("Do Action"); // NOI18N
|
|
doAction.start();
|
|
|
|
jmri.util.JUnitUtil.waitFor(() -> {
|
|
return doAction.getState().equals(Thread.State.WAITING);
|
|
}, "wait for prompt");
|
|
|
|
JemmyUtil.pressDialogButton(Bundle.getMessage("ExportComplete"), Bundle.getMessage("ButtonOK"));
|
|
|
|
jmri.util.JUnitUtil.waitFor(() -> !doAction.isAlive(), "wait for doAction to complete");
|
|
|
|
java.io.File file = new java.io.File(ExportTrainLineups.defaultOperationsFilename());
|
|
Assert.assertTrue("Confirm file creation", file.exists());
|
|
}
|
|
|
|
// private static final Logger log = LoggerFactory.getLogger(ExportTrainRosterActionTest.class);
|
|
|
|
}
|