os/persistentdata/loggingservices/eventlogger/test/src/t_logview2.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/eventlogger/test/src/t_logview2.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,7014 @@
     1.4 +// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include <s32file.h>
    1.20 +#include <logeng.h>
    1.21 +#include <tz.h>
    1.22 +#include "t_logutil2.h"
    1.23 +#include <logview.h>
    1.24 +
    1.25 +RTest TheTest(_L("t_logview2"));
    1.26 +
    1.27 +const TInt KTestEventNum = 20;
    1.28 +const TInt KTestErrorEventNum = 3;
    1.29 +const TLogContactItemId KTestContact1 = 0x123;
    1.30 +const TLogContactItemId KTestContact2 = 0x456;
    1.31 +const TLogContactItemId KTestContact3 = 0x789;
    1.32 +_LIT(KTestDirection1, "Direction Test 1");
    1.33 +_LIT(KTestDirection2, "Direction Test 2");
    1.34 +_LIT(KTestDirection3, "Direction Test 3");
    1.35 +_LIT(KTestNumber1, "Number Test 1");
    1.36 +_LIT(KTestNumber2, "Number Test 2");
    1.37 +_LIT(KTestNumber3, "Number Test 3");
    1.38 +_LIT(KTestRemote1, "Remote Test 1");
    1.39 +_LIT(KTestRemote2, "Remote Test 2");
    1.40 +_LIT(KTestRemote3, "Remote Test 3");
    1.41 +_LIT(KTestStatus1, "Status Test 1");
    1.42 +_LIT(KTestStatus2, "Status Test 2");
    1.43 +_LIT(KTestStatus3, "Status Test 3");
    1.44 +_LIT(KTestSubject, "Test Subject");
    1.45 +const TLogLink KTestLink = 0x123456;
    1.46 +_LIT8(KTestData, "Test data");
    1.47 +
    1.48 +/**
    1.49 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0930
    1.50 +@SYMTestCaseDesc	    Tests for the functionality of CLogViewEvent,CLogFilter classes
    1.51 +@SYMTestPriority 	    High
    1.52 +@SYMTestActions  	    Tests for event view after setting filter on the views.
    1.53 +                        Change the filter list configuration and test for the view
    1.54 +@SYMTestExpectedResults Test must not fail
    1.55 +@SYMREQ                 REQ0000
    1.56 +*/
    1.57 +LOCAL_C void TestEventViewWithFilterListL(CLogClient& aClient)
    1.58 +	{
    1.59 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0930 "));
    1.60 +	CTestActive* active = new(ELeave)CTestActive;
    1.61 +	CleanupStack::PushL(active);
    1.62 +
    1.63 +	CLogEvent* event = CLogEvent::NewL();
    1.64 +	CleanupStack::PushL(event);
    1.65 +
    1.66 +	event->SetEventType(KLogCallEventTypeUid);
    1.67 +	event->SetContact(KTestContact1);
    1.68 +	event->SetDirection(KTestDirection1);
    1.69 +	event->SetDurationType(KLogDurationNone);
    1.70 +	event->SetNumber(KTestNumber1);
    1.71 +	event->SetRemoteParty(KTestRemote1);
    1.72 +	event->SetStatus(KTestStatus1);
    1.73 +
    1.74 +	// Add event
    1.75 +	active->StartL();
    1.76 +	aClient.AddEvent(*event, active->iStatus);
    1.77 +	CActiveScheduler::Start();
    1.78 +	TEST2(active->iStatus.Int(), KErrNone);
    1.79 +
    1.80 +	event->SetEventType(KLogDataEventTypeUid);
    1.81 +	event->SetContact(KTestContact2);
    1.82 +	event->SetDirection(KTestDirection2);
    1.83 +	event->SetDurationType(KLogDurationValid);
    1.84 +	event->SetNumber(KTestNumber2);
    1.85 +	event->SetRemoteParty(KTestRemote2);
    1.86 +	event->SetStatus(KTestStatus2);
    1.87 +
    1.88 +	// Add event
    1.89 +	active->StartL();
    1.90 +	aClient.AddEvent(*event, active->iStatus);
    1.91 +	CActiveScheduler::Start();
    1.92 +	TEST2(active->iStatus.Int(), KErrNone);
    1.93 +
    1.94 +	event->SetEventType(KLogFaxEventTypeUid);
    1.95 +	event->SetContact(KTestContact3);
    1.96 +	event->SetDirection(KTestDirection3);
    1.97 +	event->SetDurationType(KLogDurationData);
    1.98 +	event->SetNumber(KTestNumber3);
    1.99 +	event->SetRemoteParty(KTestRemote3);
   1.100 +	event->SetStatus(KTestStatus3);
   1.101 +
   1.102 +	// Add event
   1.103 +	active->StartL();
   1.104 +	aClient.AddEvent(*event, active->iStatus);
   1.105 +	CActiveScheduler::Start();
   1.106 +	TEST2(active->iStatus.Int(), KErrNone);
   1.107 +
   1.108 +	CLogFilterList* list = new(ELeave)CLogFilterList;
   1.109 +	CleanupStack::PushL(list);
   1.110 +
   1.111 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
   1.112 +	CleanupStack::PushL(view);
   1.113 +
   1.114 +	CLogFilter* filter = CLogFilter::NewL();
   1.115 +	CleanupStack::PushL(filter);
   1.116 +	
   1.117 +	// Set filter
   1.118 +	filter->SetContact(KTestContact1);
   1.119 +
   1.120 +	list->AppendL(filter);
   1.121 +	CleanupStack::Pop(); // filter
   1.122 +
   1.123 +	// Test View
   1.124 +	active->StartL();
   1.125 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.126 +	CActiveScheduler::Start();
   1.127 +	TEST2(view->CountL(),1);
   1.128 +
   1.129 +	filter = CLogFilter::NewL();
   1.130 +	CleanupStack::PushL(filter);
   1.131 +	
   1.132 +	// Set filter
   1.133 +	filter->SetContact(KTestContact2);
   1.134 +
   1.135 +	list->AppendL(filter);
   1.136 +	CleanupStack::Pop(); // filter
   1.137 +
   1.138 +	// Test View
   1.139 +	active->StartL();
   1.140 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.141 +	CActiveScheduler::Start();
   1.142 +	TEST2(view->CountL(), 2);
   1.143 +
   1.144 +	filter = CLogFilter::NewL();
   1.145 +	CleanupStack::PushL(filter);
   1.146 +	
   1.147 +	// Set filter
   1.148 +	filter->SetContact(KTestContact3);
   1.149 +
   1.150 +	list->AppendL(filter);
   1.151 +	CleanupStack::Pop(); // filter
   1.152 +
   1.153 +	// Test View
   1.154 +	active->StartL();
   1.155 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.156 +	CActiveScheduler::Start();
   1.157 +	TEST2(view->CountL(), 3);
   1.158 +
   1.159 +	list->ResetAndDestroy();
   1.160 +
   1.161 +	/////////////////////////////////////////
   1.162 +
   1.163 +	filter = CLogFilter::NewL();
   1.164 +	CleanupStack::PushL(filter);
   1.165 +	
   1.166 +	// Set filter
   1.167 +	filter->SetContact(KTestContact1);
   1.168 +	filter->SetDirection(KTestDirection1);
   1.169 +
   1.170 +	list->AppendL(filter);
   1.171 +	CleanupStack::Pop(); // filter
   1.172 +
   1.173 +	// Test View
   1.174 +	active->StartL();
   1.175 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.176 +	CActiveScheduler::Start();
   1.177 +	TEST2(view->CountL(), 1);
   1.178 +
   1.179 +	filter = CLogFilter::NewL();
   1.180 +	CleanupStack::PushL(filter);
   1.181 +	
   1.182 +	// Set filter
   1.183 +	filter->SetContact(KTestContact2);
   1.184 +	filter->SetDirection(KTestDirection2);
   1.185 +
   1.186 +	list->AppendL(filter);
   1.187 +	CleanupStack::Pop(); // filter
   1.188 +
   1.189 +	// Test View
   1.190 +	active->StartL();
   1.191 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.192 +	CActiveScheduler::Start();
   1.193 +	TEST2(view->CountL(), 2);
   1.194 +
   1.195 +	filter = CLogFilter::NewL();
   1.196 +	CleanupStack::PushL(filter);
   1.197 +	
   1.198 +	// Set filter
   1.199 +	filter->SetContact(KTestContact3);
   1.200 +	filter->SetDirection(KTestDirection3);
   1.201 +
   1.202 +	list->AppendL(filter);
   1.203 +	CleanupStack::Pop(); // filter
   1.204 +
   1.205 +	// Test View
   1.206 +	active->StartL();
   1.207 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.208 +	CActiveScheduler::Start();
   1.209 +	TEST2(view->CountL(), 3);
   1.210 +
   1.211 +	list->ResetAndDestroy();
   1.212 +
   1.213 +	/////////////////////////////////////////
   1.214 +
   1.215 +	filter = CLogFilter::NewL();
   1.216 +	CleanupStack::PushL(filter);
   1.217 +	
   1.218 +	// Set filter
   1.219 +	filter->SetContact(KTestContact1);
   1.220 +	filter->SetDirection(KTestDirection1);
   1.221 +	filter->SetDurationType(KLogDurationNone);
   1.222 +
   1.223 +	list->AppendL(filter);
   1.224 +	CleanupStack::Pop(); // filter
   1.225 +
   1.226 +	// Test View
   1.227 +	active->StartL();
   1.228 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.229 +	CActiveScheduler::Start();
   1.230 +	TEST2(view->CountL(), 1);
   1.231 +
   1.232 +	filter = CLogFilter::NewL();
   1.233 +	CleanupStack::PushL(filter);
   1.234 +	
   1.235 +	// Set filter
   1.236 +	filter->SetContact(KTestContact2);
   1.237 +	filter->SetDirection(KTestDirection2);
   1.238 +	filter->SetDurationType(KLogDurationValid);
   1.239 +
   1.240 +	list->AppendL(filter);
   1.241 +	CleanupStack::Pop(); // filter
   1.242 +
   1.243 +	// Test View
   1.244 +	active->StartL();
   1.245 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.246 +	CActiveScheduler::Start();
   1.247 +	TEST2(view->CountL(), 2);
   1.248 +
   1.249 +	filter = CLogFilter::NewL();
   1.250 +	CleanupStack::PushL(filter);
   1.251 +	
   1.252 +	// Set filter
   1.253 +	filter->SetContact(KTestContact3);
   1.254 +	filter->SetDirection(KTestDirection3);
   1.255 +	filter->SetDurationType(KLogDurationData);
   1.256 +
   1.257 +	list->AppendL(filter);
   1.258 +	CleanupStack::Pop(); // filter
   1.259 +
   1.260 +	// Test View
   1.261 +	active->StartL();
   1.262 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.263 +	CActiveScheduler::Start();
   1.264 +	TEST2(view->CountL(), 3);
   1.265 +
   1.266 +	list->ResetAndDestroy();
   1.267 +
   1.268 +	/////////////////////////////////////////
   1.269 +
   1.270 +	filter = CLogFilter::NewL();
   1.271 +	CleanupStack::PushL(filter);
   1.272 +	
   1.273 +	// Set filter
   1.274 +	filter->SetContact(KTestContact1);
   1.275 +	filter->SetDirection(KTestDirection1);
   1.276 +	filter->SetDurationType(KLogDurationNone);
   1.277 +	filter->SetEventType(KLogCallEventTypeUid);
   1.278 +
   1.279 +	list->AppendL(filter);
   1.280 +	CleanupStack::Pop(); // filter
   1.281 +
   1.282 +	// Test View
   1.283 +	active->StartL();
   1.284 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.285 +	CActiveScheduler::Start();
   1.286 +	TEST2(view->CountL(), 1);
   1.287 +
   1.288 +	filter = CLogFilter::NewL();
   1.289 +	CleanupStack::PushL(filter);
   1.290 +	
   1.291 +	// Set filter
   1.292 +	filter->SetContact(KTestContact2);
   1.293 +	filter->SetDirection(KTestDirection2);
   1.294 +	filter->SetDurationType(KLogDurationValid);
   1.295 +	filter->SetEventType(KLogDataEventTypeUid);
   1.296 +
   1.297 +	list->AppendL(filter);
   1.298 +	CleanupStack::Pop(); // filter
   1.299 +
   1.300 +	// Test View
   1.301 +	active->StartL();
   1.302 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.303 +	CActiveScheduler::Start();
   1.304 +	TEST2(view->CountL(), 2);
   1.305 +
   1.306 +	filter = CLogFilter::NewL();
   1.307 +	CleanupStack::PushL(filter);
   1.308 +	
   1.309 +	// Set filter
   1.310 +	filter->SetContact(KTestContact3);
   1.311 +	filter->SetDirection(KTestDirection3);
   1.312 +	filter->SetDurationType(KLogDurationData);
   1.313 +	filter->SetEventType(KLogFaxEventTypeUid);
   1.314 +
   1.315 +	list->AppendL(filter);
   1.316 +	CleanupStack::Pop(); // filter
   1.317 +
   1.318 +	// Test View
   1.319 +	active->StartL();
   1.320 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.321 +	CActiveScheduler::Start();
   1.322 +	TEST2(view->CountL(), 3);
   1.323 +
   1.324 +	list->ResetAndDestroy();
   1.325 +
   1.326 +	/////////////////////////////////////////
   1.327 +
   1.328 +	filter = CLogFilter::NewL();
   1.329 +	CleanupStack::PushL(filter);
   1.330 +	
   1.331 +	// Set filter
   1.332 +	filter->SetContact(KTestContact1);
   1.333 +	filter->SetDirection(KTestDirection1);
   1.334 +	filter->SetDurationType(KLogDurationNone);
   1.335 +	filter->SetEventType(KLogCallEventTypeUid);
   1.336 +	filter->SetNumber(KTestNumber1);
   1.337 +
   1.338 +	list->AppendL(filter);
   1.339 +	CleanupStack::Pop(); // filter
   1.340 +
   1.341 +	// Test View
   1.342 +	active->StartL();
   1.343 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.344 +	CActiveScheduler::Start();
   1.345 +	TEST2(view->CountL(), 1);
   1.346 +
   1.347 +	filter = CLogFilter::NewL();
   1.348 +	CleanupStack::PushL(filter);
   1.349 +	
   1.350 +	// Set filter
   1.351 +	filter->SetContact(KTestContact2);
   1.352 +	filter->SetDirection(KTestDirection2);
   1.353 +	filter->SetDurationType(KLogDurationValid);
   1.354 +	filter->SetEventType(KLogDataEventTypeUid);
   1.355 +	filter->SetNumber(KTestNumber2);
   1.356 +
   1.357 +	list->AppendL(filter);
   1.358 +	CleanupStack::Pop(); // filter
   1.359 +
   1.360 +	// Test View
   1.361 +	active->StartL();
   1.362 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.363 +	CActiveScheduler::Start();
   1.364 +	TEST2(view->CountL(), 2);
   1.365 +
   1.366 +	filter = CLogFilter::NewL();
   1.367 +	CleanupStack::PushL(filter);
   1.368 +	
   1.369 +	// Set filter
   1.370 +	filter->SetContact(KTestContact3);
   1.371 +	filter->SetDirection(KTestDirection3);
   1.372 +	filter->SetDurationType(KLogDurationData);
   1.373 +	filter->SetEventType(KLogFaxEventTypeUid);
   1.374 +	filter->SetNumber(KTestNumber3);
   1.375 +
   1.376 +	list->AppendL(filter);
   1.377 +	CleanupStack::Pop(); // filter
   1.378 +
   1.379 +	// Test View
   1.380 +	active->StartL();
   1.381 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.382 +	CActiveScheduler::Start();
   1.383 +	TEST2(view->CountL(), 3);
   1.384 +
   1.385 +	list->ResetAndDestroy();
   1.386 +
   1.387 +	/////////////////////////////////////////
   1.388 +
   1.389 +	filter = CLogFilter::NewL();
   1.390 +	CleanupStack::PushL(filter);
   1.391 +	
   1.392 +	// Set filter
   1.393 +	filter->SetContact(KTestContact1);
   1.394 +	filter->SetDirection(KTestDirection1);
   1.395 +	filter->SetDurationType(KLogDurationNone);
   1.396 +	filter->SetEventType(KLogCallEventTypeUid);
   1.397 +	filter->SetNumber(KTestNumber1);
   1.398 +	filter->SetRemoteParty(KTestRemote1);
   1.399 +
   1.400 +	list->AppendL(filter);
   1.401 +	CleanupStack::Pop(); // filter
   1.402 +
   1.403 +	// Test View
   1.404 +	active->StartL();
   1.405 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.406 +	CActiveScheduler::Start();
   1.407 +	TEST2(view->CountL(), 1);
   1.408 +
   1.409 +	filter = CLogFilter::NewL();
   1.410 +	CleanupStack::PushL(filter);
   1.411 +	
   1.412 +	// Set filter
   1.413 +	filter->SetContact(KTestContact2);
   1.414 +	filter->SetDirection(KTestDirection2);
   1.415 +	filter->SetDurationType(KLogDurationValid);
   1.416 +	filter->SetEventType(KLogDataEventTypeUid);
   1.417 +	filter->SetNumber(KTestNumber2);
   1.418 +	filter->SetRemoteParty(KTestRemote2);
   1.419 +
   1.420 +	list->AppendL(filter);
   1.421 +	CleanupStack::Pop(); // filter
   1.422 +
   1.423 +	// Test View
   1.424 +	active->StartL();
   1.425 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.426 +	CActiveScheduler::Start();
   1.427 +	TEST2(view->CountL(), 2);
   1.428 +
   1.429 +	filter = CLogFilter::NewL();
   1.430 +	CleanupStack::PushL(filter);
   1.431 +	
   1.432 +	// Set filter
   1.433 +	filter->SetContact(KTestContact3);
   1.434 +	filter->SetDirection(KTestDirection3);
   1.435 +	filter->SetDurationType(KLogDurationData);
   1.436 +	filter->SetEventType(KLogFaxEventTypeUid);
   1.437 +	filter->SetNumber(KTestNumber3);
   1.438 +	filter->SetRemoteParty(KTestRemote3);
   1.439 +
   1.440 +	list->AppendL(filter);
   1.441 +	CleanupStack::Pop(); // filter
   1.442 +
   1.443 +	// Test View
   1.444 +	active->StartL();
   1.445 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.446 +	CActiveScheduler::Start();
   1.447 +	TEST2(view->CountL(), 3);
   1.448 +
   1.449 +	list->ResetAndDestroy();
   1.450 +
   1.451 +	/////////////////////////////////////////
   1.452 +
   1.453 +	filter = CLogFilter::NewL();
   1.454 +	CleanupStack::PushL(filter);
   1.455 +	
   1.456 +	// Set filter
   1.457 +	filter->SetContact(KTestContact1);
   1.458 +	filter->SetDirection(KTestDirection1);
   1.459 +	filter->SetDurationType(KLogDurationNone);
   1.460 +	filter->SetEventType(KLogCallEventTypeUid);
   1.461 +	filter->SetNumber(KTestNumber1);
   1.462 +	filter->SetRemoteParty(KTestRemote1);
   1.463 +	filter->SetStatus(KTestStatus1);
   1.464 +
   1.465 +	list->AppendL(filter);
   1.466 +	CleanupStack::Pop(); // filter
   1.467 +
   1.468 +	// Test View
   1.469 +	active->StartL();
   1.470 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.471 +	CActiveScheduler::Start();
   1.472 +	TEST2(view->CountL(), 1);
   1.473 +
   1.474 +	filter = CLogFilter::NewL();
   1.475 +	CleanupStack::PushL(filter);
   1.476 +	
   1.477 +	// Set filter
   1.478 +	filter->SetContact(KTestContact2);
   1.479 +	filter->SetDirection(KTestDirection2);
   1.480 +	filter->SetDurationType(KLogDurationValid);
   1.481 +	filter->SetEventType(KLogDataEventTypeUid);
   1.482 +	filter->SetNumber(KTestNumber2);
   1.483 +	filter->SetRemoteParty(KTestRemote2);
   1.484 +	filter->SetStatus(KTestStatus2);
   1.485 +
   1.486 +	list->AppendL(filter);
   1.487 +	CleanupStack::Pop(); // filter
   1.488 +
   1.489 +	// Test View
   1.490 +	active->StartL();
   1.491 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.492 +	CActiveScheduler::Start();
   1.493 +	TEST2(view->CountL(), 2);
   1.494 +
   1.495 +	filter = CLogFilter::NewL();
   1.496 +	CleanupStack::PushL(filter);
   1.497 +	
   1.498 +	// Set filter
   1.499 +	filter->SetContact(KTestContact3);
   1.500 +	filter->SetDirection(KTestDirection3);
   1.501 +	filter->SetDurationType(KLogDurationData);
   1.502 +	filter->SetEventType(KLogFaxEventTypeUid);
   1.503 +	filter->SetNumber(KTestNumber3);
   1.504 +	filter->SetRemoteParty(KTestRemote3);
   1.505 +	filter->SetStatus(KTestStatus3);
   1.506 +
   1.507 +	list->AppendL(filter);
   1.508 +	CleanupStack::Pop(); // filter
   1.509 +
   1.510 +	// Test View
   1.511 +	active->StartL();
   1.512 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.513 +	CActiveScheduler::Start();
   1.514 +	TEST2(view->CountL(), 3);
   1.515 +
   1.516 +	list->ResetAndDestroy();
   1.517 +
   1.518 +	CleanupStack::PopAndDestroy(4); // list, view, event, active
   1.519 +	}
   1.520 +
   1.521 +/**
   1.522 +@SYMTestCaseID          SYSLIB-LOGENG-CT-3432
   1.523 +@SYMTestCaseDesc	    Test the functionality of CLogViewEvent::SetFilterL with the CLogFilterList parameter containing multiple filters with start time and end time.
   1.524 +@SYMTestPriority 	    High
   1.525 +@SYMTestActions  	    1. Add 2 events.
   1.526 +						2. Setup a CLogFilterList with two filters targeting the first event. Both filters have start and end time. Call SetFilterL.
   1.527 +						3. Verify view has 1 event and no LogServ panic.
   1.528 +						4. Clear the filter list.
   1.529 +						5. Setup filter for first event with start and end time. Call SetFilterL.
   1.530 +						6. Verify view has one event.
   1.531 +                        7. Setup second filter for second event with start and end time. Append this filter to filter list and call SetFilterL.
   1.532 +						8. Verify view has 2 events and no LogServ panic.
   1.533 +@SYMTestExpectedResults Log view has expected number of events and no LogServ panic.
   1.534 +@SYMDEF                 INC102412
   1.535 +*/
   1.536 +LOCAL_C void TestEventViewWithTimestampsInFilterListL(CLogClient& aClient)
   1.537 +	{
   1.538 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3432 "));
   1.539 +	TTime testStartTime;
   1.540 +	testStartTime.UniversalTime();
   1.541 +	TTime tomorrow = testStartTime + (TTimeIntervalDays)1;
   1.542 +	TTime twoDaysFromNow = tomorrow + (TTimeIntervalDays)1;
   1.543 +
   1.544 +	CTestActive* active = new(ELeave)CTestActive;
   1.545 +	CleanupStack::PushL(active);
   1.546 +
   1.547 +	// Get rid of all the events in the log
   1.548 +	active->StartL();
   1.549 +	aClient.ClearLog(tomorrow, active->iStatus);
   1.550 +	CActiveScheduler::Start();
   1.551 +	TEST2(active->iStatus.Int(), KErrNone);
   1.552 +	
   1.553 +	// Wait a second before adding events to log.
   1.554 +	User::After(1100000);
   1.555 +
   1.556 +	// Add two events to log
   1.557 +	CLogEvent* event = CLogEvent::NewL();
   1.558 +	CleanupStack::PushL(event);
   1.559 +
   1.560 +	// Add event 1
   1.561 +	event->SetEventType(KLogCallEventTypeUid);
   1.562 +	event->SetContact(KTestContact1);
   1.563 +	event->SetDirection(KTestDirection1);
   1.564 +	event->SetDurationType(KLogDurationNone);
   1.565 +	event->SetNumber(KTestNumber1);
   1.566 +	event->SetRemoteParty(KTestRemote1);
   1.567 +	event->SetStatus(KTestStatus1);
   1.568 +
   1.569 +	active->StartL();
   1.570 +	aClient.AddEvent(*event, active->iStatus);
   1.571 +	CActiveScheduler::Start();
   1.572 +	TEST2(active->iStatus.Int(), KErrNone);
   1.573 +
   1.574 +	// Add event 2
   1.575 +	event->SetEventType(KLogDataEventTypeUid);
   1.576 +	event->SetContact(KTestContact2);
   1.577 +	event->SetDirection(KTestDirection2);
   1.578 +	event->SetDurationType(KLogDurationValid);
   1.579 +	event->SetNumber(KTestNumber2);
   1.580 +	event->SetRemoteParty(KTestRemote2);
   1.581 +	event->SetStatus(KTestStatus2);
   1.582 +
   1.583 +	active->StartL();
   1.584 +	aClient.AddEvent(*event, active->iStatus);
   1.585 +	CActiveScheduler::Start();
   1.586 +	TEST2(active->iStatus.Int(), KErrNone);
   1.587 +
   1.588 +	// Setup filter
   1.589 +	CLogFilterList* list = new(ELeave)CLogFilterList;
   1.590 +	CleanupStack::PushL(list);
   1.591 +
   1.592 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
   1.593 +	CleanupStack::PushL(view);
   1.594 +
   1.595 +	CLogFilter* filter = CLogFilter::NewL();
   1.596 +	CleanupStack::PushL(filter);
   1.597 +	
   1.598 +	// Set half a filter
   1.599 +	filter->SetContact(KTestContact1);
   1.600 +	filter->SetDirection(KTestDirection1);
   1.601 +	filter->SetDurationType(KLogDurationNone);
   1.602 +	filter->SetStartTime(testStartTime);
   1.603 +	TTime t1 = filter->StartTime();
   1.604 +	TEST(t1 == testStartTime);
   1.605 +	filter->SetEndTime(tomorrow);
   1.606 +	TTime t2 = filter->EndTime();
   1.607 +	TEST(t2 == tomorrow);
   1.608 +
   1.609 +	list->AppendL(filter);
   1.610 +	CleanupStack::Pop(); // filter
   1.611 +
   1.612 +	// set the other half of filter for event 1
   1.613 +	filter = CLogFilter::NewL();
   1.614 +	CleanupStack::PushL(filter);
   1.615 +
   1.616 +	filter->SetEventType(KLogCallEventTypeUid);
   1.617 +	filter->SetNumber(KTestNumber1);
   1.618 +	filter->SetRemoteParty(KTestRemote1);
   1.619 +	filter->SetStatus(KTestStatus1);
   1.620 +
   1.621 +	// start time is duplicate of previous filter, 
   1.622 +	// end time is not duplicate
   1.623 +	filter->SetStartTime(testStartTime);
   1.624 +	filter->SetEndTime(twoDaysFromNow);
   1.625 +
   1.626 +	list->AppendL(filter);
   1.627 +	CleanupStack::Pop(); // filter
   1.628 +
   1.629 +	// Test View
   1.630 +	active->StartL();
   1.631 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.632 +	CActiveScheduler::Start();
   1.633 +	TEST2(view->CountL(),1);
   1.634 +
   1.635 +	list->ResetAndDestroy();
   1.636 +
   1.637 +	// check contents of the event.
   1.638 +	TBool res = view->FirstL(active->iStatus);
   1.639 +	TEST(res);
   1.640 +	active->StartL();
   1.641 +	CActiveScheduler::Start();
   1.642 +	TEST2(active->iStatus.Int(), KErrNone);
   1.643 +	
   1.644 +	TEST2(view->Event().Contact(), KTestContact1);
   1.645 +	TEST( view->Event().Number() == KTestNumber1);
   1.646 +	TEST( view->Event().Status() == KTestStatus1);
   1.647 +	TEST( view->Event().RemoteParty() == KTestRemote1);
   1.648 +
   1.649 +	/////////////////////////////////////////
   1.650 +
   1.651 +	filter = CLogFilter::NewL();
   1.652 +	CleanupStack::PushL(filter);
   1.653 +	
   1.654 +	// Set filter
   1.655 +	filter->SetContact(KTestContact1);
   1.656 +	filter->SetDirection(KTestDirection1);
   1.657 +	filter->SetDurationType(KLogDurationNone);
   1.658 +	filter->SetEventType(KLogCallEventTypeUid);
   1.659 +	filter->SetNumber(KTestNumber1);
   1.660 +	filter->SetRemoteParty(KTestRemote1);
   1.661 +	filter->SetStatus(KTestStatus1);
   1.662 +	filter->SetStartTime(testStartTime);
   1.663 +	filter->SetEndTime(tomorrow);
   1.664 +
   1.665 +	list->AppendL(filter);
   1.666 +	CleanupStack::Pop(); // filter
   1.667 +
   1.668 +	// Test View
   1.669 +	active->StartL();
   1.670 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.671 +	CActiveScheduler::Start();
   1.672 +	TEST2(view->CountL(), 1);
   1.673 +
   1.674 +	filter = CLogFilter::NewL();
   1.675 +	CleanupStack::PushL(filter);
   1.676 +	
   1.677 +	// Set filter
   1.678 +	filter->SetContact(KTestContact2);
   1.679 +	filter->SetDirection(KTestDirection2);
   1.680 +	filter->SetDurationType(KLogDurationValid);
   1.681 +	filter->SetEventType(KLogDataEventTypeUid);
   1.682 +	filter->SetNumber(KTestNumber2);
   1.683 +	filter->SetRemoteParty(KTestRemote2);
   1.684 +	filter->SetStatus(KTestStatus2);
   1.685 +
   1.686 +	// start time is duplicate,
   1.687 +	// end time is not duplicate
   1.688 +	filter->SetStartTime(testStartTime);
   1.689 +	filter->SetEndTime(twoDaysFromNow);
   1.690 +
   1.691 +	list->AppendL(filter);
   1.692 +	CleanupStack::Pop(); // filter
   1.693 +
   1.694 +	// Test View
   1.695 +	active->StartL();
   1.696 +	TEST(view->SetFilterL(*list, active->iStatus));
   1.697 +	CActiveScheduler::Start();
   1.698 +	TEST2(view->CountL(), 2);
   1.699 +
   1.700 +	list->ResetAndDestroy();
   1.701 +
   1.702 +	// check contents of event 2 (most recent)
   1.703 +	res = view->FirstL(active->iStatus);
   1.704 +	TEST(res);
   1.705 +	active->StartL();
   1.706 +	CActiveScheduler::Start();
   1.707 +	TEST2(active->iStatus.Int(), KErrNone);
   1.708 +	
   1.709 +	TEST2(view->Event().Contact(), KTestContact2);
   1.710 +	TEST( view->Event().Number() == KTestNumber2);
   1.711 +	TEST( view->Event().Status() == KTestStatus2);
   1.712 +	TEST( view->Event().RemoteParty() == KTestRemote2);
   1.713 +
   1.714 +	// check contents of event 1 (older)
   1.715 +	res = view->NextL(active->iStatus);
   1.716 +	TEST(res);
   1.717 +	active->StartL();
   1.718 +	CActiveScheduler::Start();
   1.719 +	TEST2(active->iStatus.Int(), KErrNone);
   1.720 +	
   1.721 +	TEST2(view->Event().Contact(), KTestContact1);
   1.722 +	TEST( view->Event().Number() == KTestNumber1);
   1.723 +	TEST( view->Event().Status() == KTestStatus1);
   1.724 +	TEST( view->Event().RemoteParty() == KTestRemote1);
   1.725 +
   1.726 +	CleanupStack::PopAndDestroy(4); // list, view, event, active
   1.727 +	}
   1.728 +
   1.729 +/**
   1.730 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0931
   1.731 +@SYMTestCaseDesc	    Tests for recent view list with filters 
   1.732 +@SYMTestPriority 	    High
   1.733 +@SYMTestActions  	    Tests for recent view list,with different settings of the filter. 
   1.734 +@SYMTestExpectedResults Test must not fail
   1.735 +@SYMREQ                 REQ0000
   1.736 +*/
   1.737 +LOCAL_C void TestRecentViewWithFilterL(CLogClient& aClient)
   1.738 +	{
   1.739 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0931 "));
   1.740 +	CLogEvent* event = CLogEvent::NewL();
   1.741 +	CleanupStack::PushL(event);
   1.742 +
   1.743 +	CTestActive* active = new(ELeave)CTestActive();
   1.744 +	CleanupStack::PushL(active);
   1.745 +
   1.746 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
   1.747 +	CleanupStack::PushL(view);
   1.748 +
   1.749 +	// Incoming
   1.750 +	TLogString buf;
   1.751 +	aClient.GetString(buf, R_LOG_DIR_IN);
   1.752 +
   1.753 +	event->SetEventType(KLogCallEventTypeUid);
   1.754 +	event->SetDirection(buf);
   1.755 +	event->SetNumber(_L("1"));
   1.756 +
   1.757 +	// Add event
   1.758 +	active->StartL();
   1.759 +	aClient.AddEvent(*event, active->iStatus);
   1.760 +	CActiveScheduler::Start();
   1.761 +	TEST2(active->iStatus.Int(), KErrNone);
   1.762 +
   1.763 +	event->SetDurationType(KLogDurationData);
   1.764 +	event->SetNumber(_L("2"));
   1.765 +
   1.766 +	// Add event
   1.767 +	active->StartL();
   1.768 +	aClient.AddEvent(*event, active->iStatus);
   1.769 +	CActiveScheduler::Start();
   1.770 +	TEST2(active->iStatus.Int(), KErrNone);
   1.771 +
   1.772 +	event->SetStatus(KTestStatus1);
   1.773 +	event->SetNumber(_L("3"));
   1.774 +
   1.775 +	// Add event
   1.776 +	active->StartL();
   1.777 +	aClient.AddEvent(*event, active->iStatus);
   1.778 +	CActiveScheduler::Start();
   1.779 +	TEST2(active->iStatus.Int(), KErrNone);
   1.780 +
   1.781 +	event->SetContact(KTestContact1);
   1.782 +	event->SetNumber(_L("4"));
   1.783 +
   1.784 +	// Add event
   1.785 +	active->StartL();
   1.786 +	aClient.AddEvent(*event, active->iStatus);
   1.787 +	CActiveScheduler::Start();
   1.788 +	TEST2(active->iStatus.Int(), KErrNone);
   1.789 +
   1.790 +	active->StartL();
   1.791 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
   1.792 +	CActiveScheduler::Start();
   1.793 +	TEST2(view->CountL(), 4);
   1.794 +
   1.795 +	CLogFilter* filter = CLogFilter::NewL();
   1.796 +	CleanupStack::PushL(filter);
   1.797 +
   1.798 +	// This should make no difference
   1.799 +	filter->SetEventType(KLogCallEventTypeUid);
   1.800 +
   1.801 +	active->StartL();
   1.802 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   1.803 +	CActiveScheduler::Start();
   1.804 +	TEST2(view->CountL(), 4);
   1.805 +
   1.806 +	// This should make no difference
   1.807 +	filter->SetDirection(buf);
   1.808 +
   1.809 +	active->StartL();
   1.810 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   1.811 +	CActiveScheduler::Start();
   1.812 +	TEST2(view->CountL(), 4);
   1.813 +
   1.814 +	filter->SetDurationType(KLogDurationData);
   1.815 +
   1.816 +	active->StartL();
   1.817 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   1.818 +	CActiveScheduler::Start();
   1.819 +	TEST2(view->CountL(), 3);
   1.820 +
   1.821 +	filter->SetStatus(KTestStatus1);
   1.822 +
   1.823 +	active->StartL();
   1.824 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   1.825 +	CActiveScheduler::Start();
   1.826 +	TEST2(view->CountL(), 2);
   1.827 +
   1.828 +	filter->SetContact(KTestContact1);
   1.829 +
   1.830 +	active->StartL();
   1.831 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   1.832 +	CActiveScheduler::Start();
   1.833 +	TEST2(view->CountL(), 1);
   1.834 +
   1.835 +	filter->SetStatus(_L("Dummy"));
   1.836 +	TEST(!view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
   1.837 +
   1.838 +	CleanupStack::PopAndDestroy(4); // filter, view, active, event
   1.839 +	}
   1.840 +
   1.841 +/**
   1.842 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0932
   1.843 +@SYMTestCaseDesc	    Tests for recent view list with filter set for the view
   1.844 +@SYMTestPriority 	    High
   1.845 +@SYMTestActions  	    Tests for recent view list set by the specified set of filters.
   1.846 +@SYMTestExpectedResults Test must not fail
   1.847 +@SYMREQ                 REQ0000
   1.848 +*/
   1.849 +LOCAL_C void TestRecentViewWithFilterListL(CLogClient& aClient)
   1.850 +	{
   1.851 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0932 "));
   1.852 +	CLogEvent* event = CLogEvent::NewL();
   1.853 +	CleanupStack::PushL(event);
   1.854 +
   1.855 +	CTestActive* active = new(ELeave)CTestActive();
   1.856 +	CleanupStack::PushL(active);
   1.857 +
   1.858 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
   1.859 +	CleanupStack::PushL(view);
   1.860 +
   1.861 +	// Make sure there are no entries in any recent lists
   1.862 +	active->StartL();
   1.863 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
   1.864 +	CActiveScheduler::Start();
   1.865 +	TEST2(active->iStatus.Int(), KErrNone);
   1.866 +
   1.867 +	// Incoming
   1.868 +	TLogString buf;
   1.869 +	aClient.GetString(buf, R_LOG_DIR_IN);
   1.870 +
   1.871 +	event->SetEventType(KLogCallEventTypeUid);
   1.872 +	event->SetDirection(buf);
   1.873 +	event->SetDurationType(KLogDurationNone);
   1.874 +	event->SetContact(KTestContact1);
   1.875 +	event->SetStatus(KTestStatus1);
   1.876 +
   1.877 +	// Add event
   1.878 +	active->StartL();
   1.879 +	aClient.AddEvent(*event, active->iStatus);
   1.880 +	CActiveScheduler::Start();
   1.881 +	TEST2(active->iStatus.Int(), KErrNone);
   1.882 +
   1.883 +	event->SetDurationType(KLogDurationValid);
   1.884 +	event->SetContact(KTestContact2);
   1.885 +	event->SetStatus(KTestStatus2);
   1.886 +
   1.887 +	// Add event
   1.888 +	active->StartL();
   1.889 +	aClient.AddEvent(*event, active->iStatus);
   1.890 +	CActiveScheduler::Start();
   1.891 +	TEST2(active->iStatus.Int(), KErrNone);
   1.892 +
   1.893 +	event->SetDurationType(KLogDurationData);
   1.894 +	event->SetContact(KTestContact3);
   1.895 +	event->SetStatus(KTestStatus3);
   1.896 +
   1.897 +	// Add event
   1.898 +	active->StartL();
   1.899 +	aClient.AddEvent(*event, active->iStatus);
   1.900 +	CActiveScheduler::Start();
   1.901 +	TEST2(active->iStatus.Int(), KErrNone);
   1.902 +
   1.903 +	active->StartL();
   1.904 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
   1.905 +	CActiveScheduler::Start();
   1.906 +	TEST2(active->iStatus.Int(), KErrNone);
   1.907 +	TEST2(view->CountL(), 3);
   1.908 +
   1.909 +	CLogFilterList* list = new(ELeave)CLogFilterList;
   1.910 +	CleanupStack::PushL(list);
   1.911 +
   1.912 +	CLogFilter* filter = CLogFilter::NewL();
   1.913 +	CleanupStack::PushL(filter);
   1.914 +	list->AppendL(filter);
   1.915 +	CleanupStack::Pop(); // filter
   1.916 +
   1.917 +	filter->SetDurationType(KLogDurationNone);
   1.918 +	filter->SetStatus(KTestStatus1);
   1.919 +	filter->SetContact(KTestContact1);
   1.920 +
   1.921 +	active->StartL();
   1.922 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
   1.923 +	CActiveScheduler::Start();
   1.924 +	TEST2(active->iStatus.Int(), KErrNone);
   1.925 +	TEST2(view->CountL(), 1);
   1.926 +
   1.927 +	filter = CLogFilter::NewL();
   1.928 +	CleanupStack::PushL(filter);
   1.929 +	list->AppendL(filter);
   1.930 +	CleanupStack::Pop(); // filter
   1.931 +
   1.932 +	filter->SetDurationType(KLogDurationValid);
   1.933 +	filter->SetStatus(KTestStatus2);
   1.934 +	filter->SetContact(KTestContact2);
   1.935 +
   1.936 +	active->StartL();
   1.937 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
   1.938 +	CActiveScheduler::Start();
   1.939 +	TEST2(active->iStatus.Int(), KErrNone);
   1.940 +	TEST2(view->CountL(), 2);
   1.941 +
   1.942 +	filter = CLogFilter::NewL();
   1.943 +	CleanupStack::PushL(filter);
   1.944 +	list->AppendL(filter);
   1.945 +	CleanupStack::Pop(); // filter
   1.946 +
   1.947 +	filter->SetDurationType(KLogDurationData);
   1.948 +	filter->SetStatus(KTestStatus3);
   1.949 +	filter->SetContact(KTestContact3);
   1.950 +
   1.951 +	active->StartL();
   1.952 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
   1.953 +	CActiveScheduler::Start();
   1.954 +	TEST2(active->iStatus.Int(), KErrNone);
   1.955 +	TEST2(view->CountL(), 3);
   1.956 +
   1.957 +	list->ResetAndDestroy();
   1.958 +	CleanupStack::PopAndDestroy(4); // list, view, active, event
   1.959 +	}
   1.960 +
   1.961 +/**
   1.962 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0933
   1.963 +@SYMTestCaseDesc	    Tests for duplicate event view with filter 
   1.964 +@SYMTestPriority 	    High
   1.965 +@SYMTestActions  	    Tests for duplicate event view count. 
   1.966 +@SYMTestExpectedResults Test must not fail
   1.967 +@SYMREQ                 REQ0000
   1.968 +*/
   1.969 +LOCAL_C void TestDuplicateViewWithFilterL(CLogClient& aClient)
   1.970 +	{
   1.971 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0933 "));
   1.972 +	CLogEvent* event = CLogEvent::NewL();
   1.973 +	CleanupStack::PushL(event);
   1.974 +
   1.975 +	CTestActive* active = new(ELeave)CTestActive();
   1.976 +	CleanupStack::PushL(active);
   1.977 +
   1.978 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
   1.979 +	CleanupStack::PushL(view);
   1.980 +
   1.981 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
   1.982 +	CleanupStack::PushL(duplicate);
   1.983 +
   1.984 +	// Make sure there are no entries in any recent lists
   1.985 +	active->StartL();
   1.986 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
   1.987 +	CActiveScheduler::Start();
   1.988 +	TEST2(active->iStatus.Int(), KErrNone);
   1.989 +
   1.990 +	// Incoming
   1.991 +	TLogString buf;
   1.992 +	aClient.GetString(buf, R_LOG_DIR_IN);
   1.993 +
   1.994 +	event->SetEventType(KLogCallEventTypeUid);
   1.995 +	event->SetDirection(buf);
   1.996 +	event->SetContact(KTestContact1);
   1.997 +
   1.998 +	// Add event
   1.999 +	active->StartL();
  1.1000 +	aClient.AddEvent(*event, active->iStatus);
  1.1001 +	CActiveScheduler::Start();
  1.1002 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1003 +
  1.1004 +	event->SetDurationType(KLogDurationValid);
  1.1005 +
  1.1006 +	// Add event
  1.1007 +	active->StartL();
  1.1008 +	aClient.AddEvent(*event, active->iStatus);
  1.1009 +	CActiveScheduler::Start();
  1.1010 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1011 +
  1.1012 +	event->SetStatus(KTestStatus1);
  1.1013 +
  1.1014 +	// Add event
  1.1015 +	active->StartL();
  1.1016 +	aClient.AddEvent(*event, active->iStatus);
  1.1017 +	CActiveScheduler::Start();
  1.1018 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1019 +
  1.1020 +	event->SetDurationType(KLogDurationNone);
  1.1021 +	event->SetStatus(KNullDesC);
  1.1022 +
  1.1023 +	// Add event - This will be the entry in recent list
  1.1024 +	active->StartL();
  1.1025 +	aClient.AddEvent(*event, active->iStatus);
  1.1026 +	CActiveScheduler::Start();
  1.1027 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1028 +	TLogId logId1 = event->Id();
  1.1029 +
  1.1030 +	// Should only be one event in recent list - the rest are duplicates
  1.1031 +	active->StartL();
  1.1032 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.1033 +	CActiveScheduler::Start();
  1.1034 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1035 +	TEST2(view->CountL(), 1);
  1.1036 +	
  1.1037 +	TLogRecentList recentList = view->RecentList();
  1.1038 +	TEST(recentList == KLogRecentIncomingCalls);
  1.1039 +
  1.1040 +	// Check duplicate count
  1.1041 +	active->StartL();
  1.1042 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.1043 +	CActiveScheduler::Start();
  1.1044 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1045 +	TEST2(duplicate->CountL(), 3);
  1.1046 +	
  1.1047 +	TLogId logId2 = duplicate->Source();
  1.1048 +	TEST(logId1 == logId2);
  1.1049 +
  1.1050 +	CLogFilter* filter = CLogFilter::NewL();
  1.1051 +	CleanupStack::PushL(filter);
  1.1052 +
  1.1053 +	active->StartL();
  1.1054 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1055 +	CActiveScheduler::Start();
  1.1056 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1057 +	TEST2(duplicate->CountL(), 3);
  1.1058 +
  1.1059 +	filter->SetDurationType(KLogDurationValid);
  1.1060 +
  1.1061 +	active->StartL();
  1.1062 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1063 +	CActiveScheduler::Start();
  1.1064 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1065 +	TEST2(duplicate->CountL(), 2);
  1.1066 +
  1.1067 +	filter->SetStatus(KTestStatus1);
  1.1068 +
  1.1069 +	active->StartL();
  1.1070 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1071 +	CActiveScheduler::Start();
  1.1072 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1073 +	TEST2(duplicate->CountL(), 1);
  1.1074 +
  1.1075 +	filter->SetStatus(KTestStatus2);
  1.1076 +	TEST(!view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1077 +
  1.1078 +	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
  1.1079 +	}
  1.1080 +
  1.1081 +/**
  1.1082 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0934
  1.1083 +@SYMTestCaseDesc	    Tests for duplicate event view with filter list
  1.1084 +@SYMTestPriority 	    High
  1.1085 +@SYMTestActions  	    Tests for duplicate event view count,set by the specified set of filters.
  1.1086 +@SYMTestExpectedResults Test must not fail
  1.1087 +@SYMREQ                 REQ0000
  1.1088 +*/
  1.1089 +LOCAL_C void TestDuplicateViewWithFilterListL(CLogClient& aClient)
  1.1090 +	{
  1.1091 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0934 "));
  1.1092 +	CLogEvent* event = CLogEvent::NewL();
  1.1093 +	CleanupStack::PushL(event);
  1.1094 +
  1.1095 +	CTestActive* active = new(ELeave)CTestActive();
  1.1096 +	CleanupStack::PushL(active);
  1.1097 +
  1.1098 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.1099 +	CleanupStack::PushL(view);
  1.1100 +
  1.1101 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.1102 +	CleanupStack::PushL(duplicate);
  1.1103 +
  1.1104 +	// Make sure there are no entries in any recent lists
  1.1105 +	active->StartL();
  1.1106 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.1107 +	CActiveScheduler::Start();
  1.1108 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1109 +
  1.1110 +	// Incoming
  1.1111 +	TLogString buf;
  1.1112 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.1113 +
  1.1114 +	event->SetEventType(KLogCallEventTypeUid);
  1.1115 +	event->SetDirection(buf);
  1.1116 +	event->SetContact(KTestContact1);
  1.1117 +
  1.1118 +	event->SetDurationType(KLogDurationNone);
  1.1119 +	event->SetStatus(KNullDesC);
  1.1120 +
  1.1121 +	// Add event
  1.1122 +	active->StartL();
  1.1123 +	aClient.AddEvent(*event, active->iStatus);
  1.1124 +	CActiveScheduler::Start();
  1.1125 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1126 +
  1.1127 +	event->SetDurationType(KLogDurationValid);
  1.1128 +
  1.1129 +	active->StartL();
  1.1130 +	aClient.AddEvent(*event, active->iStatus);
  1.1131 +	CActiveScheduler::Start();
  1.1132 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1133 +
  1.1134 +	event->SetDurationType(KLogDurationData);
  1.1135 +
  1.1136 +	active->StartL();
  1.1137 +	aClient.AddEvent(*event, active->iStatus);
  1.1138 +	CActiveScheduler::Start();
  1.1139 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1140 +
  1.1141 +	// Final event will be most recent
  1.1142 +	event->SetDurationType(KLogDurationNone);
  1.1143 +	event->SetStatus(KNullDesC);
  1.1144 +
  1.1145 +	// Add event
  1.1146 +	active->StartL();
  1.1147 +	aClient.AddEvent(*event, active->iStatus);
  1.1148 +	CActiveScheduler::Start();
  1.1149 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1150 +
  1.1151 +	CLogFilterList* list = new(ELeave)CLogFilterList;
  1.1152 +	CleanupStack::PushL(list);
  1.1153 +
  1.1154 +	active->StartL();
  1.1155 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.1156 +	CActiveScheduler::Start();
  1.1157 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1158 +	TEST2(view->CountL(), 1);
  1.1159 +
  1.1160 +	active->StartL();
  1.1161 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.1162 +	CActiveScheduler::Start();
  1.1163 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1164 +	TEST2(duplicate->CountL(), 3);
  1.1165 +
  1.1166 +	CLogFilter* filter = CLogFilter::NewL();
  1.1167 +	CleanupStack::PushL(filter);
  1.1168 +	list->AppendL(filter);
  1.1169 +	CleanupStack::Pop(); // filter
  1.1170 +
  1.1171 +	filter->SetDurationType(KLogDurationValid);
  1.1172 +
  1.1173 +	active->StartL();
  1.1174 +	TEST(view->DuplicatesL(*duplicate, *list, active->iStatus));
  1.1175 +	CActiveScheduler::Start();
  1.1176 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1177 +	TEST2(duplicate->CountL(), 1);
  1.1178 +
  1.1179 +	filter = CLogFilter::NewL();
  1.1180 +	CleanupStack::PushL(filter);
  1.1181 +	list->AppendL(filter);
  1.1182 +	CleanupStack::Pop(); // filter
  1.1183 +
  1.1184 +	filter->SetDurationType(KLogDurationData);
  1.1185 +
  1.1186 +	active->StartL();
  1.1187 +	TEST(view->DuplicatesL(*duplicate, *list, active->iStatus));
  1.1188 +	CActiveScheduler::Start();
  1.1189 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1190 +	TEST2(duplicate->CountL(), 2);
  1.1191 +
  1.1192 +	list->ResetAndDestroy();
  1.1193 +	CleanupStack::PopAndDestroy(5); // list, duplicate, view, active, event
  1.1194 +	}
  1.1195 +
  1.1196 +/**
  1.1197 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0935
  1.1198 +@SYMTestCaseDesc	    Tests for null field set on filter in the event view 
  1.1199 +                        Tests for CLogFilter::SetNullFields() function
  1.1200 +@SYMTestPriority 	    High
  1.1201 +@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
  1.1202 +@SYMTestExpectedResults Test must not fail
  1.1203 +@SYMREQ                 REQ0000
  1.1204 +*/
  1.1205 +LOCAL_C void TestEventViewForNullFieldsL(CLogClient& aClient)
  1.1206 +	{
  1.1207 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0935 "));
  1.1208 +	CTestActive* active = new(ELeave)CTestActive;
  1.1209 +	CleanupStack::PushL(active);
  1.1210 +
  1.1211 +	CLogEvent* event = CLogEvent::NewL();
  1.1212 +	CleanupStack::PushL(event);
  1.1213 +	event->SetEventType(KLogCallEventTypeUid);
  1.1214 +
  1.1215 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
  1.1216 +	CleanupStack::PushL(view);
  1.1217 +
  1.1218 +	CLogFilter* filter = CLogFilter::NewL();
  1.1219 +	CleanupStack::PushL(filter);
  1.1220 +
  1.1221 +	// Wait a second
  1.1222 +	User::After(1000000);
  1.1223 +
  1.1224 +	TTime now;
  1.1225 +	now.UniversalTime();
  1.1226 +	now += (TTimeIntervalDays)+1;
  1.1227 +	// Get rid of all the events in the log
  1.1228 +	active->StartL();
  1.1229 +	aClient.ClearLog(now, active->iStatus);
  1.1230 +	CActiveScheduler::Start();
  1.1231 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1232 +	
  1.1233 +	// Make sure there are no events
  1.1234 +	TEST(!view->SetFilterL(*filter, active->iStatus));
  1.1235 +
  1.1236 +	active->StartL();
  1.1237 +	aClient.AddEvent(*event, active->iStatus);
  1.1238 +	CActiveScheduler::Start();
  1.1239 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1240 +
  1.1241 +	event->SetContact(KTestContact1);
  1.1242 +
  1.1243 +	active->StartL();
  1.1244 +	aClient.AddEvent(*event, active->iStatus);
  1.1245 +	CActiveScheduler::Start();
  1.1246 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1247 +
  1.1248 +	event->SetDirection(KTestDirection1);
  1.1249 +
  1.1250 +	active->StartL();
  1.1251 +	aClient.AddEvent(*event, active->iStatus);
  1.1252 +	CActiveScheduler::Start();
  1.1253 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1254 +
  1.1255 +	event->SetNumber(KTestNumber1);
  1.1256 +
  1.1257 +	active->StartL();
  1.1258 +	aClient.AddEvent(*event, active->iStatus);
  1.1259 +	CActiveScheduler::Start();
  1.1260 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1261 +
  1.1262 +	event->SetRemoteParty(KTestRemote1);
  1.1263 +
  1.1264 +	active->StartL();
  1.1265 +	aClient.AddEvent(*event, active->iStatus);
  1.1266 +	CActiveScheduler::Start();
  1.1267 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1268 +
  1.1269 +	event->SetStatus(KTestStatus1);
  1.1270 +
  1.1271 +	active->StartL();
  1.1272 +	aClient.AddEvent(*event, active->iStatus);
  1.1273 +	CActiveScheduler::Start();
  1.1274 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1275 +
  1.1276 +	event->SetSubject(KTestSubject);
  1.1277 +
  1.1278 +	active->StartL();
  1.1279 +	aClient.AddEvent(*event, active->iStatus);
  1.1280 +	CActiveScheduler::Start();
  1.1281 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1282 +
  1.1283 +	event->SetLink(KTestLink);
  1.1284 +
  1.1285 +	active->StartL();
  1.1286 +	aClient.AddEvent(*event, active->iStatus);
  1.1287 +	CActiveScheduler::Start();
  1.1288 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1289 +
  1.1290 +	event->SetDataL(KTestData);
  1.1291 +
  1.1292 +	active->StartL();
  1.1293 +	aClient.AddEvent(*event, active->iStatus);
  1.1294 +	CActiveScheduler::Start();
  1.1295 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1296 +
  1.1297 +	// Test for NULL fields
  1.1298 +
  1.1299 +	active->StartL();
  1.1300 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1301 +	CActiveScheduler::Start();
  1.1302 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1303 +	TEST2(view->CountL(), 9);
  1.1304 +
  1.1305 +	filter->SetNullFields(ELogContactField);
  1.1306 +
  1.1307 +	active->StartL();
  1.1308 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1309 +	CActiveScheduler::Start();
  1.1310 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1311 +	TEST2(view->CountL(), 1);
  1.1312 +
  1.1313 +	filter->SetNullFields(ELogContactField | ELogDirectionField);
  1.1314 +
  1.1315 +	active->StartL();
  1.1316 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1317 +	CActiveScheduler::Start();
  1.1318 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1319 +	TEST2(view->CountL(), 1);
  1.1320 +
  1.1321 +	filter->SetNullFields(ELogContactField | ELogDirectionField);
  1.1322 +
  1.1323 +	active->StartL();
  1.1324 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1325 +	CActiveScheduler::Start();
  1.1326 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1327 +	TEST2(view->CountL(), 1);
  1.1328 +
  1.1329 +	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField);
  1.1330 +
  1.1331 +	active->StartL();
  1.1332 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1333 +	CActiveScheduler::Start();
  1.1334 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1335 +	TEST2(view->CountL(), 1);
  1.1336 +
  1.1337 +	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField);
  1.1338 +
  1.1339 +	active->StartL();
  1.1340 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1341 +	CActiveScheduler::Start();
  1.1342 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1343 +	TEST2(view->CountL(), 1);
  1.1344 +
  1.1345 +	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField);
  1.1346 +
  1.1347 +	active->StartL();
  1.1348 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1349 +	CActiveScheduler::Start();
  1.1350 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1351 +	TEST2(view->CountL(), 1);
  1.1352 +
  1.1353 +	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField);
  1.1354 +
  1.1355 +	active->StartL();
  1.1356 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1357 +	CActiveScheduler::Start();
  1.1358 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1359 +	TEST2(view->CountL(), 1);
  1.1360 +
  1.1361 +	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField | ELogLinkField);
  1.1362 +
  1.1363 +	active->StartL();
  1.1364 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1365 +	CActiveScheduler::Start();
  1.1366 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1367 +	TEST2(view->CountL(), 1);
  1.1368 +
  1.1369 +	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
  1.1370 +
  1.1371 +	active->StartL();
  1.1372 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.1373 +	CActiveScheduler::Start();
  1.1374 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1375 +	TEST2(view->CountL(), 1);
  1.1376 +
  1.1377 +	CleanupStack::PopAndDestroy(4); // filter, view, event, active
  1.1378 +	}
  1.1379 +
  1.1380 +/**
  1.1381 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0936
  1.1382 +@SYMTestCaseDesc	    Tests for null field set on filter for the recent event view list 
  1.1383 +@SYMTestPriority 	    High
  1.1384 +@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
  1.1385 +@SYMTestExpectedResults Test must not fail
  1.1386 +@SYMREQ                 REQ0000
  1.1387 +*/
  1.1388 +LOCAL_C void TestRecentViewForNullFieldsL(CLogClient& aClient)
  1.1389 +	{
  1.1390 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0936 "));
  1.1391 +	CLogEvent* event = CLogEvent::NewL();
  1.1392 +	CleanupStack::PushL(event);
  1.1393 +
  1.1394 +	CTestActive* active = new(ELeave)CTestActive();
  1.1395 +	CleanupStack::PushL(active);
  1.1396 +
  1.1397 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.1398 +	CleanupStack::PushL(view);
  1.1399 +
  1.1400 +	// Incoming
  1.1401 +	TLogString buf;
  1.1402 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.1403 +
  1.1404 +	event->SetEventType(KLogCallEventTypeUid);
  1.1405 +	event->SetDirection(buf);
  1.1406 +	event->SetNumber(_L("1"));
  1.1407 +
  1.1408 +	// Add event
  1.1409 +	active->StartL();
  1.1410 +	aClient.AddEvent(*event, active->iStatus);
  1.1411 +	CActiveScheduler::Start();
  1.1412 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1413 +
  1.1414 +	event->SetStatus(KTestStatus1);
  1.1415 +	event->SetNumber(_L("2"));
  1.1416 +
  1.1417 +	// Add event
  1.1418 +	active->StartL();
  1.1419 +	aClient.AddEvent(*event, active->iStatus);
  1.1420 +	CActiveScheduler::Start();
  1.1421 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1422 +
  1.1423 +	event->SetSubject(KTestSubject);
  1.1424 +	event->SetNumber(_L("3"));
  1.1425 +
  1.1426 +	active->StartL();
  1.1427 +	aClient.AddEvent(*event, active->iStatus);
  1.1428 +	CActiveScheduler::Start();
  1.1429 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1430 +
  1.1431 +	event->SetLink(KTestLink);
  1.1432 +	event->SetNumber(_L("4"));
  1.1433 +
  1.1434 +	active->StartL();
  1.1435 +	aClient.AddEvent(*event, active->iStatus);
  1.1436 +	CActiveScheduler::Start();
  1.1437 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1438 +
  1.1439 +	event->SetDataL(KTestData);
  1.1440 +	event->SetNumber(_L("5"));
  1.1441 +
  1.1442 +	active->StartL();
  1.1443 +	aClient.AddEvent(*event, active->iStatus);
  1.1444 +	CActiveScheduler::Start();
  1.1445 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1446 +
  1.1447 +	active->StartL();
  1.1448 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.1449 +	CActiveScheduler::Start();
  1.1450 +	TEST2(view->CountL(), 5);
  1.1451 +
  1.1452 +	CLogFilter* filter = CLogFilter::NewL();
  1.1453 +	CleanupStack::PushL(filter);
  1.1454 +	
  1.1455 +	// Test for NULL fields
  1.1456 +
  1.1457 +	filter->SetNullFields(ELogStatusField);
  1.1458 +
  1.1459 +	active->StartL();
  1.1460 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1461 +	CActiveScheduler::Start();
  1.1462 +	TEST2(view->CountL(), 1);
  1.1463 +
  1.1464 +	filter->SetNullFields(ELogStatusField | ELogSubjectField);
  1.1465 +
  1.1466 +	active->StartL();
  1.1467 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1468 +	CActiveScheduler::Start();
  1.1469 +	TEST2(view->CountL(), 1);
  1.1470 +
  1.1471 +	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField);
  1.1472 +
  1.1473 +	active->StartL();
  1.1474 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1475 +	CActiveScheduler::Start();
  1.1476 +	TEST2(view->CountL(), 1);
  1.1477 +
  1.1478 +	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
  1.1479 +
  1.1480 +	active->StartL();
  1.1481 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1482 +	CActiveScheduler::Start();
  1.1483 +	TEST2(view->CountL(), 1);
  1.1484 +
  1.1485 +	CleanupStack::PopAndDestroy(4); // filter, view, active, event
  1.1486 +	}
  1.1487 +
  1.1488 +/**
  1.1489 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0937
  1.1490 +@SYMTestCaseDesc	    Tests for null field set on filter for the duplicate event view list 
  1.1491 +@SYMTestPriority 	    High
  1.1492 +@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
  1.1493 +@SYMTestExpectedResults Test must not fail
  1.1494 +@SYMREQ                 REQ0000
  1.1495 +*/
  1.1496 +LOCAL_C void TestDuplicateViewForNullFieldsL(CLogClient& aClient)
  1.1497 +	{
  1.1498 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0937 "));
  1.1499 +	CLogEvent* event = CLogEvent::NewL();
  1.1500 +	CleanupStack::PushL(event);
  1.1501 +
  1.1502 +	CTestActive* active = new(ELeave)CTestActive();
  1.1503 +	CleanupStack::PushL(active);
  1.1504 +
  1.1505 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.1506 +	CleanupStack::PushL(view);
  1.1507 +
  1.1508 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.1509 +	CleanupStack::PushL(duplicate);
  1.1510 +
  1.1511 +	// Make sure there are no entries in any recent lists
  1.1512 +	active->StartL();
  1.1513 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.1514 +	CActiveScheduler::Start();
  1.1515 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1516 +
  1.1517 +	// Incoming
  1.1518 +	TLogString buf;
  1.1519 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.1520 +
  1.1521 +	event->SetEventType(KLogCallEventTypeUid);
  1.1522 +	event->SetDirection(buf);
  1.1523 +	event->SetContact(KTestContact1);
  1.1524 +
  1.1525 +	// Add event
  1.1526 +	active->StartL();
  1.1527 +	aClient.AddEvent(*event, active->iStatus);
  1.1528 +	CActiveScheduler::Start();
  1.1529 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1530 +
  1.1531 +	event->SetStatus(KTestStatus1);
  1.1532 +
  1.1533 +	// Add event
  1.1534 +	active->StartL();
  1.1535 +	aClient.AddEvent(*event, active->iStatus);
  1.1536 +	CActiveScheduler::Start();
  1.1537 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1538 +
  1.1539 +	event->SetSubject(KTestSubject);
  1.1540 +
  1.1541 +	// Add event
  1.1542 +	active->StartL();
  1.1543 +	aClient.AddEvent(*event, active->iStatus);
  1.1544 +	CActiveScheduler::Start();
  1.1545 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1546 +
  1.1547 +	event->SetLink(KTestLink);
  1.1548 +
  1.1549 +	// Add event
  1.1550 +	active->StartL();
  1.1551 +	aClient.AddEvent(*event, active->iStatus);
  1.1552 +	CActiveScheduler::Start();
  1.1553 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1554 +
  1.1555 +	event->SetDataL(KTestData);
  1.1556 +
  1.1557 +	// Add event
  1.1558 +	active->StartL();
  1.1559 +	aClient.AddEvent(*event, active->iStatus);
  1.1560 +	CActiveScheduler::Start();
  1.1561 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1562 +
  1.1563 +	event->SetDurationType(KLogDurationNone);
  1.1564 +	event->SetStatus(KNullDesC);
  1.1565 +
  1.1566 +	// Add event - This will be the entry in recent list
  1.1567 +	active->StartL();
  1.1568 +	aClient.AddEvent(*event, active->iStatus);
  1.1569 +	CActiveScheduler::Start();
  1.1570 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1571 +
  1.1572 +	// Should only be one event in recent list - the rest are duplicates
  1.1573 +	active->StartL();
  1.1574 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.1575 +	CActiveScheduler::Start();
  1.1576 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1577 +	TEST2(view->CountL(), 1);
  1.1578 +
  1.1579 +	// Check duplicate count
  1.1580 +	active->StartL();
  1.1581 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.1582 +	CActiveScheduler::Start();
  1.1583 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1584 +	TEST2(duplicate->CountL(), 5);
  1.1585 +
  1.1586 +	CLogFilter* filter = CLogFilter::NewL();
  1.1587 +	CleanupStack::PushL(filter);
  1.1588 +
  1.1589 +	filter->SetNullFields(ELogStatusField);
  1.1590 +
  1.1591 +	active->StartL();
  1.1592 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1593 +	CActiveScheduler::Start();
  1.1594 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1595 +	TEST2(duplicate->CountL(), 1);
  1.1596 +
  1.1597 +	filter->SetNullFields(ELogStatusField | ELogSubjectField);
  1.1598 +
  1.1599 +	active->StartL();
  1.1600 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1601 +	CActiveScheduler::Start();
  1.1602 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1603 +	TEST2(duplicate->CountL(), 1);
  1.1604 +
  1.1605 +	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField);
  1.1606 +
  1.1607 +	active->StartL();
  1.1608 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1609 +	CActiveScheduler::Start();
  1.1610 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1611 +	TEST2(duplicate->CountL(), 1);
  1.1612 +
  1.1613 +	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
  1.1614 +
  1.1615 +	active->StartL();
  1.1616 +	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1617 +	CActiveScheduler::Start();
  1.1618 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1619 +	TEST2(duplicate->CountL(), 1);
  1.1620 +
  1.1621 +	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
  1.1622 +	}
  1.1623 +
  1.1624 +/**
  1.1625 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0938
  1.1626 +@SYMTestCaseDesc	    Querying event view for flags test
  1.1627 +@SYMTestPriority 	    High
  1.1628 +@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields and set flags in the filter and check the view
  1.1629 +@SYMTestExpectedResults Test must not fail
  1.1630 +@SYMREQ                 REQ0000
  1.1631 +*/
  1.1632 +LOCAL_C void TestEventViewForFlagsL(CLogClient& aClient)
  1.1633 +	{
  1.1634 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0938 "));
  1.1635 +	CLogEvent* event = CLogEvent::NewL();
  1.1636 +	CleanupStack::PushL(event);
  1.1637 +
  1.1638 +	CTestActive* active = new(ELeave)CTestActive();
  1.1639 +	CleanupStack::PushL(active);
  1.1640 +
  1.1641 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
  1.1642 +	CleanupStack::PushL(view);
  1.1643 +
  1.1644 +	CLogFilter* filter = CLogFilter::NewL();
  1.1645 +	CleanupStack::PushL(filter);
  1.1646 +
  1.1647 +	// Wait a second
  1.1648 +	User::After(1000000);
  1.1649 +
  1.1650 +	TTime now;
  1.1651 +	now.UniversalTime();
  1.1652 +	now += (TTimeIntervalDays)+1;
  1.1653 +	
  1.1654 +	// Get rid of all the events in the log
  1.1655 +	active->StartL();
  1.1656 +	aClient.ClearLog(now, active->iStatus);
  1.1657 +	CActiveScheduler::Start();
  1.1658 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1659 +	
  1.1660 +	// Make sure there are now events
  1.1661 +	TEST(!view->SetFilterL(*filter, active->iStatus));
  1.1662 +
  1.1663 +	// Add some events
  1.1664 +	event->SetEventType(KLogCallEventTypeUid);
  1.1665 +	TLogFlags flags = KLogFlagsMask + 1;
  1.1666 +	TLogFlags flags2;
  1.1667 +
  1.1668 +	while(flags--)
  1.1669 +		{
  1.1670 +		event->ClearFlags(0xF);
  1.1671 +		event->SetFlags(flags);
  1.1672 +
  1.1673 +		// Add event
  1.1674 +		active->StartL();
  1.1675 +		aClient.AddEvent(*event, active->iStatus);
  1.1676 +		CActiveScheduler::Start();
  1.1677 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1678 +		}
  1.1679 +
  1.1680 +	flags = KLogFlagsMask + 1;
  1.1681 +	while(flags--)
  1.1682 +		{
  1.1683 +		filter->ClearFlags(0xF);
  1.1684 +		// we use this because, since the events were all created without contact ids
  1.1685 +		// the log engine looked each one up in the contacts DB and set the flag so we
  1.1686 +		// need to set it in the flags being looked for
  1.1687 +		flags2 = static_cast<TLogFlags>(flags | KLogEventContactSearched);
  1.1688 +		filter->SetFlags(flags2);
  1.1689 +		active->StartL();
  1.1690 +		TEST(view->SetFilterL(*filter, active->iStatus));
  1.1691 +		CActiveScheduler::Start();
  1.1692 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1693 +		TEST((view->Event().Flags() & flags2) == flags2);
  1.1694 +
  1.1695 +		while(view->NextL(active->iStatus))
  1.1696 +			{
  1.1697 +			active->StartL();
  1.1698 +			CActiveScheduler::Start();
  1.1699 +			TEST2(active->iStatus.Int(), KErrNone);
  1.1700 +			TEST((view->Event().Flags() & flags2) == flags2);
  1.1701 +			}
  1.1702 +		}
  1.1703 +	
  1.1704 +	// Now TEST we can query for the inverse
  1.1705 +	filter->SetNullFields(ELogFlagsField);
  1.1706 +
  1.1707 +	flags = KLogFlagsMask + 1;
  1.1708 +	while(flags--)
  1.1709 +		{
  1.1710 +		filter->ClearFlags(0xF);
  1.1711 +		// we use this because, since the events were all created without contact ids
  1.1712 +		// the log engine looked each one up in the contacts DB and set the flag so we
  1.1713 +		// need to unset it in the flags being excluded
  1.1714 +		flags2 = static_cast<TLogFlags>(flags & ~KLogEventContactSearched);
  1.1715 +		filter->SetFlags(flags2);
  1.1716 +
  1.1717 +		active->StartL();
  1.1718 +		TEST(view->SetFilterL(*filter, active->iStatus));
  1.1719 +		CActiveScheduler::Start();
  1.1720 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1721 +		TEST((~view->Event().Flags() & flags2) == flags2);
  1.1722 +
  1.1723 +		while(view->NextL(active->iStatus))
  1.1724 +			{
  1.1725 +			active->StartL();
  1.1726 +			CActiveScheduler::Start();
  1.1727 +			TEST2(active->iStatus.Int(), KErrNone);
  1.1728 +			TEST((~view->Event().Flags() & flags2) == flags2);
  1.1729 +			}
  1.1730 +		}
  1.1731 +
  1.1732 +	CleanupStack::PopAndDestroy(4); // filter, view, active, event
  1.1733 +	}
  1.1734 +
  1.1735 +/**
  1.1736 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0939
  1.1737 +@SYMTestCaseDesc	    Querying recent event view for flags test
  1.1738 +@SYMTestPriority 	    High
  1.1739 +@SYMTestActions  	    Change the log configuration.Clear the log for any recent list and add some events.Query for flags in the recent view list
  1.1740 +@SYMTestExpectedResults Test must not fail
  1.1741 +@SYMREQ                 REQ0000
  1.1742 +*/
  1.1743 +LOCAL_C void TestRecentViewForFlagsL(CLogClient& aClient)
  1.1744 +	{
  1.1745 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0939 "));
  1.1746 +	CLogEvent* event = CLogEvent::NewL();
  1.1747 +	CleanupStack::PushL(event);
  1.1748 +
  1.1749 +	CTestActive* active = new(ELeave)CTestActive();
  1.1750 +	CleanupStack::PushL(active);
  1.1751 +
  1.1752 +	TLogConfig config;
  1.1753 +
  1.1754 +	// Change the log engine config
  1.1755 +	active->StartL();
  1.1756 +	aClient.GetConfig(config, active->iStatus);
  1.1757 +	CActiveScheduler::Start();
  1.1758 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1759 +
  1.1760 +	config.iMaxRecentLogSize = KLogFlagsMask + 1;
  1.1761 +
  1.1762 +	// Change the log engine config
  1.1763 +	active->StartL();
  1.1764 +	aClient.ChangeConfig(config, active->iStatus);
  1.1765 +	CActiveScheduler::Start();
  1.1766 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1767 +
  1.1768 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.1769 +	CleanupStack::PushL(view);
  1.1770 +
  1.1771 +	CLogFilter* filter = CLogFilter::NewL();
  1.1772 +	CleanupStack::PushL(filter);
  1.1773 +
  1.1774 +	// Make sure there are no entries in any recent lists
  1.1775 +	active->StartL();
  1.1776 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.1777 +	CActiveScheduler::Start();
  1.1778 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1779 +
  1.1780 +	// Make sure there are no events
  1.1781 +	TEST(!view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1.1782 +
  1.1783 +	// Incoming
  1.1784 +	TLogString buf;
  1.1785 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.1786 +
  1.1787 +	// Add some events
  1.1788 +	event->SetEventType(KLogCallEventTypeUid);
  1.1789 +	event->SetDirection(buf);
  1.1790 +
  1.1791 +	TLogFlags flags = KLogFlagsMask + 1;
  1.1792 +	while(flags--)
  1.1793 +		{
  1.1794 +		event->ClearFlags(0xF);
  1.1795 +		event->SetFlags(flags);
  1.1796 +		event->SetContact(flags);
  1.1797 +
  1.1798 +		// Add event
  1.1799 +		active->StartL();
  1.1800 +		aClient.AddEvent(*event, active->iStatus);
  1.1801 +		CActiveScheduler::Start();
  1.1802 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1803 +		}
  1.1804 +
  1.1805 +	flags = KLogFlagsMask + 1;
  1.1806 +	while(flags--)
  1.1807 +		{
  1.1808 +		filter->ClearFlags(0xF);
  1.1809 +		filter->SetFlags(flags);
  1.1810 +
  1.1811 +		active->StartL();
  1.1812 +		TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1813 +		CActiveScheduler::Start();
  1.1814 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1815 +		TEST((view->Event().Flags() & flags) == flags);
  1.1816 +
  1.1817 +		while(view->NextL(active->iStatus))
  1.1818 +			{
  1.1819 +			active->StartL();
  1.1820 +			CActiveScheduler::Start();
  1.1821 +			TEST2(active->iStatus.Int(), KErrNone);
  1.1822 +			TEST((view->Event().Flags() & flags) == flags);
  1.1823 +			}
  1.1824 +		}
  1.1825 +	
  1.1826 +	// Now TEST we can query for the inverse
  1.1827 +	filter->SetNullFields(ELogFlagsField);
  1.1828 +
  1.1829 +	flags = KLogFlagsMask + 1;
  1.1830 +	while(flags--)
  1.1831 +		{
  1.1832 +		filter->ClearFlags(0xF);
  1.1833 +		filter->SetFlags(flags);
  1.1834 +
  1.1835 +		active->StartL();
  1.1836 +		TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1837 +		CActiveScheduler::Start();
  1.1838 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1839 +		TEST((~view->Event().Flags() & flags) == flags);
  1.1840 +
  1.1841 +		while(view->NextL(active->iStatus))
  1.1842 +			{
  1.1843 +			active->StartL();
  1.1844 +			CActiveScheduler::Start();
  1.1845 +			TEST2(active->iStatus.Int(), KErrNone);
  1.1846 +			TEST((~view->Event().Flags() & flags) == flags);
  1.1847 +			}
  1.1848 +		}
  1.1849 +
  1.1850 +	CleanupStack::PopAndDestroy(4); // filter, view, active, event
  1.1851 +	}
  1.1852 +
  1.1853 +/**
  1.1854 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0940
  1.1855 +@SYMTestCaseDesc	    Querying duplicate event view for flags test
  1.1856 +@SYMTestPriority 	    High
  1.1857 +@SYMTestActions  	    Change the log configuration.Clear the log for any recent list and add some events.Query for flags in the duplicate view list
  1.1858 +@SYMTestExpectedResults Test must not fail
  1.1859 +@SYMREQ                 REQ0000
  1.1860 +*/
  1.1861 +LOCAL_C void TestDuplicateViewForFlagsL(CLogClient& aClient)
  1.1862 +	{
  1.1863 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0940 "));
  1.1864 +	CLogEvent* event = CLogEvent::NewL();
  1.1865 +	CleanupStack::PushL(event);
  1.1866 +
  1.1867 +	CTestActive* active = new(ELeave)CTestActive();
  1.1868 +	CleanupStack::PushL(active);
  1.1869 +
  1.1870 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.1871 +	CleanupStack::PushL(view);
  1.1872 +
  1.1873 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.1874 +	CleanupStack::PushL(duplicate);
  1.1875 +
  1.1876 +	CLogFilter* filter = CLogFilter::NewL();
  1.1877 +	CleanupStack::PushL(filter);
  1.1878 +
  1.1879 +	// Make sure there are no entries in any recent lists
  1.1880 +	active->StartL();
  1.1881 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.1882 +	CActiveScheduler::Start();
  1.1883 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1884 +
  1.1885 +	// Make sure there are now events
  1.1886 +	TEST(!view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1.1887 +
  1.1888 +	// Incoming
  1.1889 +	TLogString buf;
  1.1890 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.1891 +
  1.1892 +	// Add some events
  1.1893 +	event->SetEventType(KLogCallEventTypeUid);
  1.1894 +	event->SetDirection(buf);
  1.1895 +	event->SetDurationType(KLogDurationNone);
  1.1896 +	event->SetContact(KTestContact1);
  1.1897 +	event->SetStatus(KTestStatus1);
  1.1898 +
  1.1899 +	TLogFlags flags = KLogFlagsMask + 1;
  1.1900 +	while(flags--)
  1.1901 +		{
  1.1902 +		event->ClearFlags(0xF);
  1.1903 +		event->SetFlags(flags);
  1.1904 +
  1.1905 +		// Add event
  1.1906 +		active->StartL();
  1.1907 +		aClient.AddEvent(*event, active->iStatus);
  1.1908 +		CActiveScheduler::Start();
  1.1909 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1910 +		}
  1.1911 +
  1.1912 +	// Add an extra event which will be the most recent
  1.1913 +	active->StartL();
  1.1914 +	aClient.AddEvent(*event, active->iStatus);
  1.1915 +	CActiveScheduler::Start();
  1.1916 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1917 +
  1.1918 +	active->StartL();
  1.1919 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
  1.1920 +	CActiveScheduler::Start();
  1.1921 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1922 +	TEST2(view->CountL(), 1);
  1.1923 +
  1.1924 +	flags = KLogFlagsMask + 1;
  1.1925 +	while(flags--)
  1.1926 +		{
  1.1927 +		filter->ClearFlags(0xF);
  1.1928 +		filter->SetFlags(flags);
  1.1929 +
  1.1930 +		active->StartL();
  1.1931 +		TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1932 +		CActiveScheduler::Start();
  1.1933 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1934 +		TEST((duplicate->Event().Flags() & flags) == flags);
  1.1935 +
  1.1936 +		while(duplicate->NextL(active->iStatus))
  1.1937 +			{
  1.1938 +			active->StartL();
  1.1939 +			CActiveScheduler::Start();
  1.1940 +			TEST2(active->iStatus.Int(), KErrNone);
  1.1941 +			TEST((duplicate->Event().Flags() & flags) == flags);
  1.1942 +			}
  1.1943 +		}
  1.1944 +	
  1.1945 +	// Now TEST we can query for the inverse
  1.1946 +	filter->SetNullFields(ELogFlagsField);
  1.1947 +
  1.1948 +	flags = KLogFlagsMask + 1;
  1.1949 +	while(flags--)
  1.1950 +		{
  1.1951 +		filter->ClearFlags(0xF);
  1.1952 +		filter->SetFlags(flags);
  1.1953 +
  1.1954 +		active->StartL();
  1.1955 +		TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
  1.1956 +		CActiveScheduler::Start();
  1.1957 +		TEST2(active->iStatus.Int(), KErrNone);
  1.1958 +		TEST((~duplicate->Event().Flags() & flags) == flags);
  1.1959 +
  1.1960 +		while(duplicate->NextL(active->iStatus))
  1.1961 +			{
  1.1962 +			active->StartL();
  1.1963 +			CActiveScheduler::Start();
  1.1964 +			TEST2(active->iStatus.Int(), KErrNone);
  1.1965 +			TEST((~duplicate->Event().Flags() & flags) == flags);
  1.1966 +			}
  1.1967 +		}
  1.1968 +
  1.1969 +	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
  1.1970 +	}
  1.1971 +
  1.1972 +/**
  1.1973 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0941
  1.1974 +@SYMTestCaseDesc	    Tests for removing recent events.Tests for CLogClient::ClearLog() function 
  1.1975 +@SYMTestPriority 	    High
  1.1976 +@SYMTestActions  	    Clear log for any recent entries.Add events and create the view.Test for removing the recent events from the view
  1.1977 +@SYMTestExpectedResults Test must not fail
  1.1978 +@SYMREQ                 REQ0000
  1.1979 +*/
  1.1980 +LOCAL_C void TestRemovingRecentEventsL(CLogClient& aClient)
  1.1981 +	{
  1.1982 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0941 "));
  1.1983 +	CLogEvent* event = CLogEvent::NewL();
  1.1984 +	CleanupStack::PushL(event);
  1.1985 +
  1.1986 +	CTestActive* active = new(ELeave)CTestActive();
  1.1987 +	CleanupStack::PushL(active);
  1.1988 +
  1.1989 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.1990 +	CleanupStack::PushL(view);
  1.1991 +
  1.1992 +	// Make sure there are no entries in any recent lists
  1.1993 +	active->StartL();
  1.1994 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.1995 +	CActiveScheduler::Start();
  1.1996 +	TEST2(active->iStatus.Int(), KErrNone);
  1.1997 +
  1.1998 +	// Make sure there are no events
  1.1999 +	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
  1.2000 +
  1.2001 +	// Incoming
  1.2002 +	TLogString buf;
  1.2003 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.2004 +
  1.2005 +	// Add some events
  1.2006 +	event->SetEventType(KLogCallEventTypeUid);
  1.2007 +	event->SetDirection(buf);
  1.2008 +
  1.2009 +	TInt count = 10;
  1.2010 +	while(count--)
  1.2011 +		{
  1.2012 +		// Add event
  1.2013 +		active->StartL();
  1.2014 +		aClient.AddEvent(*event, active->iStatus);
  1.2015 +		CActiveScheduler::Start();
  1.2016 +		TEST2(active->iStatus.Int(), KErrNone);
  1.2017 +		}
  1.2018 +
  1.2019 +	// Create the view
  1.2020 +	active->StartL();
  1.2021 +	TEST(view->SetRecentListL(KLogNullRecentList, active->iStatus));
  1.2022 +	CActiveScheduler::Start();
  1.2023 +	TEST2(active->iStatus.Int(), KErrNone);
  1.2024 +
  1.2025 +	TLogId id = view->Event().Id();
  1.2026 +	while(view->NextL(active->iStatus))
  1.2027 +		{
  1.2028 +		active->StartL();
  1.2029 +		CActiveScheduler::Start();
  1.2030 +		TEST2(active->iStatus.Int(), KErrNone);
  1.2031 +
  1.2032 +		// Try removing the previous event
  1.2033 +		view->RemoveL(id);
  1.2034 +		id = view->Event().Id();
  1.2035 +		}
  1.2036 +
  1.2037 +	// Try removing the current event
  1.2038 +	view->RemoveL(id);
  1.2039 +	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
  1.2040 +
  1.2041 +	CleanupStack::PopAndDestroy(3); // view, active, event
  1.2042 +	}
  1.2043 +
  1.2044 +/**
  1.2045 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0942
  1.2046 +@SYMTestCaseDesc	    Removing duplicate events from the duplicate view
  1.2047 +                        Tests for CLogViewRecent::DuplicatesL() function
  1.2048 +@SYMTestPriority 	    High
  1.2049 +@SYMTestActions  	    Clear log for any recent entries.Add events and create the view and duplicate view.
  1.2050 +@SYMTestExpectedResults Test must not fail
  1.2051 +@SYMREQ                 REQ0000
  1.2052 +*/
  1.2053 +LOCAL_C void TestRemovingDuplicateEventsL(CLogClient& aClient)
  1.2054 +	{
  1.2055 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0942 "));
  1.2056 +	CLogEvent* event = CLogEvent::NewL();
  1.2057 +	CleanupStack::PushL(event);
  1.2058 +
  1.2059 +	CTestActive* active = new(ELeave)CTestActive();
  1.2060 +	CleanupStack::PushL(active);
  1.2061 +
  1.2062 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.2063 +	CleanupStack::PushL(view);
  1.2064 +
  1.2065 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.2066 +	CleanupStack::PushL(duplicate);
  1.2067 +
  1.2068 +	// Make sure there are no entries in any recent lists
  1.2069 +	active->StartL();
  1.2070 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.2071 +	CActiveScheduler::Start();
  1.2072 +	TEST2(active->iStatus.Int(), KErrNone);
  1.2073 +
  1.2074 +	// Make sure there are no events
  1.2075 +	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
  1.2076 +
  1.2077 +	// Incoming
  1.2078 +	TLogString buf;
  1.2079 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.2080 +
  1.2081 +	// Add some events
  1.2082 +	event->SetEventType(KLogCallEventTypeUid);
  1.2083 +	event->SetDirection(buf);
  1.2084 +	event->SetDurationType(KLogDurationNone);
  1.2085 +	event->SetContact(KTestContact1);
  1.2086 +	event->SetStatus(KTestStatus1);
  1.2087 +
  1.2088 +	TInt count = 10;
  1.2089 +	while(count--)
  1.2090 +		{
  1.2091 +		// Add event
  1.2092 +		active->StartL();
  1.2093 +		aClient.AddEvent(*event, active->iStatus);
  1.2094 +		CActiveScheduler::Start();
  1.2095 +		TEST2(active->iStatus.Int(), KErrNone);
  1.2096 +		TheTest.Printf(_L("EVENT ID: %d\n"), event->Id());
  1.2097 +		}
  1.2098 +
  1.2099 +	// Create the view
  1.2100 +	active->StartL();
  1.2101 +	TEST(view->SetRecentListL(KLogNullRecentList, active->iStatus));
  1.2102 +	CActiveScheduler::Start();
  1.2103 +	TEST2(active->iStatus.Int(), KErrNone);
  1.2104 +
  1.2105 +	// Create the duplicate view
  1.2106 +	active->StartL();
  1.2107 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.2108 +	CActiveScheduler::Start();
  1.2109 +	TEST2(active->iStatus.Int(), KErrNone);
  1.2110 +	TEST2(view->CountL(), 1);
  1.2111 +	count = duplicate->CountL();
  1.2112 +	TEST2(count, 9);
  1.2113 +
  1.2114 +	TLogId id = duplicate->Event().Id();
  1.2115 +	while(duplicate->NextL(active->iStatus))
  1.2116 +		{
  1.2117 +		active->StartL();
  1.2118 +		CActiveScheduler::Start();
  1.2119 +		TEST2(active->iStatus.Int(), KErrNone);
  1.2120 +
  1.2121 +		// Try removing the previous event
  1.2122 +		duplicate->RemoveL(id);
  1.2123 +		id = duplicate->Event().Id();
  1.2124 +		}
  1.2125 +
  1.2126 +	// Try removing the current event
  1.2127 +	duplicate->RemoveL(id);
  1.2128 +	count = duplicate->CountL();
  1.2129 +	TEST2(count, 0);
  1.2130 +	//
  1.2131 +	TEST(!view->DuplicatesL(*duplicate, active->iStatus));
  1.2132 +
  1.2133 +	CleanupStack::PopAndDestroy(4); // duplicate, view, active, event
  1.2134 +	}
  1.2135 +
  1.2136 +/**
  1.2137 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0943
  1.2138 +s@SYMTestCaseDesc	    Multiple log event views test
  1.2139 +@SYMTestPriority 	    High
  1.2140 +@SYMTestActions  	    Add events and set the filter with different fields.Check for log event views
  1.2141 +@SYMTestExpectedResults Test must not fail
  1.2142 +@SYMREQ                 REQ0000
  1.2143 +*/
  1.2144 +LOCAL_C void TestMultipleViews1L(CLogClient& aClient)
  1.2145 +	{
  1.2146 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0943 "));
  1.2147 +	CTestActive* active1 = new(ELeave)CTestActive;
  1.2148 +	CleanupStack::PushL(active1);
  1.2149 +
  1.2150 +	// Wait a second
  1.2151 +	User::After(1000000);
  1.2152 +
  1.2153 +	TTime now;
  1.2154 +	now.UniversalTime();
  1.2155 +	now += (TTimeIntervalDays)+1;
  1.2156 +
  1.2157 +	// Get rid of all the events in the log
  1.2158 +	active1->StartL();
  1.2159 +	aClient.ClearLog(now, active1->iStatus);
  1.2160 +	CActiveScheduler::Start();
  1.2161 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2162 +
  1.2163 +	CTestActive* active2 = new(ELeave)CTestActive;
  1.2164 +	CleanupStack::PushL(active2);
  1.2165 +
  1.2166 +	CLogEvent* event = CLogEvent::NewL();
  1.2167 +	CleanupStack::PushL(event);
  1.2168 +
  1.2169 +	event->SetEventType(KLogCallEventTypeUid);
  1.2170 +	event->SetContact(KTestContact1);
  1.2171 +	event->SetDirection(KTestDirection1);
  1.2172 +	event->SetDurationType(KLogDurationNone);
  1.2173 +	event->SetNumber(KTestNumber1);
  1.2174 +	event->SetRemoteParty(KTestRemote1);
  1.2175 +	event->SetStatus(KTestStatus1);
  1.2176 +
  1.2177 +	// Add event
  1.2178 +	active1->StartL();
  1.2179 +	aClient.AddEvent(*event, active1->iStatus);
  1.2180 +	CActiveScheduler::Start();
  1.2181 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2182 +
  1.2183 +	event->SetEventType(KLogDataEventTypeUid);
  1.2184 +	event->SetContact(KTestContact2);
  1.2185 +	event->SetDirection(KTestDirection2);
  1.2186 +	event->SetDurationType(KLogDurationValid);
  1.2187 +	event->SetNumber(KTestNumber2);
  1.2188 +	event->SetRemoteParty(KTestRemote2);
  1.2189 +	event->SetStatus(KTestStatus2);
  1.2190 +
  1.2191 +	// Add event
  1.2192 +	active1->StartL();
  1.2193 +	aClient.AddEvent(*event, active1->iStatus);
  1.2194 +	CActiveScheduler::Start();
  1.2195 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2196 +
  1.2197 +	event->SetEventType(KLogFaxEventTypeUid);
  1.2198 +	event->SetContact(KTestContact3);
  1.2199 +	event->SetDirection(KTestDirection3);
  1.2200 +	event->SetDurationType(KLogDurationData);
  1.2201 +	event->SetNumber(KTestNumber3);
  1.2202 +	event->SetRemoteParty(KTestRemote3);
  1.2203 +	event->SetStatus(KTestStatus3);
  1.2204 +
  1.2205 +	// Add event
  1.2206 +	active1->StartL();
  1.2207 +	aClient.AddEvent(*event, active1->iStatus);
  1.2208 +	CActiveScheduler::Start();
  1.2209 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2210 +
  1.2211 +	CLogFilterList* list = new(ELeave)CLogFilterList;
  1.2212 +	CleanupStack::PushL(list);
  1.2213 +
  1.2214 +	CLogViewEvent* view1 = CLogViewEvent::NewL(aClient);
  1.2215 +	CleanupStack::PushL(view1);
  1.2216 +
  1.2217 +	CLogViewEvent* view2 = CLogViewEvent::NewL(aClient);
  1.2218 +	CleanupStack::PushL(view2);
  1.2219 +
  1.2220 +	CLogFilter* filter = CLogFilter::NewL();
  1.2221 +	CleanupStack::PushL(filter);
  1.2222 +	
  1.2223 +	// Set filter
  1.2224 +	filter->SetContact(KTestContact1);
  1.2225 +
  1.2226 +	list->AppendL(filter);
  1.2227 +	CleanupStack::Pop(); // filter
  1.2228 +
  1.2229 +	// Test Views
  1.2230 +	active1->StartL();
  1.2231 +	active2->StartL();
  1.2232 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2233 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2234 +	CActiveScheduler::Start();
  1.2235 +	CActiveScheduler::Start();
  1.2236 +	TEST2(view1->CountL(), 1);
  1.2237 +	TEST2(view2->CountL(), 1);
  1.2238 +
  1.2239 +	filter = CLogFilter::NewL();
  1.2240 +	CleanupStack::PushL(filter);
  1.2241 +	
  1.2242 +	// Set filter
  1.2243 +	filter->SetContact(KTestContact2);
  1.2244 +
  1.2245 +	list->AppendL(filter);
  1.2246 +	CleanupStack::Pop(); // filter
  1.2247 +
  1.2248 +	// Test View
  1.2249 +	active1->StartL();
  1.2250 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2251 +	CActiveScheduler::Start();
  1.2252 +	TEST2(view1->CountL(), 2);
  1.2253 +
  1.2254 +	filter = CLogFilter::NewL();
  1.2255 +	CleanupStack::PushL(filter);
  1.2256 +	
  1.2257 +	// Set filter
  1.2258 +	filter->SetContact(KTestContact3);
  1.2259 +
  1.2260 +	list->AppendL(filter);
  1.2261 +	CleanupStack::Pop(); // filter
  1.2262 +
  1.2263 +	// Test View
  1.2264 +	active1->StartL();
  1.2265 +	active2->StartL();
  1.2266 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2267 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2268 +	CActiveScheduler::Start();
  1.2269 +	CActiveScheduler::Start();
  1.2270 +	TEST2(view1->CountL(), 3);
  1.2271 +	TEST2(view2->CountL(), 3);
  1.2272 +
  1.2273 +	list->ResetAndDestroy();
  1.2274 +
  1.2275 +	/////////////////////////////////////////
  1.2276 +
  1.2277 +	filter = CLogFilter::NewL();
  1.2278 +	CleanupStack::PushL(filter);
  1.2279 +	
  1.2280 +	// Set filter
  1.2281 +	filter->SetContact(KTestContact1);
  1.2282 +	filter->SetDirection(KTestDirection1);
  1.2283 +
  1.2284 +	list->AppendL(filter);
  1.2285 +	CleanupStack::Pop(); // filter
  1.2286 +
  1.2287 +	// Test View
  1.2288 +	active1->StartL();
  1.2289 +	active2->StartL();
  1.2290 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2291 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2292 +	CActiveScheduler::Start();
  1.2293 +	CActiveScheduler::Start();
  1.2294 +	TEST2(view1->CountL(), 1);
  1.2295 +	TEST2(view2->CountL(), 1);
  1.2296 +
  1.2297 +	filter = CLogFilter::NewL();
  1.2298 +	CleanupStack::PushL(filter);
  1.2299 +	
  1.2300 +	// Set filter
  1.2301 +	filter->SetContact(KTestContact2);
  1.2302 +	filter->SetDirection(KTestDirection2);
  1.2303 +
  1.2304 +	list->AppendL(filter);
  1.2305 +	CleanupStack::Pop(); // filter
  1.2306 +
  1.2307 +	// Test View
  1.2308 +	active1->StartL();
  1.2309 +	active2->StartL();
  1.2310 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2311 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2312 +	CActiveScheduler::Start();
  1.2313 +	CActiveScheduler::Start();
  1.2314 +	TEST2(view1->CountL(), 2);
  1.2315 +	TEST2(view2->CountL(), 2);
  1.2316 +
  1.2317 +	filter = CLogFilter::NewL();
  1.2318 +	CleanupStack::PushL(filter);
  1.2319 +	
  1.2320 +	// Set filter
  1.2321 +	filter->SetContact(KTestContact3);
  1.2322 +	filter->SetDirection(KTestDirection3);
  1.2323 +
  1.2324 +	list->AppendL(filter);
  1.2325 +	CleanupStack::Pop(); // filter
  1.2326 +
  1.2327 +	// Test View
  1.2328 +	active1->StartL();
  1.2329 +	active2->StartL();
  1.2330 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2331 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2332 +	CActiveScheduler::Start();
  1.2333 +	CActiveScheduler::Start();
  1.2334 +	TEST2(view1->CountL(), 3);
  1.2335 +	TEST2(view2->CountL(), 3);
  1.2336 +
  1.2337 +	list->ResetAndDestroy();
  1.2338 +
  1.2339 +	/////////////////////////////////////////
  1.2340 +
  1.2341 +	filter = CLogFilter::NewL();
  1.2342 +	CleanupStack::PushL(filter);
  1.2343 +	
  1.2344 +	// Set filter
  1.2345 +	filter->SetContact(KTestContact1);
  1.2346 +	filter->SetDirection(KTestDirection1);
  1.2347 +	filter->SetDurationType(KLogDurationNone);
  1.2348 +
  1.2349 +	list->AppendL(filter);
  1.2350 +	CleanupStack::Pop(); // filter
  1.2351 +
  1.2352 +	// Test View
  1.2353 +	active1->StartL();
  1.2354 +	active2->StartL();
  1.2355 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2356 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2357 +	CActiveScheduler::Start();
  1.2358 +	CActiveScheduler::Start();
  1.2359 +	TEST2(view1->CountL(), 1);
  1.2360 +	TEST2(view2->CountL(), 1);
  1.2361 +
  1.2362 +	filter = CLogFilter::NewL();
  1.2363 +	CleanupStack::PushL(filter);
  1.2364 +	
  1.2365 +	// Set filter
  1.2366 +	filter->SetContact(KTestContact2);
  1.2367 +	filter->SetDirection(KTestDirection2);
  1.2368 +	filter->SetDurationType(KLogDurationValid);
  1.2369 +
  1.2370 +	list->AppendL(filter);
  1.2371 +	CleanupStack::Pop(); // filter
  1.2372 +
  1.2373 +	// Test View
  1.2374 +	active1->StartL();
  1.2375 +	active2->StartL();
  1.2376 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2377 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2378 +	CActiveScheduler::Start();
  1.2379 +	CActiveScheduler::Start();
  1.2380 +	TEST2(view1->CountL(), 2);
  1.2381 +	TEST2(view2->CountL(), 2);
  1.2382 +
  1.2383 +	filter = CLogFilter::NewL();
  1.2384 +	CleanupStack::PushL(filter);
  1.2385 +	
  1.2386 +	// Set filter
  1.2387 +	filter->SetContact(KTestContact3);
  1.2388 +	filter->SetDirection(KTestDirection3);
  1.2389 +	filter->SetDurationType(KLogDurationData);
  1.2390 +
  1.2391 +	list->AppendL(filter);
  1.2392 +	CleanupStack::Pop(); // filter
  1.2393 +
  1.2394 +	// Test View
  1.2395 +	active1->StartL();
  1.2396 +	active2->StartL();
  1.2397 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2398 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2399 +	CActiveScheduler::Start();
  1.2400 +	CActiveScheduler::Start();
  1.2401 +	TEST2(view1->CountL(), 3);
  1.2402 +	TEST2(view2->CountL(), 3);
  1.2403 +
  1.2404 +	list->ResetAndDestroy();
  1.2405 +
  1.2406 +	/////////////////////////////////////////
  1.2407 +
  1.2408 +	filter = CLogFilter::NewL();
  1.2409 +	CleanupStack::PushL(filter);
  1.2410 +	
  1.2411 +	// Set filter
  1.2412 +	filter->SetContact(KTestContact1);
  1.2413 +	filter->SetDirection(KTestDirection1);
  1.2414 +	filter->SetDurationType(KLogDurationNone);
  1.2415 +	filter->SetEventType(KLogCallEventTypeUid);
  1.2416 +
  1.2417 +	list->AppendL(filter);
  1.2418 +	CleanupStack::Pop(); // filter
  1.2419 +
  1.2420 +	// Test View
  1.2421 +	active1->StartL();
  1.2422 +	active2->StartL();
  1.2423 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2424 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2425 +	CActiveScheduler::Start();
  1.2426 +	CActiveScheduler::Start();
  1.2427 +	TEST2(view1->CountL(), 1);
  1.2428 +	TEST2(view2->CountL(), 1);
  1.2429 +
  1.2430 +	filter = CLogFilter::NewL();
  1.2431 +	CleanupStack::PushL(filter);
  1.2432 +	
  1.2433 +	// Set filter
  1.2434 +	filter->SetContact(KTestContact2);
  1.2435 +	filter->SetDirection(KTestDirection2);
  1.2436 +	filter->SetDurationType(KLogDurationValid);
  1.2437 +	filter->SetEventType(KLogDataEventTypeUid);
  1.2438 +
  1.2439 +	list->AppendL(filter);
  1.2440 +	CleanupStack::Pop(); // filter
  1.2441 +
  1.2442 +	// Test View
  1.2443 +	active1->StartL();
  1.2444 +	active2->StartL();
  1.2445 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2446 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2447 +	CActiveScheduler::Start();
  1.2448 +	CActiveScheduler::Start();
  1.2449 +	TEST2(view1->CountL(), 2);
  1.2450 +	TEST2(view2->CountL(), 2);
  1.2451 +
  1.2452 +	filter = CLogFilter::NewL();
  1.2453 +	CleanupStack::PushL(filter);
  1.2454 +	
  1.2455 +	// Set filter
  1.2456 +	filter->SetContact(KTestContact3);
  1.2457 +	filter->SetDirection(KTestDirection3);
  1.2458 +	filter->SetDurationType(KLogDurationData);
  1.2459 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.2460 +
  1.2461 +	list->AppendL(filter);
  1.2462 +	CleanupStack::Pop(); // filter
  1.2463 +
  1.2464 +	// Test View
  1.2465 +	active1->StartL();
  1.2466 +	active2->StartL();
  1.2467 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2468 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2469 +	CActiveScheduler::Start();
  1.2470 +	CActiveScheduler::Start();
  1.2471 +	TEST2(view1->CountL(), 3);
  1.2472 +	TEST2(view2->CountL(), 3);
  1.2473 +
  1.2474 +	list->ResetAndDestroy();
  1.2475 +
  1.2476 +	/////////////////////////////////////////
  1.2477 +
  1.2478 +	filter = CLogFilter::NewL();
  1.2479 +	CleanupStack::PushL(filter);
  1.2480 +	
  1.2481 +	// Set filter
  1.2482 +	filter->SetContact(KTestContact1);
  1.2483 +	filter->SetDirection(KTestDirection1);
  1.2484 +	filter->SetDurationType(KLogDurationNone);
  1.2485 +	filter->SetEventType(KLogCallEventTypeUid);
  1.2486 +	filter->SetNumber(KTestNumber1);
  1.2487 +
  1.2488 +	list->AppendL(filter);
  1.2489 +	CleanupStack::Pop(); // filter
  1.2490 +
  1.2491 +	// Test View
  1.2492 +	active1->StartL();
  1.2493 +	active2->StartL();
  1.2494 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2495 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2496 +	CActiveScheduler::Start();
  1.2497 +	CActiveScheduler::Start();
  1.2498 +	TEST2(view1->CountL(), 1);
  1.2499 +	TEST2(view2->CountL(), 1);
  1.2500 +
  1.2501 +	filter = CLogFilter::NewL();
  1.2502 +	CleanupStack::PushL(filter);
  1.2503 +	
  1.2504 +	// Set filter
  1.2505 +	filter->SetContact(KTestContact2);
  1.2506 +	filter->SetDirection(KTestDirection2);
  1.2507 +	filter->SetDurationType(KLogDurationValid);
  1.2508 +	filter->SetEventType(KLogDataEventTypeUid);
  1.2509 +	filter->SetNumber(KTestNumber2);
  1.2510 +
  1.2511 +	list->AppendL(filter);
  1.2512 +	CleanupStack::Pop(); // filter
  1.2513 +
  1.2514 +	// Test View
  1.2515 +	active1->StartL();
  1.2516 +	active2->StartL();
  1.2517 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2518 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2519 +	CActiveScheduler::Start();
  1.2520 +	CActiveScheduler::Start();
  1.2521 +	TEST2(view1->CountL(), 2);
  1.2522 +	TEST2(view2->CountL(), 2);
  1.2523 +
  1.2524 +	filter = CLogFilter::NewL();
  1.2525 +	CleanupStack::PushL(filter);
  1.2526 +	
  1.2527 +	// Set filter
  1.2528 +	filter->SetContact(KTestContact3);
  1.2529 +	filter->SetDirection(KTestDirection3);
  1.2530 +	filter->SetDurationType(KLogDurationData);
  1.2531 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.2532 +	filter->SetNumber(KTestNumber3);
  1.2533 +
  1.2534 +	list->AppendL(filter);
  1.2535 +	CleanupStack::Pop(); // filter
  1.2536 +
  1.2537 +	// Test View
  1.2538 +	active1->StartL();
  1.2539 +	active2->StartL();
  1.2540 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2541 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2542 +	CActiveScheduler::Start();
  1.2543 +	CActiveScheduler::Start();
  1.2544 +	TEST2(view1->CountL(), 3);
  1.2545 +	TEST2(view2->CountL(), 3);
  1.2546 +
  1.2547 +	list->ResetAndDestroy();
  1.2548 +
  1.2549 +	/////////////////////////////////////////
  1.2550 +
  1.2551 +	filter = CLogFilter::NewL();
  1.2552 +	CleanupStack::PushL(filter);
  1.2553 +	
  1.2554 +	// Set filter
  1.2555 +	filter->SetContact(KTestContact1);
  1.2556 +	filter->SetDirection(KTestDirection1);
  1.2557 +	filter->SetDurationType(KLogDurationNone);
  1.2558 +	filter->SetEventType(KLogCallEventTypeUid);
  1.2559 +	filter->SetNumber(KTestNumber1);
  1.2560 +	filter->SetRemoteParty(KTestRemote1);
  1.2561 +
  1.2562 +	list->AppendL(filter);
  1.2563 +	CleanupStack::Pop(); // filter
  1.2564 +
  1.2565 +	// Test View
  1.2566 +	active1->StartL();
  1.2567 +	active2->StartL();
  1.2568 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2569 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2570 +	CActiveScheduler::Start();
  1.2571 +	CActiveScheduler::Start();
  1.2572 +	TEST2(view1->CountL(), 1);
  1.2573 +	TEST2(view2->CountL(), 1);
  1.2574 +
  1.2575 +	filter = CLogFilter::NewL();
  1.2576 +	CleanupStack::PushL(filter);
  1.2577 +	
  1.2578 +	// Set filter
  1.2579 +	filter->SetContact(KTestContact2);
  1.2580 +	filter->SetDirection(KTestDirection2);
  1.2581 +	filter->SetDurationType(KLogDurationValid);
  1.2582 +	filter->SetEventType(KLogDataEventTypeUid);
  1.2583 +	filter->SetNumber(KTestNumber2);
  1.2584 +	filter->SetRemoteParty(KTestRemote2);
  1.2585 +
  1.2586 +	list->AppendL(filter);
  1.2587 +	CleanupStack::Pop(); // filter
  1.2588 +
  1.2589 +	// Test View
  1.2590 +	active1->StartL();
  1.2591 +	active2->StartL();
  1.2592 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2593 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2594 +	CActiveScheduler::Start();
  1.2595 +	CActiveScheduler::Start();
  1.2596 +	TEST2(view1->CountL(), 2);
  1.2597 +	TEST2(view2->CountL(), 2);
  1.2598 +
  1.2599 +	filter = CLogFilter::NewL();
  1.2600 +	CleanupStack::PushL(filter);
  1.2601 +	
  1.2602 +	// Set filter
  1.2603 +	filter->SetContact(KTestContact3);
  1.2604 +	filter->SetDirection(KTestDirection3);
  1.2605 +	filter->SetDurationType(KLogDurationData);
  1.2606 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.2607 +	filter->SetNumber(KTestNumber3);
  1.2608 +	filter->SetRemoteParty(KTestRemote3);
  1.2609 +
  1.2610 +	list->AppendL(filter);
  1.2611 +	CleanupStack::Pop(); // filter
  1.2612 +
  1.2613 +	// Test View
  1.2614 +	active1->StartL();
  1.2615 +	active2->StartL();
  1.2616 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2617 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2618 +	CActiveScheduler::Start();
  1.2619 +	CActiveScheduler::Start();
  1.2620 +	TEST2(view1->CountL(), 3);
  1.2621 +	TEST2(view2->CountL(), 3);
  1.2622 +
  1.2623 +	list->ResetAndDestroy();
  1.2624 +
  1.2625 +	/////////////////////////////////////////
  1.2626 +
  1.2627 +	filter = CLogFilter::NewL();
  1.2628 +	CleanupStack::PushL(filter);
  1.2629 +	
  1.2630 +	// Set filter
  1.2631 +	filter->SetContact(KTestContact1);
  1.2632 +	filter->SetDirection(KTestDirection1);
  1.2633 +	filter->SetDurationType(KLogDurationNone);
  1.2634 +	filter->SetEventType(KLogCallEventTypeUid);
  1.2635 +	filter->SetNumber(KTestNumber1);
  1.2636 +	filter->SetRemoteParty(KTestRemote1);
  1.2637 +	filter->SetStatus(KTestStatus1);
  1.2638 +
  1.2639 +	list->AppendL(filter);
  1.2640 +	CleanupStack::Pop(); // filter
  1.2641 +
  1.2642 +	// Test View
  1.2643 +	active1->StartL();
  1.2644 +	active2->StartL();
  1.2645 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2646 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2647 +	CActiveScheduler::Start();
  1.2648 +	CActiveScheduler::Start();
  1.2649 +	TEST2(view1->CountL(), 1);
  1.2650 +	TEST2(view2->CountL(), 1);
  1.2651 +
  1.2652 +	filter = CLogFilter::NewL();
  1.2653 +	CleanupStack::PushL(filter);
  1.2654 +	
  1.2655 +	// Set filter
  1.2656 +	filter->SetContact(KTestContact2);
  1.2657 +	filter->SetDirection(KTestDirection2);
  1.2658 +	filter->SetDurationType(KLogDurationValid);
  1.2659 +	filter->SetEventType(KLogDataEventTypeUid);
  1.2660 +	filter->SetNumber(KTestNumber2);
  1.2661 +	filter->SetRemoteParty(KTestRemote2);
  1.2662 +	filter->SetStatus(KTestStatus2);
  1.2663 +
  1.2664 +	list->AppendL(filter);
  1.2665 +	CleanupStack::Pop(); // filter
  1.2666 +
  1.2667 +	// Test View
  1.2668 +	active1->StartL();
  1.2669 +	active2->StartL();
  1.2670 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2671 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2672 +	CActiveScheduler::Start();
  1.2673 +	CActiveScheduler::Start();
  1.2674 +	TEST2(view1->CountL(), 2);
  1.2675 +	TEST2(view2->CountL(), 2);
  1.2676 +
  1.2677 +	filter = CLogFilter::NewL();
  1.2678 +	CleanupStack::PushL(filter);
  1.2679 +	
  1.2680 +	// Set filter
  1.2681 +	filter->SetContact(KTestContact3);
  1.2682 +	filter->SetDirection(KTestDirection3);
  1.2683 +	filter->SetDurationType(KLogDurationData);
  1.2684 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.2685 +	filter->SetNumber(KTestNumber3);
  1.2686 +	filter->SetRemoteParty(KTestRemote3);
  1.2687 +	filter->SetStatus(KTestStatus3);
  1.2688 +
  1.2689 +	list->AppendL(filter);
  1.2690 +	CleanupStack::Pop(); // filter
  1.2691 +
  1.2692 +	// Test View
  1.2693 +	active1->StartL();
  1.2694 +	active2->StartL();
  1.2695 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2696 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2697 +	CActiveScheduler::Start();
  1.2698 +	CActiveScheduler::Start();
  1.2699 +	TEST2(view1->CountL(), 3);
  1.2700 +	TEST2(view2->CountL(), 3);
  1.2701 +
  1.2702 +	list->ResetAndDestroy();
  1.2703 +
  1.2704 +	CleanupStack::PopAndDestroy(6); // list, view1, view2, event, active1, active2
  1.2705 +	}
  1.2706 +
  1.2707 +/**
  1.2708 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0944
  1.2709 +@SYMTestCaseDesc	    Multiple log event views test
  1.2710 +@SYMTestPriority 	    High
  1.2711 +@SYMTestActions  	    Add events and set the filter with different fields.
  1.2712 +						Check for log event views and the test for the count of events
  1.2713 +@SYMTestExpectedResults Test must not fail
  1.2714 +@SYMREQ                 REQ0000
  1.2715 +*/
  1.2716 +LOCAL_C void TestMultipleViews2L(CLogClient& aClient)
  1.2717 +	{
  1.2718 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0944 "));
  1.2719 +	CTestActive* active1 = new(ELeave)CTestActive;
  1.2720 +	CleanupStack::PushL(active1);
  1.2721 +
  1.2722 +	// Wait a second
  1.2723 +	User::After(1000000);
  1.2724 +
  1.2725 +	TTime now;
  1.2726 +	now.UniversalTime();
  1.2727 +	now += (TTimeIntervalDays)+1;
  1.2728 +
  1.2729 +	// Get rid of all the events in the log
  1.2730 +	active1->StartL();
  1.2731 +	aClient.ClearLog(now, active1->iStatus);
  1.2732 +	CActiveScheduler::Start();
  1.2733 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2734 +
  1.2735 +	CTestActive* active2 = new(ELeave)CTestActive;
  1.2736 +	CleanupStack::PushL(active2);
  1.2737 +
  1.2738 +	CLogEvent* event = CLogEvent::NewL();
  1.2739 +	CleanupStack::PushL(event);
  1.2740 +
  1.2741 +	event->SetEventType(KLogCallEventTypeUid);
  1.2742 +	event->SetContact(KTestContact1);
  1.2743 +	event->SetDirection(KTestDirection1);
  1.2744 +	event->SetDurationType(KLogDurationNone);
  1.2745 +	event->SetNumber(KTestNumber1);
  1.2746 +	event->SetRemoteParty(KTestRemote1);
  1.2747 +	event->SetStatus(KTestStatus1);
  1.2748 +
  1.2749 +	// Add event
  1.2750 +	active1->StartL();
  1.2751 +	aClient.AddEvent(*event, active1->iStatus);
  1.2752 +	CActiveScheduler::Start();
  1.2753 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2754 +
  1.2755 +	event->SetEventType(KLogDataEventTypeUid);
  1.2756 +	event->SetContact(KTestContact2);
  1.2757 +	event->SetDirection(KTestDirection2);
  1.2758 +	event->SetDurationType(KLogDurationValid);
  1.2759 +	event->SetNumber(KTestNumber2);
  1.2760 +	event->SetRemoteParty(KTestRemote2);
  1.2761 +	event->SetStatus(KTestStatus2);
  1.2762 +
  1.2763 +	// Add event
  1.2764 +	active1->StartL();
  1.2765 +	aClient.AddEvent(*event, active1->iStatus);
  1.2766 +	CActiveScheduler::Start();
  1.2767 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2768 +
  1.2769 +	event->SetEventType(KLogFaxEventTypeUid);
  1.2770 +	event->SetContact(KTestContact3);
  1.2771 +	event->SetDirection(KTestDirection3);
  1.2772 +	event->SetDurationType(KLogDurationData);
  1.2773 +	event->SetNumber(KTestNumber3);
  1.2774 +	event->SetRemoteParty(KTestRemote3);
  1.2775 +	event->SetStatus(KTestStatus3);
  1.2776 +
  1.2777 +	// Add event
  1.2778 +	active1->StartL();
  1.2779 +	aClient.AddEvent(*event, active1->iStatus);
  1.2780 +	CActiveScheduler::Start();
  1.2781 +	TEST2(active1->iStatus.Int(), KErrNone);
  1.2782 +
  1.2783 +	CLogFilterList* list = new(ELeave)CLogFilterList;
  1.2784 +	CleanupStack::PushL(list);
  1.2785 +
  1.2786 +	CLogViewEvent* view1 = CLogViewEvent::NewL(aClient);
  1.2787 +	CleanupStack::PushL(view1);
  1.2788 +
  1.2789 +	CLogClient* client2 = CLogClient::NewL(theFs);
  1.2790 +	CleanupStack::PushL(client2);
  1.2791 +
  1.2792 +	CLogViewEvent* view2 = CLogViewEvent::NewL(*client2);
  1.2793 +	CleanupStack::PushL(view2);
  1.2794 +
  1.2795 +	CLogFilter* filter = CLogFilter::NewL();
  1.2796 +	CleanupStack::PushL(filter);
  1.2797 +	
  1.2798 +	// Set filter
  1.2799 +	filter->SetContact(KTestContact1);
  1.2800 +
  1.2801 +	list->AppendL(filter);
  1.2802 +	CleanupStack::Pop(); // filter
  1.2803 +
  1.2804 +	// Test Views
  1.2805 +	active1->StartL();
  1.2806 +	active2->StartL();
  1.2807 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2808 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2809 +	CActiveScheduler::Start();
  1.2810 +	CActiveScheduler::Start();
  1.2811 +	TEST2(view1->CountL(), 1);
  1.2812 +	TEST2(view2->CountL(), 1);
  1.2813 +
  1.2814 +	filter = CLogFilter::NewL();
  1.2815 +	CleanupStack::PushL(filter);
  1.2816 +	
  1.2817 +	// Set filter
  1.2818 +	filter->SetContact(KTestContact2);
  1.2819 +
  1.2820 +	list->AppendL(filter);
  1.2821 +	CleanupStack::Pop(); // filter
  1.2822 +
  1.2823 +	// Test View
  1.2824 +	active1->StartL();
  1.2825 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2826 +	CActiveScheduler::Start();
  1.2827 +	TEST2(view1->CountL(), 2);
  1.2828 +
  1.2829 +	filter = CLogFilter::NewL();
  1.2830 +	CleanupStack::PushL(filter);
  1.2831 +	
  1.2832 +	// Set filter
  1.2833 +	filter->SetContact(KTestContact3);
  1.2834 +
  1.2835 +	list->AppendL(filter);
  1.2836 +	CleanupStack::Pop(); // filter
  1.2837 +
  1.2838 +	// Test View
  1.2839 +	active1->StartL();
  1.2840 +	active2->StartL();
  1.2841 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2842 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2843 +	CActiveScheduler::Start();
  1.2844 +	CActiveScheduler::Start();
  1.2845 +	TEST2(view1->CountL(), 3);
  1.2846 +	TEST2(view2->CountL(), 3);
  1.2847 +
  1.2848 +	list->ResetAndDestroy();
  1.2849 +
  1.2850 +	/////////////////////////////////////////
  1.2851 +
  1.2852 +	filter = CLogFilter::NewL();
  1.2853 +	CleanupStack::PushL(filter);
  1.2854 +	
  1.2855 +	// Set filter
  1.2856 +	filter->SetContact(KTestContact1);
  1.2857 +	filter->SetDirection(KTestDirection1);
  1.2858 +
  1.2859 +	list->AppendL(filter);
  1.2860 +	CleanupStack::Pop(); // filter
  1.2861 +
  1.2862 +	// Test View
  1.2863 +	active1->StartL();
  1.2864 +	active2->StartL();
  1.2865 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2866 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2867 +	CActiveScheduler::Start();
  1.2868 +	CActiveScheduler::Start();
  1.2869 +	TEST2(view1->CountL(), 1);
  1.2870 +	TEST2(view2->CountL(), 1);
  1.2871 +
  1.2872 +	filter = CLogFilter::NewL();
  1.2873 +	CleanupStack::PushL(filter);
  1.2874 +	
  1.2875 +	// Set filter
  1.2876 +	filter->SetContact(KTestContact2);
  1.2877 +	filter->SetDirection(KTestDirection2);
  1.2878 +
  1.2879 +	list->AppendL(filter);
  1.2880 +	CleanupStack::Pop(); // filter
  1.2881 +
  1.2882 +	// Test View
  1.2883 +	active1->StartL();
  1.2884 +	active2->StartL();
  1.2885 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2886 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2887 +	CActiveScheduler::Start();
  1.2888 +	CActiveScheduler::Start();
  1.2889 +	TEST2(view1->CountL(), 2);
  1.2890 +	TEST2(view2->CountL(), 2);
  1.2891 +
  1.2892 +	filter = CLogFilter::NewL();
  1.2893 +	CleanupStack::PushL(filter);
  1.2894 +	
  1.2895 +	// Set filter
  1.2896 +	filter->SetContact(KTestContact3);
  1.2897 +	filter->SetDirection(KTestDirection3);
  1.2898 +
  1.2899 +	list->AppendL(filter);
  1.2900 +	CleanupStack::Pop(); // filter
  1.2901 +
  1.2902 +	// Test View
  1.2903 +	active1->StartL();
  1.2904 +	active2->StartL();
  1.2905 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2906 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2907 +	CActiveScheduler::Start();
  1.2908 +	CActiveScheduler::Start();
  1.2909 +	TEST2(view1->CountL(), 3);
  1.2910 +	TEST2(view2->CountL(), 3);
  1.2911 +
  1.2912 +	list->ResetAndDestroy();
  1.2913 +
  1.2914 +	/////////////////////////////////////////
  1.2915 +
  1.2916 +	filter = CLogFilter::NewL();
  1.2917 +	CleanupStack::PushL(filter);
  1.2918 +	
  1.2919 +	// Set filter
  1.2920 +	filter->SetContact(KTestContact1);
  1.2921 +	filter->SetDirection(KTestDirection1);
  1.2922 +	filter->SetDurationType(KLogDurationNone);
  1.2923 +
  1.2924 +	list->AppendL(filter);
  1.2925 +	CleanupStack::Pop(); // filter
  1.2926 +
  1.2927 +	// Test View
  1.2928 +	active1->StartL();
  1.2929 +	active2->StartL();
  1.2930 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2931 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2932 +	CActiveScheduler::Start();
  1.2933 +	CActiveScheduler::Start();
  1.2934 +	TEST2(view1->CountL(), 1);
  1.2935 +	TEST2(view2->CountL(), 1);
  1.2936 +
  1.2937 +	filter = CLogFilter::NewL();
  1.2938 +	CleanupStack::PushL(filter);
  1.2939 +	
  1.2940 +	// Set filter
  1.2941 +	filter->SetContact(KTestContact2);
  1.2942 +	filter->SetDirection(KTestDirection2);
  1.2943 +	filter->SetDurationType(KLogDurationValid);
  1.2944 +
  1.2945 +	list->AppendL(filter);
  1.2946 +	CleanupStack::Pop(); // filter
  1.2947 +
  1.2948 +	// Test View
  1.2949 +	active1->StartL();
  1.2950 +	active2->StartL();
  1.2951 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2952 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2953 +	CActiveScheduler::Start();
  1.2954 +	CActiveScheduler::Start();
  1.2955 +	TEST2(view1->CountL(), 2);
  1.2956 +	TEST2(view2->CountL(), 2);
  1.2957 +
  1.2958 +	filter = CLogFilter::NewL();
  1.2959 +	CleanupStack::PushL(filter);
  1.2960 +	
  1.2961 +	// Set filter
  1.2962 +	filter->SetContact(KTestContact3);
  1.2963 +	filter->SetDirection(KTestDirection3);
  1.2964 +	filter->SetDurationType(KLogDurationData);
  1.2965 +
  1.2966 +	list->AppendL(filter);
  1.2967 +	CleanupStack::Pop(); // filter
  1.2968 +
  1.2969 +	// Test View
  1.2970 +	active1->StartL();
  1.2971 +	active2->StartL();
  1.2972 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2973 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.2974 +	CActiveScheduler::Start();
  1.2975 +	CActiveScheduler::Start();
  1.2976 +	TEST2(view1->CountL(), 3);
  1.2977 +	TEST2(view2->CountL(), 3);
  1.2978 +
  1.2979 +	list->ResetAndDestroy();
  1.2980 +
  1.2981 +	/////////////////////////////////////////
  1.2982 +
  1.2983 +	filter = CLogFilter::NewL();
  1.2984 +	CleanupStack::PushL(filter);
  1.2985 +	
  1.2986 +	// Set filter
  1.2987 +	filter->SetContact(KTestContact1);
  1.2988 +	filter->SetDirection(KTestDirection1);
  1.2989 +	filter->SetDurationType(KLogDurationNone);
  1.2990 +	filter->SetEventType(KLogCallEventTypeUid);
  1.2991 +
  1.2992 +	list->AppendL(filter);
  1.2993 +	CleanupStack::Pop(); // filter
  1.2994 +
  1.2995 +	// Test View
  1.2996 +	active1->StartL();
  1.2997 +	active2->StartL();
  1.2998 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.2999 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3000 +	CActiveScheduler::Start();
  1.3001 +	CActiveScheduler::Start();
  1.3002 +	TEST2(view1->CountL(), 1);
  1.3003 +	TEST2(view2->CountL(), 1);
  1.3004 +
  1.3005 +	filter = CLogFilter::NewL();
  1.3006 +	CleanupStack::PushL(filter);
  1.3007 +	
  1.3008 +	// Set filter
  1.3009 +	filter->SetContact(KTestContact2);
  1.3010 +	filter->SetDirection(KTestDirection2);
  1.3011 +	filter->SetDurationType(KLogDurationValid);
  1.3012 +	filter->SetEventType(KLogDataEventTypeUid);
  1.3013 +
  1.3014 +	list->AppendL(filter);
  1.3015 +	CleanupStack::Pop(); // filter
  1.3016 +
  1.3017 +	// Test View
  1.3018 +	active1->StartL();
  1.3019 +	active2->StartL();
  1.3020 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3021 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3022 +	CActiveScheduler::Start();
  1.3023 +	CActiveScheduler::Start();
  1.3024 +	TEST2(view1->CountL(), 2);
  1.3025 +	TEST2(view2->CountL(), 2);
  1.3026 +
  1.3027 +	filter = CLogFilter::NewL();
  1.3028 +	CleanupStack::PushL(filter);
  1.3029 +	
  1.3030 +	// Set filter
  1.3031 +	filter->SetContact(KTestContact3);
  1.3032 +	filter->SetDirection(KTestDirection3);
  1.3033 +	filter->SetDurationType(KLogDurationData);
  1.3034 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.3035 +
  1.3036 +	list->AppendL(filter);
  1.3037 +	CleanupStack::Pop(); // filter
  1.3038 +
  1.3039 +	// Test View
  1.3040 +	active1->StartL();
  1.3041 +	active2->StartL();
  1.3042 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3043 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3044 +	CActiveScheduler::Start();
  1.3045 +	CActiveScheduler::Start();
  1.3046 +	TEST2(view1->CountL(), 3);
  1.3047 +	TEST2(view2->CountL(), 3);
  1.3048 +
  1.3049 +	list->ResetAndDestroy();
  1.3050 +
  1.3051 +	/////////////////////////////////////////
  1.3052 +
  1.3053 +	filter = CLogFilter::NewL();
  1.3054 +	CleanupStack::PushL(filter);
  1.3055 +	
  1.3056 +	// Set filter
  1.3057 +	filter->SetContact(KTestContact1);
  1.3058 +	filter->SetDirection(KTestDirection1);
  1.3059 +	filter->SetDurationType(KLogDurationNone);
  1.3060 +	filter->SetEventType(KLogCallEventTypeUid);
  1.3061 +	filter->SetNumber(KTestNumber1);
  1.3062 +
  1.3063 +	list->AppendL(filter);
  1.3064 +	CleanupStack::Pop(); // filter
  1.3065 +
  1.3066 +	// Test View
  1.3067 +	active1->StartL();
  1.3068 +	active2->StartL();
  1.3069 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3070 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3071 +	CActiveScheduler::Start();
  1.3072 +	CActiveScheduler::Start();
  1.3073 +	TEST2(view1->CountL(), 1);
  1.3074 +	TEST2(view2->CountL(), 1);
  1.3075 +
  1.3076 +	filter = CLogFilter::NewL();
  1.3077 +	CleanupStack::PushL(filter);
  1.3078 +	
  1.3079 +	// Set filter
  1.3080 +	filter->SetContact(KTestContact2);
  1.3081 +	filter->SetDirection(KTestDirection2);
  1.3082 +	filter->SetDurationType(KLogDurationValid);
  1.3083 +	filter->SetEventType(KLogDataEventTypeUid);
  1.3084 +	filter->SetNumber(KTestNumber2);
  1.3085 +
  1.3086 +	list->AppendL(filter);
  1.3087 +	CleanupStack::Pop(); // filter
  1.3088 +
  1.3089 +	// Test View
  1.3090 +	active1->StartL();
  1.3091 +	active2->StartL();
  1.3092 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3093 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3094 +	CActiveScheduler::Start();
  1.3095 +	CActiveScheduler::Start();
  1.3096 +	TEST2(view1->CountL(), 2);
  1.3097 +	TEST2(view2->CountL(), 2);
  1.3098 +
  1.3099 +	filter = CLogFilter::NewL();
  1.3100 +	CleanupStack::PushL(filter);
  1.3101 +	
  1.3102 +	// Set filter
  1.3103 +	filter->SetContact(KTestContact3);
  1.3104 +	filter->SetDirection(KTestDirection3);
  1.3105 +	filter->SetDurationType(KLogDurationData);
  1.3106 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.3107 +	filter->SetNumber(KTestNumber3);
  1.3108 +
  1.3109 +	list->AppendL(filter);
  1.3110 +	CleanupStack::Pop(); // filter
  1.3111 +
  1.3112 +	// Test View
  1.3113 +	active1->StartL();
  1.3114 +	active2->StartL();
  1.3115 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3116 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3117 +	CActiveScheduler::Start();
  1.3118 +	CActiveScheduler::Start();
  1.3119 +	TEST2(view1->CountL(), 3);
  1.3120 +	TEST2(view2->CountL(), 3);
  1.3121 +
  1.3122 +	list->ResetAndDestroy();
  1.3123 +
  1.3124 +	/////////////////////////////////////////
  1.3125 +
  1.3126 +	filter = CLogFilter::NewL();
  1.3127 +	CleanupStack::PushL(filter);
  1.3128 +	
  1.3129 +	// Set filter
  1.3130 +	filter->SetContact(KTestContact1);
  1.3131 +	filter->SetDirection(KTestDirection1);
  1.3132 +	filter->SetDurationType(KLogDurationNone);
  1.3133 +	filter->SetEventType(KLogCallEventTypeUid);
  1.3134 +	filter->SetNumber(KTestNumber1);
  1.3135 +	filter->SetRemoteParty(KTestRemote1);
  1.3136 +
  1.3137 +	list->AppendL(filter);
  1.3138 +	CleanupStack::Pop(); // filter
  1.3139 +
  1.3140 +	// Test View
  1.3141 +	active1->StartL();
  1.3142 +	active2->StartL();
  1.3143 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3144 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3145 +	CActiveScheduler::Start();
  1.3146 +	CActiveScheduler::Start();
  1.3147 +	TEST2(view1->CountL(), 1);
  1.3148 +	TEST2(view2->CountL(), 1);
  1.3149 +
  1.3150 +	filter = CLogFilter::NewL();
  1.3151 +	CleanupStack::PushL(filter);
  1.3152 +	
  1.3153 +	// Set filter
  1.3154 +	filter->SetContact(KTestContact2);
  1.3155 +	filter->SetDirection(KTestDirection2);
  1.3156 +	filter->SetDurationType(KLogDurationValid);
  1.3157 +	filter->SetEventType(KLogDataEventTypeUid);
  1.3158 +	filter->SetNumber(KTestNumber2);
  1.3159 +	filter->SetRemoteParty(KTestRemote2);
  1.3160 +
  1.3161 +	list->AppendL(filter);
  1.3162 +	CleanupStack::Pop(); // filter
  1.3163 +
  1.3164 +	// Test View
  1.3165 +	active1->StartL();
  1.3166 +	active2->StartL();
  1.3167 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3168 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3169 +	CActiveScheduler::Start();
  1.3170 +	CActiveScheduler::Start();
  1.3171 +	TEST2(view1->CountL(), 2);
  1.3172 +	TEST2(view2->CountL(), 2);
  1.3173 +
  1.3174 +	filter = CLogFilter::NewL();
  1.3175 +	CleanupStack::PushL(filter);
  1.3176 +	
  1.3177 +	// Set filter
  1.3178 +	filter->SetContact(KTestContact3);
  1.3179 +	filter->SetDirection(KTestDirection3);
  1.3180 +	filter->SetDurationType(KLogDurationData);
  1.3181 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.3182 +	filter->SetNumber(KTestNumber3);
  1.3183 +	filter->SetRemoteParty(KTestRemote3);
  1.3184 +
  1.3185 +	list->AppendL(filter);
  1.3186 +	CleanupStack::Pop(); // filter
  1.3187 +
  1.3188 +	// Test View
  1.3189 +	active1->StartL();
  1.3190 +	active2->StartL();
  1.3191 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3192 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3193 +	CActiveScheduler::Start();
  1.3194 +	CActiveScheduler::Start();
  1.3195 +	TEST2(view1->CountL(), 3);
  1.3196 +	TEST2(view2->CountL(), 3);
  1.3197 +
  1.3198 +	list->ResetAndDestroy();
  1.3199 +
  1.3200 +	/////////////////////////////////////////
  1.3201 +
  1.3202 +	filter = CLogFilter::NewL();
  1.3203 +	CleanupStack::PushL(filter);
  1.3204 +	
  1.3205 +	// Set filter
  1.3206 +	filter->SetContact(KTestContact1);
  1.3207 +	filter->SetDirection(KTestDirection1);
  1.3208 +	filter->SetDurationType(KLogDurationNone);
  1.3209 +	filter->SetEventType(KLogCallEventTypeUid);
  1.3210 +	filter->SetNumber(KTestNumber1);
  1.3211 +	filter->SetRemoteParty(KTestRemote1);
  1.3212 +	filter->SetStatus(KTestStatus1);
  1.3213 +
  1.3214 +	list->AppendL(filter);
  1.3215 +	CleanupStack::Pop(); // filter
  1.3216 +
  1.3217 +	// Test View
  1.3218 +	active1->StartL();
  1.3219 +	active2->StartL();
  1.3220 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3221 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3222 +	CActiveScheduler::Start();
  1.3223 +	CActiveScheduler::Start();
  1.3224 +	TEST2(view1->CountL(), 1);
  1.3225 +	TEST2(view2->CountL(), 1);
  1.3226 +
  1.3227 +	filter = CLogFilter::NewL();
  1.3228 +	CleanupStack::PushL(filter);
  1.3229 +	
  1.3230 +	// Set filter
  1.3231 +	filter->SetContact(KTestContact2);
  1.3232 +	filter->SetDirection(KTestDirection2);
  1.3233 +	filter->SetDurationType(KLogDurationValid);
  1.3234 +	filter->SetEventType(KLogDataEventTypeUid);
  1.3235 +	filter->SetNumber(KTestNumber2);
  1.3236 +	filter->SetRemoteParty(KTestRemote2);
  1.3237 +	filter->SetStatus(KTestStatus2);
  1.3238 +
  1.3239 +	list->AppendL(filter);
  1.3240 +	CleanupStack::Pop(); // filter
  1.3241 +
  1.3242 +	// Test View
  1.3243 +	active1->StartL();
  1.3244 +	active2->StartL();
  1.3245 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3246 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3247 +	CActiveScheduler::Start();
  1.3248 +	CActiveScheduler::Start();
  1.3249 +	TEST2(view1->CountL(), 2);
  1.3250 +	TEST2(view2->CountL(), 2);
  1.3251 +
  1.3252 +	filter = CLogFilter::NewL();
  1.3253 +	CleanupStack::PushL(filter);
  1.3254 +	
  1.3255 +	// Set filter
  1.3256 +	filter->SetContact(KTestContact3);
  1.3257 +	filter->SetDirection(KTestDirection3);
  1.3258 +	filter->SetDurationType(KLogDurationData);
  1.3259 +	filter->SetEventType(KLogFaxEventTypeUid);
  1.3260 +	filter->SetNumber(KTestNumber3);
  1.3261 +	filter->SetRemoteParty(KTestRemote3);
  1.3262 +	filter->SetStatus(KTestStatus3);
  1.3263 +
  1.3264 +	list->AppendL(filter);
  1.3265 +	CleanupStack::Pop(); // filter
  1.3266 +
  1.3267 +	// Test View
  1.3268 +	active1->StartL();
  1.3269 +	active2->StartL();
  1.3270 +	TEST(view1->SetFilterL(*list, active1->iStatus));
  1.3271 +	TEST(view2->SetFilterL(*list, active2->iStatus));
  1.3272 +	CActiveScheduler::Start();
  1.3273 +	CActiveScheduler::Start();
  1.3274 +	TEST2(view1->CountL(), 3);
  1.3275 +	TEST2(view2->CountL(), 3);
  1.3276 +
  1.3277 +	list->ResetAndDestroy();
  1.3278 +
  1.3279 +	CleanupStack::PopAndDestroy(7); // list, view1, view2, client2, event, active1, active2
  1.3280 +	}
  1.3281 +
  1.3282 +/**
  1.3283 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0945
  1.3284 +@SYMTestCaseDesc	    Tests for notification on changes done to the view
  1.3285 +                        Tests for CLogViewChangeObserver::iStatus 
  1.3286 +@SYMTestPriority 	    High
  1.3287 +@SYMTestActions  	    Tests for setting a filter on the view.Check for receiving notifications on adding events to the view
  1.3288 +@SYMTestExpectedResults Test must not fail
  1.3289 +@SYMREQ                 REQ0000
  1.3290 +*/
  1.3291 +LOCAL_C void TestViewChangeEventsL(CLogClient& aClient)
  1.3292 +	{
  1.3293 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0945 "));
  1.3294 +	TestUtils::DeleteDatabaseL();
  1.3295 +
  1.3296 +	CLogEvent* event = CLogEvent::NewL();
  1.3297 +	CleanupStack::PushL(event);
  1.3298 +	event->SetEventType(KLogCallEventTypeUid);
  1.3299 +
  1.3300 +	CTestActive* active = new(ELeave) CTestActive();
  1.3301 +	CleanupStack::PushL(active);
  1.3302 +
  1.3303 +	CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC();
  1.3304 +
  1.3305 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
  1.3306 +	CleanupStack::PushL(view);
  1.3307 +
  1.3308 +	CLogFilter* filter = CLogFilter::NewL();
  1.3309 +	CleanupStack::PushL(filter);
  1.3310 +	TEST(!view->SetFilterL(*filter, active->iStatus));
  1.3311 +
  1.3312 +	// Add some events and check we receive change notifications
  1.3313 +	TInt count;
  1.3314 +	TLogId logId;
  1.3315 +	TInt viewIndex;
  1.3316 +	//
  1.3317 +	for(count = 0; count < KTestEventNum; count++)
  1.3318 +		{
  1.3319 +		aClient.AddEvent(*event, changeObs->iStatus);
  1.3320 +		CLogChangeDefinition* changes = changeObs->WaitForChangesLC(CLogViewChangeObserver::EStopOnBoth);
  1.3321 +		TEST2(changeObs->iStatus.Int(), KErrNone);
  1.3322 +		TEST(event->Id() == (TLogId) count);
  1.3323 +		//
  1.3324 +		User::After(1);
  1.3325 +		//
  1.3326 +		TEST2(changes->Count(), 1);
  1.3327 +		TEST2(changes->At(0, logId, viewIndex), ELogChangeTypeEventAdded);
  1.3328 +		TEST(logId == (TLogId) count);
  1.3329 +		TEST2(viewIndex, 0);
  1.3330 +		CleanupStack::PopAndDestroy(changes);
  1.3331 +		}
  1.3332 +
  1.3333 +	CleanupStack::PopAndDestroy(5, event); // filter, view, changeObs, active, event
  1.3334 +	}
  1.3335 +
  1.3336 +/**
  1.3337 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0946
  1.3338 +@SYMTestCaseDesc	    Tests for events in the recent view list 
  1.3339 +@SYMTestPriority 	    High
  1.3340 +@SYMTestActions  	    Tests for events in the recent view list after setting the filters for incoming,outgoing and missed calls
  1.3341 +@SYMTestExpectedResults Test must not fail
  1.3342 +@SYMREQ                 REQ0000
  1.3343 +*/
  1.3344 +LOCAL_C void TestAltEventsInRecentListL(CLogClient& aClient)
  1.3345 +	{
  1.3346 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0946 "));
  1.3347 +	CLogEvent* event = CLogEvent::NewL();
  1.3348 +	CleanupStack::PushL(event);
  1.3349 +
  1.3350 +	CTestActive* active = new(ELeave)CTestActive();
  1.3351 +	CleanupStack::PushL(active);
  1.3352 +
  1.3353 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.3354 +	CleanupStack::PushL(view);
  1.3355 +
  1.3356 +	// Clear recent lists
  1.3357 +	active->StartL();
  1.3358 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.3359 +	CActiveScheduler::Start();
  1.3360 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3361 +
  1.3362 +	TLogString buf;
  1.3363 +	event->SetEventType(KLogCallEventTypeUid);
  1.3364 +	
  1.3365 +	// Add Incoming events
  1.3366 +	aClient.GetString(buf, R_LOG_DIR_IN);	
  1.3367 +	event->SetDirection(buf);
  1.3368 +	event->SetContact(1);
  1.3369 +	active->StartL();
  1.3370 +	aClient.AddEvent(*event, active->iStatus);
  1.3371 +	CActiveScheduler::Start();
  1.3372 +	TEST2(active->iStatus.Int(), KErrNone);	
  1.3373 +	aClient.GetString(buf, R_LOG_DIR_IN_ALT);
  1.3374 +	event->SetDirection(buf);
  1.3375 +	event->SetContact(2);
  1.3376 +	active->StartL();
  1.3377 +	aClient.AddEvent(*event, active->iStatus);
  1.3378 +	CActiveScheduler::Start();
  1.3379 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3380 +	// Verify both events in recent list
  1.3381 +	active->StartL();
  1.3382 +	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3383 +	CActiveScheduler::Start();
  1.3384 +	TEST2(active->iStatus.Int(), KErrNone);  
  1.3385 +	TEST2(view->CountL(), 2);
  1.3386 +
  1.3387 +	// Add Outgoing events
  1.3388 +	aClient.GetString(buf, R_LOG_DIR_OUT);
  1.3389 +	event->SetDirection(buf);
  1.3390 +	event->SetContact(3);
  1.3391 +	active->StartL();
  1.3392 +	aClient.AddEvent(*event, active->iStatus);
  1.3393 +	CActiveScheduler::Start();
  1.3394 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3395 +	aClient.GetString(buf, R_LOG_DIR_OUT_ALT);
  1.3396 +	event->SetDirection(buf);
  1.3397 +	event->SetContact(4);
  1.3398 +	active->StartL();
  1.3399 +	aClient.AddEvent(*event, active->iStatus);
  1.3400 +	CActiveScheduler::Start();
  1.3401 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3402 +	// Verify both events in recent list
  1.3403 +	active->StartL();
  1.3404 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.3405 +	CActiveScheduler::Start();
  1.3406 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3407 +	TEST2(view->CountL(), 2);
  1.3408 +
  1.3409 +	// Add Missed events
  1.3410 +	aClient.GetString(buf, R_LOG_DIR_MISSED);
  1.3411 +	event->SetDirection(buf);
  1.3412 +	event->SetContact(5);
  1.3413 +	active->StartL();
  1.3414 +	aClient.AddEvent(*event, active->iStatus);
  1.3415 +	CActiveScheduler::Start();
  1.3416 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3417 +	aClient.GetString(buf, R_LOG_DIR_MISSED_ALT);
  1.3418 +	event->SetDirection(buf);
  1.3419 +	event->SetContact(6);
  1.3420 +	active->StartL();
  1.3421 +	aClient.AddEvent(*event, active->iStatus);
  1.3422 +	CActiveScheduler::Start();
  1.3423 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3424 +	// Verify both events in recent list
  1.3425 +	active->StartL();
  1.3426 +	TEST(view->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.3427 +	CActiveScheduler::Start();
  1.3428 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3429 +	TEST2(view->CountL(), 2);
  1.3430 +
  1.3431 +	CleanupStack::PopAndDestroy(3); // view, active, event, 
  1.3432 +	}
  1.3433 +
  1.3434 +/**
  1.3435 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0947
  1.3436 +@SYMTestCaseDesc	    Tests for view with filter by time 
  1.3437 +@SYMTestPriority 	    High
  1.3438 +@SYMTestActions  	    Tests for view with filters set by different time
  1.3439 +@SYMTestExpectedResults Test must not fail
  1.3440 +@SYMREQ                 REQ0000
  1.3441 +*/
  1.3442 +LOCAL_C void TestFilterByTimeL(CLogClient& aClient)
  1.3443 +	{
  1.3444 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0947 "));
  1.3445 +	CLogEvent* event = CLogEvent::NewL();
  1.3446 +	CleanupStack::PushL(event);
  1.3447 +
  1.3448 +	CTestActive* active = new(ELeave)CTestActive();
  1.3449 +	CleanupStack::PushL(active);
  1.3450 +
  1.3451 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.3452 +	CleanupStack::PushL(view);
  1.3453 +
  1.3454 +	// Clear recent lists
  1.3455 +	active->StartL();
  1.3456 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.3457 +	CActiveScheduler::Start();
  1.3458 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3459 +
  1.3460 +	event->SetEventType(KLogCallEventTypeUid);
  1.3461 +	TLogString buf;
  1.3462 +	aClient.GetString(buf, R_LOG_DIR_IN);	
  1.3463 +	event->SetDirection(buf);
  1.3464 +	
  1.3465 +	// add first event (events following are added on successive days)
  1.3466 +	event->SetContact(1);  // ensures events are not duplicates
  1.3467 +	active->StartL();
  1.3468 +	aClient.AddEvent(*event, active->iStatus);
  1.3469 +	CActiveScheduler::Start();
  1.3470 +	TEST2(active->iStatus.Int(), KErrNone);		
  1.3471 +
  1.3472 +	TTime systemTime;
  1.3473 +	systemTime.UniversalTime();
  1.3474 +
  1.3475 +	// set filter startDate
  1.3476 +	TTime startDate = systemTime + (TTimeIntervalHours)+1;
  1.3477 +
  1.3478 +	// add event 2	
  1.3479 +	systemTime += (TTimeIntervalDays)+1;
  1.3480 +	event->SetContact(2);
  1.3481 +	active->StartL();
  1.3482 +	aClient.AddEvent(*event, active->iStatus);
  1.3483 +	CActiveScheduler::Start();
  1.3484 +	TEST2(active->iStatus.Int(), KErrNone);	
  1.3485 +
  1.3486 +	event->SetTime(systemTime);
  1.3487 +	active->StartL();
  1.3488 +	aClient.ChangeEvent(*event, active->iStatus);
  1.3489 +	CActiveScheduler::Start();
  1.3490 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3491 +	
  1.3492 +	// add event 3
  1.3493 +	systemTime += (TTimeIntervalDays)+1;
  1.3494 +	event->SetContact(3);
  1.3495 +	active->StartL();
  1.3496 +	aClient.AddEvent(*event, active->iStatus);
  1.3497 +	CActiveScheduler::Start();
  1.3498 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3499 +
  1.3500 +	event->SetTime(systemTime);
  1.3501 +	active->StartL();
  1.3502 +	aClient.ChangeEvent(*event, active->iStatus);
  1.3503 +	CActiveScheduler::Start();
  1.3504 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3505 +
  1.3506 +	// set filter endDate 
  1.3507 +	TTime endDate = systemTime + (TTimeIntervalHours)+1;
  1.3508 +
  1.3509 +	// add event 4
  1.3510 +	systemTime += (TTimeIntervalDays)+1;
  1.3511 +	event->SetContact(4);
  1.3512 +	active->StartL();
  1.3513 +	aClient.AddEvent(*event, active->iStatus);
  1.3514 +	CActiveScheduler::Start();
  1.3515 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3516 +
  1.3517 +	event->SetTime(systemTime);
  1.3518 +	active->StartL();
  1.3519 +	aClient.ChangeEvent(*event, active->iStatus);
  1.3520 +	CActiveScheduler::Start();
  1.3521 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3522 +
  1.3523 +	CLogFilter* filter = CLogFilter::NewL();
  1.3524 +	CleanupStack::PushL(filter);
  1.3525 +	
  1.3526 +	// check using both start and end
  1.3527 +	filter->SetStartTime(startDate);	
  1.3528 +	filter->SetEndTime(endDate);		
  1.3529 +	active->StartL();
  1.3530 +	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1.3531 +	CActiveScheduler::Start();
  1.3532 +	TEST2(active->iStatus.Int(), KErrNone);  
  1.3533 +	TEST2(view->CountL(), 2); 
  1.3534 +
  1.3535 +	//  only end filter
  1.3536 +	filter->SetStartTime(TTime(0));	// reset	
  1.3537 +	filter->SetEndTime(endDate);		
  1.3538 +	active->StartL();
  1.3539 +	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1.3540 +	CActiveScheduler::Start();
  1.3541 +	TEST2(active->iStatus.Int(), KErrNone);  
  1.3542 +	TEST2(view->CountL(), 3); 
  1.3543 +
  1.3544 +	//  only start filter
  1.3545 +	filter->SetStartTime(startDate); 
  1.3546 +	filter->SetEndTime(TTime(0));		
  1.3547 +	active->StartL();
  1.3548 +	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1.3549 +	CActiveScheduler::Start();
  1.3550 +	TEST2(active->iStatus.Int(), KErrNone);  
  1.3551 +	TEST2(view->CountL(), 3); 	
  1.3552 +
  1.3553 +	//  no time filter
  1.3554 +	filter->SetStartTime(TTime(0)); 
  1.3555 +	filter->SetEndTime(TTime(0));		
  1.3556 +	active->StartL();
  1.3557 +	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
  1.3558 +	CActiveScheduler::Start();
  1.3559 +	TEST2(active->iStatus.Int(), KErrNone);  
  1.3560 +	TEST2(view->CountL(), 4); 	
  1.3561 +
  1.3562 +	CleanupStack::PopAndDestroy(4); // view, active, event, filter 
  1.3563 +	}
  1.3564 +
  1.3565 +/**
  1.3566 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0948
  1.3567 +@SYMTestCaseDesc	    Tests for log view change observer
  1.3568 +@SYMTestPriority 	    High
  1.3569 +@SYMTestActions  	    Check that a view doesn't get change events for duplicates
  1.3570 +@SYMTestExpectedResults Test must not fail
  1.3571 +@SYMREQ                 REQ0000
  1.3572 +*/
  1.3573 +LOCAL_C void TestHiddenChangeEvents1L(CLogClient& aClient)
  1.3574 +	{
  1.3575 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0948 "));
  1.3576 +	TLogId logId;
  1.3577 +	TInt viewIndex;
  1.3578 +	TLogDatabaseChangeType type;
  1.3579 +
  1.3580 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.3581 +	changeObs1->StartCollectingChanges();
  1.3582 +
  1.3583 +
  1.3584 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.3585 +	CleanupStack::PushL(view);
  1.3586 +
  1.3587 +	CLogFilter* filter = CLogFilter::NewL();
  1.3588 +	CleanupStack::PushL(filter);
  1.3589 +
  1.3590 +	CLogEvent* event = CLogEvent::NewL();
  1.3591 +	CleanupStack::PushL(event);
  1.3592 +
  1.3593 +	CTestActive* active = new(ELeave)CTestActive();
  1.3594 +	CleanupStack::PushL(active);
  1.3595 +
  1.3596 +	TTime now;
  1.3597 +	now.UniversalTime();
  1.3598 +	now += (TTimeIntervalDays)+1;
  1.3599 +
  1.3600 +	// Get rid of all the events in the log
  1.3601 +	active->StartL();
  1.3602 +	aClient.ClearLog(now, active->iStatus);
  1.3603 +	CActiveScheduler::Start();
  1.3604 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3605 +
  1.3606 +	// Incoming call event
  1.3607 +	event->SetEventType(KLogCallEventTypeUid);
  1.3608 +	TBuf<KLogMaxDirectionLength> buf;
  1.3609 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.3610 +	event->SetDirection(buf);
  1.3611 +
  1.3612 +	// Add an event
  1.3613 +	active->StartL();
  1.3614 +	aClient.AddEvent(*event, active->iStatus);
  1.3615 +	CActiveScheduler::Start();
  1.3616 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3617 +
  1.3618 +	// Setup normal event view
  1.3619 +	active->StartL();
  1.3620 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.3621 +	CActiveScheduler::Start();
  1.3622 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3623 +
  1.3624 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.3625 +	changeObs2->StartCollectingChanges();
  1.3626 +
  1.3627 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.3628 +	CleanupStack::PushL(recent);
  1.3629 +
  1.3630 +	// Check recent view
  1.3631 +	active->StartL();
  1.3632 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3633 +	CActiveScheduler::Start();
  1.3634 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3635 +	TEST2(recent->CountL(), 1);
  1.3636 +
  1.3637 +	// Add a new event
  1.3638 +	active->StartL();
  1.3639 +	aClient.AddEvent(*event, active->iStatus);
  1.3640 +	CActiveScheduler::Start();
  1.3641 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3642 +
  1.3643 +	// Check change events
  1.3644 +	CTestTimer* timer = CTestTimer::NewL();
  1.3645 +	timer->After(100000);
  1.3646 +	CActiveScheduler::Start();
  1.3647 +	delete timer;
  1.3648 +	
  1.3649 +	TEST2(changeObs2->Changes().Count(), 2);
  1.3650 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.3651 +	TEST2(type, ELogChangeTypeEventAdded);
  1.3652 +	type = changeObs2->Changes().At(1, logId, viewIndex);
  1.3653 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.3654 +
  1.3655 +	// Check recent view
  1.3656 +	active->StartL();
  1.3657 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3658 +	CActiveScheduler::Start();
  1.3659 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3660 +	TEST2(recent->CountL(), 1);
  1.3661 +
  1.3662 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.3663 +	CleanupStack::PushL(duplicate);
  1.3664 +
  1.3665 +	// Check duplicate count
  1.3666 +	active->StartL();
  1.3667 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.3668 +	CActiveScheduler::Start();
  1.3669 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3670 +	TEST2(duplicate->CountL(), 1);
  1.3671 +
  1.3672 +	// Check change events
  1.3673 +	User::After(100000);
  1.3674 +	TEST2(changeObs1->Changes().Count(), 1);
  1.3675 +	type = changeObs1->Changes().At(0, logId, viewIndex);
  1.3676 +	TEST2(type, ELogChangeTypeEventAdded);
  1.3677 +
  1.3678 +	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.3679 +	}
  1.3680 +
  1.3681 +/**
  1.3682 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0949
  1.3683 +@SYMTestCaseDesc	    Tests for log view change observer
  1.3684 +@SYMTestPriority 	    High
  1.3685 +@SYMTestActions  	    Check that a view doesn't get change events when recent list purged
  1.3686 +@SYMTestExpectedResults Test must not fail
  1.3687 +@SYMREQ                 REQ0000
  1.3688 +*/
  1.3689 +LOCAL_C void TestHiddenChangeEvents2L(CLogClient& aClient)
  1.3690 +	{
  1.3691 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0949 "));
  1.3692 +	TLogId logId;
  1.3693 +	TInt viewIndex;
  1.3694 +	TLogDatabaseChangeType type;
  1.3695 +
  1.3696 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.3697 +	changeObs1->StartCollectingChanges();
  1.3698 +
  1.3699 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.3700 +	CleanupStack::PushL(view);
  1.3701 +
  1.3702 +	CLogFilter* filter = CLogFilter::NewL();
  1.3703 +	CleanupStack::PushL(filter);
  1.3704 +
  1.3705 +	CLogEvent* event = CLogEvent::NewL();
  1.3706 +	CleanupStack::PushL(event);
  1.3707 +
  1.3708 +	CTestActive* active = new(ELeave)CTestActive();
  1.3709 +	CleanupStack::PushL(active);
  1.3710 +
  1.3711 +	TTime now;
  1.3712 +	now.UniversalTime();
  1.3713 +	now += (TTimeIntervalDays)+1;
  1.3714 +
  1.3715 +	// Get rid of all the events in the log
  1.3716 +	active->StartL();
  1.3717 +	aClient.ClearLog(now, active->iStatus);
  1.3718 +	CActiveScheduler::Start();
  1.3719 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3720 +
  1.3721 +	// Get config
  1.3722 +	TLogConfig config;
  1.3723 +	active->StartL();
  1.3724 +	aClient.GetConfig(config, active->iStatus);
  1.3725 +	CActiveScheduler::Start();
  1.3726 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3727 +
  1.3728 +	// Incoming call event
  1.3729 +	event->SetEventType(KLogCallEventTypeUid);
  1.3730 +	TBuf<KLogMaxDirectionLength> buf;
  1.3731 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.3732 +	event->SetDirection(buf);
  1.3733 +
  1.3734 +	// Add max allowed events
  1.3735 +	TInt count = config.iMaxRecentLogSize;
  1.3736 +	while(count--)
  1.3737 +		{
  1.3738 +		event->SetContact(count+1);
  1.3739 +		active->StartL();
  1.3740 +		aClient.AddEvent(*event, active->iStatus);
  1.3741 +		CActiveScheduler::Start();
  1.3742 +		TEST2(active->iStatus.Int(), KErrNone);
  1.3743 +		}
  1.3744 +
  1.3745 +	// Setup normal event view
  1.3746 +	active->StartL();
  1.3747 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.3748 +	CActiveScheduler::Start();
  1.3749 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3750 +
  1.3751 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.3752 +	changeObs2->StartCollectingChanges();
  1.3753 +
  1.3754 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.3755 +	CleanupStack::PushL(recent);
  1.3756 +
  1.3757 +	// Check recent view
  1.3758 +	active->StartL();
  1.3759 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3760 +	CActiveScheduler::Start();
  1.3761 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3762 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.3763 +
  1.3764 +	// Add a new event, will cause one to be purged from recent view
  1.3765 +	event->SetContact(1234);
  1.3766 +	active->StartL();
  1.3767 +	aClient.AddEvent(*event, active->iStatus);
  1.3768 +	CActiveScheduler::Start();
  1.3769 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3770 +
  1.3771 +	// Check change events
  1.3772 +	CTestTimer *timer = CTestTimer::NewL();
  1.3773 + 	timer->After(100000);
  1.3774 + 	CActiveScheduler::Start();
  1.3775 + 	delete timer;
  1.3776 +		
  1.3777 +	TEST2(changeObs2->Changes().Count(), 2);
  1.3778 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.3779 +	TEST2(type, ELogChangeTypeEventAdded);
  1.3780 +	type = changeObs2->Changes().At(1, logId, viewIndex);
  1.3781 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.3782 +
  1.3783 +	// Check recent view
  1.3784 +	active->StartL();
  1.3785 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3786 +	CActiveScheduler::Start();
  1.3787 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3788 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.3789 +
  1.3790 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.3791 +	CleanupStack::PushL(duplicate);
  1.3792 +
  1.3793 +	// Check duplicate count
  1.3794 +	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  1.3795 +
  1.3796 +	// Check change events
  1.3797 +	User::After(100000);
  1.3798 +	TEST2(changeObs1->Changes().Count(), 1);
  1.3799 +	type = changeObs1->Changes().At(0, logId, viewIndex);
  1.3800 +	TEST2(type, ELogChangeTypeEventAdded);
  1.3801 +
  1.3802 +	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.3803 +	}
  1.3804 +/**
  1.3805 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0950
  1.3806 +@SYMTestCaseDesc	    Tests for log view change observer
  1.3807 +@SYMTestPriority 	    High
  1.3808 +@SYMTestActions  	    Check that a view doesn't get change events when recent list purged after changing config
  1.3809 +@SYMTestExpectedResults Test must not fail
  1.3810 +@SYMREQ                 REQ0000
  1.3811 +*/
  1.3812 +LOCAL_C void TestHiddenChangeEvents3L(CLogClient& aClient)
  1.3813 +	{
  1.3814 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0950 "));
  1.3815 +	TLogId logId;
  1.3816 +	TInt viewIndex;
  1.3817 +	TLogDatabaseChangeType type;
  1.3818 +
  1.3819 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.3820 +	changeObs1->StartCollectingChanges();
  1.3821 +
  1.3822 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.3823 +	CleanupStack::PushL(view);
  1.3824 +
  1.3825 +	CLogFilter* filter = CLogFilter::NewL();
  1.3826 +	CleanupStack::PushL(filter);
  1.3827 +
  1.3828 +	CLogEvent* event = CLogEvent::NewL();
  1.3829 +	CleanupStack::PushL(event);
  1.3830 +
  1.3831 +	CTestActive* active = new(ELeave)CTestActive();
  1.3832 +	CleanupStack::PushL(active);
  1.3833 +
  1.3834 +	TTime now;
  1.3835 +	now.UniversalTime();
  1.3836 +	now += (TTimeIntervalDays)+1;
  1.3837 +
  1.3838 +	// Get rid of all the events in the log
  1.3839 +	active->StartL();
  1.3840 +	aClient.ClearLog(now, active->iStatus);
  1.3841 +	CActiveScheduler::Start();
  1.3842 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3843 +
  1.3844 +	// Get and set config
  1.3845 +	TLogConfig config;
  1.3846 +	active->StartL();
  1.3847 +	aClient.GetConfig(config, active->iStatus);
  1.3848 +	CActiveScheduler::Start();
  1.3849 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3850 +	config.iMaxRecentLogSize = 2;
  1.3851 +	active->StartL();
  1.3852 +	aClient.ChangeConfig(config, active->iStatus);
  1.3853 +	CActiveScheduler::Start();
  1.3854 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3855 +
  1.3856 +	// Incoming call event
  1.3857 +	event->SetEventType(KLogCallEventTypeUid);
  1.3858 +	TBuf<KLogMaxDirectionLength> buf;
  1.3859 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.3860 +	event->SetDirection(buf);
  1.3861 +
  1.3862 +	// Add max allowed events
  1.3863 +	TInt count = config.iMaxRecentLogSize;
  1.3864 +	while(count--)
  1.3865 +		{
  1.3866 +		event->SetContact(count+1);
  1.3867 +		active->StartL();
  1.3868 +		aClient.AddEvent(*event, active->iStatus);
  1.3869 +		CActiveScheduler::Start();
  1.3870 +		TEST2(active->iStatus.Int(), KErrNone);
  1.3871 +		}
  1.3872 +
  1.3873 +	// Setup normal event view
  1.3874 +	active->StartL();
  1.3875 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.3876 +	CActiveScheduler::Start();
  1.3877 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3878 +
  1.3879 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.3880 +	changeObs2->StartCollectingChanges();
  1.3881 +
  1.3882 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.3883 +	CleanupStack::PushL(recent);
  1.3884 +
  1.3885 +	// Check recent view
  1.3886 +	active->StartL();
  1.3887 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3888 +	CActiveScheduler::Start();
  1.3889 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3890 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.3891 +
  1.3892 +	// Change config, will cause one event to be purged from recent view
  1.3893 +	config.iMaxRecentLogSize = 1;
  1.3894 +	active->StartL();
  1.3895 +	aClient.ChangeConfig(config, active->iStatus);
  1.3896 +	CActiveScheduler::Start();
  1.3897 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3898 +
  1.3899 +	// Check change events
  1.3900 +	User::After(100000);
  1.3901 +	TEST2(changeObs2->Changes().Count(), 1);
  1.3902 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.3903 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.3904 +
  1.3905 +	// Check recent view
  1.3906 +	active->StartL();
  1.3907 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.3908 +	CActiveScheduler::Start();
  1.3909 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3910 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.3911 +
  1.3912 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.3913 +	CleanupStack::PushL(duplicate);
  1.3914 +
  1.3915 +	// Check duplicate count
  1.3916 +	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  1.3917 +
  1.3918 +	// Check change events
  1.3919 +	User::After(100000);
  1.3920 +	TEST(!changeObs1->HaveChanges());
  1.3921 +
  1.3922 +	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.3923 +	}
  1.3924 +
  1.3925 +/**
  1.3926 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0951
  1.3927 +@SYMTestCaseDesc	    Test for log view change observer
  1.3928 +@SYMTestPriority 	    High
  1.3929 +@SYMTestActions  	    Check that when deleting an event causing recent lists to be updated,views don't get unnecessary change events
  1.3930 +@SYMTestExpectedResults Test must not fail
  1.3931 +@SYMREQ                 REQ0000
  1.3932 +*/
  1.3933 +LOCAL_C void TestHiddenChangeEvents4L(CLogClient& aClient)
  1.3934 +	{
  1.3935 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0951 "));
  1.3936 +	TLogId logId;
  1.3937 +	TInt viewIndex;
  1.3938 +	TLogDatabaseChangeType type;
  1.3939 +
  1.3940 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.3941 +	changeObs1->StartCollectingChanges();
  1.3942 +
  1.3943 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.3944 +	CleanupStack::PushL(view);
  1.3945 +
  1.3946 +	CLogFilter* filter = CLogFilter::NewL();
  1.3947 +	CleanupStack::PushL(filter);
  1.3948 +	filter->SetFlags(1); // Need to hide an event from the view
  1.3949 +
  1.3950 +	CLogEvent* event = CLogEvent::NewL();
  1.3951 +	CleanupStack::PushL(event);
  1.3952 +
  1.3953 +	CTestActive* active = new(ELeave)CTestActive();
  1.3954 +	CleanupStack::PushL(active);
  1.3955 +
  1.3956 +	TTime now;
  1.3957 +	now.UniversalTime();
  1.3958 +	now += (TTimeIntervalDays)+1;
  1.3959 +
  1.3960 +	// Get rid of all the events in the log
  1.3961 +	active->StartL();
  1.3962 +	aClient.ClearLog(now, active->iStatus);
  1.3963 +	CActiveScheduler::Start();
  1.3964 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3965 +
  1.3966 +	// Incoming call event
  1.3967 +	event->SetEventType(KLogCallEventTypeUid);
  1.3968 +	TBuf<KLogMaxDirectionLength> buf;
  1.3969 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.3970 +	event->SetDirection(buf);
  1.3971 +
  1.3972 +	event->SetFlags(1);
  1.3973 +
  1.3974 +	// Add an event
  1.3975 +	active->StartL();
  1.3976 +	aClient.AddEvent(*event, active->iStatus);
  1.3977 +	CActiveScheduler::Start();
  1.3978 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3979 +
  1.3980 +	// Add an event
  1.3981 +	active->StartL();
  1.3982 +	aClient.AddEvent(*event, active->iStatus);
  1.3983 +	CActiveScheduler::Start();
  1.3984 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3985 +
  1.3986 +	event->ClearFlags(0xF);
  1.3987 +
  1.3988 +	// Add an event
  1.3989 +	active->StartL();
  1.3990 +	aClient.AddEvent(*event, active->iStatus);
  1.3991 +	CActiveScheduler::Start();
  1.3992 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3993 +
  1.3994 +	// Setup normal event view
  1.3995 +	active->StartL();
  1.3996 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.3997 +	CActiveScheduler::Start();
  1.3998 +	TEST2(active->iStatus.Int(), KErrNone);
  1.3999 +	TEST2(view->CountL(), 2);
  1.4000 +
  1.4001 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.4002 +	changeObs2->StartCollectingChanges();
  1.4003 +
  1.4004 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.4005 +	CleanupStack::PushL(recent);
  1.4006 +
  1.4007 +	// Check recent view
  1.4008 +	active->StartL();
  1.4009 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4010 +	CActiveScheduler::Start();
  1.4011 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4012 +	TEST2(recent->CountL(), 1);
  1.4013 +
  1.4014 +	changeObs1->StartCollectingChanges();
  1.4015 +	changeObs2->StartCollectingChanges();
  1.4016 +
  1.4017 +	// Delete the event in recent list
  1.4018 +	active->StartL();
  1.4019 +	aClient.DeleteEvent(event->Id(), active->iStatus);
  1.4020 +	CActiveScheduler::Start();
  1.4021 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4022 +
  1.4023 +	// Check change events
  1.4024 +	User::After(1000000);
  1.4025 +	TEST2(changeObs2->Changes().Count(), 2);
  1.4026 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.4027 +	TEST2(type, ELogChangeTypeEventAdded);
  1.4028 +	type = changeObs2->Changes().At(1, logId, viewIndex);
  1.4029 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.4030 +
  1.4031 +	TEST(!changeObs1->HaveChanges());
  1.4032 +
  1.4033 +	CleanupStack::PopAndDestroy(7); // changeObs1, changeObs2, view, filter, event, active, recent
  1.4034 +	}
  1.4035 +
  1.4036 +/**
  1.4037 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0952
  1.4038 +@SYMTestCaseDesc	    Tests for log view change observer
  1.4039 +@SYMTestPriority 	    High
  1.4040 +@SYMTestActions  	    Check that a view doesn't get change events when recent list cleared
  1.4041 +@SYMTestExpectedResults Test must not fail
  1.4042 +@SYMREQ                 REQ0000
  1.4043 +*/
  1.4044 +LOCAL_C void TestHiddenChangeEvents5L(CLogClient& aClient)
  1.4045 +	{
  1.4046 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0952 "));
  1.4047 +	TLogId logId;
  1.4048 +	TInt viewIndex;
  1.4049 +	TLogDatabaseChangeType type;
  1.4050 +
  1.4051 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.4052 +	changeObs1->StartCollectingChanges();
  1.4053 +
  1.4054 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.4055 +	CleanupStack::PushL(view);
  1.4056 +
  1.4057 +	CLogFilter* filter = CLogFilter::NewL();
  1.4058 +	CleanupStack::PushL(filter);
  1.4059 +
  1.4060 +	CLogEvent* event = CLogEvent::NewL();
  1.4061 +	CleanupStack::PushL(event);
  1.4062 +
  1.4063 +	CTestActive* active = new(ELeave)CTestActive();
  1.4064 +	CleanupStack::PushL(active);
  1.4065 +
  1.4066 +	TTime now;
  1.4067 +	now.UniversalTime();
  1.4068 +	now += (TTimeIntervalDays)+1;
  1.4069 +
  1.4070 +	// Get rid of all the events in the log
  1.4071 +	active->StartL();
  1.4072 +	aClient.ClearLog(now, active->iStatus);
  1.4073 +	CActiveScheduler::Start();
  1.4074 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4075 +
  1.4076 +	// Get config
  1.4077 +	TLogConfig config;
  1.4078 +	active->StartL();
  1.4079 +	aClient.GetConfig(config, active->iStatus);
  1.4080 +	CActiveScheduler::Start();
  1.4081 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4082 +
  1.4083 +	// Incoming call event
  1.4084 +	event->SetEventType(KLogCallEventTypeUid);
  1.4085 +	TBuf<KLogMaxDirectionLength> buf;
  1.4086 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.4087 +	event->SetDirection(buf);
  1.4088 +
  1.4089 +	// Add max allowed events
  1.4090 +	TInt count = config.iMaxRecentLogSize;
  1.4091 +	while(count--)
  1.4092 +		{
  1.4093 +		event->SetContact(count+1);
  1.4094 +		active->StartL();
  1.4095 +		aClient.AddEvent(*event, active->iStatus);
  1.4096 +		CActiveScheduler::Start();
  1.4097 +		TEST2(active->iStatus.Int(), KErrNone);
  1.4098 +		}
  1.4099 +
  1.4100 +	// Setup normal event view
  1.4101 +	active->StartL();
  1.4102 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.4103 +	CActiveScheduler::Start();
  1.4104 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4105 +
  1.4106 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.4107 +	changeObs2->StartCollectingChanges();
  1.4108 +
  1.4109 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.4110 +	CleanupStack::PushL(recent);
  1.4111 +
  1.4112 +	// Check recent view
  1.4113 +	active->StartL();
  1.4114 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4115 +	CActiveScheduler::Start();
  1.4116 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4117 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.4118 +
  1.4119 +	// Clear recent view
  1.4120 +	active->StartL();
  1.4121 +	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
  1.4122 +	CActiveScheduler::Start();
  1.4123 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4124 +
  1.4125 +	// Check change events
  1.4126 +	User::After(100000);
  1.4127 +
  1.4128 +	count = config.iMaxRecentLogSize;
  1.4129 +	TEST2(changeObs2->Changes().Count(), count);
  1.4130 +	while(count--)
  1.4131 +		{
  1.4132 +		type = changeObs2->Changes().At(count, logId, viewIndex);
  1.4133 +		TEST2(type, ELogChangeTypeEventDeleted);
  1.4134 +		}
  1.4135 +
  1.4136 +	// Check recent view
  1.4137 +	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4138 +
  1.4139 +	// Check change events
  1.4140 +	User::After(100000);
  1.4141 +	TEST(!changeObs1->HaveChanges());
  1.4142 +
  1.4143 +	CleanupStack::PopAndDestroy(7); // changeObs1, changeObs2, view, filter, event, active, recent
  1.4144 +	}
  1.4145 +
  1.4146 +/**
  1.4147 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0953
  1.4148 +@SYMTestCaseDesc	    Tests for log view change observer
  1.4149 +@SYMTestPriority 	    High
  1.4150 +@SYMTestActions  	    Check that a view doesn't get change events when removing events from a recent or duplicate view
  1.4151 +@SYMTestExpectedResults Test must not fail
  1.4152 +@SYMREQ                 REQ0000
  1.4153 +*/
  1.4154 +LOCAL_C void TestHiddenChangeEvents6L(CLogClient& aClient)
  1.4155 +	{
  1.4156 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0953 "));
  1.4157 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.4158 +	changeObs1->StartCollectingChanges();
  1.4159 +
  1.4160 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.4161 +	CleanupStack::PushL(view);
  1.4162 +
  1.4163 +	CLogFilter* filter = CLogFilter::NewL();
  1.4164 +	CleanupStack::PushL(filter);
  1.4165 +
  1.4166 +	CLogEvent* event = CLogEvent::NewL();
  1.4167 +	CleanupStack::PushL(event);
  1.4168 +
  1.4169 +	CTestActive* active = new(ELeave)CTestActive();
  1.4170 +	CleanupStack::PushL(active);
  1.4171 +
  1.4172 +	TTime now;
  1.4173 +	now.UniversalTime();
  1.4174 +	now += (TTimeIntervalDays)+1;
  1.4175 +
  1.4176 +	// Get rid of all the events in the log
  1.4177 +	active->StartL();
  1.4178 +	aClient.ClearLog(now, active->iStatus);
  1.4179 +	CActiveScheduler::Start();
  1.4180 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4181 +
  1.4182 +	// Incoming call event
  1.4183 +	event->SetEventType(KLogCallEventTypeUid);
  1.4184 +	TBuf<KLogMaxDirectionLength> buf;
  1.4185 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.4186 +	event->SetDirection(buf);
  1.4187 +
  1.4188 +	// Add an event
  1.4189 +	active->StartL();
  1.4190 +	aClient.AddEvent(*event, active->iStatus);
  1.4191 +	CActiveScheduler::Start();
  1.4192 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4193 +
  1.4194 +	// Add a duplicate
  1.4195 +	active->StartL();
  1.4196 +	aClient.AddEvent(*event, active->iStatus);
  1.4197 +	CActiveScheduler::Start();
  1.4198 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4199 +
  1.4200 +	// Setup normal event view
  1.4201 +	active->StartL();
  1.4202 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.4203 +	CActiveScheduler::Start();
  1.4204 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4205 +	TEST2(view->CountL(), 2);
  1.4206 +
  1.4207 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.4208 +	changeObs2->StartCollectingChanges();
  1.4209 +
  1.4210 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.4211 +	CleanupStack::PushL(recent);
  1.4212 +
  1.4213 +	// Check recent view
  1.4214 +	active->StartL();
  1.4215 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4216 +	CActiveScheduler::Start();
  1.4217 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4218 +	TEST2(recent->CountL(), 1);
  1.4219 +
  1.4220 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.4221 +	CleanupStack::PushL(duplicate);
  1.4222 +
  1.4223 +	// Check duplicate count
  1.4224 +	active->StartL();
  1.4225 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.4226 +	CActiveScheduler::Start();
  1.4227 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4228 +	TEST2(recent->CountL(), 1);
  1.4229 +
  1.4230 +	// Remove duplicate
  1.4231 +	duplicate->RemoveL(duplicate->Event().Id());
  1.4232 +
  1.4233 +	CTestTimer* timer = CTestTimer::NewL();
  1.4234 +	CleanupStack::PushL(timer);
  1.4235 +	timer->After(100000);
  1.4236 +	CActiveScheduler::Start();
  1.4237 +
  1.4238 +	// Check change events
  1.4239 +	TEST(!changeObs1->HaveChanges());
  1.4240 +	TEST(!changeObs2->HaveChanges());
  1.4241 +
  1.4242 +	// Remove recent
  1.4243 +	recent->RemoveL(recent->Event().Id());
  1.4244 +
  1.4245 +	// Check change events
  1.4246 +	timer->After(100000);
  1.4247 +	CActiveScheduler::Start();
  1.4248 +
  1.4249 +	TEST(!changeObs1->HaveChanges());
  1.4250 +	TEST(!changeObs2->HaveChanges()); // No event because we should know we called Remove on ourselves
  1.4251 +
  1.4252 +	CleanupStack::PopAndDestroy(9); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate, timer
  1.4253 +	}
  1.4254 +
  1.4255 +/**
  1.4256 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0954
  1.4257 +@SYMTestCaseDesc	    Tests for log view change observer
  1.4258 +@SYMTestPriority 	    High
  1.4259 +@SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates
  1.4260 +@SYMTestExpectedResults Test must not fail
  1.4261 +@SYMREQ                 REQ0000
  1.4262 +*/
  1.4263 +LOCAL_C void TestHiddenChangeEvents7L(CLogClient& aClient)
  1.4264 +	{
  1.4265 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0954 "));
  1.4266 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.4267 +	changeObs1->StartCollectingChanges();
  1.4268 +
  1.4269 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.4270 +	CleanupStack::PushL(view);
  1.4271 +
  1.4272 +	CLogFilter* filter = CLogFilter::NewL();
  1.4273 +	CleanupStack::PushL(filter);
  1.4274 +
  1.4275 +	CLogEvent* event = CLogEvent::NewL();
  1.4276 +	CleanupStack::PushL(event);
  1.4277 +
  1.4278 +	CTestActive* active = new(ELeave)CTestActive();
  1.4279 +	CleanupStack::PushL(active);
  1.4280 +
  1.4281 +	TTime now;
  1.4282 +	now.UniversalTime();
  1.4283 +	now += (TTimeIntervalDays)+1;
  1.4284 +
  1.4285 +	// Get rid of all the events in the log
  1.4286 +	active->StartL();
  1.4287 +	aClient.ClearLog(now, active->iStatus);
  1.4288 +	CActiveScheduler::Start();
  1.4289 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4290 +
  1.4291 +	// Incoming call event
  1.4292 +	event->SetEventType(KLogCallEventTypeUid);
  1.4293 +	TBuf<KLogMaxDirectionLength> buf;
  1.4294 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.4295 +	event->SetDirection(buf);
  1.4296 +
  1.4297 +	// Add an event
  1.4298 +	active->StartL();
  1.4299 +	aClient.AddEvent(*event, active->iStatus);
  1.4300 +	CActiveScheduler::Start();
  1.4301 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4302 +
  1.4303 +	// Add a duplicate
  1.4304 +	active->StartL();
  1.4305 +	aClient.AddEvent(*event, active->iStatus);
  1.4306 +	CActiveScheduler::Start();
  1.4307 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4308 +
  1.4309 +	// Setup normal event view
  1.4310 +	active->StartL();
  1.4311 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.4312 +	CActiveScheduler::Start();
  1.4313 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4314 +	TEST2(view->CountL(), 2);
  1.4315 +
  1.4316 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.4317 +	changeObs2->StartCollectingChanges();
  1.4318 +
  1.4319 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.4320 +	CleanupStack::PushL(recent);
  1.4321 +
  1.4322 +	// Check recent view
  1.4323 +	active->StartL();
  1.4324 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4325 +	CActiveScheduler::Start();
  1.4326 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4327 +	TEST2(recent->CountL(), 1);
  1.4328 +
  1.4329 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.4330 +	CleanupStack::PushL(duplicate);
  1.4331 +
  1.4332 +	// Check duplicate count
  1.4333 +	active->StartL();
  1.4334 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.4335 +	CActiveScheduler::Start();
  1.4336 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4337 +	TEST2(recent->CountL(), 1);
  1.4338 +
  1.4339 +	// Remove duplicate
  1.4340 +	recent->ClearDuplicatesL();
  1.4341 +
  1.4342 +	CTestTimer* timer = CTestTimer::NewL();
  1.4343 +	CleanupStack::PushL(timer);
  1.4344 +	timer->After(100000);
  1.4345 +	CActiveScheduler::Start();
  1.4346 +
  1.4347 +	// Check change events
  1.4348 +	TEST(!changeObs1->HaveChanges());
  1.4349 +	TEST(!changeObs2->HaveChanges());
  1.4350 +
  1.4351 +	CleanupStack::PopAndDestroy(9); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate, timer
  1.4352 +	}
  1.4353 +
  1.4354 +/**
  1.4355 +@SYMTestCaseID          SYSLIB-LOGENG-CT-1363
  1.4356 +@SYMTestCaseDesc	    Tests for log view change observer 
  1.4357 +						Making a call from recent call list causes total freeze if log 
  1.4358 +						has been cleared
  1.4359 +@SYMTestPriority 	    High
  1.4360 +@SYMTestActions  	    Test that editing a recent event does not cause a panic if 
  1.4361 +						part of the log has been cleared
  1.4362 +@SYMTestExpectedResults Test must not fail
  1.4363 +@SYMDEF                 DEF066296
  1.4364 +*/
  1.4365 +LOCAL_C void DEF066296L(CLogClient& aClient)
  1.4366 +	{
  1.4367 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1363 "));
  1.4368 +	TBuf<KLogMaxDirectionLength> buf;
  1.4369 +
  1.4370 +	CLogEvent* event = CLogEvent::NewL();
  1.4371 +	CleanupStack::PushL(event);
  1.4372 +
  1.4373 +	CTestActive* active = new(ELeave)CTestActive();
  1.4374 +	CleanupStack::PushL(active);
  1.4375 +
  1.4376 +	// To reproduce this defect, we need a view to be updated
  1.4377 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.4378 +	CleanupStack::PushL(view);
  1.4379 +
  1.4380 +	// Set up the event and log a call from number 444
  1.4381 +	event->SetEventType(KLogCallEventTypeUid);
  1.4382 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.4383 +	event->SetDirection(buf);
  1.4384 +	event->SetNumber(_L("444"));
  1.4385 +	active->StartL();
  1.4386 +	aClient.AddEvent(*event, active->iStatus);
  1.4387 +	CActiveScheduler::Start();
  1.4388 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4389 +	
  1.4390 +	// Set up the view to display the recent call list
  1.4391 +	active->StartL();
  1.4392 +	TEST(view->SetRecentListL(-1, active->iStatus));
  1.4393 +	CActiveScheduler::Start();
  1.4394 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4395 +
  1.4396 +	// Get and print current UTC time
  1.4397 +	TTime now;
  1.4398 +	now.UniversalTime();
  1.4399 +	TBuf<0x80> testString;
  1.4400 +	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  1.4401 +	TheTest.Printf(_L("Current  UTC  time    - %S\n"), &testString);
  1.4402 +
  1.4403 +	// Move the UTC time forward by one day
  1.4404 +	now += TTimeIntervalDays(1);
  1.4405 +	User::SetUTCTime(now);
  1.4406 +
  1.4407 +	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  1.4408 +	TheTest.Printf(_L("Changed  UTC  time to - %S\n"), &testString);
  1.4409 +	
  1.4410 +	// Set up the event and log a call from number 555
  1.4411 +	event->SetNumber(_L("555"));
  1.4412 +	active->StartL();
  1.4413 +	aClient.AddEvent(*event, active->iStatus);
  1.4414 +	CActiveScheduler::Start();
  1.4415 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4416 +	
  1.4417 +	// Set up the event and log a call from number 611
  1.4418 +	event->SetNumber(_L("611"));
  1.4419 +	active->StartL();
  1.4420 +	aClient.AddEvent(*event, active->iStatus);
  1.4421 +	CActiveScheduler::Start();
  1.4422 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4423 +	
  1.4424 +	//remember this Id - we will try to change this log event later
  1.4425 +	TInt logId = event->Id();
  1.4426 +
  1.4427 +	// Set up the event and log a call from number 777
  1.4428 +	event->SetNumber(_L("777"));
  1.4429 +	active->StartL();
  1.4430 +	aClient.AddEvent(*event, active->iStatus);
  1.4431 +	CActiveScheduler::Start();
  1.4432 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4433 +
  1.4434 +	// Delete all events occurring before today
  1.4435 +	// this should remove only the first call to number 444
  1.4436 +	TDateTime midnight = now.DateTime();
  1.4437 +	midnight.SetHour(0);
  1.4438 +	midnight.SetMinute(0);
  1.4439 +	midnight.SetSecond(0);
  1.4440 +	midnight.SetMicroSecond(0);
  1.4441 +
  1.4442 +	active->StartL();
  1.4443 +	aClient.ClearLog(midnight, active->iStatus);
  1.4444 +	CActiveScheduler::Start();
  1.4445 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4446 +
  1.4447 +	// Attempt to change an entry from the recent list - that for the call to number 611 
  1.4448 +	// without this defect fix, the call to ChangeEvent() will panic with EBadArrayPosition
  1.4449 +	event->SetNumber(_L("555"));
  1.4450 +	event->SetId(logId);
  1.4451 +	active->StartL();
  1.4452 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4453 +	CActiveScheduler::Start();
  1.4454 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4455 +
  1.4456 +	// Restore and print UTC time
  1.4457 +	now.UniversalTime();
  1.4458 +	now -= TTimeIntervalDays(1);
  1.4459 +	User::SetUTCTime(now);
  1.4460 +
  1.4461 +	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  1.4462 +	TheTest.Printf(_L("Restored UTC  time to - %S\n"), &testString);
  1.4463 +
  1.4464 +	CleanupStack::PopAndDestroy(3, event); //event, active, view
  1.4465 +	}
  1.4466 +
  1.4467 +/**
  1.4468 +@SYMTestCaseID          SYSLIB-LOGENG-CT-1807
  1.4469 +@SYMTestCaseDesc	    Tests that DEF087459 works between 00:00 and 01:00am hometime
  1.4470 +@SYMTestPriority 	    Medium
  1.4471 +@SYMTestActions  	    Change the home time to 00:30 and run DEF066296 test
  1.4472 +@SYMTestExpectedResults Test must not fail
  1.4473 +@SYMDEF                 DEF087459
  1.4474 +*/
  1.4475 +LOCAL_C void DEF087459L(CLogClient& aClient)
  1.4476 +	{
  1.4477 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1807 "));
  1.4478 +	RTz tz;				
  1.4479 +	TInt err = tz.Connect();
  1.4480 +	TEST2(err, KErrNone);
  1.4481 +	CleanupClosePushL(tz);
  1.4482 +	TTime now, saveNow;
  1.4483 +	
  1.4484 +	// Get and print current home time and save it
  1.4485 +	now.HomeTime();
  1.4486 +	saveNow=now;
  1.4487 +	
  1.4488 +	TBuf<0x80> testString;
  1.4489 +	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  1.4490 +	TheTest.Printf(_L("Current  home time    - %S\n"), &testString);
  1.4491 +
  1.4492 +	// Problem occurred between midnight and 01:00am hometime, so change home time to
  1.4493 +	// be 00:30am
  1.4494 +	TDateTime midnight = now.DateTime();
  1.4495 +	midnight.SetHour(0);
  1.4496 +	midnight.SetMinute(30);
  1.4497 +	midnight.SetSecond(0);
  1.4498 +	midnight.SetMicroSecond(0);
  1.4499 +	
  1.4500 +	TTime newTime=midnight;
  1.4501 +
  1.4502 +	err = tz.SetHomeTime(midnight);
  1.4503 +	TEST2(err, KErrNone);
  1.4504 +
  1.4505 +	// Get and print new home time
  1.4506 +	now.HomeTime();
  1.4507 +	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  1.4508 +	TheTest.Printf(_L("Changed  home time to - %S\n"), &testString);
  1.4509 +	TheTest.Printf(_L("Re-running DEF066296 test\n"));
  1.4510 +	
  1.4511 +	DEF066296L(aClient);
  1.4512 +	
  1.4513 +	// Restore and print hometime
  1.4514 +	err = tz.SetHomeTime(saveNow);
  1.4515 +	TEST2(err, KErrNone);
  1.4516 +	now.HomeTime();
  1.4517 +	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
  1.4518 +	TheTest.Printf(_L("Restored home time to - %S\n"), &testString);
  1.4519 +	
  1.4520 +	CleanupStack::PopAndDestroy(); //tz
  1.4521 +	}
  1.4522 +
  1.4523 +/**
  1.4524 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0955
  1.4525 +@SYMTestCaseDesc	    Tests that events can be changed to move them between recent lists
  1.4526 +@SYMTestPriority 	    High
  1.4527 +@SYMTestActions  	    Add the events to the view.Move most recent event to another recent list
  1.4528 +@SYMTestExpectedResults Test must not fail
  1.4529 +@SYMREQ                 REQ0000
  1.4530 +*/
  1.4531 +LOCAL_C void TestChangeEventRecentView1L(CLogClient& aClient)
  1.4532 +	{
  1.4533 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0955 "));
  1.4534 +	CTestActive* active = new(ELeave)CTestActive();
  1.4535 +	CleanupStack::PushL(active);
  1.4536 +
  1.4537 +	CLogEvent* event = CLogEvent::NewL();
  1.4538 +	CleanupStack::PushL(event);
  1.4539 +
  1.4540 +	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
  1.4541 +	CleanupStack::PushL(recent1);
  1.4542 +
  1.4543 +	CLogViewDuplicate* duplicate1 = CLogViewDuplicate::NewL(aClient);
  1.4544 +	CleanupStack::PushL(duplicate1);
  1.4545 +
  1.4546 +	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
  1.4547 +	CleanupStack::PushL(recent2);
  1.4548 +
  1.4549 +	CLogViewDuplicate* duplicate2 = CLogViewDuplicate::NewL(aClient);
  1.4550 +	CleanupStack::PushL(duplicate2);
  1.4551 +
  1.4552 +	// Make sure there are no entries in any recent lists
  1.4553 +	active->StartL();
  1.4554 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.4555 +	CActiveScheduler::Start();
  1.4556 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4557 +
  1.4558 +	// Incoming call event
  1.4559 +	TBuf<KLogMaxDirectionLength> incoming;
  1.4560 +	aClient.GetString(incoming, R_LOG_DIR_IN);
  1.4561 +
  1.4562 +	// Missed call event
  1.4563 +	TBuf<KLogMaxDirectionLength> missed;
  1.4564 +	aClient.GetString(missed, R_LOG_DIR_MISSED);
  1.4565 +
  1.4566 +	event->SetEventType(KLogCallEventTypeUid);
  1.4567 +	event->SetDirection(missed);
  1.4568 +	event->SetContact(1);
  1.4569 +
  1.4570 +	// Add some events
  1.4571 +	active->StartL();
  1.4572 +	aClient.AddEvent(*event, active->iStatus);
  1.4573 +	CActiveScheduler::Start();
  1.4574 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4575 +	TLogId id1 = event->Id();
  1.4576 +
  1.4577 +	User::After(1000000);
  1.4578 +
  1.4579 +	active->StartL();
  1.4580 +	aClient.AddEvent(*event, active->iStatus);
  1.4581 +	CActiveScheduler::Start();
  1.4582 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4583 +	TLogId id2 = event->Id();
  1.4584 +
  1.4585 +	User::After(1000000);
  1.4586 +
  1.4587 +	active->StartL();
  1.4588 +	aClient.AddEvent(*event, active->iStatus);
  1.4589 +	CActiveScheduler::Start();
  1.4590 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4591 +	TLogId id3 = event->Id();
  1.4592 +
  1.4593 +	User::After(1000000);
  1.4594 +
  1.4595 +	// Most recent
  1.4596 +	active->StartL();
  1.4597 +	aClient.AddEvent(*event, active->iStatus);
  1.4598 +	CActiveScheduler::Start();
  1.4599 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4600 +	TLogId id4 = event->Id();
  1.4601 +
  1.4602 +	// Check there's a recent event in the list
  1.4603 +	active->StartL();
  1.4604 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4605 +	CActiveScheduler::Start();
  1.4606 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4607 +	TEST2(recent1->CountL(), 1);
  1.4608 +	TEST2(recent1->Event().Id(), id4);
  1.4609 +
  1.4610 +	// Check it has duplicates
  1.4611 +	active->StartL();
  1.4612 +	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4613 +	CActiveScheduler::Start();
  1.4614 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4615 +	TEST2(duplicate1->CountL(), 3);
  1.4616 +	TEST2(duplicate1->Event().Id(), id3);
  1.4617 +
  1.4618 +	// Check id
  1.4619 +	active->StartL();
  1.4620 +	TEST(duplicate1->NextL(active->iStatus));
  1.4621 +	CActiveScheduler::Start();
  1.4622 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4623 +	TEST2(duplicate1->Event().Id(), id2);
  1.4624 +
  1.4625 +	// Check id
  1.4626 +	active->StartL();
  1.4627 +	TEST(duplicate1->NextL(active->iStatus));
  1.4628 +	CActiveScheduler::Start();
  1.4629 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4630 +	TEST2(duplicate1->Event().Id(), id1);
  1.4631 +
  1.4632 +	// Other recent list should be empty
  1.4633 +	TEST(!recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4634 +
  1.4635 +	// Now move most recent event to another recent list
  1.4636 +	event->SetDirection(incoming);
  1.4637 +	active->StartL();
  1.4638 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4639 +	CActiveScheduler::Start();
  1.4640 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4641 +
  1.4642 +	// Most recent duplicate should now be the latest
  1.4643 +	active->StartL();
  1.4644 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4645 +	CActiveScheduler::Start();
  1.4646 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4647 +	TEST2(recent1->CountL(), 1);
  1.4648 +	TEST2(recent1->Event().Id(), id3);
  1.4649 +	event->CopyL(recent1->Event()); // for later
  1.4650 +
  1.4651 +	// There should still be some duplicates
  1.4652 +	active->StartL();
  1.4653 +	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4654 +	CActiveScheduler::Start();
  1.4655 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4656 +	TEST2(duplicate1->CountL(), 2);
  1.4657 +	TEST2(duplicate1->Event().Id(), id2);
  1.4658 +
  1.4659 +	// Check id
  1.4660 +	active->StartL();
  1.4661 +	TEST(duplicate1->NextL(active->iStatus));
  1.4662 +	CActiveScheduler::Start();
  1.4663 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4664 +	TEST2(duplicate1->Event().Id(), id1);
  1.4665 +
  1.4666 +	// Now the event should have moved to another recent list
  1.4667 +	active->StartL();
  1.4668 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4669 +	CActiveScheduler::Start();
  1.4670 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4671 +	TEST2(recent2->CountL(), 1);
  1.4672 +	TEST2(recent2->Event().Id(), id4);
  1.4673 +
  1.4674 +	// No duplicates yet
  1.4675 +	TEST(!recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.4676 +
  1.4677 +	// Now move most recent event to another recent list
  1.4678 +	event->SetDirection(incoming);
  1.4679 +	active->StartL();
  1.4680 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4681 +	CActiveScheduler::Start();
  1.4682 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4683 +
  1.4684 +	// Most recent duplicate should now be the latest
  1.4685 +	active->StartL();
  1.4686 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4687 +	CActiveScheduler::Start();
  1.4688 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4689 +	TEST2(recent1->CountL(), 1);
  1.4690 +	TEST2(recent1->Event().Id(), id2);
  1.4691 +	event->CopyL(recent1->Event()); // for later
  1.4692 +
  1.4693 +	// There should still be some duplicates
  1.4694 +	active->StartL();
  1.4695 +	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4696 +	CActiveScheduler::Start();
  1.4697 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4698 +	TEST2(duplicate1->CountL(), 1);
  1.4699 +	TEST2(duplicate1->Event().Id(), id1);
  1.4700 +
  1.4701 +	// Now the event should have moved to another recent list
  1.4702 +	active->StartL();
  1.4703 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4704 +	CActiveScheduler::Start();
  1.4705 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4706 +	TEST2(recent2->CountL(), 1);
  1.4707 +	TEST2(recent2->Event().Id(), id4);
  1.4708 +
  1.4709 +	// There should still be some duplicates
  1.4710 +	active->StartL();
  1.4711 +	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.4712 +	CActiveScheduler::Start();
  1.4713 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4714 +	TEST2(duplicate2->CountL(), 1);
  1.4715 +	TEST2(duplicate2->Event().Id(), id3);
  1.4716 +
  1.4717 +	// Now move most recent event to another recent list
  1.4718 +	event->SetDirection(incoming);
  1.4719 +	active->StartL();
  1.4720 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4721 +	CActiveScheduler::Start();
  1.4722 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4723 +
  1.4724 +	// Most recent duplicate should now be the latest
  1.4725 +	active->StartL();
  1.4726 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4727 +	CActiveScheduler::Start();
  1.4728 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4729 +	TEST2(recent1->CountL(), 1);
  1.4730 +	TEST2(recent1->Event().Id(), id1);
  1.4731 +	event->CopyL(recent1->Event()); // for later
  1.4732 +
  1.4733 +	// Should be no more duplicates
  1.4734 +	TEST(!recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4735 +
  1.4736 +	// Now the event should have moved to another recent list
  1.4737 +	active->StartL();
  1.4738 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4739 +	CActiveScheduler::Start();
  1.4740 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4741 +	TEST2(recent2->CountL(), 1);
  1.4742 +	TEST2(recent2->Event().Id(), id4);
  1.4743 +
  1.4744 +	// There should still be some duplicates
  1.4745 +	active->StartL();
  1.4746 +	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.4747 +	CActiveScheduler::Start();
  1.4748 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4749 +	TEST2(duplicate2->CountL(), 2);
  1.4750 +	TEST2(duplicate2->Event().Id(), id3);
  1.4751 +
  1.4752 +	// Check id
  1.4753 +	active->StartL();
  1.4754 +	TEST(duplicate2->NextL(active->iStatus));
  1.4755 +	CActiveScheduler::Start();
  1.4756 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4757 +	TEST2(duplicate2->Event().Id(), id2);
  1.4758 +
  1.4759 +	// Now move most recent event to another recent list
  1.4760 +	event->SetDirection(incoming);
  1.4761 +	active->StartL();
  1.4762 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4763 +	CActiveScheduler::Start();
  1.4764 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4765 +
  1.4766 +	// No more recent events
  1.4767 +	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4768 +
  1.4769 +	// Now the event should have moved to another recent list
  1.4770 +	active->StartL();
  1.4771 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4772 +	CActiveScheduler::Start();
  1.4773 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4774 +	TEST2(recent2->CountL(), 1);
  1.4775 +	TEST2(recent2->Event().Id(), id4);
  1.4776 +
  1.4777 +	// There should still be some duplicates
  1.4778 +	active->StartL();
  1.4779 +	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.4780 +	CActiveScheduler::Start();
  1.4781 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4782 +	TEST2(duplicate2->CountL(), 3);
  1.4783 +	TEST2(duplicate2->Event().Id(), id3);
  1.4784 +
  1.4785 +	// Check id
  1.4786 +	active->StartL();
  1.4787 +	TEST(duplicate2->NextL(active->iStatus));
  1.4788 +	CActiveScheduler::Start();
  1.4789 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4790 +	TEST2(duplicate2->Event().Id(), id2);
  1.4791 +
  1.4792 +	// Check id
  1.4793 +	active->StartL();
  1.4794 +	TEST(duplicate2->NextL(active->iStatus));
  1.4795 +	CActiveScheduler::Start();
  1.4796 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4797 +	TEST2(duplicate2->Event().Id(), id1);
  1.4798 +
  1.4799 +	CleanupStack::PopAndDestroy(6); // active, event, recent1, duplicate1, recent2, duplicate2
  1.4800 +	}
  1.4801 +
  1.4802 +/**
  1.4803 +Test that events can be changed to move them between recent lists
  1.4804 +The same as TestChangeEventRecentView1L, but the events are transferred in reverse order
  1.4805 +
  1.4806 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0956
  1.4807 +@SYMTestCaseDesc	    Tests that events can be changed to move them between recent lists
  1.4808 +@SYMTestPriority 	    High
  1.4809 +@SYMTestActions  	    Add the events to the view.Move most recent event to another recent list in reverse order
  1.4810 +@SYMTestExpectedResults Test must not fail
  1.4811 +@SYMREQ                 REQ0000
  1.4812 +*/
  1.4813 +LOCAL_C void TestChangeEventRecentView2L(CLogClient& aClient)
  1.4814 +	{
  1.4815 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0956 "));
  1.4816 +	CTestActive* active = new(ELeave)CTestActive();
  1.4817 +	CleanupStack::PushL(active);
  1.4818 +
  1.4819 +	CLogEvent* event = CLogEvent::NewL();
  1.4820 +	CleanupStack::PushL(event);
  1.4821 +
  1.4822 +	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
  1.4823 +	CleanupStack::PushL(recent1);
  1.4824 +
  1.4825 +	CLogViewDuplicate* duplicate1 = CLogViewDuplicate::NewL(aClient);
  1.4826 +	CleanupStack::PushL(duplicate1);
  1.4827 +
  1.4828 +	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
  1.4829 +	CleanupStack::PushL(recent2);
  1.4830 +
  1.4831 +	CLogViewDuplicate* duplicate2 = CLogViewDuplicate::NewL(aClient);
  1.4832 +	CleanupStack::PushL(duplicate2);
  1.4833 +
  1.4834 +	// Make sure there are no entries in any recent lists
  1.4835 +	active->StartL();
  1.4836 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.4837 +	CActiveScheduler::Start();
  1.4838 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4839 +
  1.4840 +	// Incoming call event
  1.4841 +	TBuf<KLogMaxDirectionLength> incoming;
  1.4842 +	aClient.GetString(incoming, R_LOG_DIR_IN);
  1.4843 +
  1.4844 +	// Missed call event
  1.4845 +	TBuf<KLogMaxDirectionLength> missed;
  1.4846 +	aClient.GetString(missed, R_LOG_DIR_MISSED);
  1.4847 +
  1.4848 +	event->SetEventType(KLogCallEventTypeUid);
  1.4849 +	event->SetDirection(missed);
  1.4850 +	event->SetContact(1);
  1.4851 +
  1.4852 +	// Add some events
  1.4853 +	active->StartL();
  1.4854 +	aClient.AddEvent(*event, active->iStatus);
  1.4855 +	CActiveScheduler::Start();
  1.4856 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4857 +	TLogId id1 = event->Id();
  1.4858 +
  1.4859 +	User::After(1000000);
  1.4860 +
  1.4861 +	active->StartL();
  1.4862 +	aClient.AddEvent(*event, active->iStatus);
  1.4863 +	CActiveScheduler::Start();
  1.4864 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4865 +	TLogId id2 = event->Id();
  1.4866 +
  1.4867 +	User::After(1000000);
  1.4868 +
  1.4869 +	active->StartL();
  1.4870 +	aClient.AddEvent(*event, active->iStatus);
  1.4871 +	CActiveScheduler::Start();
  1.4872 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4873 +	TLogId id3 = event->Id();
  1.4874 +
  1.4875 +	User::After(1000000);
  1.4876 +
  1.4877 +	// Most recent
  1.4878 +	active->StartL();
  1.4879 +	aClient.AddEvent(*event, active->iStatus);
  1.4880 +	CActiveScheduler::Start();
  1.4881 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4882 +	TLogId id4 = event->Id();
  1.4883 +
  1.4884 +	// Check there's a recent event in the list
  1.4885 +	active->StartL();
  1.4886 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4887 +	CActiveScheduler::Start();
  1.4888 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4889 +	TEST2(recent1->CountL(), 1);
  1.4890 +	TEST2(recent1->Event().Id(), id4);
  1.4891 +
  1.4892 +	// Check it has duplicates
  1.4893 +	active->StartL();
  1.4894 +	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4895 +	CActiveScheduler::Start();
  1.4896 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4897 +	TEST2(duplicate1->CountL(), 3);
  1.4898 +	TEST2(duplicate1->Event().Id(), id3);
  1.4899 +
  1.4900 +	// Check id
  1.4901 +	active->StartL();
  1.4902 +	TEST(duplicate1->NextL(active->iStatus));
  1.4903 +	CActiveScheduler::Start();
  1.4904 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4905 +	TEST2(duplicate1->Event().Id(), id2);
  1.4906 +
  1.4907 +	// Check id
  1.4908 +	active->StartL();
  1.4909 +	TEST(duplicate1->NextL(active->iStatus));
  1.4910 +	CActiveScheduler::Start();
  1.4911 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4912 +	TEST2(duplicate1->Event().Id(), id1);
  1.4913 +	event->CopyL(duplicate1->Event()); // for later
  1.4914 +
  1.4915 +	// Other recent list should be empty
  1.4916 +	TEST(!recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4917 +
  1.4918 +	// Now move latest recent event to another recent list
  1.4919 +	event->SetDirection(incoming);
  1.4920 +	active->StartL();
  1.4921 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4922 +	CActiveScheduler::Start();
  1.4923 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4924 +
  1.4925 +	// Most recent duplicate should still be the latest
  1.4926 +	active->StartL();
  1.4927 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4928 +	CActiveScheduler::Start();
  1.4929 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4930 +	TEST2(recent1->CountL(), 1);
  1.4931 +	TEST2(recent1->Event().Id(), id4);
  1.4932 +
  1.4933 +	// There should still be some duplicates
  1.4934 +	active->StartL();
  1.4935 +	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4936 +	CActiveScheduler::Start();
  1.4937 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4938 +	TEST2(duplicate1->CountL(), 2);
  1.4939 +	TEST2(duplicate1->Event().Id(), id3);
  1.4940 +
  1.4941 +	// Check id
  1.4942 +	active->StartL();
  1.4943 +	TEST(duplicate1->NextL(active->iStatus));
  1.4944 +	CActiveScheduler::Start();
  1.4945 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4946 +	TEST2(duplicate1->Event().Id(), id2);
  1.4947 +	event->CopyL(duplicate1->Event()); // for later
  1.4948 +
  1.4949 +	// Now the event should have moved to another recent list
  1.4950 +	active->StartL();
  1.4951 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4952 +	CActiveScheduler::Start();
  1.4953 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4954 +	TEST2(recent2->CountL(), 1);
  1.4955 +	TEST2(recent2->Event().Id(), id1);
  1.4956 +
  1.4957 +	// No duplicates yet
  1.4958 +	TEST(!recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.4959 +
  1.4960 +	// Now move most recent event to another recent list
  1.4961 +	event->SetDirection(incoming);
  1.4962 +	active->StartL();
  1.4963 +	aClient.ChangeEvent(*event, active->iStatus);
  1.4964 +	CActiveScheduler::Start();
  1.4965 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4966 +
  1.4967 +	// Most recent duplicate should still be the latest
  1.4968 +	active->StartL();
  1.4969 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.4970 +	CActiveScheduler::Start();
  1.4971 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4972 +	TEST2(recent1->CountL(), 1);
  1.4973 +	TEST2(recent1->Event().Id(), id4);
  1.4974 +
  1.4975 +	// There should still be some duplicates
  1.4976 +	active->StartL();
  1.4977 +	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.4978 +	CActiveScheduler::Start();
  1.4979 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4980 +	TEST2(duplicate1->CountL(), 1);
  1.4981 +	TEST2(duplicate1->Event().Id(), id3);
  1.4982 +	event->CopyL(duplicate1->Event()); // for later
  1.4983 +
  1.4984 +	// Now the event should have moved to another recent list
  1.4985 +	active->StartL();
  1.4986 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.4987 +	CActiveScheduler::Start();
  1.4988 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4989 +	TEST2(recent2->CountL(), 1);
  1.4990 +	TEST2(recent2->Event().Id(), id2);
  1.4991 +
  1.4992 +	// There should still be some duplicates
  1.4993 +	active->StartL();
  1.4994 +	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.4995 +	CActiveScheduler::Start();
  1.4996 +	TEST2(active->iStatus.Int(), KErrNone);
  1.4997 +	TEST2(duplicate2->CountL(), 1);
  1.4998 +	TEST2(duplicate2->Event().Id(), id1);
  1.4999 +
  1.5000 +	// Now move most recent event to another recent list
  1.5001 +	event->SetDirection(incoming);
  1.5002 +	active->StartL();
  1.5003 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5004 +	CActiveScheduler::Start();
  1.5005 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5006 +
  1.5007 +	// Most recent duplicate should still be the latest
  1.5008 +	active->StartL();
  1.5009 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5010 +	CActiveScheduler::Start();
  1.5011 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5012 +	TEST2(recent1->CountL(), 1);
  1.5013 +	TEST2(recent1->Event().Id(), id4);
  1.5014 +	event->CopyL(recent1->Event()); // for later
  1.5015 +
  1.5016 +	// Should be no more duplicates
  1.5017 +	TEST(!recent1->DuplicatesL(*duplicate1, active->iStatus));
  1.5018 +
  1.5019 +	// Now the event should have moved to another recent list
  1.5020 +	active->StartL();
  1.5021 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5022 +	CActiveScheduler::Start();
  1.5023 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5024 +	TEST2(recent2->CountL(), 1);
  1.5025 +	TEST2(recent2->Event().Id(), id3);
  1.5026 +
  1.5027 +	// There should still be some duplicates
  1.5028 +	active->StartL();
  1.5029 +	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.5030 +	CActiveScheduler::Start();
  1.5031 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5032 +	TEST2(duplicate2->CountL(), 2);
  1.5033 +	TEST2(duplicate2->Event().Id(), id2);
  1.5034 +
  1.5035 +	// Check id
  1.5036 +	active->StartL();
  1.5037 +	TEST(duplicate2->NextL(active->iStatus));
  1.5038 +	CActiveScheduler::Start();
  1.5039 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5040 +	TEST2(duplicate2->Event().Id(), id1);
  1.5041 +
  1.5042 +	// Now move most recent event to another recent list
  1.5043 +	event->SetDirection(incoming);
  1.5044 +	active->StartL();
  1.5045 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5046 +	CActiveScheduler::Start();
  1.5047 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5048 +
  1.5049 +	// No more recent events
  1.5050 +	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5051 +
  1.5052 +	// Now the event should have moved to another recent list
  1.5053 +	active->StartL();
  1.5054 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5055 +	CActiveScheduler::Start();
  1.5056 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5057 +	TEST2(recent2->CountL(), 1);
  1.5058 +	TEST2(recent2->Event().Id(), id4);
  1.5059 +
  1.5060 +	// There should still be some duplicates
  1.5061 +	active->StartL();
  1.5062 +	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
  1.5063 +	CActiveScheduler::Start();
  1.5064 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5065 +	TEST2(duplicate2->CountL(), 3);
  1.5066 +	TEST2(duplicate2->Event().Id(), id3);
  1.5067 +
  1.5068 +	// Check id
  1.5069 +	active->StartL();
  1.5070 +	TEST(duplicate2->NextL(active->iStatus));
  1.5071 +	CActiveScheduler::Start();
  1.5072 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5073 +	TEST2(duplicate2->Event().Id(), id2);
  1.5074 +
  1.5075 +	// Check id
  1.5076 +	active->StartL();
  1.5077 +	TEST(duplicate2->NextL(active->iStatus));
  1.5078 +	CActiveScheduler::Start();
  1.5079 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5080 +	TEST2(duplicate2->Event().Id(), id1);
  1.5081 +
  1.5082 +	CleanupStack::PopAndDestroy(6); // active, event, recent1, duplicate1, recent2, duplicate2
  1.5083 +	}
  1.5084 +
  1.5085 +/**
  1.5086 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0957
  1.5087 +@SYMTestCaseDesc	    Tests that change in log view after moving an event
  1.5088 +@SYMTestPriority 	    High
  1.5089 +@SYMTestActions  	    Check recent views are purged if necessary after moving an event
  1.5090 +@SYMTestExpectedResults Test must not fail
  1.5091 +@SYMREQ                 REQ0000
  1.5092 +*/
  1.5093 +LOCAL_C void TestChangeEventRecentViewAndPurgeL(CLogClient& aClient)
  1.5094 +	{
  1.5095 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0957 "));
  1.5096 +	CTestActive* active = new(ELeave)CTestActive();
  1.5097 +	CleanupStack::PushL(active);
  1.5098 +
  1.5099 +	CLogEvent* event = CLogEvent::NewL();
  1.5100 +	CleanupStack::PushL(event);
  1.5101 +
  1.5102 +	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
  1.5103 +	CleanupStack::PushL(recent1);
  1.5104 +
  1.5105 +	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
  1.5106 +	CleanupStack::PushL(recent2);
  1.5107 +
  1.5108 +	// Make sure there are no entries in any recent lists
  1.5109 +	active->StartL();
  1.5110 +	aClient.ClearLog(KLogNullRecentList, active->iStatus);
  1.5111 +	CActiveScheduler::Start();
  1.5112 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5113 +
  1.5114 +	// Get log config
  1.5115 +	TLogConfig config;
  1.5116 +	active->StartL();
  1.5117 +	aClient.GetConfig(config, active->iStatus);
  1.5118 +	CActiveScheduler::Start();
  1.5119 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5120 +
  1.5121 +	// Set the max recent list size to something small
  1.5122 +	config.iMaxRecentLogSize = 3;
  1.5123 +	active->StartL();
  1.5124 +	aClient.ChangeConfig(config, active->iStatus);
  1.5125 +	CActiveScheduler::Start();
  1.5126 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5127 +
  1.5128 +	// Incoming call event
  1.5129 +	TBuf<KLogMaxDirectionLength> incoming;
  1.5130 +	aClient.GetString(incoming, R_LOG_DIR_IN);
  1.5131 +
  1.5132 +	// Missed call event
  1.5133 +	TBuf<KLogMaxDirectionLength> missed;
  1.5134 +	aClient.GetString(missed, R_LOG_DIR_MISSED);
  1.5135 +
  1.5136 +	event->SetEventType(KLogCallEventTypeUid);
  1.5137 +	event->SetDirection(missed);
  1.5138 +
  1.5139 +	// Add an event
  1.5140 +	event->SetContact(1);
  1.5141 +	active->StartL();
  1.5142 +	aClient.AddEvent(*event, active->iStatus);
  1.5143 +	CActiveScheduler::Start();
  1.5144 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5145 +	TLogId id1 = event->Id();
  1.5146 +
  1.5147 +	User::After(1000000);
  1.5148 +	event->SetDirection(incoming);
  1.5149 +
  1.5150 +	// Add an event
  1.5151 +	event->SetContact(2);
  1.5152 +	active->StartL();
  1.5153 +	aClient.AddEvent(*event, active->iStatus);
  1.5154 +	CActiveScheduler::Start();
  1.5155 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5156 +	TLogId id2 = event->Id();
  1.5157 +
  1.5158 +	User::After(1000000);
  1.5159 +
  1.5160 +	// Add an event
  1.5161 +	event->SetContact(3);
  1.5162 +	active->StartL();
  1.5163 +	aClient.AddEvent(*event, active->iStatus);
  1.5164 +	CActiveScheduler::Start();
  1.5165 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5166 +	TLogId id3 = event->Id();
  1.5167 +
  1.5168 +	User::After(1000000);
  1.5169 +
  1.5170 +	// Add an event
  1.5171 +	event->SetContact(4);
  1.5172 +	active->StartL();
  1.5173 +	aClient.AddEvent(*event, active->iStatus);
  1.5174 +	CActiveScheduler::Start();
  1.5175 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5176 +	TLogId id4 = event->Id();
  1.5177 +
  1.5178 +	// Check the views
  1.5179 +	active->StartL();
  1.5180 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5181 +	CActiveScheduler::Start();
  1.5182 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5183 +	TEST2(recent1->CountL(), 1);
  1.5184 +
  1.5185 +	active->StartL();
  1.5186 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5187 +	CActiveScheduler::Start();
  1.5188 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5189 +	TEST2(recent2->CountL(), 3);
  1.5190 +
  1.5191 +	// Retrieve event
  1.5192 +	event->SetId(id1);
  1.5193 +	active->StartL();
  1.5194 +	aClient.GetEvent(*event, active->iStatus);
  1.5195 +	CActiveScheduler::Start();
  1.5196 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5197 +
  1.5198 +	// Now move the oldest event to another recent list - it should be purged
  1.5199 +	event->SetDirection(incoming);
  1.5200 +	active->StartL();
  1.5201 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5202 +	CActiveScheduler::Start();
  1.5203 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5204 +
  1.5205 +	// Missed call list now empty
  1.5206 +	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5207 +
  1.5208 +	// Incoming view should be unchanged
  1.5209 +	active->StartL();
  1.5210 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5211 +	CActiveScheduler::Start();
  1.5212 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5213 +	TEST2(recent2->CountL(), 3);
  1.5214 +	TEST2(recent2->Event().Id(), id4);
  1.5215 +
  1.5216 +	// Check id
  1.5217 +	active->StartL();
  1.5218 +	TEST(recent2->NextL(active->iStatus));
  1.5219 +	CActiveScheduler::Start();
  1.5220 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5221 +	TEST2(recent2->Event().Id(), id3);
  1.5222 +
  1.5223 +	// Check id
  1.5224 +	active->StartL();
  1.5225 +	TEST(recent2->NextL(active->iStatus));
  1.5226 +	CActiveScheduler::Start();
  1.5227 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5228 +	TEST2(recent2->Event().Id(), id2);
  1.5229 +
  1.5230 +	TTime now;
  1.5231 +	now.UniversalTime();
  1.5232 +
  1.5233 +	// This should have no effect
  1.5234 +	event->SetTime(now);
  1.5235 +	active->StartL();
  1.5236 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5237 +	CActiveScheduler::Start();
  1.5238 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5239 +
  1.5240 +	// Incoming view should be unchanged
  1.5241 +	active->StartL();
  1.5242 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5243 +	CActiveScheduler::Start();
  1.5244 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5245 +	TEST2(recent2->CountL(), 3);
  1.5246 +	TEST2(recent2->Event().Id(), id4);
  1.5247 +
  1.5248 +	// Check id
  1.5249 +	active->StartL();
  1.5250 +	TEST(recent2->NextL(active->iStatus));
  1.5251 +	CActiveScheduler::Start();
  1.5252 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5253 +	TEST2(recent2->Event().Id(), id3);
  1.5254 +
  1.5255 +	// Check id
  1.5256 +	active->StartL();
  1.5257 +	TEST(recent2->NextL(active->iStatus));
  1.5258 +	CActiveScheduler::Start();
  1.5259 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5260 +	TEST2(recent2->Event().Id(), id2);
  1.5261 +
  1.5262 +	// Now add a new event to missed view (the latest)
  1.5263 +	User::After(1000000);
  1.5264 +	event->SetDirection(missed);
  1.5265 +	active->StartL();
  1.5266 +	aClient.AddEvent(*event, active->iStatus);
  1.5267 +	CActiveScheduler::Start();
  1.5268 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5269 +
  1.5270 +	User::After(1000000);
  1.5271 +	now.UniversalTime();
  1.5272 +
  1.5273 +	// This should have no effect
  1.5274 +	event->SetTime(now);
  1.5275 +	active->StartL();
  1.5276 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5277 +	CActiveScheduler::Start();
  1.5278 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5279 +
  1.5280 +	// Check the views
  1.5281 +	active->StartL();
  1.5282 +	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5283 +	CActiveScheduler::Start();
  1.5284 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5285 +	TEST2(recent1->CountL(), 1);
  1.5286 +
  1.5287 +	active->StartL();
  1.5288 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5289 +	CActiveScheduler::Start();
  1.5290 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5291 +	TEST2(recent2->CountL(), 3);
  1.5292 +
  1.5293 +	// Now move the latest event to another recent list - oldest should be purged
  1.5294 +	event->SetDirection(incoming);
  1.5295 +	active->StartL();
  1.5296 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5297 +	CActiveScheduler::Start();
  1.5298 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5299 +
  1.5300 +	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5301 +
  1.5302 +	active->StartL();
  1.5303 +	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5304 +	CActiveScheduler::Start();
  1.5305 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5306 +	TEST2(recent2->CountL(), 3);
  1.5307 +	TEST2(recent2->Event().Id(), event->Id());
  1.5308 +
  1.5309 +	// Check id
  1.5310 +	active->StartL();
  1.5311 +	TEST(recent2->NextL(active->iStatus));
  1.5312 +	CActiveScheduler::Start();
  1.5313 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5314 +	TEST2(recent2->Event().Id(), id4);
  1.5315 +
  1.5316 +	// Check id
  1.5317 +	active->StartL();
  1.5318 +	TEST(recent2->NextL(active->iStatus));
  1.5319 +	CActiveScheduler::Start();
  1.5320 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5321 +	TEST2(recent2->Event().Id(), id3);
  1.5322 +
  1.5323 +	CleanupStack::PopAndDestroy(4); // active, event, recent1, recent2
  1.5324 +	}
  1.5325 +
  1.5326 +/**
  1.5327 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0958
  1.5328 +@SYMTestCaseDesc	    Tests for the log view,on changing an event
  1.5329 +@SYMTestPriority 	    High
  1.5330 +@SYMTestActions  	    Check an event can be removed from recent lists by changing it
  1.5331 +@SYMTestExpectedResults Test must not fail
  1.5332 +@SYMREQ                 REQ0000
  1.5333 +*/
  1.5334 +LOCAL_C void TestChangeEventRecentViewRemoveL(CLogClient& aClient)
  1.5335 +	{
  1.5336 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0958 "));
  1.5337 +	CTestActive* active = new(ELeave)CTestActive();
  1.5338 +	CleanupStack::PushL(active);
  1.5339 +
  1.5340 +	CLogEvent* event = CLogEvent::NewL();
  1.5341 +	CleanupStack::PushL(event);
  1.5342 +
  1.5343 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
  1.5344 +	CleanupStack::PushL(recent);
  1.5345 +
  1.5346 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.5347 +	CleanupStack::PushL(duplicate);
  1.5348 +
  1.5349 +	// Missed call event
  1.5350 +	TBuf<KLogMaxDirectionLength> missed;
  1.5351 +	aClient.GetString(missed, R_LOG_DIR_MISSED);
  1.5352 +
  1.5353 +	event->SetEventType(KLogCallEventTypeUid);
  1.5354 +	event->SetDirection(missed);
  1.5355 +
  1.5356 +	// Add an event
  1.5357 +	event->SetContact(1);
  1.5358 +	active->StartL();
  1.5359 +	aClient.AddEvent(*event, active->iStatus);
  1.5360 +	CActiveScheduler::Start();
  1.5361 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5362 +	TLogId id1 = event->Id();
  1.5363 +
  1.5364 +	User::After(1000000);
  1.5365 +
  1.5366 +	// Add some duplicates
  1.5367 +	active->StartL();
  1.5368 +	aClient.AddEvent(*event, active->iStatus);
  1.5369 +	CActiveScheduler::Start();
  1.5370 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5371 +	TLogId id2 = event->Id();
  1.5372 +
  1.5373 +	User::After(1000000);
  1.5374 +
  1.5375 +	active->StartL();
  1.5376 +	aClient.AddEvent(*event, active->iStatus);
  1.5377 +	CActiveScheduler::Start();
  1.5378 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5379 +	TLogId id3 = event->Id();
  1.5380 +
  1.5381 +	User::After(1000000);
  1.5382 +
  1.5383 +	active->StartL();
  1.5384 +	aClient.AddEvent(*event, active->iStatus);
  1.5385 +	CActiveScheduler::Start();
  1.5386 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5387 +	TLogId id4 = event->Id();
  1.5388 +
  1.5389 +	// Check views
  1.5390 +	active->StartL();
  1.5391 +	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5392 +	CActiveScheduler::Start();
  1.5393 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5394 +	TEST2(recent->CountL(), 1);
  1.5395 +	TEST2(recent->Event().Id(), id4);
  1.5396 +
  1.5397 +	active->StartL();
  1.5398 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.5399 +	CActiveScheduler::Start();
  1.5400 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5401 +	TEST2(duplicate->CountL(), 3);
  1.5402 +	TEST2(duplicate->Event().Id(), id3);
  1.5403 +
  1.5404 +	// Check id
  1.5405 +	active->StartL();
  1.5406 +	TEST(duplicate->NextL(active->iStatus));
  1.5407 +	CActiveScheduler::Start();
  1.5408 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5409 +	TEST2(duplicate->Event().Id(), id2);
  1.5410 +
  1.5411 +	// Check id
  1.5412 +	active->StartL();
  1.5413 +	TEST(duplicate->NextL(active->iStatus));
  1.5414 +	CActiveScheduler::Start();
  1.5415 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5416 +	TEST2(duplicate->Event().Id(), id1);
  1.5417 +
  1.5418 +	// Fetched call event
  1.5419 +	TBuf<KLogMaxDirectionLength> fetched;
  1.5420 +	aClient.GetString(missed, R_LOG_DIR_FETCHED);
  1.5421 +
  1.5422 +	// Now change the event to remove it from recent lists
  1.5423 +	event->SetDirection(fetched);
  1.5424 +	active->StartL();
  1.5425 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5426 +	CActiveScheduler::Start();
  1.5427 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5428 +
  1.5429 +	// Check views
  1.5430 +	active->StartL();
  1.5431 +	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5432 +	CActiveScheduler::Start();
  1.5433 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5434 +	TEST2(recent->CountL(), 1);
  1.5435 +	TEST2(recent->Event().Id(), id3);
  1.5436 +
  1.5437 +	active->StartL();
  1.5438 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.5439 +	CActiveScheduler::Start();
  1.5440 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5441 +	TEST2(duplicate->CountL(), 2);
  1.5442 +	TEST2(duplicate->Event().Id(), id2);
  1.5443 +	event->CopyL(duplicate->Event()); // For later
  1.5444 +
  1.5445 +	// Check id
  1.5446 +	active->StartL();
  1.5447 +	TEST(duplicate->NextL(active->iStatus));
  1.5448 +	CActiveScheduler::Start();
  1.5449 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5450 +	TEST2(duplicate->Event().Id(), id1);
  1.5451 +
  1.5452 +	// Now change the event to remove it from recent lists
  1.5453 +	event->SetDirection(fetched);
  1.5454 +	active->StartL();
  1.5455 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5456 +	CActiveScheduler::Start();
  1.5457 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5458 +
  1.5459 +	// Check views
  1.5460 +	active->StartL();
  1.5461 +	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5462 +	CActiveScheduler::Start();
  1.5463 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5464 +	TEST2(recent->CountL(), 1);
  1.5465 +	TEST2(recent->Event().Id(), id3);
  1.5466 +
  1.5467 +	active->StartL();
  1.5468 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.5469 +	CActiveScheduler::Start();
  1.5470 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5471 +	TEST2(duplicate->CountL(), 1);
  1.5472 +	TEST2(duplicate->Event().Id(), id1);
  1.5473 +	event->CopyL(duplicate->Event()); // For later
  1.5474 +
  1.5475 +	// Now change the event to remove it from recent lists
  1.5476 +	event->SetDirection(fetched);
  1.5477 +	active->StartL();
  1.5478 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5479 +	CActiveScheduler::Start();
  1.5480 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5481 +
  1.5482 +	// Check views
  1.5483 +	active->StartL();
  1.5484 +	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5485 +	CActiveScheduler::Start();
  1.5486 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5487 +	TEST2(recent->CountL(), 1);
  1.5488 +	TEST2(recent->Event().Id(), id3);
  1.5489 +	event->CopyL(recent->Event()); // For later
  1.5490 +
  1.5491 +	// No more duplicates
  1.5492 +	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  1.5493 +
  1.5494 +	// Now change the event to remove it from recent lists
  1.5495 +	event->SetDirection(fetched);
  1.5496 +	active->StartL();
  1.5497 +	aClient.ChangeEvent(*event, active->iStatus);
  1.5498 +	CActiveScheduler::Start();
  1.5499 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5500 +
  1.5501 +	TEST(!recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
  1.5502 +
  1.5503 +	CleanupStack::PopAndDestroy(4); // active, event, recent, duplicate
  1.5504 +	}
  1.5505 +
  1.5506 +CBaBackupSessionWrapper* theBackup = NULL;
  1.5507 +
  1.5508 +LOCAL_C TBool IsLogOpenL()
  1.5509 +	{
  1.5510 +	return TestUtils::IsDatabaseOpenL();
  1.5511 +	}
  1.5512 +
  1.5513 +LOCAL_C void TestLogOpenL()
  1.5514 +	{
  1.5515 +	TEST(IsLogOpenL());
  1.5516 +	}
  1.5517 +
  1.5518 +LOCAL_C void TestLogClosedL()
  1.5519 +	{
  1.5520 +	TEST(!IsLogOpenL());
  1.5521 +	}
  1.5522 +
  1.5523 +LOCAL_C void StartBackupL()
  1.5524 +	{
  1.5525 +	User::InfoPrint(_L("Backup"));
  1.5526 +
  1.5527 +	TDriveUnit driveUnit(EDriveC);
  1.5528 +	TDriveName name = driveUnit.Name();
  1.5529 +
  1.5530 +	TParse parse;
  1.5531 +	LEAVE_IF_ERROR(parse.Set(KLogDatabaseName, &name, NULL));
  1.5532 +
  1.5533 +	delete theBackup;
  1.5534 +	theBackup = NULL;
  1.5535 +	theBackup = CBaBackupSessionWrapper::NewL();
  1.5536 +
  1.5537 +	theBackup->CloseFileL(parse.FullName(), MBackupObserver::EReleaseLockNoAccess);
  1.5538 +	User::After(1000000);
  1.5539 +	}
  1.5540 +
  1.5541 +LOCAL_C void EndBackupL()
  1.5542 +	{
  1.5543 +	delete theBackup;
  1.5544 +	theBackup = NULL;
  1.5545 +	User::After(1000000);
  1.5546 +	}
  1.5547 +
  1.5548 +LOCAL_C void DelayL(TInt aDelay)
  1.5549 +	{
  1.5550 +	CTestTimer* timer = CTestTimer::NewL();
  1.5551 +	timer->After(aDelay);
  1.5552 +	CActiveScheduler::Start();
  1.5553 +	delete timer;
  1.5554 +	}
  1.5555 +
  1.5556 +/**
  1.5557 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0959
  1.5558 +@SYMTestCaseDesc	    Tests for log view change observer
  1.5559 +						Test change stuff with backup
  1.5560 +@SYMTestPriority 	    High
  1.5561 +@SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates even after backup
  1.5562 +@SYMTestExpectedResults Test must not fail
  1.5563 +@SYMREQ                 REQ0000
  1.5564 +*/
  1.5565 +LOCAL_C void TestHiddenChangeEvents1aL(CLogClient& aClient)
  1.5566 +	{
  1.5567 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0959 "));
  1.5568 +	TLogId logId;
  1.5569 +	TInt viewIndex;
  1.5570 +	TLogDatabaseChangeType type;
  1.5571 +
  1.5572 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.5573 +	changeObs1->StartCollectingChanges();
  1.5574 +
  1.5575 +
  1.5576 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.5577 +	CleanupStack::PushL(view);
  1.5578 +
  1.5579 +	CLogFilter* filter = CLogFilter::NewL();
  1.5580 +	CleanupStack::PushL(filter);
  1.5581 +
  1.5582 +	CLogEvent* event = CLogEvent::NewL();
  1.5583 +	CleanupStack::PushL(event);
  1.5584 +
  1.5585 +	CTestActive* active = new(ELeave)CTestActive();
  1.5586 +	CleanupStack::PushL(active);
  1.5587 +
  1.5588 +	TTime now;
  1.5589 +	now.UniversalTime();
  1.5590 +	now += (TTimeIntervalDays)+1;
  1.5591 +
  1.5592 +	// Get rid of all the events in the log
  1.5593 +	active->StartL();
  1.5594 +	aClient.ClearLog(now, active->iStatus);
  1.5595 +	CActiveScheduler::Start();
  1.5596 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5597 +
  1.5598 +	// Incoming call event
  1.5599 +	event->SetEventType(KLogCallEventTypeUid);
  1.5600 +	TBuf<KLogMaxDirectionLength> buf;
  1.5601 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.5602 +	event->SetDirection(buf);
  1.5603 +
  1.5604 +	// Add an event
  1.5605 +	active->StartL();
  1.5606 +	aClient.AddEvent(*event, active->iStatus);
  1.5607 +	CActiveScheduler::Start();
  1.5608 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5609 +
  1.5610 +	// Setup normal event view
  1.5611 +	active->StartL();
  1.5612 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.5613 +	CActiveScheduler::Start();
  1.5614 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5615 +
  1.5616 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.5617 +	changeObs2->StartCollectingChanges();
  1.5618 +
  1.5619 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.5620 +	CleanupStack::PushL(recent);
  1.5621 +
  1.5622 +	// Check recent view
  1.5623 +	active->StartL();
  1.5624 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5625 +	CActiveScheduler::Start();
  1.5626 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5627 +	TEST2(recent->CountL(), 1);
  1.5628 +
  1.5629 +	// Add a new event
  1.5630 +	active->StartL();
  1.5631 +	aClient.AddEvent(*event, active->iStatus);
  1.5632 +	CActiveScheduler::Start();
  1.5633 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5634 +
  1.5635 +	// Check that changes work after a backup
  1.5636 +	StartBackupL();
  1.5637 +	DelayL(1000000);
  1.5638 +	TestLogClosedL();
  1.5639 +	EndBackupL();
  1.5640 +	DelayL(1000000);
  1.5641 +	TestLogOpenL();
  1.5642 +	
  1.5643 +	TEST2(changeObs2->Changes().Count(), 2);
  1.5644 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.5645 +	TEST2(type, ELogChangeTypeEventAdded);
  1.5646 +	type = changeObs2->Changes().At(1, logId, viewIndex);
  1.5647 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.5648 +
  1.5649 +	// Check recent view
  1.5650 +	active->StartL();
  1.5651 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5652 +	CActiveScheduler::Start();
  1.5653 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5654 +	TEST2(recent->CountL(), 1);
  1.5655 +
  1.5656 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.5657 +	CleanupStack::PushL(duplicate);
  1.5658 +
  1.5659 +	// Check duplicate count
  1.5660 +	active->StartL();
  1.5661 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.5662 +	CActiveScheduler::Start();
  1.5663 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5664 +	TEST2(duplicate->CountL(), 1);
  1.5665 +
  1.5666 +	// Check that changes work after a backup
  1.5667 +	StartBackupL();
  1.5668 +	DelayL(1000000);
  1.5669 +	TestLogClosedL();
  1.5670 +	EndBackupL();
  1.5671 +	TestLogOpenL();
  1.5672 +
  1.5673 +	// Check change events
  1.5674 +	User::After(100000);
  1.5675 +	TEST2(changeObs1->Changes().Count(), 1);
  1.5676 +	type = changeObs1->Changes().At(0, logId, viewIndex);
  1.5677 +	TEST2(type, ELogChangeTypeEventAdded);
  1.5678 +
  1.5679 +	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.5680 +	}
  1.5681 +
  1.5682 +/**
  1.5683 +Check that a view doesn't get change events when recent list purged
  1.5684 +
  1.5685 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0960
  1.5686 +@SYMTestCaseDesc	    Tests for log view change observer
  1.5687 +@SYMTestPriority 	    High
  1.5688 +@SYMTestActions  	    Check that a view doesn't get change events when recent list purged,even after backup
  1.5689 +@SYMTestExpectedResults Test must not fail
  1.5690 +@SYMREQ                 REQ0000
  1.5691 +*/
  1.5692 +LOCAL_C void TestHiddenChangeEvents2aL(CLogClient& aClient)
  1.5693 +	{
  1.5694 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0960 "));
  1.5695 +	TLogId logId;
  1.5696 +	TInt viewIndex;
  1.5697 +	TLogDatabaseChangeType type;
  1.5698 +
  1.5699 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.5700 +	changeObs1->StartCollectingChanges();
  1.5701 +
  1.5702 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.5703 +	CleanupStack::PushL(view);
  1.5704 +
  1.5705 +	CLogFilter* filter = CLogFilter::NewL();
  1.5706 +	CleanupStack::PushL(filter);
  1.5707 +
  1.5708 +	CLogEvent* event = CLogEvent::NewL();
  1.5709 +	CleanupStack::PushL(event);
  1.5710 +
  1.5711 +	CTestActive* active = new(ELeave)CTestActive();
  1.5712 +	CleanupStack::PushL(active);
  1.5713 +
  1.5714 +	TTime now;
  1.5715 +	now.UniversalTime();
  1.5716 +	now += (TTimeIntervalDays)+1;
  1.5717 +
  1.5718 +	// Get rid of all the events in the log
  1.5719 +	active->StartL();
  1.5720 +	aClient.ClearLog(now, active->iStatus);
  1.5721 +	CActiveScheduler::Start();
  1.5722 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5723 +
  1.5724 +	// Get config
  1.5725 +	TLogConfig config;
  1.5726 +	active->StartL();
  1.5727 +	aClient.GetConfig(config, active->iStatus);
  1.5728 +	CActiveScheduler::Start();
  1.5729 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5730 +
  1.5731 +	// Incoming call event
  1.5732 +	event->SetEventType(KLogCallEventTypeUid);
  1.5733 +	TBuf<KLogMaxDirectionLength> buf;
  1.5734 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.5735 +	event->SetDirection(buf);
  1.5736 +
  1.5737 +	// Add max allowed events
  1.5738 +	TInt count = config.iMaxRecentLogSize;
  1.5739 +	while(count--)
  1.5740 +		{
  1.5741 +		event->SetContact(count+1);
  1.5742 +		active->StartL();
  1.5743 +		aClient.AddEvent(*event, active->iStatus);
  1.5744 +		CActiveScheduler::Start();
  1.5745 +		TEST2(active->iStatus.Int(), KErrNone);
  1.5746 +		}
  1.5747 +
  1.5748 +	// Setup normal event view
  1.5749 +	active->StartL();
  1.5750 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.5751 +	CActiveScheduler::Start();
  1.5752 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5753 +
  1.5754 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.5755 +	changeObs2->StartCollectingChanges();
  1.5756 +
  1.5757 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.5758 +	CleanupStack::PushL(recent);
  1.5759 +
  1.5760 +	// Check recent view
  1.5761 +	active->StartL();
  1.5762 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5763 +	CActiveScheduler::Start();
  1.5764 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5765 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.5766 +
  1.5767 +	// Add a new event, will cause one to be purged from recent view
  1.5768 +	event->SetContact(1234);
  1.5769 +	active->StartL();
  1.5770 +	aClient.AddEvent(*event, active->iStatus);
  1.5771 +	CActiveScheduler::Start();
  1.5772 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5773 +
  1.5774 +	// Check that changes work after a backup
  1.5775 +	StartBackupL();
  1.5776 +	DelayL(1000000);
  1.5777 +	TestLogClosedL();
  1.5778 +	EndBackupL();
  1.5779 +	TestLogOpenL();
  1.5780 +	DelayL(1000000);
  1.5781 +		
  1.5782 +	TEST2(changeObs2->Changes().Count(), 2);
  1.5783 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.5784 +	TEST2(type, ELogChangeTypeEventAdded);
  1.5785 +	type = changeObs2->Changes().At(1, logId, viewIndex);
  1.5786 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.5787 +
  1.5788 +	// Check recent view
  1.5789 +	active->StartL();
  1.5790 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5791 +	CActiveScheduler::Start();
  1.5792 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5793 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.5794 +
  1.5795 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.5796 +	CleanupStack::PushL(duplicate);
  1.5797 +
  1.5798 +	// Check duplicate count
  1.5799 +	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  1.5800 +
  1.5801 +	// Check that changes work after a backup
  1.5802 +	StartBackupL();
  1.5803 +	DelayL(1000000);
  1.5804 +	TestLogClosedL();
  1.5805 +	EndBackupL();
  1.5806 +	TestLogOpenL();
  1.5807 +
  1.5808 +	// Check change events
  1.5809 +	User::After(100000);
  1.5810 +	TEST2(changeObs1->Changes().Count(), 1);
  1.5811 +	type = changeObs1->Changes().At(0, logId, viewIndex);
  1.5812 +	TEST2(type, ELogChangeTypeEventAdded);
  1.5813 +
  1.5814 +	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.5815 +	}
  1.5816 +
  1.5817 +/**
  1.5818 +Check that a view doesn't get change events when recent list purged after changing config
  1.5819 +
  1.5820 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0961
  1.5821 +@SYMTestCaseDesc	    Tests for log view change observer
  1.5822 +@SYMTestPriority 	    High
  1.5823 +@SYMTestActions  	    Check that a view doesn't get change events when recent list purged after changing config,even after backup
  1.5824 +@SYMTestExpectedResults Test must not fail
  1.5825 +@SYMREQ                 REQ0000
  1.5826 +*/
  1.5827 +LOCAL_C void TestHiddenChangeEvents3aL(CLogClient& aClient)
  1.5828 +	{
  1.5829 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0961 "));
  1.5830 +	TLogId logId;
  1.5831 +	TInt viewIndex;
  1.5832 +	TLogDatabaseChangeType type;
  1.5833 +
  1.5834 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.5835 +	changeObs1->StartCollectingChanges();
  1.5836 +
  1.5837 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.5838 +	CleanupStack::PushL(view);
  1.5839 +
  1.5840 +	CLogFilter* filter = CLogFilter::NewL();
  1.5841 +	CleanupStack::PushL(filter);
  1.5842 +
  1.5843 +	CLogEvent* event = CLogEvent::NewL();
  1.5844 +	CleanupStack::PushL(event);
  1.5845 +
  1.5846 +	CTestActive* active = new(ELeave)CTestActive();
  1.5847 +	CleanupStack::PushL(active);
  1.5848 +
  1.5849 +	TTime now;
  1.5850 +	now.UniversalTime();
  1.5851 +	now += (TTimeIntervalDays)+1;
  1.5852 +
  1.5853 +	// Get rid of all the events in the log
  1.5854 +	active->StartL();
  1.5855 +	aClient.ClearLog(now, active->iStatus);
  1.5856 +	CActiveScheduler::Start();
  1.5857 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5858 +
  1.5859 +	// Get and set config
  1.5860 +	TLogConfig config;
  1.5861 +	active->StartL();
  1.5862 +	aClient.GetConfig(config, active->iStatus);
  1.5863 +	CActiveScheduler::Start();
  1.5864 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5865 +	config.iMaxRecentLogSize = 2;
  1.5866 +	active->StartL();
  1.5867 +	aClient.ChangeConfig(config, active->iStatus);
  1.5868 +	CActiveScheduler::Start();
  1.5869 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5870 +
  1.5871 +	// Incoming call event
  1.5872 +	event->SetEventType(KLogCallEventTypeUid);
  1.5873 +	TBuf<KLogMaxDirectionLength> buf;
  1.5874 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.5875 +	event->SetDirection(buf);
  1.5876 +
  1.5877 +	// Add max allowed events
  1.5878 +	TInt count = config.iMaxRecentLogSize;
  1.5879 +	while(count--)
  1.5880 +		{
  1.5881 +		event->SetContact(count+1);
  1.5882 +		active->StartL();
  1.5883 +		aClient.AddEvent(*event, active->iStatus);
  1.5884 +		CActiveScheduler::Start();
  1.5885 +		TEST2(active->iStatus.Int(), KErrNone);
  1.5886 +		}
  1.5887 +
  1.5888 +	// Setup normal event view
  1.5889 +	active->StartL();
  1.5890 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.5891 +	CActiveScheduler::Start();
  1.5892 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5893 +
  1.5894 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.5895 +	changeObs2->StartCollectingChanges();
  1.5896 +
  1.5897 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.5898 +	CleanupStack::PushL(recent);
  1.5899 +
  1.5900 +	// Check recent view
  1.5901 +	active->StartL();
  1.5902 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5903 +	CActiveScheduler::Start();
  1.5904 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5905 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.5906 +
  1.5907 +	// Change config, will cause one event to be purged from recent view
  1.5908 +	config.iMaxRecentLogSize = 1;
  1.5909 +	active->StartL();
  1.5910 +	aClient.ChangeConfig(config, active->iStatus);
  1.5911 +	CActiveScheduler::Start();
  1.5912 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5913 +
  1.5914 +	// Check that changes work after a backup
  1.5915 +	StartBackupL();
  1.5916 +	DelayL(1000000);
  1.5917 +	TestLogClosedL();
  1.5918 +	EndBackupL();
  1.5919 +	TestLogOpenL();
  1.5920 +	DelayL(1000000);
  1.5921 +
  1.5922 +	// Check change events
  1.5923 +	User::After(100000);
  1.5924 +	TEST2(changeObs2->Changes().Count(), 1);
  1.5925 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.5926 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.5927 +
  1.5928 +	// Check recent view
  1.5929 +	active->StartL();
  1.5930 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.5931 +	CActiveScheduler::Start();
  1.5932 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5933 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.5934 +
  1.5935 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.5936 +	CleanupStack::PushL(duplicate);
  1.5937 +
  1.5938 +	// Check duplicate count
  1.5939 +	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
  1.5940 +
  1.5941 +	// Check that changes work after a backup
  1.5942 +	StartBackupL();
  1.5943 +	DelayL(1000000);
  1.5944 +	TestLogClosedL();
  1.5945 +	EndBackupL();
  1.5946 +	TestLogOpenL();
  1.5947 +
  1.5948 +	// Check change events
  1.5949 +	User::After(100000);
  1.5950 +	TEST(!changeObs1->HaveChanges());
  1.5951 +
  1.5952 +	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.5953 +	}
  1.5954 +
  1.5955 +/**
  1.5956 +Check that when deleting an event causing recent lists to be updated, views don't get unnecessary change events
  1.5957 +
  1.5958 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0962
  1.5959 +@SYMTestCaseDesc	    Tests for log view change observer
  1.5960 +@SYMTestPriority 	    High
  1.5961 +@SYMTestActions  	    Check that when deleting an event causing recent lists to be updated,views don't get unnecessary change events.
  1.5962 +                        Check the test work even after backup operations
  1.5963 +@SYMTestExpectedResults Test must not fail
  1.5964 +@SYMREQ                 REQ0000
  1.5965 +*/
  1.5966 +LOCAL_C void TestHiddenChangeEvents4aL(CLogClient& aClient)
  1.5967 +	{
  1.5968 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0962 "));
  1.5969 +	TLogId logId;
  1.5970 +	TInt viewIndex;
  1.5971 +	TLogDatabaseChangeType type;
  1.5972 +
  1.5973 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.5974 +	changeObs1->StartCollectingChanges();
  1.5975 +
  1.5976 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.5977 +	CleanupStack::PushL(view);
  1.5978 +
  1.5979 +	CLogFilter* filter = CLogFilter::NewL();
  1.5980 +	CleanupStack::PushL(filter);
  1.5981 +	filter->SetFlags(1); // Need to hide an event from the view
  1.5982 +
  1.5983 +	CLogEvent* event = CLogEvent::NewL();
  1.5984 +	CleanupStack::PushL(event);
  1.5985 +
  1.5986 +	CTestActive* active = new(ELeave)CTestActive();
  1.5987 +	CleanupStack::PushL(active);
  1.5988 +
  1.5989 +	TTime now;
  1.5990 +	now.UniversalTime();
  1.5991 +	now += (TTimeIntervalDays)+1;
  1.5992 +
  1.5993 +	// Get rid of all the events in the log
  1.5994 +	active->StartL();
  1.5995 +	aClient.ClearLog(now, active->iStatus);
  1.5996 +	CActiveScheduler::Start();
  1.5997 +	TEST2(active->iStatus.Int(), KErrNone);
  1.5998 +
  1.5999 +	// Incoming call event
  1.6000 +	event->SetEventType(KLogCallEventTypeUid);
  1.6001 +	TBuf<KLogMaxDirectionLength> buf;
  1.6002 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.6003 +	event->SetDirection(buf);
  1.6004 +
  1.6005 +	event->SetFlags(1);
  1.6006 +
  1.6007 +	// Add an event
  1.6008 +	active->StartL();
  1.6009 +	aClient.AddEvent(*event, active->iStatus);
  1.6010 +	CActiveScheduler::Start();
  1.6011 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6012 +
  1.6013 +	// Add an event
  1.6014 +	active->StartL();
  1.6015 +	aClient.AddEvent(*event, active->iStatus);
  1.6016 +	CActiveScheduler::Start();
  1.6017 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6018 +
  1.6019 +	event->ClearFlags(0xF);
  1.6020 +
  1.6021 +	// Add an event
  1.6022 +	active->StartL();
  1.6023 +	aClient.AddEvent(*event, active->iStatus);
  1.6024 +	CActiveScheduler::Start();
  1.6025 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6026 +
  1.6027 +	// Setup normal event view
  1.6028 +	active->StartL();
  1.6029 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.6030 +	CActiveScheduler::Start();
  1.6031 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6032 +	TEST2(view->CountL(), 2);
  1.6033 +
  1.6034 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.6035 +	changeObs2->StartCollectingChanges();
  1.6036 +
  1.6037 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.6038 +	CleanupStack::PushL(recent);
  1.6039 +
  1.6040 +	// Check recent view
  1.6041 +	active->StartL();
  1.6042 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.6043 +	CActiveScheduler::Start();
  1.6044 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6045 +	TEST2(recent->CountL(), 1);
  1.6046 +
  1.6047 +	changeObs1->StartCollectingChanges();
  1.6048 +	changeObs2->StartCollectingChanges();
  1.6049 +
  1.6050 +	// Delete the event in recent list
  1.6051 +	active->StartL();
  1.6052 +	aClient.DeleteEvent(event->Id(), active->iStatus);
  1.6053 +	CActiveScheduler::Start();
  1.6054 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6055 +
  1.6056 +	// Check that changes work after a backup
  1.6057 +	StartBackupL();
  1.6058 +	DelayL(1000000);
  1.6059 +	TestLogClosedL();
  1.6060 +	EndBackupL();
  1.6061 +	TestLogOpenL();
  1.6062 +
  1.6063 +	// Check change events
  1.6064 +	TEST2(changeObs2->Changes().Count(), 2);
  1.6065 +	type = changeObs2->Changes().At(0, logId, viewIndex);
  1.6066 +	TEST2(type, ELogChangeTypeEventAdded);
  1.6067 +	type = changeObs2->Changes().At(1, logId, viewIndex);
  1.6068 +	TEST2(type, ELogChangeTypeEventDeleted);
  1.6069 +
  1.6070 +	TEST(!changeObs1->HaveChanges());
  1.6071 +
  1.6072 +	CleanupStack::PopAndDestroy(7, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent
  1.6073 +	}
  1.6074 +
  1.6075 +/**
  1.6076 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0963
  1.6077 +@SYMTestCaseDesc	    Tests for log view change observer
  1.6078 +@SYMTestPriority 	    High
  1.6079 +@SYMTestActions  	    Check that a view doesn't get change events when recent list cleared
  1.6080 +                        Check the test work even after backup operations
  1.6081 +@SYMTestExpectedResults Test must not fail
  1.6082 +@SYMREQ                 REQ0000
  1.6083 +*/
  1.6084 +LOCAL_C void TestHiddenChangeEvents5aL(CLogClient& aClient)
  1.6085 +	{
  1.6086 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0963 "));
  1.6087 +	TLogId logId;
  1.6088 +	TInt viewIndex;
  1.6089 +	TLogDatabaseChangeType type;
  1.6090 +
  1.6091 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.6092 +	changeObs1->StartCollectingChanges();
  1.6093 +
  1.6094 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.6095 +	CleanupStack::PushL(view);
  1.6096 +
  1.6097 +	CLogFilter* filter = CLogFilter::NewL();
  1.6098 +	CleanupStack::PushL(filter);
  1.6099 +
  1.6100 +	CLogEvent* event = CLogEvent::NewL();
  1.6101 +	CleanupStack::PushL(event);
  1.6102 +
  1.6103 +	CTestActive* active = new(ELeave)CTestActive();
  1.6104 +	CleanupStack::PushL(active);
  1.6105 +
  1.6106 +	TTime now;
  1.6107 +	now.UniversalTime();
  1.6108 +	now += (TTimeIntervalDays)+1;
  1.6109 +
  1.6110 +	// Get rid of all the events in the log
  1.6111 +	active->StartL();
  1.6112 +	aClient.ClearLog(now, active->iStatus);
  1.6113 +	CActiveScheduler::Start();
  1.6114 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6115 +
  1.6116 +	// Get config
  1.6117 +	TLogConfig config;
  1.6118 +	active->StartL();
  1.6119 +	aClient.GetConfig(config, active->iStatus);
  1.6120 +	CActiveScheduler::Start();
  1.6121 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6122 +
  1.6123 +	// Incoming call event
  1.6124 +	event->SetEventType(KLogCallEventTypeUid);
  1.6125 +	TBuf<KLogMaxDirectionLength> buf;
  1.6126 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.6127 +	event->SetDirection(buf);
  1.6128 +
  1.6129 +	// Add max allowed events
  1.6130 +	TInt count = config.iMaxRecentLogSize;
  1.6131 +	while(count--)
  1.6132 +		{
  1.6133 +		event->SetContact(count+1);
  1.6134 +		active->StartL();
  1.6135 +		aClient.AddEvent(*event, active->iStatus);
  1.6136 +		CActiveScheduler::Start();
  1.6137 +		TEST2(active->iStatus.Int(), KErrNone);
  1.6138 +		}
  1.6139 +
  1.6140 +	// Setup normal event view
  1.6141 +	active->StartL();
  1.6142 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.6143 +	CActiveScheduler::Start();
  1.6144 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6145 +
  1.6146 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.6147 +	changeObs2->StartCollectingChanges();
  1.6148 +
  1.6149 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.6150 +	CleanupStack::PushL(recent);
  1.6151 +
  1.6152 +	// Check recent view
  1.6153 +	active->StartL();
  1.6154 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.6155 +	CActiveScheduler::Start();
  1.6156 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6157 +	TEST2(recent->CountL(), config.iMaxRecentLogSize);
  1.6158 +
  1.6159 +	// Clear recent view
  1.6160 +	active->StartL();
  1.6161 +	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
  1.6162 +	CActiveScheduler::Start();
  1.6163 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6164 +
  1.6165 +	// Check that changes work after a backup
  1.6166 +	StartBackupL();
  1.6167 +	DelayL(1000000);
  1.6168 +	TestLogClosedL();
  1.6169 +	EndBackupL();
  1.6170 +	TestLogOpenL();
  1.6171 +
  1.6172 +	count = config.iMaxRecentLogSize;
  1.6173 +	TEST2(changeObs2->Changes().Count(), count);
  1.6174 +	while(count--)
  1.6175 +		{
  1.6176 +		type = changeObs2->Changes().At(count, logId, viewIndex);
  1.6177 +		TEST2(type, ELogChangeTypeEventDeleted);
  1.6178 +		}
  1.6179 +
  1.6180 +	// Check recent view
  1.6181 +	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.6182 +
  1.6183 +	// Check that changes work after a backup
  1.6184 +	StartBackupL();
  1.6185 +	DelayL(1000000);
  1.6186 +	TestLogClosedL();
  1.6187 +	EndBackupL();
  1.6188 +	TestLogOpenL();
  1.6189 +
  1.6190 +	// Check change events
  1.6191 +	User::After(100000);
  1.6192 +	TEST(!changeObs1->HaveChanges());
  1.6193 +
  1.6194 +	CleanupStack::PopAndDestroy(7, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent
  1.6195 +	}
  1.6196 +
  1.6197 +/**
  1.6198 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0964
  1.6199 +@SYMTestCaseDesc	    Tests for log view change observer
  1.6200 +@SYMTestPriority 	    High
  1.6201 +@SYMTestActions  	    Check that a view doesn't get change events when removing events from a recent or duplicate view
  1.6202 +                        Check the test work even after backup operations
  1.6203 +@SYMTestExpectedResults Test must not fail
  1.6204 +@SYMREQ                 REQ0000
  1.6205 +*/
  1.6206 +LOCAL_C void TestHiddenChangeEvents6aL(CLogClient& aClient)
  1.6207 +	{
  1.6208 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0964 "));
  1.6209 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.6210 +	changeObs1->StartCollectingChanges();
  1.6211 +
  1.6212 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.6213 +	CleanupStack::PushL(view);
  1.6214 +
  1.6215 +	CLogFilter* filter = CLogFilter::NewL();
  1.6216 +	CleanupStack::PushL(filter);
  1.6217 +
  1.6218 +	CLogEvent* event = CLogEvent::NewL();
  1.6219 +	CleanupStack::PushL(event);
  1.6220 +
  1.6221 +	CTestActive* active = new(ELeave)CTestActive();
  1.6222 +	CleanupStack::PushL(active);
  1.6223 +
  1.6224 +	TTime now;
  1.6225 +	now.UniversalTime();
  1.6226 +	now += (TTimeIntervalDays)+1;
  1.6227 +
  1.6228 +	// Get rid of all the events in the log
  1.6229 +	active->StartL();
  1.6230 +	aClient.ClearLog(now, active->iStatus);
  1.6231 +	CActiveScheduler::Start();
  1.6232 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6233 +
  1.6234 +	// Incoming call event
  1.6235 +	event->SetEventType(KLogCallEventTypeUid);
  1.6236 +	TBuf<KLogMaxDirectionLength> buf;
  1.6237 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.6238 +	event->SetDirection(buf);
  1.6239 +
  1.6240 +	// Add an event
  1.6241 +	active->StartL();
  1.6242 +	aClient.AddEvent(*event, active->iStatus);
  1.6243 +	CActiveScheduler::Start();
  1.6244 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6245 +
  1.6246 +	// Add a duplicate
  1.6247 +	active->StartL();
  1.6248 +	aClient.AddEvent(*event, active->iStatus);
  1.6249 +	CActiveScheduler::Start();
  1.6250 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6251 +
  1.6252 +	// Setup normal event view
  1.6253 +	active->StartL();
  1.6254 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.6255 +	CActiveScheduler::Start();
  1.6256 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6257 +	TEST(view->CountL() == 2);
  1.6258 +
  1.6259 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.6260 +	changeObs2->StartCollectingChanges();
  1.6261 +
  1.6262 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.6263 +	CleanupStack::PushL(recent);
  1.6264 +
  1.6265 +	// Check recent view
  1.6266 +	active->StartL();
  1.6267 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.6268 +	CActiveScheduler::Start();
  1.6269 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6270 +	TEST2(recent->CountL(), 1);
  1.6271 +
  1.6272 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.6273 +	CleanupStack::PushL(duplicate);
  1.6274 +
  1.6275 +	// Check duplicate count
  1.6276 +	active->StartL();
  1.6277 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.6278 +	CActiveScheduler::Start();
  1.6279 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6280 +	TEST2(recent->CountL(), 1);
  1.6281 +
  1.6282 +	// Remove duplicate
  1.6283 +	duplicate->RemoveL(duplicate->Event().Id());
  1.6284 +
  1.6285 +	// Check that changes work after a backup
  1.6286 +	StartBackupL();
  1.6287 +	DelayL(1000000);
  1.6288 +	TestLogClosedL();
  1.6289 +	EndBackupL();
  1.6290 +	TestLogOpenL();
  1.6291 +
  1.6292 +	// Check change events
  1.6293 +	TEST(!changeObs1->HaveChanges());
  1.6294 +	TEST(!changeObs2->HaveChanges());
  1.6295 +
  1.6296 +	// Remove recent
  1.6297 +	recent->RemoveL(recent->Event().Id());
  1.6298 +
  1.6299 +	// Check that changes work after a backup
  1.6300 +	StartBackupL();
  1.6301 +	DelayL(1000000);
  1.6302 +	TestLogClosedL();
  1.6303 +	EndBackupL();
  1.6304 +	TestLogOpenL();
  1.6305 +
  1.6306 +	TEST(!changeObs1->HaveChanges());
  1.6307 +	TEST(!changeObs2->HaveChanges()); // No event because we should know we called Remove on ourselves
  1.6308 +
  1.6309 +	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.6310 +	}
  1.6311 +
  1.6312 +/**
  1.6313 +@SYMTestCaseID          SYSLIB-LOGENG-CT-0965
  1.6314 +@SYMTestCaseDesc	    Tests for log view change observer
  1.6315 +@SYMTestPriority 	    High
  1.6316 +@SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates
  1.6317 +                        Check the test work even after backup operations
  1.6318 +@SYMTestExpectedResults Test must not fail
  1.6319 +@SYMREQ                 REQ0000
  1.6320 +*/
  1.6321 +LOCAL_C void TestHiddenChangeEvents7aL(CLogClient& aClient)
  1.6322 +	{
  1.6323 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0965 "));
  1.6324 +	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
  1.6325 +	changeObs1->StartCollectingChanges();
  1.6326 +
  1.6327 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
  1.6328 +	CleanupStack::PushL(view);
  1.6329 +
  1.6330 +	CLogFilter* filter = CLogFilter::NewL();
  1.6331 +	CleanupStack::PushL(filter);
  1.6332 +
  1.6333 +	CLogEvent* event = CLogEvent::NewL();
  1.6334 +	CleanupStack::PushL(event);
  1.6335 +
  1.6336 +	CTestActive* active = new(ELeave)CTestActive();
  1.6337 +	CleanupStack::PushL(active);
  1.6338 +
  1.6339 +	TTime now;
  1.6340 +	now.UniversalTime();
  1.6341 +	now += (TTimeIntervalDays)+1;
  1.6342 +
  1.6343 +	// Get rid of all the events in the log
  1.6344 +	active->StartL();
  1.6345 +	aClient.ClearLog(now, active->iStatus);
  1.6346 +	CActiveScheduler::Start();
  1.6347 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6348 +
  1.6349 +	// Incoming call event
  1.6350 +	event->SetEventType(KLogCallEventTypeUid);
  1.6351 +	TBuf<KLogMaxDirectionLength> buf;
  1.6352 +	aClient.GetString(buf, R_LOG_DIR_IN);
  1.6353 +	event->SetDirection(buf);
  1.6354 +
  1.6355 +	// Add an event
  1.6356 +	active->StartL();
  1.6357 +	aClient.AddEvent(*event, active->iStatus);
  1.6358 +	CActiveScheduler::Start();
  1.6359 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6360 +
  1.6361 +	// Add a duplicate
  1.6362 +	active->StartL();
  1.6363 +	aClient.AddEvent(*event, active->iStatus);
  1.6364 +	CActiveScheduler::Start();
  1.6365 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6366 +
  1.6367 +	// Setup normal event view
  1.6368 +	active->StartL();
  1.6369 +	TEST(view->SetFilterL(*filter, active->iStatus));
  1.6370 +	CActiveScheduler::Start();
  1.6371 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6372 +	TEST2(view->CountL(), 2);
  1.6373 +
  1.6374 +	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
  1.6375 +	changeObs2->StartCollectingChanges();
  1.6376 +
  1.6377 +	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
  1.6378 +	CleanupStack::PushL(recent);
  1.6379 +
  1.6380 +	// Check recent view
  1.6381 +	active->StartL();
  1.6382 +	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
  1.6383 +	CActiveScheduler::Start();
  1.6384 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6385 +	TEST2(recent->CountL(), 1);
  1.6386 +
  1.6387 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.6388 +	CleanupStack::PushL(duplicate);
  1.6389 +
  1.6390 +	// Check duplicate count
  1.6391 +	active->StartL();
  1.6392 +	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
  1.6393 +	CActiveScheduler::Start();
  1.6394 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6395 +	TEST2(recent->CountL(), 1);
  1.6396 +
  1.6397 +	// Remove duplicate
  1.6398 +	recent->ClearDuplicatesL();
  1.6399 +
  1.6400 +	// Check that changes work after a backup
  1.6401 +	StartBackupL();
  1.6402 +	DelayL(1000000);
  1.6403 +	TestLogClosedL();
  1.6404 +	EndBackupL();
  1.6405 +	TestLogOpenL();
  1.6406 +
  1.6407 +	// Check change events
  1.6408 +	TEST(!changeObs1->HaveChanges());
  1.6409 +	TEST(!changeObs2->HaveChanges());
  1.6410 +
  1.6411 +	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
  1.6412 +	}
  1.6413 +	
  1.6414 +/**
  1.6415 +@SYMTestCaseID          SYSLIB-LOGENG-CT-3511
  1.6416 +@SYMTestCaseDesc	    Tests an error condition for adding an event.                       
  1.6417 +@SYMTestPriority 	    High
  1.6418 +@SYMTestActions  	    A leave will be caused in an observer when a specific event is added. This test 
  1.6419 +                        ensures by successful test completion that there are no panics in this 
  1.6420 +                        situation.
  1.6421 +@SYMTestExpectedResults Test must not fail
  1.6422 +@SYMDEF                 DEF108741
  1.6423 +*/
  1.6424 +LOCAL_C void DEF108741L(CLogClient& aClient)
  1.6425 +	{
  1.6426 +	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3511 "));
  1.6427 +	// Perform clean up
  1.6428 + 	TestUtils::DeleteDatabaseL();
  1.6429 +
  1.6430 +	// Create a new event 
  1.6431 +	CLogEvent* event = CLogEvent::NewL();
  1.6432 +	CleanupStack::PushL(event);
  1.6433 +	event->SetEventType(KLogCallEventTypeUid);
  1.6434 +
  1.6435 +	CTestActive* active = new(ELeave) CTestActive();
  1.6436 +	CleanupStack::PushL(active);
  1.6437 +
  1.6438 +	// Create a change observer. This observer will cause errors in order to verify that 
  1.6439 +	// the system handles them properly.
  1.6440 +	CLogViewChangeObserverErrorTest* changeObs = CLogViewChangeObserverErrorTest::NewLC();
  1.6441 +
  1.6442 +	// Create a view for the event log  
  1.6443 +	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
  1.6444 +	CleanupStack::PushL(view);
  1.6445 +	
  1.6446 +	// Create a filter to specify what events appear in the view
  1.6447 +	CLogFilter* filter = CLogFilter::NewL();
  1.6448 +	CleanupStack::PushL(filter);
  1.6449 +	TEST(!view->SetFilterL(*filter, active->iStatus));
  1.6450 +	 
  1.6451 +	TInt count;
  1.6452 +	TLogId logId;
  1.6453 +	TInt viewIndex;
  1.6454 + 
  1.6455 + 	// This code adds 3 events with ids 0,1 and 2.
  1.6456 + 	// The observer add event handler :
  1.6457 + 	// CLogViewChangeObserverErrorTest::HandleLogViewChangeEventAddedL
  1.6458 + 	// has been written so that it will leave if an event with log id 1 is added.
  1.6459 + 	// The test completion proves that the leave is dealt with gracefully without 
  1.6460 + 	// any panics.
  1.6461 +	for(count = 0; count < KTestErrorEventNum; count++)
  1.6462 +		{
  1.6463 +		// Add an event to the log database
  1.6464 +		aClient.AddEvent(*event, changeObs->iStatus);
  1.6465 +		CLogChangeDefinition* changes = changeObs->WaitForChangesLC(CLogViewChangeObserver::EStopOnBoth);
  1.6466 +		
  1.6467 +		// Check the results/notifications are as expected
  1.6468 +		TEST2(changeObs->iStatus.Int(), KErrNone);
  1.6469 +		TEST(event->Id() == (TLogId) count);
  1.6470 +		User::After(1);
  1.6471 +		TEST2(changes->Count(), 1);
  1.6472 +		TEST2(changes->At(0, logId, viewIndex), ELogChangeTypeEventAdded);
  1.6473 +		TEST(logId == (TLogId) count);
  1.6474 +		TEST2(viewIndex, 0);
  1.6475 +		CleanupStack::PopAndDestroy(changes);
  1.6476 +		}
  1.6477 + 
  1.6478 +	CleanupStack::PopAndDestroy(5, event); // filter, view, changeObs, active, event
  1.6479 +	}
  1.6480 +
  1.6481 +/**
  1.6482 +@SYMTestCaseID          SYSLIB-LOGENG-CT-3716
  1.6483 +@SYMTestCaseDesc	    Tests for the defect INC108225 
  1.6484 +@SYMTestPriority 	    High
  1.6485 +@SYMTestActions  	    Tests for the count of out call list & the duplicates for CS & PS calls
  1.6486 +						The fields to be considered while finding duplicates records are set in the resource file named LOGWRAP.RSS
  1.6487 +						i.e. duplicate = ELogRemotePartyField|ELogContactField|ELogNumberField;
  1.6488 +						Considering this duplicate value, the where clause in the query is made to find duplicate records.
  1.6489 +@SYMTestExpectedResults Test must not fail
  1.6490 +@SYMDEF                 INC108225
  1.6491 +*/
  1.6492 +LOCAL_C void TestNumberFieldINC108225L(CLogClient& aClient)
  1.6493 +{
  1.6494 +    TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3716 ")); 
  1.6495 +	CLogEvent* event = CLogEvent::NewL();
  1.6496 +	CleanupStack::PushL(event);
  1.6497 +
  1.6498 +	CLogEvent* event1 = CLogEvent::NewL();
  1.6499 +	CleanupStack::PushL(event1);
  1.6500 +
  1.6501 +	CTestActive* active = new(ELeave)CTestActive();
  1.6502 +	CleanupStack::PushL(active);
  1.6503 +
  1.6504 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.6505 +	CleanupStack::PushL(view);
  1.6506 +
  1.6507 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.6508 +	CleanupStack::PushL(duplicate);
  1.6509 +
  1.6510 +	// Make sure there are no entries in any recent lists
  1.6511 +	active->StartL();
  1.6512 +	aClient.ClearLog(KLogRecentOutgoingCalls, active->iStatus);
  1.6513 +	CActiveScheduler::Start();
  1.6514 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6515 +	
  1.6516 +	TLogString buf1;
  1.6517 +	aClient.GetString(buf1, R_LOG_DIR_OUT);
  1.6518 +
  1.6519 +	event->SetEventType(KLogCallEventTypeUid);
  1.6520 +	event->SetDirection(buf1);
  1.6521 +	event->SetDurationType(KLogDurationNone);
  1.6522 +	event->SetContact(KTestContact1);
  1.6523 +	event->SetRemoteParty(KTestRemote1);
  1.6524 +	event->SetNumber(KTestNumber1);
  1.6525 +
  1.6526 +	// Add event 1st CS Call with contact as KTestContact & number as KTestNumber1
  1.6527 +	active->StartL();
  1.6528 +	aClient.AddEvent(*event, active->iStatus);
  1.6529 +	CActiveScheduler::Start();
  1.6530 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6531 +
  1.6532 +	active->StartL();
  1.6533 +	TBool res = view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus);
  1.6534 +	CActiveScheduler::Start();
  1.6535 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6536 +	TEST2(view->CountL(), 1);
  1.6537 +		
  1.6538 +	// Set new event with the same contact details (i.e. KTestContact) and 
  1.6539 +	//...event type as KLogCallEventTypeUid & no number field
  1.6540 +	event1->SetEventType(KLogCallEventTypeUid);
  1.6541 +	event1->SetDirection(buf1);
  1.6542 +	event1->SetDurationType(KLogDurationNone);
  1.6543 +	event1->SetContact(KTestContact1);
  1.6544 +	event1->SetRemoteParty(KTestRemote1);
  1.6545 +	
  1.6546 +	// Add event 1st PS Call with contact as KTestContact1 & Number as Null
  1.6547 +	active->StartL();
  1.6548 +	aClient.AddEvent(*event1, active->iStatus);
  1.6549 +	CActiveScheduler::Start();
  1.6550 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6551 +
  1.6552 +	active->StartL();
  1.6553 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6554 +	CActiveScheduler::Start();
  1.6555 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6556 +	TEST2(view->CountL(), 2);
  1.6557 +	
  1.6558 +	// Add event 2nd CS Call
  1.6559 +	active->StartL();
  1.6560 +	aClient.AddEvent(*event, active->iStatus);
  1.6561 +	CActiveScheduler::Start();
  1.6562 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6563 +
  1.6564 +	active->StartL();
  1.6565 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6566 +	CActiveScheduler::Start();
  1.6567 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6568 +	TEST2(view->CountL(), 2);
  1.6569 +	
  1.6570 +	// Check duplicate count for the last call made i.e. CS call
  1.6571 +	active->StartL();
  1.6572 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6573 +	CActiveScheduler::Start();
  1.6574 +	TEST2(duplicate->CountL(), 1);
  1.6575 +		
  1.6576 +	// Add event 2nd PS Call
  1.6577 +	active->StartL();
  1.6578 +	aClient.AddEvent(*event1, active->iStatus);
  1.6579 +	CActiveScheduler::Start();
  1.6580 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6581 +	
  1.6582 +	active->StartL();
  1.6583 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6584 +	CActiveScheduler::Start();
  1.6585 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6586 +	TEST2(view->CountL(), 2);
  1.6587 +
  1.6588 +	// Check duplicate count for the last call made i.e. PS call
  1.6589 +	active->StartL();
  1.6590 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6591 +	CActiveScheduler::Start();
  1.6592 +	TEST2(duplicate->CountL(), 1);
  1.6593 +	
  1.6594 +	// Add event 3rd CS Call
  1.6595 +	active->StartL();
  1.6596 +	aClient.AddEvent(*event, active->iStatus);
  1.6597 +	CActiveScheduler::Start();
  1.6598 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6599 +	
  1.6600 +	active->StartL();
  1.6601 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6602 +	CActiveScheduler::Start();
  1.6603 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6604 +	TEST2(view->CountL(), 2);
  1.6605 +	
  1.6606 +	// Check duplicate count for the last call made i.e. CS call
  1.6607 +	active->StartL();
  1.6608 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6609 +	CActiveScheduler::Start();
  1.6610 +	TEST2(duplicate->CountL(), 2);
  1.6611 +
  1.6612 +	// Add event 3rd PS Call
  1.6613 +	active->StartL();
  1.6614 +	aClient.AddEvent(*event1, active->iStatus);
  1.6615 +	CActiveScheduler::Start();
  1.6616 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6617 +	
  1.6618 +	active->StartL();
  1.6619 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6620 +	CActiveScheduler::Start();
  1.6621 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6622 +	TEST2(view->CountL(), 2);
  1.6623 +
  1.6624 +	// Check duplicate count for the last call made i.e. PS call
  1.6625 +	active->StartL();
  1.6626 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6627 +	CActiveScheduler::Start();
  1.6628 +	TEST2(duplicate->CountL(), 2);
  1.6629 +		
  1.6630 +	CleanupStack::PopAndDestroy(5);	
  1.6631 +}
  1.6632 +
  1.6633 +/**
  1.6634 +@SYMTestCaseID          SYSLIB-LOGENG-CT-3755
  1.6635 +@SYMTestCaseDesc	    Tests for the changes made in defect INC108225 for other fields 
  1.6636 +@SYMTestPriority 	    High
  1.6637 +@SYMTestActions  	    Tests for the count of out call list & the duplicates for CS calls referring other fields
  1.6638 +						The fields to be considered while finding duplicates records are set in the resource file named LOGWRAP.RSS
  1.6639 +						i.e. duplicate = ELogRemotePartyField|ELogContactField|ELogNumberField;
  1.6640 +						Considering this duplicate value, the where clause in the query is made to find duplicate records.
  1.6641 +@SYMTestExpectedResults Test must not fail
  1.6642 +@SYMDEF                 INC108225
  1.6643 +*/
  1.6644 +LOCAL_C void TestOtherFieldsINC108225L(CLogClient& aClient)
  1.6645 +{
  1.6646 +    TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3755 ")); 
  1.6647 +	CLogEvent* event = CLogEvent::NewL();
  1.6648 +	CleanupStack::PushL(event);
  1.6649 +
  1.6650 +	CTestActive* active = new(ELeave)CTestActive();
  1.6651 +	CleanupStack::PushL(active);
  1.6652 +
  1.6653 +	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
  1.6654 +	CleanupStack::PushL(view);
  1.6655 +
  1.6656 +	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
  1.6657 +	CleanupStack::PushL(duplicate);
  1.6658 +
  1.6659 +	// Make sure there are no entries in any recent lists
  1.6660 +	active->StartL();
  1.6661 +	aClient.ClearLog(KLogRecentOutgoingCalls, active->iStatus);
  1.6662 +	CActiveScheduler::Start();
  1.6663 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6664 +	
  1.6665 +	TLogString buf1;
  1.6666 +	aClient.GetString(buf1, R_LOG_DIR_OUT);
  1.6667 +
  1.6668 +	event->SetEventType(KLogCallEventTypeUid);
  1.6669 +	event->SetDirection(buf1);
  1.6670 +	event->SetContact(KTestContact1);
  1.6671 +	event->SetRemoteParty(KTestRemote1);
  1.6672 +	event->SetNumber(KTestNumber1);
  1.6673 +	event->SetDurationType(KLogDurationNone);
  1.6674 +
  1.6675 +	// Add event 1st CS Call with contact as KTestContact & number as KTestNumber1 &
  1.6676 +	//.. durationtype as KLogDurationNone
  1.6677 +	active->StartL();
  1.6678 +	aClient.AddEvent(*event, active->iStatus);
  1.6679 +	CActiveScheduler::Start();
  1.6680 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6681 +
  1.6682 +	active->StartL();
  1.6683 +	TBool res = view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus);
  1.6684 +	CActiveScheduler::Start();
  1.6685 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6686 +	TEST2(view->CountL(), 1);
  1.6687 +	
  1.6688 +	// Add event 2nd CS Call with duration type as KLogDurationValid
  1.6689 +	event->SetDurationType(KLogDurationValid);
  1.6690 +	
  1.6691 +	active->StartL();
  1.6692 +	aClient.AddEvent(*event, active->iStatus);
  1.6693 +	CActiveScheduler::Start();
  1.6694 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6695 +
  1.6696 +	active->StartL();
  1.6697 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6698 +	CActiveScheduler::Start();
  1.6699 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6700 +	TEST2(view->CountL(), 1);
  1.6701 +	
  1.6702 +	// Check duplicate count for the last call made 
  1.6703 +	active->StartL();
  1.6704 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6705 +	CActiveScheduler::Start();
  1.6706 +	TEST2(duplicate->CountL(), 1);
  1.6707 +	
  1.6708 +	// Add event 3rd CS Call with Flag as KLogNullFlags	
  1.6709 +	event->SetFlags(KLogNullFlags);
  1.6710 +	
  1.6711 +	active->StartL();
  1.6712 +	aClient.AddEvent(*event, active->iStatus);
  1.6713 +	CActiveScheduler::Start();
  1.6714 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6715 +	
  1.6716 +	active->StartL();
  1.6717 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6718 +	CActiveScheduler::Start();
  1.6719 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6720 +	TEST2(view->CountL(), 1);
  1.6721 +	
  1.6722 +	// Check duplicate count for the last call made 
  1.6723 +	active->StartL();
  1.6724 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6725 +	CActiveScheduler::Start();
  1.6726 +	TEST2(duplicate->CountL(), 2);
  1.6727 +	
  1.6728 +	// Add event 4th CS Call with Flag as KLogFlagsMask
  1.6729 +	event->SetFlags(KLogFlagsMask);
  1.6730 +	
  1.6731 +	active->StartL();
  1.6732 +	aClient.AddEvent(*event, active->iStatus);
  1.6733 +	CActiveScheduler::Start();
  1.6734 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6735 +	
  1.6736 +	active->StartL();
  1.6737 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6738 +	CActiveScheduler::Start();
  1.6739 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6740 +	TEST2(view->CountL(), 1);
  1.6741 +	
  1.6742 +	// Check duplicate count for the last call made 
  1.6743 +	active->StartL();
  1.6744 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6745 +	CActiveScheduler::Start();
  1.6746 +	TEST2(duplicate->CountL(), 3);
  1.6747 +
  1.6748 +	// Add event 5th CS Call with Status as KNullDesC
  1.6749 +	event->SetStatus(KNullDesC);
  1.6750 +	
  1.6751 +	active->StartL();
  1.6752 +	aClient.AddEvent(*event, active->iStatus);
  1.6753 +	CActiveScheduler::Start();
  1.6754 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6755 +	
  1.6756 +	active->StartL();
  1.6757 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6758 +	CActiveScheduler::Start();
  1.6759 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6760 +	TEST2(view->CountL(), 1);
  1.6761 +	
  1.6762 +	// Check duplicate count for the last call made 
  1.6763 +	active->StartL();
  1.6764 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6765 +	CActiveScheduler::Start();
  1.6766 +	TEST2(duplicate->CountL(), 4);
  1.6767 +	
  1.6768 +	// Add event 6th CS Call with Status as KTestStatus1
  1.6769 +	event->SetStatus(KTestStatus1);
  1.6770 +	
  1.6771 +	active->StartL();
  1.6772 +	aClient.AddEvent(*event, active->iStatus);
  1.6773 +	CActiveScheduler::Start();
  1.6774 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6775 +	
  1.6776 +	active->StartL();
  1.6777 +	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
  1.6778 +	CActiveScheduler::Start();
  1.6779 +	TEST2(active->iStatus.Int(), KErrNone);
  1.6780 +	TEST2(view->CountL(), 1);
  1.6781 +	
  1.6782 +	// Check duplicate count for the last call made
  1.6783 +	active->StartL();
  1.6784 +	TEST(view->DuplicatesL(*duplicate, active->iStatus));
  1.6785 +	CActiveScheduler::Start();
  1.6786 +	TEST2(duplicate->CountL(), 5);
  1.6787 +	
  1.6788 +	CleanupStack::PopAndDestroy(4);	
  1.6789 +}
  1.6790 +
  1.6791 +/**
  1.6792 +@SYMTestCaseID          PDS-LOGENG-CT-4050
  1.6793 +@SYMTestCaseDesc        Tests for the changes made in defect DEF144552 
  1.6794 +@SYMTestPriority        High
  1.6795 +@SYMTestActions         Tests for the sucessful completion of the following operation - 
  1.6796 +                        1)Applying a filter where the event's start time matches the end time.
  1.6797 +                        2)Clearing the log where the clear log time is 1 microsecs after the 
  1.6798 +                        timestamp of the event.
  1.6799 +@SYMTestExpectedResults Test must not fail
  1.6800 +@SYMREQ                 DEF144552
  1.6801 +*/
  1.6802 +LOCAL_C void DEF144552L(CLogClient& aClient)
  1.6803 +    {
  1.6804 +    TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-CT-4050 ")); 
  1.6805 +    TestUtils::DeleteDatabaseL(EFalse);
  1.6806 +    
  1.6807 +    CTestActive* active = new(ELeave)CTestActive();
  1.6808 +    CleanupStack::PushL(active);
  1.6809 +
  1.6810 +    //Setup the database by adding a event and changing the timestamp for the event
  1.6811 +    //Add 1 event
  1.6812 +    CLogEvent* event = CLogEvent::NewL();
  1.6813 +    CleanupStack::PushL(event);
  1.6814 +    event->SetEventType(KLogCallEventTypeUid);
  1.6815 +    event->SetContact(KTestContact1);
  1.6816 +    event->SetNumber(KTestNumber2);
  1.6817 +    event->SetDuration(0);
  1.6818 +    active->StartL();
  1.6819 +    aClient.AddEvent(*event, active->iStatus);
  1.6820 +    CActiveScheduler::Start();
  1.6821 +    TEST2(active->iStatus.Int(), KErrNone);
  1.6822 +    
  1.6823 +    //Change the event
  1.6824 +    TTime now;
  1.6825 +    now.UniversalTime();
  1.6826 +    event->SetTime(now);
  1.6827 +    active->StartL();
  1.6828 +    aClient.ChangeEvent(*event, active->iStatus);
  1.6829 +    CActiveScheduler::Start();
  1.6830 +    TEST2(active->iStatus.Int(), KErrNone);
  1.6831 +    
  1.6832 +    //Test 1: Setup and apply a filter where the start time matches the end time
  1.6833 +    //If the defect is fixed then the view will contain the event previously added,
  1.6834 +    //Otherwise the time parameters will be truncated and the event will not be found
  1.6835 +    
  1.6836 +    //Setup filter so that the start and the end time matches
  1.6837 +    CLogFilter* filter = CLogFilter::NewL();
  1.6838 +    CleanupStack::PushL(filter);
  1.6839 +    filter->SetStartTime(now);
  1.6840 +    filter->SetEndTime(now);
  1.6841 +    
  1.6842 +    //Apply the filter and check that 1 event is in the view
  1.6843 +    CLogViewEvent* view = CLogViewEvent::NewL(aClient);
  1.6844 +    CleanupStack::PushL(view);
  1.6845 +    active->StartL();
  1.6846 +    TEST(view->SetFilterL(*filter, active->iStatus));
  1.6847 +    CActiveScheduler::Start();
  1.6848 +    TEST2(active->iStatus.Int(), KErrNone);
  1.6849 +    TEST2(view->CountL(), 1);
  1.6850 +    
  1.6851 +    //Retrieve and check the event
  1.6852 +    active->StartL();
  1.6853 +    TEST(view->FirstL(active->iStatus));
  1.6854 +    CActiveScheduler::Start();
  1.6855 +    TEST2(active->iStatus.Int(), KErrNone);
  1.6856 +    const CLogEvent& currentEvent(view->Event());
  1.6857 +    TEST2(currentEvent.EventType().iUid, KLogCallEventTypeUid.iUid);
  1.6858 +    TEST2(currentEvent.Duration(), 0);
  1.6859 +    TEST2(currentEvent.Time().Int64(), now.Int64());
  1.6860 +    
  1.6861 +    // Test 2: Clearing a log where the time specified in ClearLog() is just
  1.6862 +    // after the timestamp of the event by 1 microsecond. If the defect is fixed
  1.6863 +    // then the event will be deleted. However if the defect is not fixed then the
  1.6864 +    // time specified in ClearLog() will be truncated and the event will not be 
  1.6865 +    // deleted
  1.6866 +    
  1.6867 +    //Clear the log
  1.6868 +    active->StartL();
  1.6869 +    TTimeIntervalMicroSeconds microsecond(1);
  1.6870 +    now += microsecond;
  1.6871 +    aClient.ClearLog(now, active->iStatus);
  1.6872 +    CActiveScheduler::Start();
  1.6873 +    TEST2(active->iStatus.Int(), KErrNone);
  1.6874 +    
  1.6875 +    //Check that the event has been deleted in the view
  1.6876 +    CleanupStack::PopAndDestroy(2);
  1.6877 +    view = CLogViewEvent::NewL(aClient);
  1.6878 +    CleanupStack::PushL(view);
  1.6879 +    filter = CLogFilter::NewL();
  1.6880 +    CleanupStack::PushL(filter);
  1.6881 +    active->StartL();
  1.6882 +    TEST(!view->SetFilterL(*filter, active->iStatus));
  1.6883 +
  1.6884 +    CleanupStack::PopAndDestroy(4, active); 
  1.6885 +    }
  1.6886 +
  1.6887 +void doTestsL()
  1.6888 +	{
  1.6889 +	TestUtils::Initialize(_L("t_logview2"));
  1.6890 +	TestUtils::DeleteDatabaseL();
  1.6891 +
  1.6892 +	CLogClient* client = CLogClient::NewL(theFs);
  1.6893 +	CleanupStack::PushL(client);
  1.6894 +
  1.6895 +	CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
  1.6896 +	CleanupStack::PushL(notifier);	
  1.6897 +
  1.6898 +	TheTest.Start(_L("Event View With Filter List"));
  1.6899 +	TestEventViewWithFilterListL(*client);
  1.6900 +	theLog.Write(_L8("Test 1 OK\n"));
  1.6901 +
  1.6902 +	TheTest.Next(_L("View change observer"));
  1.6903 +	TestViewChangeEventsL(*client);
  1.6904 +	theLog.Write(_L8("Test 2 OK\n"));
  1.6905 +
  1.6906 +	TheTest.Next(_L("Recent View With Filter"));
  1.6907 +	TestRecentViewWithFilterL(*client);
  1.6908 +	theLog.Write(_L8("Test 3 OK\n"));
  1.6909 +
  1.6910 +	TheTest.Next(_L("Recent View With Filter List"));
  1.6911 +	TestRecentViewWithFilterListL(*client);
  1.6912 +	theLog.Write(_L8("Test 4 OK\n"));
  1.6913 +
  1.6914 +	TheTest.Next(_L("Duplicate View With Filter"));
  1.6915 +	TestDuplicateViewWithFilterL(*client);
  1.6916 +	theLog.Write(_L8("Test 5 OK\n"));
  1.6917 +
  1.6918 +	TheTest.Next(_L("Duplicate View With Filter List"));
  1.6919 +	TestDuplicateViewWithFilterListL(*client);
  1.6920 +	theLog.Write(_L8("Test 6 OK\n"));
  1.6921 +
  1.6922 +	TheTest.Next(_L("Querying Event View For Null Fields"));
  1.6923 +	TestEventViewForNullFieldsL(*client);
  1.6924 +	theLog.Write(_L8("Test 7 OK\n"));
  1.6925 +
  1.6926 +	TheTest.Next(_L("Querying Recent View For Null Fields"));
  1.6927 +	TestRecentViewForNullFieldsL(*client);
  1.6928 +	theLog.Write(_L8("Test 8 OK\n"));
  1.6929 +
  1.6930 +	TheTest.Next(_L("Querying Duplicate View For Null Fields"));
  1.6931 +	TestDuplicateViewForNullFieldsL(*client);
  1.6932 +	theLog.Write(_L8("Test 9 OK\n"));
  1.6933 +
  1.6934 +	TheTest.Next(_L("Querying Event View For Flags"));
  1.6935 +	TestEventViewForFlagsL(*client);
  1.6936 +	theLog.Write(_L8("Test 10 OK\n"));
  1.6937 +
  1.6938 +	TheTest.Next(_L("Querying Recent View For Flags"));
  1.6939 +	TestRecentViewForFlagsL(*client);
  1.6940 +	theLog.Write(_L8("Test 11 OK\n"));
  1.6941 +
  1.6942 +	TheTest.Next(_L("Querying Duplicate View For Flags"));
  1.6943 +	TestDuplicateViewForFlagsL(*client);
  1.6944 +	theLog.Write(_L8("Test 12 OK\n"));
  1.6945 +
  1.6946 +	TheTest.Next(_L("Removing Recent Events"));
  1.6947 +	TestRemovingRecentEventsL(*client);
  1.6948 +	theLog.Write(_L8("Test 13 OK\n"));
  1.6949 +
  1.6950 +	TheTest.Next(_L("Removing Duplicate Events"));
  1.6951 +	TestRemovingDuplicateEventsL(*client);
  1.6952 +	theLog.Write(_L8("Test 14 OK\n"));
  1.6953 +
  1.6954 +	TheTest.Next(_L("Multiple Views"));
  1.6955 +	TestMultipleViews1L(*client);
  1.6956 +	TestMultipleViews2L(*client);
  1.6957 +	theLog.Write(_L8("Test 15 OK\n"));
  1.6958 +	
  1.6959 +	TheTest.Next(_L("Test _ALT Events In Recent List")); 
  1.6960 +	TestAltEventsInRecentListL(*client);   
  1.6961 +	theLog.Write(_L8("Test 16 OK\n"));
  1.6962 +
  1.6963 +	TheTest.Next(_L("Test filtering Events by time")); 
  1.6964 +	// This TEST sets system's 'Home Time'
  1.6965 +	TestFilterByTimeL(*client);
  1.6966 +	theLog.Write(_L8("Test 17 OK\n"));
  1.6967 +
  1.6968 +	TheTest.Next(_L("Test hidden change events")); 
  1.6969 +	TestUtils::DeleteDatabaseL();
  1.6970 +	TestHiddenChangeEvents1L(*client);
  1.6971 +	TestHiddenChangeEvents1aL(*client);
  1.6972 +	TestHiddenChangeEvents2L(*client);
  1.6973 +	TestHiddenChangeEvents2aL(*client);
  1.6974 +	TestHiddenChangeEvents3L(*client);
  1.6975 +	TestHiddenChangeEvents3aL(*client);
  1.6976 +	TestHiddenChangeEvents4L(*client);
  1.6977 +	TestHiddenChangeEvents4aL(*client);
  1.6978 +	TestHiddenChangeEvents5L(*client);
  1.6979 +	TestHiddenChangeEvents5aL(*client);
  1.6980 +	TestHiddenChangeEvents6L(*client);
  1.6981 +	TestHiddenChangeEvents6aL(*client);
  1.6982 +	TestHiddenChangeEvents7L(*client);
  1.6983 +	TestHiddenChangeEvents7aL(*client);
  1.6984 +	theLog.Write(_L8("Test 18 OK\n"));
  1.6985 +
  1.6986 +	TheTest.Next(_L("Changing events and recent views"));
  1.6987 +	TestChangeEventRecentView1L(*client);
  1.6988 +	TestChangeEventRecentView2L(*client);
  1.6989 +	TestChangeEventRecentViewAndPurgeL(*client);
  1.6990 +	TestChangeEventRecentViewRemoveL(*client);
  1.6991 +	theLog.Write(_L8("Test 19 OK\n"));
  1.6992 +
  1.6993 +	TheTest.Next(_L("Test for DEF066296"));
  1.6994 +	DEF066296L(*client);
  1.6995 +	TheTest.Next(_L("Test for DEF087459"));
  1.6996 +	DEF087459L(*client);
  1.6997 +	theLog.Write(_L8("Test 20 OK\n"));
  1.6998 +
  1.6999 +	TheTest.Next(_L("Event View With Filter List containing StartTime and EndTime"));
  1.7000 +	TestEventViewWithTimestampsInFilterListL(*client);
  1.7001 +	theLog.Write(_L8("Test 21 OK\n"));
  1.7002 +		
  1.7003 +	TheTest.Next(_L("Test for DEF108741 - View change observer, error condition"));
  1.7004 +	DEF108741L(*client);
  1.7005 +	theLog.Write(_L8("Test 22 OK\n"));
  1.7006 +	
  1.7007 +	TheTest.Next(_L("Test Defect INC108225: Call history check for the CS & PS(VOIP) calls "));
  1.7008 +	TestNumberFieldINC108225L(*client);
  1.7009 +	TestOtherFieldsINC108225L(*client);
  1.7010 +	theLog.Write(_L8("Test 23 OK\n"));
  1.7011 +
  1.7012 +	TheTest.Next(_L("Test Defect DEF144552: CLogFilter doesn't work when Starttime is the same as EndTime"));
  1.7013 +	DEF144552L(*client);
  1.7014 +	theLog.Write(_L8("Test 24 OK\n"));
  1.7015 +	
  1.7016 +	CleanupStack::PopAndDestroy(2); // client, notifier
  1.7017 +	}