phamow / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

JTreeFixture.selectPath does not work for trees with the root node not visible #300

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a JTree with some DefaultMutableNodes
2. Hide the root node
3. Find the tree with a JTreeFixture and try to select one of the visible
nodes with selectPath
4. If the root node is visible, then selecting the same path (with the root
node prepended) works.

What is the expected output? What do you see instead?
I expect to be able to select the node, instead I see a NullPointerException:
java.lang.NullPointerException
    at javax.swing.JComponent.scrollRectToVisible(JComponent.java:3071)
    at org.fest.swing.driver.JTreeDriver$9.executeInEDT(JTreeDriver.java:356)
    at org.fest.swing.driver.JTreeDriver$9.executeInEDT(JTreeDriver.java:1)
    at org.fest.swing.edt.GuiQuery.run(GuiQuery.java:42)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
    at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275
)
    at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190
)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
    at org.fest.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:73)
    at
org.fest.swing.driver.JTreeDriver.scrollToPathToSelect(JTreeDriver.java:353)
    at org.fest.swing.driver.JTreeDriver.selectMatchingPath(JTreeDriver.java:346)
    at org.fest.swing.driver.JTreeDriver.selectPath(JTreeDriver.java:207)
    at org.fest.swing.fixture.JTreeFixture.selectPath(JTreeFixture.java:233)

What version of the product are you using? On what operating system?
fest-swing-1.0 on Ubuntu 8.04 with Java version "1.6.0_07"

Please provide any additional information below.
It looks like JTreeDriver.scrollPathToSelect() is getting the wrong TreePath.

Original issue reported on code.google.com by lia...@gmail.com on 4 Feb 2009 at 11:28

GoogleCodeExporter commented 9 years ago
Thanks for filing this bug. It was already filed (issue 293).

Original comment by Alex.Rui...@gmail.com on 4 Feb 2009 at 11:31