diff -r 18fa9327a158 -r e3cdd00b5ae3 camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCaller.h --- a/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCaller.h Thu Aug 19 10:05:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CTestCaller -* -*/ - - - -#ifndef CPPUNIT_TESTCALLER_H -#define CPPUNIT_TESTCALLER_H - -#include "TestFrameWork/testCase.h" - - -/* - * A test caller provides access to a test case method - * on a test case class. Test callers are useful when - * you want to run an individual test or add it to a suite. - * - * Here is an example: - * - * class CMathTest : public CTestCase - * { - * public: - * void setUpL (); - * void tearDown (); - * - * protected: - * void testAddL (); - * void testSubtractL (); - * }; - * - * CTest* CMathTest::suiteL () - * { - * CTestSuite *suite = CTestSuite::NewL(); - * suite->addTestL(CTestCaller::NewL(_L("testAddL") testAddL)); - * suite->addTestL(CTestCaller::NewL(_L("testSubtractL") testSubtractL)); - * return suite; - * } - * - * You can use a CTestCaller to bind any test method on a CTestCase - * class, as long as it does not have parameters and returns void. - * - * See CTestCase - */ - - -template class CTestCaller : public CTestCase - { -public: - - typedef void (Fixture::*TestMethod)(); - - static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest); - static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest); - ~CTestCaller(); - -protected: - - // From CTestCase: - void setUpL () { iFixture->setUpL (); } - void executeTestL () { (iFixture->*iTest)(); } - void tearDown () { iFixture->tearDown (); } - -private: - - CTestCaller (TestMethod aTest) : iTest(aTest) { } - void ConstructL (const TDesC8& aName); - - TestMethod iTest; - Fixture *iFixture; - }; - - -template -CTestCaller* CTestCaller::NewLC (const TDesC8& aName, - TestMethod aTest) - { - CTestCaller* self = new(ELeave) CTestCaller(aTest); - CleanupStack::PushL(self); - self->ConstructL(aName); - return self; - } - -template -CTestCaller* CTestCaller::NewL (const TDesC8& aName, - TestMethod aTest) - { - CTestCaller* self = NewLC(aName, aTest); - CleanupStack::Pop(); - return self; - } - - -template -void CTestCaller::ConstructL (const TDesC8& aName) - { - CTestCase::ConstructL(aName); - iFixture = new(ELeave)Fixture; - } - - -template -CTestCaller::~CTestCaller () - { - delete iFixture; - } - -#endif