Issue Details (XML | Word | Printable)

Key: FEST-119
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alex Ruiz
Reporter: Alex Ruiz
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
FEST

'requireSelection' in JTreeFixture does not work with invisible roots

Created: 29/Apr/09 09:11 AM   Updated: 19/May/09 05:06 AM   Resolved: 19/May/09 05:06 AM
Return to search
Component/s: Swing
Affects Version/s: FEST-Assert 1.1
Fix Version/s: FEST-Swing 1.2a2

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive mylyn-context.zip (19 kB)



 Description  « Hide

From Eric Kolotyluk:

OK, The first part of my tests work, but the second part does not. The test code is

@Test public void excerciseAssetTree()
   {
       JTreeFixture treeFixture = frameFixture.tree();

       // Make sure the colors are in alphabetical order
       treeFixture.selectPath("Color/Blue");
       treeFixture.requireSelection(1);
       treeFixture.selectPath("Color/Green");
       treeFixture.requireSelection(2);
       treeFixture.selectPath("Color/Red");
       treeFixture.requireSelection(3);

       // Make sure selection works
       treeFixture.selectRow(1);
       treeFixture.requireSelection("Color/Blue");    // Fails here
       treeFixture.selectRow(2);
       treeFixture.requireSelection("Color/Green");
       treeFixture.selectRow(3);
       treeFixture.requireSelection("Color/Red");
   }

As far as I can tell the second set of tests are just the inverse of the first set, so I don't understand why it's failing.

Cheers, Eric

java.lang.AssertionError: [com.kodak.gcg.unified.ui.tree.AssetTree[name=null, selectionCount=1, selectionPaths=['[Root, Color, Blue]'], selectionMode=DISCONTIGUOUS_TREE_SELECTION, enabled=true, visible=true, showing=true] - property:'selection'] array:<[[Root, Color, Blue]]> does not contain element(s):<[[Color, Blue]]>
       at org.fest.swing.edt.GuiActionRunner.rethrowCatchedExceptionIn(GuiActionRunner.java:145)
       at org.fest.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:97)
       at org.fest.swing.driver.JTreeDriver.requireSelection(JTreeDriver.java:505)
       at org.fest.swing.driver.JTreeDriver.requireSelection(JTreeDriver.java:499)
       at org.fest.swing.fixture.JTreeFixture.requireSelection(JTreeFixture.java:493)
       at com.kodak.gcg.unified.ui.tree.AssetTreeFestTest.excerciseAssetTree(AssetTreeFestTest.java:107)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
       at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
       at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
       at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
       at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
       at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
       at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
       at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
       at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
       at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
       at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

From Jeanette:

Alex,

you can reproduce it with any tree with rootVisible == false.

Problem seems to be that the addRoot-Magic is asymmetric: it happens in selectPath(String) but not in requireSelection(String). The former delegates to JTreeMatchingPathQuery.findVisible which does add the root, the latter to JMPQ.matchingPathFor which doesn't.

BTW, any reason there are two implementations of the addRoot, one implementation in JMPQ, one in JTreeDriver (duplicating the method call in selectPath).



There are no comments yet on this issue.