#=============================================================================================
#
# @TITLE			Configure users - Set new propertie Values for group.
#
# @NUMBER			DBM3_DBUser_007_Configure_users_NewGroup_new_properties
#
# @DESCRIPTION		set new Values for the properties of this group
#
#=============================================================================================

static TestName = "DBM3_DBUser_007_Configure_users_NewGroup_new_properties";
static expHeaderTitle = "Configure Database Users / User Groups";
static expHeaderSubtitle = "Configure database user for the database administrator 'DBA'.";
static Failure = 0;

#=============================================================================================
# @STEP 1			check if Config Wizard is open --> texit
#=============================================================================================
if (win_exists("Configuration Wizard",0) != E_OK)
{
	tl_step ("Wizard not open",1,"Testname: " & TestName & ", Line:" & getvar("line_no"));
	texit("true");
}	

#=============================================================================================
# @STEP 2		check header title ---> texit
#=============================================================================================	
#get header title
set_window("Configuration Wizard", 1);
ActiveX_get_info("DBMWfr3.Framework","HeaderTitle",HeaderTitle);
ActiveX_get_info("DBMWfr3.Framework","HeaderSubtitle",HeaderSubtitle);

# check if header title is correct
if (HeaderTitle != expHeaderTitle || HeaderSubtitle != expHeaderSubtitle)
{
	tl_step ("Header title not correct",1,"Testname: " & TestName & ", Line:" & getvar("line_no"));
	texit("true");
}


#=============================================================================================
# @STEP 3		Check TEST_GROUP ---> texit
#=============================================================================================	
set_window ("Configuration Wizard", 1);
if (list_select_item ("lvwSQLUser", "TEST_GROUP") != E_OK)
{
	tl_step ("No TEST_GROUP",1,"Testname: " & TestName & ", Line:" & getvar("line_no"));
	texit("true");
}

#=============================================================================================
# @STEP 4		Check  Toolbar Buttons
#=============================================================================================	

toolbar_get_button_info("msvb_lib_toolbar","New User",ENABLED,btn_NewUser);
toolbar_get_button_info("msvb_lib_toolbar","New User Group",ENABLED,btn_NewUserGroup);
toolbar_get_button_info("msvb_lib_toolbar","Properties",ENABLED,btn_Properties);
toolbar_get_button_info("msvb_lib_toolbar","Copy",ENABLED,btn_Copy);
toolbar_get_button_info("msvb_lib_toolbar","Delete",ENABLED,btn_Delete);
toolbar_get_button_info("msvb_lib_toolbar","Rename",ENABLED,btn_Rename);

if (btn_NewUser == 0 || btn_NewUserGroup == 0 || btn_Properties == 0 || btn_Copy == 1 || btn_Delete == 0 || btn_Rename == 0 )
{
	tl_step ("Toolbar Buttons not in correct state",1,"Testname: " & TestName & ", Line:" & getvar("line_no")); 
	Failure = 1;
}

#=============================================================================================
# @STEP 5		Check Properties Button and press it ---> texit 
#=============================================================================================

toolbar_get_button_info("msvb_lib_toolbar","Properties",ENABLED,btn_NewUserGroup);
if (btn_NewUserGroup == 0)
{
	tl_step ("btn_Properties not available",1,"Testname: " & TestName & ", Line:" & getvar("line_no")); 
	texit("true");
}

set_window ("Configuration Wizard", 7);
toolbar_button_press ("msvb_lib_toolbar", "Properties");

#=============================================================================================
# @STEP 6	 	Check if new User Group Properties Window appears ---> texit
#=============================================================================================
if (win_exists("SQL User *",0) != E_OK)
{
	tl_step ("New user Group Properties window not opened",1,"Testname: " & TestName & ", Line:" & getvar("line_no")); 
	texit("true");
}

set_window("SQL User *");

#=============================================================================================
# @STEP 7 	 Select <General> Tab & set all Elements
#=============================================================================================
tab_select_item("tabPages","&General");

list_select_item("comUsermode","RESOURCE");
list_select_item("comConnectMode","EXCLUSIVE");


#=============================================================================================
# @STEP 8		Select <Extended> Tab & set all Elements
#=============================================================================================
tab_select_item("tabPages","&Extended");

edit_set("txtTimeout","32399");
edit_set("txtCostwarning","2");
edit_set("txtCostlimit","9");
list_select_item("comDefaultCode","ASCII");

button_press("OK");

#=============================================================================================
# @STEP 9		check if test passed successfully
#=============================================================================================	
if (Failure == 0)
	tl_step ("Test passed successfully",0,"Testname: " & TestName & ", Line:" & getvar("line_no"));
