From: <ker...@us...> - 2012-03-04 15:16:02
|
Revision: 21245 http://jedit.svn.sourceforge.net/jedit/?rev=21245&view=rev Author: kerik-sf Date: 2012-03-04 15:15:56 +0000 (Sun, 04 Mar 2012) Log Message: ----------- let a tree path be specified with arbitrary separator (to be able to select <style type="test/css">) EBFixture.doInBetween waits for the runnable, not only the message Modified Paths: -------------- tests/Fest/src/org/gjt/sp/jedit/testframework/EBFixture.java tests/Fest/src/org/gjt/sp/jedit/testframework/TestUtils.java Modified: tests/Fest/src/org/gjt/sp/jedit/testframework/EBFixture.java =================================================================== --- tests/Fest/src/org/gjt/sp/jedit/testframework/EBFixture.java 2012-03-03 19:15:15 UTC (rev 21244) +++ tests/Fest/src/org/gjt/sp/jedit/testframework/EBFixture.java 2012-03-04 15:15:56 UTC (rev 21245) @@ -52,7 +52,7 @@ public class EBFixture{ /** - * register for a certain message, run the runnable r, wait for the message. + * register for a certain message, run the runnable r, wait for the message and the runnable. * @param r runnable to run asyncronously * @param condition message to wait for * @param timeout how long to wait for the message @@ -60,8 +60,14 @@ public static void doInBetween(Runnable r,EBCondition condition, long timeout){ MessageListener listen = new MessageListener(); listen.registerForMessage(condition); - new Thread(r).start(); + Thread t = new Thread(r); + t.start(); listen.waitForMessage(timeout); + try{ + t.join(timeout); + }catch(InterruptedException e){ + fail("Interrupted !"); + } } /** Modified: tests/Fest/src/org/gjt/sp/jedit/testframework/TestUtils.java =================================================================== --- tests/Fest/src/org/gjt/sp/jedit/testframework/TestUtils.java 2012-03-03 19:15:15 UTC (rev 21244) +++ tests/Fest/src/org/gjt/sp/jedit/testframework/TestUtils.java 2012-03-04 15:15:56 UTC (rev 21245) @@ -34,6 +34,7 @@ import javax.swing.tree.*; import javax.swing.JTree; import java.util.Arrays; +import java.util.regex.Pattern; //{{{ jEdit import org.gjt.sp.jedit.*; @@ -383,13 +384,13 @@ public static void selectPath( JTreeFixture treeFixture, String[] path ) { JTree tree = treeFixture.targetCastedTo( JTree.class ); TreePath finalPath = getPathForStrings( treeFixture, path ); - + tree.setToggleClickCount(1); if ( !tree.isVisible( finalPath ) ) { TreePath parentPath = new TreePath( finalPath.getPathComponent( 0 ) ); for ( int i = 1;i < finalPath.getPathCount();i++ ) { TreePath curPath = parentPath.pathByAddingChild( finalPath.getPathComponent( i ) ); if ( !tree.isVisible( curPath ) ) { - treeFixture.toggleRow( tree.getRowForPath( curPath.getParentPath() ) ); + treeFixture.expandRow( tree.getRowForPath( curPath.getParentPath() ) ); } parentPath = curPath; } @@ -399,13 +400,15 @@ } - /** + /** * Convenience method to select a path in a JTree. + * Path must be absolute, separator is the first char * @param treeFixture the JTree * @param path the path to select */ public static void selectPath( JTreeFixture treeFixture, String path ) { - String[] components = path.split("/",-1); + String separator = path.substring(0,1); + String[] components = path.substring(1).split(Pattern.quote(separator),-1); selectPath(treeFixture, components); } //}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |