################################################################################
# TEST: startup
################################################################################
# $Revision: 1.3 $
# $Author: drajovic $
# $Date: 2002/12/16 19:33:51 $
# $Source: d:/Archive/CVS_QS/EMOS/EMOS_FRM_EXAMPLES/FlightDemo/Scripts/startup/script,v $
# $NoKeywords: $
################################################################################

#/***
#*	This is the project-wide startup script that initialises the test environment at
#*	the time of WinRunner start. Make sure to declare it as startup script
#*	in WinRunner's General Options dialog.
#*	<p>
#*	Please note the position of this file in the directory structure. This is important
#*	because all paths are made realtive to this file. You can therefore easily relocate
#*	the whole project anywhere you want as long as you preserve its structure.
#*/

#/**
#*	Trims given characters from the end of the given <code>str</code>ing.
#*	Use this function to ensure that getvar("curr_dir") allways returns the
#*	same value. Sometimes it returns the path ended with backslash. In other
#*	occasions (e.g. re-runing the same test) it returns the path without the
#*	backslash?!
#*	@param str (in)	string to be right-trimmed
#*	@param zap (in)	(optional) string to be trimmed [default: \]
#*	@return the trimmed string
#*/

static function strip_trail ( in str, in zap )
{
	static const DEFZAP = "\\";
	auto slen, zlen;
	if ( zap == "" ) 
		zap = DEFZAP;
	slen = length( str );
	zlen = length( zap );
	if ( slen && substr( str, (slen-zlen+1) ) == zap )
		str = strip_trail( substr( str, 1, slen-zlen ) );
	return str;
}

#------------------
# public constants
#------------------

public const MROOT = getenv ("M_ROOT");
public const TEST_HOME = strip_trail( getvar( "curr_dir" ), "\\" );
public const DATA_HOME = TEST_HOME & "\\..\\Data";
public const GUI_HOME = TEST_HOME & "\\GUI";

#------------------
# setting up environment variables
#------------------

setvar("searchpath", sprintf( ". .. <%s> <%s>" 
      , TEST_HOME
      , MROOT & "\\lib" ) );
					 
# Make sure your timeout is fine (WR sometimes confuses miliseconds with seconds)
setvar("timeout", 10 );
# Sets record owner drawn buttons to "push_button" to get FlightApp working correctly
setvar("rec_owner_drawn", "push_button");

# EMOS Framework debug mode = FALSE supresses planty of user messages
# this will only work with EMOS Framework loaded
set_debug( TRUE );

#------------------
# loading project-wide libraries
# for big projects load functions which are often needed 
# seldomly used or narrow-focused functions can be loaded with EMOS Framework
# at the time you really nead them
#------------------

reload( "LIB\\AUT_lib", 0, 1 );	# generic project-wide functions (AUT = Application Under Test)
reload( "LIB\\FRM_lib", 0, 1 );	# generic Framework functions (FRM = EMOS Framework)

# if you have many test drivers, then don't load them here
reload( "DRV\\main_lib", 0, 1 );	# main Framework driver script

#------------------
# loading global GUI-Maps
# we prefer to load GUI-Maps dynamically from driver scripts (see DRV/main_lib)
#------------------

GUI_close_all();
load_GUI( GUI_HOME & "\\" & "Generic.gui" );

#------------------
# Exceptions
#------------------
# none

#------------------
# GUI customisation
#------------------
# Configure the MS Mask object to map to edit objects.
set_class_map("MSMaskWndClass", "edit");
set_record_attr("MSMaskWndClass", "class attached_text", "MSW_id", "location");
set_record_method("MSMaskWndClass", RM_RECORD);

# Configure the status bar in the GUI Map
set_class_map("AfxWnd40", "object");
set_record_attr("AfxWnd40", "class regexp_MSW_class", "attached_text MSW_id MSW_class label", "location");

# Lars Undebakke's settings to get the StatusBar working
set_class_map("Threed.SSPanel", "object");
set_record_attr("Threed.SSPanel", "class regexp_MSW_class", "attached_text MSW_id MSW_class label", "location");
