profilesservices/FileList/tsrc/public/basic/src/T_CFLDController.cpp
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2007 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 *  CFLDController test class.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 //  Include Files
       
    22 #include "T_CFLDController.h"
       
    23 #define private public
       
    24 #define protected public
       
    25 #include "CFLDController.h"
       
    26 #include <EUnitMacros.h>
       
    27 #include <TEUnitAssertionInfo.h>
       
    28 #include <CEUnitAllocTestCaseDecorator.h>
       
    29 
       
    30 namespace
       
    31 	{
       
    32 	// Default delay 1000000 = 1sec
       
    33 	const TInt KDefaultDelay( 1000000 );
       
    34 	}
       
    35 
       
    36 // CONSTRUCTION
       
    37 // Static constructor
       
    38 T_CFLDController* T_CFLDController::NewLC()
       
    39     {
       
    40     T_CFLDController* self = new(ELeave) T_CFLDController;
       
    41     CleanupStack::PushL(self);
       
    42     self->ConstructL();
       
    43     return self;
       
    44     }
       
    45 
       
    46 // Destructor (virtual by CBase)
       
    47 T_CFLDController::~T_CFLDController()
       
    48     {
       
    49     delete iController;
       
    50     iController = NULL;
       
    51     }
       
    52 
       
    53 // Second phase construct
       
    54 void T_CFLDController::ConstructL()
       
    55     {
       
    56     CEUnitTestSuiteClass::ConstructL();
       
    57     }
       
    58 
       
    59 T_CFLDController::T_CFLDController()
       
    60     {
       
    61     }
       
    62 
       
    63 //---------------------------------------------------------------
       
    64 //----------------- TEST CASE METHODS ---------------------------
       
    65 //---------------------------------------------------------------
       
    66 
       
    67 //  METHODS
       
    68 
       
    69 // Setup nothing.
       
    70 void T_CFLDController::EmptySetupL()
       
    71     {
       
    72     }
       
    73 
       
    74 void T_CFLDController::SetupL()
       
    75     {
       
    76     EmptySetupL();
       
    77     TBool showErrorMsgs( ETrue );
       
    78  
       
    79     iController = CFLDController::NewL( showErrorMsgs, KDefaultDelay );
       
    80     }
       
    81 
       
    82 // Teardown nothing.
       
    83 void T_CFLDController::Teardown()
       
    84     {
       
    85     delete iController;
       
    86     iController = NULL;
       
    87     }
       
    88 
       
    89 // CREATIONAL TESTS
       
    90 void T_CFLDController::TestCreateObjectL()
       
    91     {
       
    92     TBool showErrorMsgs( ETrue );
       
    93     
       
    94     CFLDController* controller = NULL;
       
    95     controller = CFLDController::NewL( showErrorMsgs, KDefaultDelay );
       
    96     delete controller;
       
    97     controller = NULL;
       
    98 
       
    99     controller = CFLDController::NewLC( showErrorMsgs, KDefaultDelay );
       
   100     if( controller )
       
   101     	{
       
   102     	RWindow *dummy = NULL;
       
   103     	controller->CompleteConstructionL( *dummy );
       
   104     	}
       
   105     CleanupStack::Pop( controller );
       
   106     delete controller;
       
   107     }
       
   108 
       
   109 void T_CFLDController::SetDelayTestL()
       
   110     {
       
   111     __UHEAP_MARK;
       
   112     iController->SetDelay( 1000000 );
       
   113     __UHEAP_MARKEND;
       
   114     }
       
   115 
       
   116 void T_CFLDController::SetVolumeTestL()
       
   117     {
       
   118     __UHEAP_MARK;
       
   119     iController->SetVolume( 1 );
       
   120     __UHEAP_MARKEND;
       
   121     }
       
   122 void T_CFLDController::SetRingingTypeTestL()
       
   123     {
       
   124     __UHEAP_MARK;
       
   125     iController->SetRingingType( 1 );
       
   126     __UHEAP_MARKEND;
       
   127     }
       
   128 void T_CFLDController::SetVibraTestL()
       
   129     {
       
   130     __UHEAP_MARK;
       
   131     iController->SetVibra( EFalse );
       
   132     __UHEAP_MARKEND;
       
   133     }
       
   134 void T_CFLDController::Set3dEffectsTestL()
       
   135     {
       
   136     __UHEAP_MARK;
       
   137     iController->Set3dEffects( EFalse );
       
   138     __UHEAP_MARKEND;
       
   139     }
       
   140 void T_CFLDController::SetFileObserverTestL()
       
   141     {
       
   142     __UHEAP_MARK;
       
   143     iController->SetFileObserver( NULL );
       
   144     __UHEAP_MARKEND;
       
   145     }
       
   146 void T_CFLDController::HandleFileListBoxEventTestL()
       
   147     {
       
   148     __UHEAP_MARK;
       
   149     iController->HandleFileListBoxEventL( MFLDFileListBoxObserver::EVideoPreviewSelected, KNullDesC );
       
   150     __UHEAP_MARKEND;
       
   151     }
       
   152 
       
   153 
       
   154 // Test case table for this test suite class
       
   155 EUNIT_BEGIN_TEST_TABLE(
       
   156     T_CFLDController,
       
   157     "T_CFLDController test suite",
       
   158     "MODULE" )
       
   159 
       
   160 EUNIT_TEST(
       
   161     "Create and delete",
       
   162     "CFLDController",
       
   163     "NewL",
       
   164     "FUNCTIONALITY",
       
   165     EmptySetupL, TestCreateObjectL, Teardown )
       
   166 EUNIT_TEST(
       
   167     "Set delay",
       
   168     "CFLDController",
       
   169     "SetDelay",
       
   170     "FUNCTIONALITY",
       
   171     SetupL, SetDelayTestL, Teardown )
       
   172 EUNIT_TEST(
       
   173     "Set volume",
       
   174     "CFLDController",
       
   175     "SetVolume",
       
   176     "FUNCTIONALITY",
       
   177     SetupL, SetVolumeTestL, Teardown )
       
   178 EUNIT_TEST(
       
   179     "Set ringing type",
       
   180     "CFLDController",
       
   181     "SetRingingType",
       
   182     "FUNCTIONALITY",
       
   183     SetupL, SetRingingTypeTestL, Teardown )
       
   184 EUNIT_TEST(
       
   185     "Set vibra",
       
   186     "CFLDController",
       
   187     "SetVibra",
       
   188     "FUNCTIONALITY",
       
   189     SetupL, SetVibraTestL, Teardown )
       
   190 EUNIT_TEST(
       
   191     "Set 3D effects",
       
   192     "CFLDController",
       
   193     "Set3dEffects",
       
   194     "FUNCTIONALITY",
       
   195     SetupL, Set3dEffectsTestL, Teardown )
       
   196 EUNIT_TEST(
       
   197     "Set file observer",
       
   198     "CFLDController",
       
   199     "SetFileObserver",
       
   200     "FUNCTIONALITY",
       
   201     SetupL, SetFileObserverTestL, Teardown )
       
   202 EUNIT_TEST(
       
   203     "Handle ListBox Event",
       
   204     "CFLDController",
       
   205     "HandleFileListBoxEventL",
       
   206     "FUNCTIONALITY",
       
   207     SetupL, HandleFileListBoxEventTestL, Teardown )
       
   208 EUNIT_END_TEST_TABLE
       
   209 
       
   210 //  End of File