testexecmdw/tef/tef/test/regressiontest/teststep/src/writeboolstep.cpp
branchRCL_3
changeset 3 9397a16b6eb8
parent 1 6edeef394eb7
equal deleted inserted replaced
1:6edeef394eb7 3:9397a16b6eb8
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * Example CTestStep derived implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file WriteBoolStep.cpp
       
    23 */
       
    24 #include "writeboolstep.h"
       
    25 #include "te_regsteptestsuitedefs.h"
       
    26 
       
    27 CWriteBoolStep::~CWriteBoolStep()
       
    28 /**
       
    29  * Destructor
       
    30  */
       
    31 	{
       
    32 	}
       
    33 
       
    34 CWriteBoolStep::CWriteBoolStep()
       
    35 /**
       
    36  * Constructor
       
    37  */
       
    38 	{
       
    39 	// **MUST** call SetTestStepName in the constructor as the controlling
       
    40 	// framework uses the test step name immediately following construction to set
       
    41 	// up the step's unique logging ID.
       
    42 	SetTestStepName(KWriteBoolStep);
       
    43 	}
       
    44 
       
    45 TVerdict CWriteBoolStep::doTestStepPreambleL()
       
    46 /**
       
    47  * @return - TVerdict code
       
    48  * Override of base class virtual
       
    49  */
       
    50 	{
       
    51 	// process some pre setting to this test step then set SetTestStepResult to EFail or Epass.
       
    52 	SetTestStepResult(EPass);
       
    53 	return TestStepResult();
       
    54 	}
       
    55 
       
    56 
       
    57 TVerdict CWriteBoolStep::doTestStepL()
       
    58 /**
       
    59  * @return - TVerdict code
       
    60  * Override of base class pure virtual
       
    61  * Our implementation only gets called if the base class doTestStepPreambleL() did
       
    62  * not leave. That being the case, the current test result value will be EPass.
       
    63  */
       
    64 	{
       
    65 	INFO_PRINTF1(_L("This step tests WriteBoolToConfig function."));
       
    66 	SetTestStepResult(EFail);
       
    67 	
       
    68 	TBool originalValue;
       
    69 	TBool TheBool;
       
    70 	TBool ret = EFalse;
       
    71 	
       
    72 	if(!GetBoolFromConfig(ConfigSection(),KTe_RegStepTestSuiteBool, originalValue))
       
    73 		{
       
    74 		// Leave if there's any error.
       
    75 		User::Leave(KErrNotFound);
       
    76 		}
       
    77 	
       
    78 	INFO_PRINTF2(_L("The ORIGINAL Bool is %d"), originalValue); // Block end
       
    79 	TheBool = ETrue;
       
    80 	if (WriteBoolToConfig(ConfigSection(),KTe_RegStepTestSuiteBool,TheBool))
       
    81 		{
       
    82 		if (GetBoolFromConfig(ConfigSection(),KTe_RegStepTestSuiteBool, TheBool) && TheBool)
       
    83 			{
       
    84 			INFO_PRINTF2(_L("The CHANGED Bool is %d"), TheBool);
       
    85 			ret = ETrue;
       
    86 			}
       
    87 		}
       
    88 	
       
    89 	TheBool = EFalse;
       
    90 	if (WriteBoolToConfig(ConfigSection(),KTe_RegStepTestSuiteBool,TheBool))
       
    91 		{
       
    92 		if (GetBoolFromConfig(ConfigSection(),KTe_RegStepTestSuiteBool, TheBool) && !TheBool)
       
    93 			{
       
    94 			INFO_PRINTF2(_L("The CHANGED Bool is %d"), TheBool);
       
    95 			}
       
    96 		}
       
    97 	else
       
    98 		{
       
    99 		ret = EFalse;
       
   100 		}
       
   101 	
       
   102 	if (!WriteBoolToConfig(ConfigSection(),KTe_RegStepTestSuiteBool,originalValue))
       
   103 		{
       
   104 		ret = EFalse;
       
   105 		}
       
   106 	
       
   107 	if (ret)
       
   108 		{
       
   109 		SetTestStepResult(EPass);
       
   110 		}
       
   111 
       
   112 	return TestStepResult();
       
   113 	}
       
   114 
       
   115 TVerdict CWriteBoolStep::doTestStepPostambleL()
       
   116 /**
       
   117  * @return - TVerdict code
       
   118  * Override of base class virtual
       
   119  */
       
   120 	{
       
   121 	return TestStepResult();
       
   122 	}