#=============================================================================================
# @TITLE			7. Step DBM Wizard.
#
# @NUMBER			DBM2_FKT_02010
#
# @DESCRIPTION		Specifying a log volume.
#
# @EXP_RESULT		'Database Version' step.
#
# @REQUIREMENTS		"Database Manager" is installed.
#=============================================================================================
TestName = "DBM2_FKT_02010";
static WizardOpen = 1;
#=============================================================================================
# @STEP 1			Specify log volume
#=============================================================================================
if (win_exists("Database Manager Installation Wizard") == 0) {

	set_window ("Database Manager Installation Wizard", 3);
	
	if (obj_exists("tabVolumes", 0) == E_OK) {
		tabName = "tabVolumes";
		listName = "lvwVolumes";
	}
	
	if (obj_exists("tabDevSpaces", 0) == E_OK) {
		tabName = "tabDevSpaces";
		listName = "lvwDevSpaces";
	}
	
	if (GUI_Version == "2") {
		tab_select_item (tabName, "&Log ");
	}
	if (GUI_Version == "3") {
		tab_select_item (tabName, "&Log Volumes");
	}
#=============================================================================================
# @STEP 2			Checking all controls and buttons.
#=============================================================================================
	L_RC_1 = obj_exists (tabName, 0);
	L_RC_2 = obj_exists (listName,0);
	L_RC_3 = obj_exists ("msvb_lib_toolbar", 0);
	
	if (L_RC_1 == 0 &&
		L_RC_2 == 0 &&
		L_RC_3 == 0) {
		
		tl_step ("Installation wizard - 'Volumes'", "0", "Check controls. - TN: " & TestName);
#=============================================================================================
# @STEP 3			Checking buttons state.
#=============================================================================================	
		obj_get_info ("< Back", "enabled", state1);
		obj_get_info ("Next >", "enabled", state2);
		obj_get_info ("Cancel", "enabled", state3);
		
		if (state1 == 1 &&
			state2 == 0 &&
			state3 == 1) {
			
			tl_step ("Installation wizard - 'Volumes' - button state", "0", "All buttons in correct state. - TN: " & TestName);
		} else {
			tl_step ("Installation wizard - 'Volumes' - button state", "1", "At least one button in incorrect state. - TN: " & TestName);
		}
#=============================================================================================
# @STEP 4			Defining new data medium.
#=============================================================================================
		set_window ("Database Manager Installation Wizard", 3);
		toolbar_button_press ("msvb_lib_toolbar", "New Volume");
		
		set_window ("Log Volume Properties", 1);
		
		if (obj_exists ("txtSize", 0) == 0 &&
			obj_exists ("picSize", 0) == 0 &&
			obj_exists ("cmbUnit", 0) == 0 &&
			obj_exists ("txtLocation", 0) == 0 &&
			obj_exists ("txtType", 0) == 0) {
			
			tl_step ("Log Volume Properties - Obeject check","0","All object are displayed. - TN: " & TestName);
#=============================================================================================
# @STEP 5			Checking button state before entering size of volume.
#=============================================================================================
			set_window ("Log Volume Properties", 1);
			
			button_get_info ("OK", "enabled", state1);
			button_get_info ("Cancel", "enabled", state2);

			if (state1 == 0 &&
				state2 == 1) {
				
				tl_step ("Log Volume Properties - Button check", "0", "OK disabled. - TN: " & TestName);
			} else {
				tl_step ("Log Volume Properties - Button check", "1", "OK not disabled. - TN: " & TestName);
			}			
#=============================================================================================
# @STEP 6			Checking button state after entering size of volume.
#=============================================================================================
			set_window ("Log Volume Properties", 1);
			
			set_window ("Log Volume Properties", 13);
			edit_set ("txtSize", "10000");
			
			button_get_info ("OK", "enabled", state1);
			button_get_info ("Cancel", "enabled", state2);

			if (state1 == 1 &&
				state2 == 1) {
				
				tl_step ("Log Volume Properties - Button check","0","OK enabled. - TN: " & TestName);
			} else {
				tl_step ("Log Volume Properties - Button check","1","OK not enabled. - TN: " & TestName);
			}
#=============================================================================================
# @STEP 7			Clicking 'OK' and define a 10000kB log volume.
#=============================================================================================
			set_window ("Log Volume Properties", 2);
			button_press ("OK");
#=============================================================================================
# @STEP 8			Checking entry in data volume list.
#=============================================================================================
			set_window ("Database Manager Installation Wizard", 1);
			list_get_item (listName, 0, item);
			list_get_subitem (listName, item, 1, subitem1);
			list_get_subitem (listName, item, 2, subitem2);
			list_get_subitem (listName, item, 3, subitem3);
			
			if (item == "LOG001" &&
				subitem1 == "10.000 KB" &&
				subitem2 == "File" &&
				subitem3 == "LOG_001") {
				
				tl_step ("Installation wizard - 'Volumes' - Log volume", "0", "Listitem and subitem are ok. - TN: " & TestName);
			} else {
				tl_step ("Installation wizard - 'Volumes' - Log volume", "1", "Listitem and subitem are not ok. - TN: " & TestName);
			}
#=============================================================================================
# @STEP 9			Checking data volume properties window.
#=============================================================================================
			set_window ("Database Manager Installation Wizard", 3);
			toolbar_button_press ("msvb_lib_toolbar", "Properties");
			
			set_window ("Log Volume Properties", 1);
		
			if (obj_exists ("txtSize", 0) == 0 &&
				obj_exists ("picSize", 0) == 0 &&
				obj_exists ("cmbUnit", 0) == 0 &&
				obj_exists ("txtLocation", 0) == 0 &&
				obj_exists ("txtType", 0) == 0) {
				
				tl_step ("Log Volume Properties - Object check","0","All objects are displayed. - TN: " & TestName);
				
				obj_get_info ("txtSize", "value", text1);
				obj_get_info ("picSize", "text", text2);
				obj_get_info ("cmbUnit", "value", text3);
				obj_get_info ("txtLocation", "value", text4);
				obj_get_info ("txtType", "value", text5);

				if (text1 == "10000" &&
					match (text2, "10.000KB") > 0 &&
					(match (text2, "9,77MB") > 0 || match (text2, "9,77") > 0) &&
					match (text2, "0,01GB") > 0 &&
					match (text2, "1.250Pages") > 0 &&
					text3 == "KB" &&
					text4 == "LOG_001" &&
					text5 == "File") {
					
					tl_step ("Log Volume Properties - Object values", "0", "All entries are ok. - TN: " & TestName);
				} else {
					tl_step ("Log Volume Properties - Object values", "1", "Not all entries are ok. - TN: " & TestName);
				}
			} else {
				tl_step ("Log Volume Properties - Object check", "1", "Not all objects are displayed. - TN: " & TestName);
			}
			
			button_press ("Cancel");
#=============================================================================================
# @STEP 10			Delete and recreate data volume.
#=============================================================================================
			set_window ("Database Manager Installation Wizard", 3);
			toolbar_button_press ("msvb_lib_toolbar", "Delete");
			wait(5);
			list_get_info (listName, "count", count);
			if (count == 0) {				
				tl_step ("Installation wizard - 'Volumes' - Delete volume","0","Delete correctly. - TN: " & TestName);
			} else {				
				tl_step ("Installation wizard - 'Volumes' - Delete volume","1","Delete incorrectly. - TN: " & TestName);
			}
			set_window ("Database Manager Installation Wizard", 3);
			toolbar_button_press ("msvb_lib_toolbar", "New Volume");
			
			set_window ("Log Volume Properties", 13);
			edit_set ("txtSize", "10000");
			button_press ("OK");
#=============================================================================================
# @STEP 11			Going 'Next >'.
#=============================================================================================
			set_window ("Database Manager Installation Wizard", 3);
			button_press ("Next >");
		} else {
			tl_step ("Log Volume Properties - Obeject check","1","Not all object are displayed. - TN: " & TestName);
		}
	} else {
		tl_step ("Installation wizard - 'Volumes'", "1", "Check controls. - TN: " & TestName);
	}
} else {
	
	tl_step("Database Manager Installation Wizard - Window Check", "1", "Window not open. - TN: " & TestName);
	WizardOpen = 0;
}
