Exemplo n.º 1
0
LOCAL_C void TestSetSendingStateAttributeL()
	{
	CDummyObserver* ob = new(ELeave)CDummyObserver;
	CleanupStack::PushL(ob);

	CMsvSession* session = CMsvSession::OpenSyncL(*ob);
	CleanupStack::PushL(session);

	CMsvEntry* cEntry = CMsvEntry::NewL(*session, KMsvDraftEntryId, TMsvSelectionOrdering());
	CleanupStack::PushL(cEntry);

	CMsvEntrySelection* selection = new(ELeave)CMsvEntrySelection;
	CleanupStack::PushL(selection);

	TMsvEntry entry1;
	entry1.iType = KUidMsvMessageEntry;
	entry1.iMtm = KUidMsvLocalServiceMtm;
	entry1.iServiceId = KMsvLocalServiceIndexEntryId;
	entry1.SetSendingState(12);
	cEntry->CreateL(entry1);
	selection->AppendL(entry1.Id());

	TMsvEntry entry2;
	entry2.iType = KUidMsvMessageEntry;
	entry2.iMtm = KUidMsvLocalServiceMtm;
	entry2.iServiceId = KMsvLocalServiceIndexEntryId;
	entry2.SetSendingState(3);
	cEntry->CreateL(entry2);
	selection->AppendL(entry2.Id());
	
	session->ChangeAttributesL(*selection, 6<<KMsvSendingStateShift, 0);

	cEntry->SetEntryL(entry1.Id());
	test(cEntry->Entry().SendingState() == 6);

	cEntry->SetEntryL(entry2.Id());
	test(cEntry->Entry().SendingState() == 6);
	
	CleanupStack::PopAndDestroy(4); // selection, cEntry, session, ob
	}