Example #1
0
/**
@SYMTestCaseID          SYSLIB-BAFL-CT-0440
@SYMTestCaseDesc        Resource reader test
@SYMTestPriority        High
@SYMTestActions         Executes all the tests related to resource read
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
void RunTests()
    {
	test.Start(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0440 Resource reader "));
    TheFs.Connect();
    TheResourceFile.OpenL(TheFs,KRomResourceFile);
	TRsReadTester lt;
	TRAPD(errCode, lt.TestButtonL());
	test(errCode==KErrNone);
	TRAP(errCode, lt.TestArrayL());
	test(errCode==KErrNone);
	TRAP(errCode, lt.TestFlPtEdL());
	test(errCode==KErrNone);
	TRAP(errCode, lt.TestMenuBarL());
	test(errCode==KErrNone);
	TRAP(errCode, lt.TestAlignment1L());
	test(errCode==KErrNone);
	TRAP(errCode, lt.TestAlignment2L());
	test(errCode==KErrNone);
    TRAP(errCode, lt.TimingTestsL());
	test(errCode==KErrNone);
    TheResourceFile.Close();
    //Test that raises panics
	test(KErrNone==lt.PanicTests());

    TheFs.Close();
	test.End();
	test.Close();
    }
Example #2
0
LOCAL_C void doExampleL()
    {
		// Declare a resource file
	RResourceFile resourceFile;
	
		// open resource file on the emulator(__WINS__  is defined for the Windows emulator)
		//(leave if error)
	#if defined(__WINS__)
	_LIT(KZSystemDataRsc,"Z:\\Resource\\apps\\ReadData.rsc");
	resourceFile.OpenL(fsSession, KZSystemDataRsc);
	#endif

		// open a resource file on the target phone
		// ( __EPOC32__ is defined for all target hardware platforms regardless of processor type/hardware architecture)
	#if defined(__EPOC32__)
	_LIT(KCSystemDataRsc,"C:\\Resource\\apps\\ReadData.rsc");
	resourceFile.OpenL(fsSession, KCSystemDataRsc);
	#endif
	
		// Read the first resource & construct a resource reader
	HBufC8* res = resourceFile.AllocReadLC(FIRST);

	TResourceReader theReader;
	theReader.SetBuffer(res);

		// construct a CResData object to contain
		// the simple resource of type DATA.
	CResData* resData = CResData::NewLC(theReader);

		// Can now remove resData from the cleanup stack
	CleanupStack::Pop();

		// finished with res
	CleanupStack::PopAndDestroy(); 

		// display data
	resData->ShowData();

		// destroy the CResData 
	delete resData;

		// finished with resource file, so close it.
	resourceFile.Close();
	}