Search in sources :

Example 1 with JLabelFinder

use of junit.extensions.jfcunit.finder.JLabelFinder in project JMRI by JMRI.

the class PositionableLabelTest method getColor.

int getColor(String name) {
    flushAWT();
    // Find window by name
    JmriJFrame frame = JmriJFrame.getFrame(name);
    Assert.assertNotNull("frame: " + name, frame);
    // find label within that
    JLabelFinder finder = new JLabelFinder("....");
    // FIXME: finder.findAll returns an untyped list, so we have issues with casting
    @SuppressWarnings("rawtypes") java.util.List list = finder.findAll(frame);
    Assert.assertNotNull("list: " + name, list);
    Assert.assertTrue("length: " + name + ": " + list.size(), list.size() > 0);
    JComponent component = (JComponent) list.get(0);
    int[] content = getDisplayedContent(component, component.getSize(), new Point(0, 0));
    int color = content[0];
    // Unless in demo mode, close table window
    if (System.getProperty("jmri.demo", "false").equals("false")) {
        frame.setVisible(false);
    }
    return color;
}
Also used : JmriJFrame(jmri.util.JmriJFrame) JComponent(javax.swing.JComponent) JLabelFinder(junit.extensions.jfcunit.finder.JLabelFinder) Point(java.awt.Point) Point(java.awt.Point)

Aggregations

Point (java.awt.Point)1 JComponent (javax.swing.JComponent)1 JmriJFrame (jmri.util.JmriJFrame)1 JLabelFinder (junit.extensions.jfcunit.finder.JLabelFinder)1