#=============================================================================================
# @TITLE			Checking second window - Backup Wizard - Incremental.
#
# @NUMBER			DBM2_FKT_02112
#
# @DESCRIPTION		Checking window and content. Step is to define the kind of backup.
# @					First of all clicking the 'Back' button. Then
# @					clicking the options 4 options like - Complete, Incremental, 
# @					Log Backup, Set AutoLog On/Off -. And going 'Next'.
#
# @EXP_RESULT		The 'Back'buttonworks. The above mentioned 4 options will be displayed.
# @					And at last the 'Next' button works as well.
#
# @REQUIREMENTS		"Database Manager" is installed.
#=============================================================================================
static WizardOpen = 1;
#=============================================================================================
# @STEP 1			Checking window and clicking 'Next'.
#=============================================================================================
if (win_exists("Database Manager Backup Wizard",0) == 0) {
	
	tl_step("Database Manager Backup Wizard - Window Check", "0", "Window still open");
	
	set_window("Database Manager Backup Wizard", 1);
#=============================================================================================
# @STEP 2			Clicking the 'Back' button.
#=============================================================================================
	button_press ("< Back");
	
	ActiveX_get_info("rtbWelcome", "Text", Text);
	
	if (match (Text, "Welcome to the Backup Wizard.") != 0) {
		
		tl_step("Database Manager Backup Wizard - Step Welcome title","0", "Text: " & Text & " as expected");
	} else {
		tl_step("Database Manager Backup Wizard - Step Welcome title","1", "Text: " & Text & " not expected");
	}
#=============================================================================================
# @STEP 3			Clicking the 'Next' button and checking the window content.
#=============================================================================================
	button_press ("Next >");

	ActiveX_get_info ("DBMWfr2.Framework", "HeaderTitle", HeaderTitle);
	ActiveX_get_info ("DBMWfr2.Framework", "HeaderSubtitle", HeaderSubtitle);
	
	if (HeaderTitle == "Backup Type" &&
		HeaderSubtitle == "Select which type of backup you want to perform.") {
		
		tl_step ("Backup Wizard - Step title","0", "HeaderTitle: " & HeaderTitle & " as expected");
		tl_step ("Backup Wizard - Step title","0", "HeaderSubtitle " & HeaderSubtitle & " as expected");
	} else {
		tl_step ("Backup Wizard - Step title","1", "HeaderTitle: " & HeaderTitle & " not expected");
		tl_step ("Backup Wizard - Step title","1", "HeaderSubtitle " & HeaderSubtitle & " not expected");
	}
	
	L_RC_1 = obj_exists("Complete Data Backup",0);
	L_RC_2 = obj_exists("Incremental Data Backup",0);
	L_RC_3 = obj_exists("Log Backup",0);
	L_RC_4 = obj_exists("Activate/deactivate automatic log backup",0);
	L_RC_5 = obj_exists("< Back",0);
	L_RC_6 = obj_exists("Next >",0);
	L_RC_7 = obj_exists("Cancel",0);
	
	if (L_RC_1 == 0 &&
		L_RC_2 == 0 &&
		L_RC_3 == 0 &&
		L_RC_4 == 0 &&
		L_RC_5 == 0 &&
		L_RC_6 == 0 &&
		L_RC_7 == 0) {
		
		tl_step("Checking object of window.", "0", "All objects dispayed");
		
		button_get_info("Complete Data Backup","value", value11);
		button_get_info("Complete Data Backup","enabled", value12);
		button_get_info("Incremental Data Backup","value", value21);
		button_get_info("Incremental Data Backup","enabled", value22);
		button_get_info("Log Backup","value", value31);
		button_get_info("Log Backup","enabled", value32);
		button_get_info("Activate/deactivate automatic log backup","value", value41);	
		button_get_info("Activate/deactivate automatic log backup","enabled", value42);
		
		button_get_info("< Back","enabled", value5);
		button_get_info("Next >","enabled", value6);
		button_get_info("Cancel","enabled", value7);
		
		if (value11 == 1 &&
			value12 == 1 &&
			value21 == 0 &&
			value22 == 1 &&
			value31 == 0 &&
			value32 == 1 &&
			value41 == 0 &&
			value42 == 1 &&
			value5 == 1 &&
			value6 == 1 &&
			value7 == 1) {
			
			tl_step("Checking button state","0","All buttons in correct state");
		} else {
			
			tl_step("Checking button state", "1", "Not all buttons in correct state");
			tl_step("Checking button state", "1", value11 & " expected 1 (Complete Data Backup - value)");
			tl_step("Checking button state", "1", value12 & " expected 1 (Complete Data Backup - enabled)");
			tl_step("Checking button state", "1", value21 & " expected 1 (Incremental Data Backup - value)");
			tl_step("Checking button state", "1", value22 & " expected 0 (Incremental Data Backup - enabled)");
			tl_step("Checking button state", "1", value31 & " expected 1 (Log Backup - value)");
			tl_step("Checking button state", "1", value32 & " expected 0 (Log Backup - enabled)");
			tl_step("Checking button state", "1", value41 & " expected 1 (Activate/deactivate automatic log backup - value)");
			tl_step("Checking button state", "1", value42 & " expected 0 (Activate/deactivate automatic log backup - enabled)");
			tl_step("Checking button state", "1", value5 & " expected 1 (< Back)");
			tl_step("Checking button state", "1", value6 & " expected 1 (Next >)");
			tl_step("Checking button state", "1", value7 & " expected 1 (Cancel)");
		}
#=============================================================================================
# @STEP 4			Clicking 'Incremental Data Backup' and the 'Next' button
# @					--> checking the window content.
#=============================================================================================
		set_window ("Database Manager Backup Wizard", 2);
		button_set ("Incremental Data Backup", ON);

		set_window ("Database Manager Backup Wizard", 3);
		button_press ("Next >");
	} else {
		tl_step("Checking object of window.", "1", "Not all objects dispayed");
		tl_step("Checking object of window.", "1", L_RC_1 & " expected 0");
		tl_step("Checking object of window.", "1", L_RC_2 & " expected 0");
		tl_step("Checking object of window.", "1", L_RC_3 & " expected 0");
		tl_step("Checking object of window.", "1", L_RC_4 & " expected 0");
		tl_step("Checking object of window.", "1", L_RC_5 & " expected 0");
		tl_step("Checking object of window.", "1", L_RC_6 & " expected 0");
		tl_step("Checking object of window.", "1", L_RC_7 & " expected 0");
	}
} else {
	
	tl_step("Database Manager Backup Wizard - Window Check", "1", "Window not open");
	WizardOpen = 0;
}
