Skip to content
Permalink
Browse files

Fix shtml annotations. Fix push button problem in tests

  • Loading branch information...
pete_ pete_
pete_ authored and pete_ committed Aug 8, 2019
1 parent f365c02 commit fe79185d44806dae5c04a13e209fc5e3d0278978
@@ -75,7 +75,7 @@
icons of your layout diagram. The element types (OBlock, Portal,
OPath, Signal) are created and edited using various editing modes of the tool.
In short, it works as follows:
</p<p>
<p>
First create an OBlock by selecting track icons. Then create Portals by dragging
an icon that overlaps two OBlocks. Then create OPaths by selecting the portal icons
and track icons that indicate the path. Finally perhaps add a signal to protect an
@@ -71,7 +71,7 @@
private JMenu _todoMenu; // error checking items

// map OBlock to List of icons (track, portal, signal that represent it
private HashMap<OBlock, ArrayList<Positionable>> _circuitMap;
private HashMap<OBlock, ArrayList<Positionable>> _circuitMap = new HashMap<>();

// list of track icons not belonging to an OBlock
private final ArrayList<Positionable> _darkTrack = new ArrayList<>();
@@ -153,7 +153,6 @@ public CircuitBuilder(ControlPanelEditor ed) {
*/
protected JMenu makeMenu() {
_circuitMenu = new JMenu(Bundle.getMessage("CircuitBuilder"));
_circuitMap = new HashMap<>();
OBlockManager manager = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class);
SortedSet<OBlock> oblocks = manager.getNamedBeanSet();
for (OBlock block : oblocks) {
@@ -2,6 +2,7 @@

import jmri.InstanceManager;
import jmri.jmrit.catalog.NamedIcon;
import jmri.jmrit.display.Positionable;
import jmri.jmrit.display.PositionableLabel;
import jmri.jmrit.display.palette.Bundle;
//import jmri.jmrit.display.IndicatorTrackIcon;
@@ -11,6 +12,7 @@
import jmri.util.JUnitUtil;
//import jmri.util.swing.JemmyUtil;

import java.util.ArrayList;
import java.awt.GraphicsEnvironment;

import org.junit.After;
@@ -30,7 +32,6 @@
public class ConvertDialogTest {

@Test
// @org.junit.Ignore("Cannot get button pushed! set icon = null to fake a test and get a little code coverage")
public void testCTorConvert() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
ControlPanelEditor frame = new ControlPanelEditor("ConvertDialogTest");
@@ -41,32 +42,32 @@ public void testCTorConvert() {
PositionableLabel pos = new PositionableLabel(icon, frame);
pos.setLocation(200,100);
frame.putItem(pos);
ArrayList<Positionable> selections = new ArrayList<>();
selections.add(pos);
frame.setSelectionGroup(selections);
new org.netbeans.jemmy.QueueTool().waitEmpty(100);

new Thread(() -> {
// constructor for d will wait until the dialog is visible
// System.out.println(" thread running!");
String title = Bundle.getMessage("IndicatorTrack");
JDialogOperator d = new JDialogOperator(title);
// System.out.println(" JDialogOperator found \""+title+"\"!");
// new org.netbeans.jemmy.QueueTool().waitEmpty(200);
String label = Bundle.getMessage("updateButton");
JButtonOperator bo = new JButtonOperator(d, label);
// System.out.println(" JButtonOperator bo made for \""+label+"\"!");
// new org.netbeans.jemmy.QueueTool().waitEmpty(200);
bo.doClick();
// System.out.println(" JButtonOperator bo Done!");
}).start();

// System.out.println(" Open ConvertDialog!");
ConvertDialog dialog = new ConvertDialog(cb, null, ob1);
ConvertDialog dialog = new ConvertDialog(cb, pos, ob1);
Assert.assertNotNull("exists",dialog);
/* System.out.println(" ConvertDialog Opened!");
// System.out.println(" ConvertDialog Opened!");

JDialogOperator jdo = new JDialogOperator(dialog);
System.out.println(" JDialogOperator jdo Done!");
JFrameOperator jfo = new JFrameOperator(frame);
System.out.println(" JFrameOperator jfo Done!");
/* ComponentSearcher cs = new ComponentSearcher(dialog);
// cs.findComponent(chooser);
// JComponentOperator jco = new JComponentOperator(jdo, new ComponentChooser());
java.awt.Component[] comps = dialog.getComponents();
for (int i=0; i<comps.length; i++) {
if (comps[i] instanceof JPanel) {
JComponentOperator jco = new JComponentOperator(comps[i]);
}
}
JButtonOperator jbo = new JButtonOperator(jfo, Bundle.getMessage("updateButton"));
System.out.println(" JButtonOperator jbo Done!");
jbo.doClick();
dialog.dispose();*/
dialog.dispose();
frame.dispose();
}

@@ -4,14 +4,12 @@
import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.OBlockManager;
import jmri.util.JUnitUtil;
import jmri.util.swing.JemmyUtil;

import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.netbeans.jemmy.operators.JFrameOperator;

/**
*
@@ -1,16 +1,18 @@
package jmri.jmrit.display.controlPanelEditor;

import java.awt.GraphicsEnvironment;

import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.OBlockManager;
import jmri.util.JUnitUtil;
import jmri.util.swing.JemmyUtil;

import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JDialogOperator;
import org.netbeans.jemmy.operators.JFrameOperator;

/**
@@ -22,25 +24,24 @@
OBlockManager blkMgr;

@Test
@org.junit.Ignore("Cannot get button pushed!")
public void testCTor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
ControlPanelEditor frame = new ControlPanelEditor("EditCircuitPathsTest");
frame.makeCircuitMenu(true);
CircuitBuilder cb = frame.getCircuitBuilder();
Assert.assertNotNull("exists", cb);
OBlock ob1 = blkMgr.createNewOBlock("OB1", "a");

new Thread(() -> {
JFrameOperator jfo = new JFrameOperator("Edit Circuit Paths");
JDialogOperator jdo = new JDialogOperator(jfo, Bundle.getMessage("incompleteCircuit"));
JButtonOperator jbo = new JButtonOperator(jdo, "OK");
jbo.push();
}).start();

EditCircuitPaths pFrame = new EditCircuitPaths("Edit Circuit Paths", cb, ob1);
Assert.assertNotNull("exists", pFrame);

JFrameOperator jfo = new JFrameOperator(pFrame);
Thread t = new Thread(() -> {
JemmyUtil.confirmJOptionPane(jfo, Bundle.getMessage("incompleteCircuit"),
Bundle.getMessage("needPortal", ob1.getDisplayName(), Bundle.getMessage("BlockPaths")), "OK");
});
t.setName("Error Dialog Close Thread");
t.start();


JUnitUtil.dispose(frame);
JUnitUtil.dispose(pFrame);
}
@@ -1,10 +1,10 @@
package jmri.jmrit.display.controlPanelEditor;

import java.awt.GraphicsEnvironment;

import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.OBlockManager;
import jmri.util.JUnitUtil;
//import jmri.util.swing.JemmyUtil;

import org.junit.After;
import org.junit.Assert;
@@ -24,23 +24,22 @@
OBlockManager blkMgr;

@Test
@org.junit.Ignore("Cannot get button pushed!")
public void testCTor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
ControlPanelEditor frame = new ControlPanelEditor("EditPortalDirectionTest");
frame.makeCircuitMenu(true);
CircuitBuilder cb = frame.getCircuitBuilder();
OBlock ob1 = blkMgr.createNewOBlock("OB1", "a");
EditPortalDirection dFrame = new EditPortalDirection("Edit Direction Arrows", cb, ob1);
Assert.assertNotNull("exists", dFrame);

JFrameOperator jfo = new JFrameOperator(dFrame);
Thread t = new Thread(() -> {

new Thread(() -> {
JFrameOperator jfo = new JFrameOperator("Edit Direction Arrows");
JDialogOperator jdo = new JDialogOperator(jfo, Bundle.getMessage("incompleteCircuit"));
JButtonOperator jbo = new JButtonOperator(jdo, "OK");
jbo.push();
});
t.start();
}).start();

EditPortalDirection dFrame = new EditPortalDirection("Edit Direction Arrows", cb, ob1);
Assert.assertNotNull("exists", dFrame);

JUnitUtil.dispose(frame);
JUnitUtil.dispose(dFrame);
@@ -7,7 +7,6 @@
import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.OBlockManager;
import jmri.util.JUnitUtil;
//import jmri.util.swing.JemmyUtil;

import org.junit.After;
import org.junit.Assert;
@@ -27,7 +26,6 @@
OBlockManager blkMgr;

@Test
@org.junit.Ignore("Cannot get button pushed!")
public void testCTor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
ControlPanelEditor frame = new ControlPanelEditor("EditPortalFrameTest");
@@ -36,21 +34,18 @@ public void testCTor() {
OBlock ob1 = blkMgr.createNewOBlock("OB1", "a");
// NamedIcon icon = new NamedIcon("program:resources/icons/smallschematics/tracksegments/block.gif", "track");
IndicatorTrackIcon icon = new IndicatorTrackIcon(frame);
icon.setOccBlock("a");
// icon.setOccBlock("a");

new Thread(() -> {
JFrameOperator jfo = new JFrameOperator("Edit Portal Frame");
JDialogOperator jdo = new JDialogOperator(jfo, Bundle.getMessage("incompleteCircuit"));
JButtonOperator jbo = new JButtonOperator(jdo, "OK");
jbo.push();
}).start();

EditPortalFrame portalFrame = new EditPortalFrame("Edit Portal Frame", cb, ob1);
Assert.assertNotNull("exists", portalFrame);

JFrameOperator jfo = new JFrameOperator("Edit Portal Frame");
JDialogOperator jdo = new JDialogOperator(jfo, Bundle.getMessage("incompleteCircuit"));
JButtonOperator jbo = new JButtonOperator(jdo, "OK");
Thread t = new Thread(() -> {
jbo.push();
// JemmyUtil.confirmJOptionPane(jfo, Bundle.getMessage("incompleteCircuit"),
// Bundle.getMessage("needIcons", ob1.getDisplayName(), Bundle.getMessage("BlockPortals")), "OK");
});
t.setName("Error Dialog Close Thread");
t.start();

JUnitUtil.dispose(frame);
JUnitUtil.dispose(portalFrame);
}
@@ -1,16 +1,18 @@
package jmri.jmrit.display.controlPanelEditor;

import java.awt.GraphicsEnvironment;

import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.OBlockManager;
import jmri.util.JUnitUtil;
import jmri.util.swing.JemmyUtil;

import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JDialogOperator;
import org.netbeans.jemmy.operators.JFrameOperator;

/**
@@ -22,22 +24,24 @@
OBlockManager blkMgr;

@Test
@org.junit.Ignore("Cannot get button pushed!")
public void testCTor() {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
ControlPanelEditor frame = new ControlPanelEditor("EditSignalFrameTest");
frame.makeCircuitMenu(true);
CircuitBuilder cb = frame.getCircuitBuilder();
Assert.assertNotNull("exists", cb);
OBlock ob1 = blkMgr.createNewOBlock("OB1", "a");

new Thread(() -> {
JFrameOperator jfo = new JFrameOperator("Edit Signal Frame");
JDialogOperator jdo = new JDialogOperator(jfo, Bundle.getMessage("incompleteCircuit"));
JButtonOperator jbo = new JButtonOperator(jdo, "OK");
jbo.push();
}).start();

EditSignalFrame pFrame = new EditSignalFrame("Edit Signal Frame", cb, ob1);
Assert.assertNotNull("exists", pFrame);

new org.netbeans.jemmy.QueueTool().waitEmpty(100);
JFrameOperator jfo = new JFrameOperator(pFrame);
JemmyUtil.confirmJOptionPane(jfo, Bundle.getMessage("incompleteCircuit"),
Bundle.getMessage("needPortal", ob1.getDisplayName(), Bundle.getMessage("BlockSignal")), "OK");

JUnitUtil.dispose(frame);
JUnitUtil.dispose(pFrame);
}
@@ -1,7 +1,5 @@
package jmri.jmrit.display.controlPanelEditor;

import jmri.jmrit.catalog.NamedIcon;
import jmri.jmrit.display.PositionableLabel;
import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.OBlockManager;
import jmri.util.JUnitUtil;

0 comments on commit fe79185

Please sign in to comment.
You can’t perform that action at this time.