// Wait for the active workarea
// FIXME This should use an event listener to wait for the workarea
@BeforeEach
	protected void setup() throws Exception {
		// Remove the existing program data folder
		String suffix = "-" + Profile.TEST;
		ProductCard metadata = ProductCard.info( Program.class );
		Path programDataFolder = OperatingSystem.getUserProgramDataFolder( metadata.getArtifact() + suffix, metadata.getName() + suffix );
		assertThat( aggressiveDelete( programDataFolder ) ).withFailMessage( "Failed to delete program data folder" ).isTrue();
		// For the parameters to be available using Java 9, the following needs to be added
		// to the test JVM command line parameters because com.sun.javafx.application.ParametersImpl
		// is not exposed, nor is there a "proper" way to access it:
		//
		// --add-opens=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
		program = (Program)FxToolkit.setupApplication( Program.class, ProgramTestConfig.getParameterValues() );
		program.register( ProgramEvent.ANY, programWatcher = new EventWatcher( TIMEOUT ) );
		Fx.waitForWithExceptions( TIMEOUT );
		// NOTE Thread.yield() is helpful but not consistent
		Thread.yield();
		programWatcher.waitForEvent( ProgramEvent.STARTED, TIMEOUT );
		Fx.waitForWithExceptions( TIMEOUT );
		// NOTE Thread.yield() is helpful but not consistent
		Thread.yield();
		// Wait for the active workarea
		// FIXME This should use an event listener to wait for the workarea
		long limit = System.currentTimeMillis() + TIMEOUT;
		while( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() == null && System.currentTimeMillis() < limit ) {
			ThreadUtil.pause( 100 );
		}
		assertThat( program ).withFailMessage( "Program is null" ).isNotNull();
		assertThat( program.getWorkspaceManager() ).withFailMessage( "Workspace manager is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace() ).withFailMessage( "Active workspace is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() ).withFailMessage( "Active workarea is null" ).isNotNull();
		assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane() ).withFailMessage( "Active workpane is null" ).isNotNull();
		Workpane workpane = program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane();
		workpane.addEventHandler( WorkpaneEvent.ANY, workpaneWatcher = new FxEventWatcher() );
		initialMemoryUse = getMemoryUse();
	}
// NOTE Thread.yield() is helpful but not consistent
Thread.yield();
// Wait for the active workarea
// FIXME This should use an event listener to wait for the workarea
long limit = System.currentTimeMillis() + TIMEOUT;
while( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() == null && System.currentTimeMillis() < limit ) {
// --add-opens=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
program = (Program)FxToolkit.setupApplication( Program.class, ProgramTestConfig.getParameterValues() );
program.register( ProgramEvent.ANY, programWatcher = new EventWatcher( TIMEOUT ) );
Fx.waitForWithExceptions( TIMEOUT );
// NOTE Thread.yield() is helpful but not consistent
Thread.yield();
programWatcher.waitForEvent( ProgramEvent.STARTED, TIMEOUT );
Fx.waitForWithExceptions( TIMEOUT );
// NOTE Thread.yield() is helpful but not consistent
Thread.yield();
// Wait for the active workarea
// FIXME This should use an event listener to wait for the workarea
long limit = System.currentTimeMillis() + TIMEOUT;
while( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() == null && System.currentTimeMillis() < limit ) {
ThreadUtil.pause( 100 );
}
assertThat( program ).withFailMessage( "Program is null" ).isNotNull();
assertThat( program.getWorkspaceManager() ).withFailMessage( "Workspace manager is null" ).isNotNull();
assertThat( program.getWorkspaceManager().getActiveWorkspace() ).withFailMessage( "Active workspace is null" ).isNotNull();
assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() ).withFailMessage( "Active workarea is null" ).isNotNull();
assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane() ).withFailMessage( "Active workpane is null" ).isNotNull();
Workpane workpane = program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane();
protected void setup() throws Exception {
// Remove the existing program data folder
String suffix = "-" + Profile.TEST;
ProductCard metadata = ProductCard.info( Program.class );
Path programDataFolder = OperatingSystem.getUserProgramDataFolder( metadata.getArtifact() + suffix, metadata.getName() + suffix );
assertThat( aggressiveDelete( programDataFolder ) ).withFailMessage( "Failed to delete program data folder" ).isTrue();
// For the parameters to be available using Java 9, the following needs to be added
// to the test JVM command line parameters because com.sun.javafx.application.ParametersImpl
// is not exposed, nor is there a "proper" way to access it:
//
// --add-opens=javafx.graphics/com.sun.javafx.application=ALL-UNNAMED
program = (Program)FxToolkit.setupApplication( Program.class, ProgramTestConfig.getParameterValues() );
program.register( ProgramEvent.ANY, programWatcher = new EventWatcher( TIMEOUT ) );
Fx.waitForWithExceptions( TIMEOUT );
// NOTE Thread.yield() is helpful but not consistent
Thread.yield();
programWatcher.waitForEvent( ProgramEvent.STARTED, TIMEOUT );
Fx.waitForWithExceptions( TIMEOUT );
// NOTE Thread.yield() is helpful but not consistent
Thread.yield();
// Wait for the active workarea
// FIXME This should use an event listener to wait for the workarea
long limit = System.currentTimeMillis() + TIMEOUT;
while( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() == null && System.currentTimeMillis() < limit ) {
ThreadUtil.pause( 100 );
}
assertThat( program ).withFailMessage( "Program is null" ).isNotNull();
assertThat( program.getWorkspaceManager() ).withFailMessage( "Workspace manager is null" ).isNotNull();
assertThat( program.getWorkspaceManager().getActiveWorkspace() ).withFailMessage( "Active workspace is null" ).isNotNull();
assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea() ).withFailMessage( "Active workarea is null" ).isNotNull();
assertThat( program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane() ).withFailMessage( "Active workpane is null" ).isNotNull();
Workpane workpane = program.getWorkspaceManager().getActiveWorkspace().getActiveWorkarea().getWorkpane();
workpane.addEventHandler( WorkpaneEvent.ANY, workpaneWatcher = new FxEventWatcher() );
initialMemoryUse = getMemoryUse();
}