Esempio n. 1
0
void RemoveSpeedDialWhenOpenL(TInt aContact, TInt aSpeedDialID, CContactDatabase& aDatabase)
	{
	CContactItem* card1 = 0;
	TInt error = KErrNone;

	// First open the contact, which locks it:
	card1 = aDatabase.OpenContactL(aContact);
	CleanupStack::PushL(card1);

	// Now attempt to open the contact (must fail with in use):
	error = KErrNone;
	TRAP(error, aDatabase.OpenContactL(aContact));
	g_test(error == KErrInUse);

	// Now remove the speed dial on that contact (must fail with in use):
	error = KErrNone;
	TRAP(error, aDatabase.RemoveSpeedDialFieldL(aContact, aSpeedDialID));
	g_test(error == KErrInUse);
	// Now remove the speed dial on that contact again (must fail with in use):
	// Defect was application crash.
	error = KErrNone;
	TRAP(error, aDatabase.RemoveSpeedDialFieldL(aContact, aSpeedDialID));
	g_test(error == KErrInUse);

	// Now attempt to open the contact (must fail with in use):
	// Defect was fails with wrong error/no error.
	error = KErrNone;
	TRAP(error, aDatabase.OpenContactL(aContact));
	g_test(error == KErrInUse);

	// Cleanup and close:
	CleanupStack::PopAndDestroy(card1);
	TRAP(error, aDatabase.CloseContactL(aContact));
	g_test(error == KErrNone);
	}
Esempio n. 2
0
void RemoveSpeedDialL(TInt aContact, TInt aSpeedDialId, CContactDatabase& aDatabase)
    {    
    TInt error = KErrNone;
        
    TRAP(error, aDatabase.RemoveSpeedDialFieldL(aContact, aSpeedDialId));
    g_test(error == KErrNone);           
    }