os/persistentdata/loggingservices/eventlogger/test/src/t_logview2.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <s32file.h>
sl@0
    17
#include <logeng.h>
sl@0
    18
#include <tz.h>
sl@0
    19
#include "t_logutil2.h"
sl@0
    20
#include <logview.h>
sl@0
    21
sl@0
    22
RTest TheTest(_L("t_logview2"));
sl@0
    23
sl@0
    24
const TInt KTestEventNum = 20;
sl@0
    25
const TInt KTestErrorEventNum = 3;
sl@0
    26
const TLogContactItemId KTestContact1 = 0x123;
sl@0
    27
const TLogContactItemId KTestContact2 = 0x456;
sl@0
    28
const TLogContactItemId KTestContact3 = 0x789;
sl@0
    29
_LIT(KTestDirection1, "Direction Test 1");
sl@0
    30
_LIT(KTestDirection2, "Direction Test 2");
sl@0
    31
_LIT(KTestDirection3, "Direction Test 3");
sl@0
    32
_LIT(KTestNumber1, "Number Test 1");
sl@0
    33
_LIT(KTestNumber2, "Number Test 2");
sl@0
    34
_LIT(KTestNumber3, "Number Test 3");
sl@0
    35
_LIT(KTestRemote1, "Remote Test 1");
sl@0
    36
_LIT(KTestRemote2, "Remote Test 2");
sl@0
    37
_LIT(KTestRemote3, "Remote Test 3");
sl@0
    38
_LIT(KTestStatus1, "Status Test 1");
sl@0
    39
_LIT(KTestStatus2, "Status Test 2");
sl@0
    40
_LIT(KTestStatus3, "Status Test 3");
sl@0
    41
_LIT(KTestSubject, "Test Subject");
sl@0
    42
const TLogLink KTestLink = 0x123456;
sl@0
    43
_LIT8(KTestData, "Test data");
sl@0
    44
sl@0
    45
/**
sl@0
    46
@SYMTestCaseID          SYSLIB-LOGENG-CT-0930
sl@0
    47
@SYMTestCaseDesc	    Tests for the functionality of CLogViewEvent,CLogFilter classes
sl@0
    48
@SYMTestPriority 	    High
sl@0
    49
@SYMTestActions  	    Tests for event view after setting filter on the views.
sl@0
    50
                        Change the filter list configuration and test for the view
sl@0
    51
@SYMTestExpectedResults Test must not fail
sl@0
    52
@SYMREQ                 REQ0000
sl@0
    53
*/
sl@0
    54
LOCAL_C void TestEventViewWithFilterListL(CLogClient& aClient)
sl@0
    55
	{
sl@0
    56
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0930 "));
sl@0
    57
	CTestActive* active = new(ELeave)CTestActive;
sl@0
    58
	CleanupStack::PushL(active);
sl@0
    59
sl@0
    60
	CLogEvent* event = CLogEvent::NewL();
sl@0
    61
	CleanupStack::PushL(event);
sl@0
    62
sl@0
    63
	event->SetEventType(KLogCallEventTypeUid);
sl@0
    64
	event->SetContact(KTestContact1);
sl@0
    65
	event->SetDirection(KTestDirection1);
sl@0
    66
	event->SetDurationType(KLogDurationNone);
sl@0
    67
	event->SetNumber(KTestNumber1);
sl@0
    68
	event->SetRemoteParty(KTestRemote1);
sl@0
    69
	event->SetStatus(KTestStatus1);
sl@0
    70
sl@0
    71
	// Add event
sl@0
    72
	active->StartL();
sl@0
    73
	aClient.AddEvent(*event, active->iStatus);
sl@0
    74
	CActiveScheduler::Start();
sl@0
    75
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
    76
sl@0
    77
	event->SetEventType(KLogDataEventTypeUid);
sl@0
    78
	event->SetContact(KTestContact2);
sl@0
    79
	event->SetDirection(KTestDirection2);
sl@0
    80
	event->SetDurationType(KLogDurationValid);
sl@0
    81
	event->SetNumber(KTestNumber2);
sl@0
    82
	event->SetRemoteParty(KTestRemote2);
sl@0
    83
	event->SetStatus(KTestStatus2);
sl@0
    84
sl@0
    85
	// Add event
sl@0
    86
	active->StartL();
sl@0
    87
	aClient.AddEvent(*event, active->iStatus);
sl@0
    88
	CActiveScheduler::Start();
sl@0
    89
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
    90
sl@0
    91
	event->SetEventType(KLogFaxEventTypeUid);
sl@0
    92
	event->SetContact(KTestContact3);
sl@0
    93
	event->SetDirection(KTestDirection3);
sl@0
    94
	event->SetDurationType(KLogDurationData);
sl@0
    95
	event->SetNumber(KTestNumber3);
sl@0
    96
	event->SetRemoteParty(KTestRemote3);
sl@0
    97
	event->SetStatus(KTestStatus3);
sl@0
    98
sl@0
    99
	// Add event
sl@0
   100
	active->StartL();
sl@0
   101
	aClient.AddEvent(*event, active->iStatus);
sl@0
   102
	CActiveScheduler::Start();
sl@0
   103
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   104
sl@0
   105
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   106
	CleanupStack::PushL(list);
sl@0
   107
sl@0
   108
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
   109
	CleanupStack::PushL(view);
sl@0
   110
sl@0
   111
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   112
	CleanupStack::PushL(filter);
sl@0
   113
	
sl@0
   114
	// Set filter
sl@0
   115
	filter->SetContact(KTestContact1);
sl@0
   116
sl@0
   117
	list->AppendL(filter);
sl@0
   118
	CleanupStack::Pop(); // filter
sl@0
   119
sl@0
   120
	// Test View
sl@0
   121
	active->StartL();
sl@0
   122
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   123
	CActiveScheduler::Start();
sl@0
   124
	TEST2(view->CountL(),1);
sl@0
   125
sl@0
   126
	filter = CLogFilter::NewL();
sl@0
   127
	CleanupStack::PushL(filter);
sl@0
   128
	
sl@0
   129
	// Set filter
sl@0
   130
	filter->SetContact(KTestContact2);
sl@0
   131
sl@0
   132
	list->AppendL(filter);
sl@0
   133
	CleanupStack::Pop(); // filter
sl@0
   134
sl@0
   135
	// Test View
sl@0
   136
	active->StartL();
sl@0
   137
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   138
	CActiveScheduler::Start();
sl@0
   139
	TEST2(view->CountL(), 2);
sl@0
   140
sl@0
   141
	filter = CLogFilter::NewL();
sl@0
   142
	CleanupStack::PushL(filter);
sl@0
   143
	
sl@0
   144
	// Set filter
sl@0
   145
	filter->SetContact(KTestContact3);
sl@0
   146
sl@0
   147
	list->AppendL(filter);
sl@0
   148
	CleanupStack::Pop(); // filter
sl@0
   149
sl@0
   150
	// Test View
sl@0
   151
	active->StartL();
sl@0
   152
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   153
	CActiveScheduler::Start();
sl@0
   154
	TEST2(view->CountL(), 3);
sl@0
   155
sl@0
   156
	list->ResetAndDestroy();
sl@0
   157
sl@0
   158
	/////////////////////////////////////////
sl@0
   159
sl@0
   160
	filter = CLogFilter::NewL();
sl@0
   161
	CleanupStack::PushL(filter);
sl@0
   162
	
sl@0
   163
	// Set filter
sl@0
   164
	filter->SetContact(KTestContact1);
sl@0
   165
	filter->SetDirection(KTestDirection1);
sl@0
   166
sl@0
   167
	list->AppendL(filter);
sl@0
   168
	CleanupStack::Pop(); // filter
sl@0
   169
sl@0
   170
	// Test View
sl@0
   171
	active->StartL();
sl@0
   172
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   173
	CActiveScheduler::Start();
sl@0
   174
	TEST2(view->CountL(), 1);
sl@0
   175
sl@0
   176
	filter = CLogFilter::NewL();
sl@0
   177
	CleanupStack::PushL(filter);
sl@0
   178
	
sl@0
   179
	// Set filter
sl@0
   180
	filter->SetContact(KTestContact2);
sl@0
   181
	filter->SetDirection(KTestDirection2);
sl@0
   182
sl@0
   183
	list->AppendL(filter);
sl@0
   184
	CleanupStack::Pop(); // filter
sl@0
   185
sl@0
   186
	// Test View
sl@0
   187
	active->StartL();
sl@0
   188
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   189
	CActiveScheduler::Start();
sl@0
   190
	TEST2(view->CountL(), 2);
sl@0
   191
sl@0
   192
	filter = CLogFilter::NewL();
sl@0
   193
	CleanupStack::PushL(filter);
sl@0
   194
	
sl@0
   195
	// Set filter
sl@0
   196
	filter->SetContact(KTestContact3);
sl@0
   197
	filter->SetDirection(KTestDirection3);
sl@0
   198
sl@0
   199
	list->AppendL(filter);
sl@0
   200
	CleanupStack::Pop(); // filter
sl@0
   201
sl@0
   202
	// Test View
sl@0
   203
	active->StartL();
sl@0
   204
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   205
	CActiveScheduler::Start();
sl@0
   206
	TEST2(view->CountL(), 3);
sl@0
   207
sl@0
   208
	list->ResetAndDestroy();
sl@0
   209
sl@0
   210
	/////////////////////////////////////////
sl@0
   211
sl@0
   212
	filter = CLogFilter::NewL();
sl@0
   213
	CleanupStack::PushL(filter);
sl@0
   214
	
sl@0
   215
	// Set filter
sl@0
   216
	filter->SetContact(KTestContact1);
sl@0
   217
	filter->SetDirection(KTestDirection1);
sl@0
   218
	filter->SetDurationType(KLogDurationNone);
sl@0
   219
sl@0
   220
	list->AppendL(filter);
sl@0
   221
	CleanupStack::Pop(); // filter
sl@0
   222
sl@0
   223
	// Test View
sl@0
   224
	active->StartL();
sl@0
   225
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   226
	CActiveScheduler::Start();
sl@0
   227
	TEST2(view->CountL(), 1);
sl@0
   228
sl@0
   229
	filter = CLogFilter::NewL();
sl@0
   230
	CleanupStack::PushL(filter);
sl@0
   231
	
sl@0
   232
	// Set filter
sl@0
   233
	filter->SetContact(KTestContact2);
sl@0
   234
	filter->SetDirection(KTestDirection2);
sl@0
   235
	filter->SetDurationType(KLogDurationValid);
sl@0
   236
sl@0
   237
	list->AppendL(filter);
sl@0
   238
	CleanupStack::Pop(); // filter
sl@0
   239
sl@0
   240
	// Test View
sl@0
   241
	active->StartL();
sl@0
   242
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   243
	CActiveScheduler::Start();
sl@0
   244
	TEST2(view->CountL(), 2);
sl@0
   245
sl@0
   246
	filter = CLogFilter::NewL();
sl@0
   247
	CleanupStack::PushL(filter);
sl@0
   248
	
sl@0
   249
	// Set filter
sl@0
   250
	filter->SetContact(KTestContact3);
sl@0
   251
	filter->SetDirection(KTestDirection3);
sl@0
   252
	filter->SetDurationType(KLogDurationData);
sl@0
   253
sl@0
   254
	list->AppendL(filter);
sl@0
   255
	CleanupStack::Pop(); // filter
sl@0
   256
sl@0
   257
	// Test View
sl@0
   258
	active->StartL();
sl@0
   259
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   260
	CActiveScheduler::Start();
sl@0
   261
	TEST2(view->CountL(), 3);
sl@0
   262
sl@0
   263
	list->ResetAndDestroy();
sl@0
   264
sl@0
   265
	/////////////////////////////////////////
sl@0
   266
sl@0
   267
	filter = CLogFilter::NewL();
sl@0
   268
	CleanupStack::PushL(filter);
sl@0
   269
	
sl@0
   270
	// Set filter
sl@0
   271
	filter->SetContact(KTestContact1);
sl@0
   272
	filter->SetDirection(KTestDirection1);
sl@0
   273
	filter->SetDurationType(KLogDurationNone);
sl@0
   274
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   275
sl@0
   276
	list->AppendL(filter);
sl@0
   277
	CleanupStack::Pop(); // filter
sl@0
   278
sl@0
   279
	// Test View
sl@0
   280
	active->StartL();
sl@0
   281
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   282
	CActiveScheduler::Start();
sl@0
   283
	TEST2(view->CountL(), 1);
sl@0
   284
sl@0
   285
	filter = CLogFilter::NewL();
sl@0
   286
	CleanupStack::PushL(filter);
sl@0
   287
	
sl@0
   288
	// Set filter
sl@0
   289
	filter->SetContact(KTestContact2);
sl@0
   290
	filter->SetDirection(KTestDirection2);
sl@0
   291
	filter->SetDurationType(KLogDurationValid);
sl@0
   292
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
   293
sl@0
   294
	list->AppendL(filter);
sl@0
   295
	CleanupStack::Pop(); // filter
sl@0
   296
sl@0
   297
	// Test View
sl@0
   298
	active->StartL();
sl@0
   299
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   300
	CActiveScheduler::Start();
sl@0
   301
	TEST2(view->CountL(), 2);
sl@0
   302
sl@0
   303
	filter = CLogFilter::NewL();
sl@0
   304
	CleanupStack::PushL(filter);
sl@0
   305
	
sl@0
   306
	// Set filter
sl@0
   307
	filter->SetContact(KTestContact3);
sl@0
   308
	filter->SetDirection(KTestDirection3);
sl@0
   309
	filter->SetDurationType(KLogDurationData);
sl@0
   310
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
   311
sl@0
   312
	list->AppendL(filter);
sl@0
   313
	CleanupStack::Pop(); // filter
sl@0
   314
sl@0
   315
	// Test View
sl@0
   316
	active->StartL();
sl@0
   317
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   318
	CActiveScheduler::Start();
sl@0
   319
	TEST2(view->CountL(), 3);
sl@0
   320
sl@0
   321
	list->ResetAndDestroy();
sl@0
   322
sl@0
   323
	/////////////////////////////////////////
sl@0
   324
sl@0
   325
	filter = CLogFilter::NewL();
sl@0
   326
	CleanupStack::PushL(filter);
sl@0
   327
	
sl@0
   328
	// Set filter
sl@0
   329
	filter->SetContact(KTestContact1);
sl@0
   330
	filter->SetDirection(KTestDirection1);
sl@0
   331
	filter->SetDurationType(KLogDurationNone);
sl@0
   332
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   333
	filter->SetNumber(KTestNumber1);
sl@0
   334
sl@0
   335
	list->AppendL(filter);
sl@0
   336
	CleanupStack::Pop(); // filter
sl@0
   337
sl@0
   338
	// Test View
sl@0
   339
	active->StartL();
sl@0
   340
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   341
	CActiveScheduler::Start();
sl@0
   342
	TEST2(view->CountL(), 1);
sl@0
   343
sl@0
   344
	filter = CLogFilter::NewL();
sl@0
   345
	CleanupStack::PushL(filter);
sl@0
   346
	
sl@0
   347
	// Set filter
sl@0
   348
	filter->SetContact(KTestContact2);
sl@0
   349
	filter->SetDirection(KTestDirection2);
sl@0
   350
	filter->SetDurationType(KLogDurationValid);
sl@0
   351
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
   352
	filter->SetNumber(KTestNumber2);
sl@0
   353
sl@0
   354
	list->AppendL(filter);
sl@0
   355
	CleanupStack::Pop(); // filter
sl@0
   356
sl@0
   357
	// Test View
sl@0
   358
	active->StartL();
sl@0
   359
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   360
	CActiveScheduler::Start();
sl@0
   361
	TEST2(view->CountL(), 2);
sl@0
   362
sl@0
   363
	filter = CLogFilter::NewL();
sl@0
   364
	CleanupStack::PushL(filter);
sl@0
   365
	
sl@0
   366
	// Set filter
sl@0
   367
	filter->SetContact(KTestContact3);
sl@0
   368
	filter->SetDirection(KTestDirection3);
sl@0
   369
	filter->SetDurationType(KLogDurationData);
sl@0
   370
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
   371
	filter->SetNumber(KTestNumber3);
sl@0
   372
sl@0
   373
	list->AppendL(filter);
sl@0
   374
	CleanupStack::Pop(); // filter
sl@0
   375
sl@0
   376
	// Test View
sl@0
   377
	active->StartL();
sl@0
   378
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   379
	CActiveScheduler::Start();
sl@0
   380
	TEST2(view->CountL(), 3);
sl@0
   381
sl@0
   382
	list->ResetAndDestroy();
sl@0
   383
sl@0
   384
	/////////////////////////////////////////
sl@0
   385
sl@0
   386
	filter = CLogFilter::NewL();
sl@0
   387
	CleanupStack::PushL(filter);
sl@0
   388
	
sl@0
   389
	// Set filter
sl@0
   390
	filter->SetContact(KTestContact1);
sl@0
   391
	filter->SetDirection(KTestDirection1);
sl@0
   392
	filter->SetDurationType(KLogDurationNone);
sl@0
   393
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   394
	filter->SetNumber(KTestNumber1);
sl@0
   395
	filter->SetRemoteParty(KTestRemote1);
sl@0
   396
sl@0
   397
	list->AppendL(filter);
sl@0
   398
	CleanupStack::Pop(); // filter
sl@0
   399
sl@0
   400
	// Test View
sl@0
   401
	active->StartL();
sl@0
   402
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   403
	CActiveScheduler::Start();
sl@0
   404
	TEST2(view->CountL(), 1);
sl@0
   405
sl@0
   406
	filter = CLogFilter::NewL();
sl@0
   407
	CleanupStack::PushL(filter);
sl@0
   408
	
sl@0
   409
	// Set filter
sl@0
   410
	filter->SetContact(KTestContact2);
sl@0
   411
	filter->SetDirection(KTestDirection2);
sl@0
   412
	filter->SetDurationType(KLogDurationValid);
sl@0
   413
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
   414
	filter->SetNumber(KTestNumber2);
sl@0
   415
	filter->SetRemoteParty(KTestRemote2);
sl@0
   416
sl@0
   417
	list->AppendL(filter);
sl@0
   418
	CleanupStack::Pop(); // filter
sl@0
   419
sl@0
   420
	// Test View
sl@0
   421
	active->StartL();
sl@0
   422
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   423
	CActiveScheduler::Start();
sl@0
   424
	TEST2(view->CountL(), 2);
sl@0
   425
sl@0
   426
	filter = CLogFilter::NewL();
sl@0
   427
	CleanupStack::PushL(filter);
sl@0
   428
	
sl@0
   429
	// Set filter
sl@0
   430
	filter->SetContact(KTestContact3);
sl@0
   431
	filter->SetDirection(KTestDirection3);
sl@0
   432
	filter->SetDurationType(KLogDurationData);
sl@0
   433
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
   434
	filter->SetNumber(KTestNumber3);
sl@0
   435
	filter->SetRemoteParty(KTestRemote3);
sl@0
   436
sl@0
   437
	list->AppendL(filter);
sl@0
   438
	CleanupStack::Pop(); // filter
sl@0
   439
sl@0
   440
	// Test View
sl@0
   441
	active->StartL();
sl@0
   442
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   443
	CActiveScheduler::Start();
sl@0
   444
	TEST2(view->CountL(), 3);
sl@0
   445
sl@0
   446
	list->ResetAndDestroy();
sl@0
   447
sl@0
   448
	/////////////////////////////////////////
sl@0
   449
sl@0
   450
	filter = CLogFilter::NewL();
sl@0
   451
	CleanupStack::PushL(filter);
sl@0
   452
	
sl@0
   453
	// Set filter
sl@0
   454
	filter->SetContact(KTestContact1);
sl@0
   455
	filter->SetDirection(KTestDirection1);
sl@0
   456
	filter->SetDurationType(KLogDurationNone);
sl@0
   457
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   458
	filter->SetNumber(KTestNumber1);
sl@0
   459
	filter->SetRemoteParty(KTestRemote1);
sl@0
   460
	filter->SetStatus(KTestStatus1);
sl@0
   461
sl@0
   462
	list->AppendL(filter);
sl@0
   463
	CleanupStack::Pop(); // filter
sl@0
   464
sl@0
   465
	// Test View
sl@0
   466
	active->StartL();
sl@0
   467
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   468
	CActiveScheduler::Start();
sl@0
   469
	TEST2(view->CountL(), 1);
sl@0
   470
sl@0
   471
	filter = CLogFilter::NewL();
sl@0
   472
	CleanupStack::PushL(filter);
sl@0
   473
	
sl@0
   474
	// Set filter
sl@0
   475
	filter->SetContact(KTestContact2);
sl@0
   476
	filter->SetDirection(KTestDirection2);
sl@0
   477
	filter->SetDurationType(KLogDurationValid);
sl@0
   478
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
   479
	filter->SetNumber(KTestNumber2);
sl@0
   480
	filter->SetRemoteParty(KTestRemote2);
sl@0
   481
	filter->SetStatus(KTestStatus2);
sl@0
   482
sl@0
   483
	list->AppendL(filter);
sl@0
   484
	CleanupStack::Pop(); // filter
sl@0
   485
sl@0
   486
	// Test View
sl@0
   487
	active->StartL();
sl@0
   488
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   489
	CActiveScheduler::Start();
sl@0
   490
	TEST2(view->CountL(), 2);
sl@0
   491
sl@0
   492
	filter = CLogFilter::NewL();
sl@0
   493
	CleanupStack::PushL(filter);
sl@0
   494
	
sl@0
   495
	// Set filter
sl@0
   496
	filter->SetContact(KTestContact3);
sl@0
   497
	filter->SetDirection(KTestDirection3);
sl@0
   498
	filter->SetDurationType(KLogDurationData);
sl@0
   499
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
   500
	filter->SetNumber(KTestNumber3);
sl@0
   501
	filter->SetRemoteParty(KTestRemote3);
sl@0
   502
	filter->SetStatus(KTestStatus3);
sl@0
   503
sl@0
   504
	list->AppendL(filter);
sl@0
   505
	CleanupStack::Pop(); // filter
sl@0
   506
sl@0
   507
	// Test View
sl@0
   508
	active->StartL();
sl@0
   509
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   510
	CActiveScheduler::Start();
sl@0
   511
	TEST2(view->CountL(), 3);
sl@0
   512
sl@0
   513
	list->ResetAndDestroy();
sl@0
   514
sl@0
   515
	CleanupStack::PopAndDestroy(4); // list, view, event, active
sl@0
   516
	}
sl@0
   517
sl@0
   518
/**
sl@0
   519
@SYMTestCaseID          SYSLIB-LOGENG-CT-3432
sl@0
   520
@SYMTestCaseDesc	    Test the functionality of CLogViewEvent::SetFilterL with the CLogFilterList parameter containing multiple filters with start time and end time.
sl@0
   521
@SYMTestPriority 	    High
sl@0
   522
@SYMTestActions  	    1. Add 2 events.
sl@0
   523
						2. Setup a CLogFilterList with two filters targeting the first event. Both filters have start and end time. Call SetFilterL.
sl@0
   524
						3. Verify view has 1 event and no LogServ panic.
sl@0
   525
						4. Clear the filter list.
sl@0
   526
						5. Setup filter for first event with start and end time. Call SetFilterL.
sl@0
   527
						6. Verify view has one event.
sl@0
   528
                        7. Setup second filter for second event with start and end time. Append this filter to filter list and call SetFilterL.
sl@0
   529
						8. Verify view has 2 events and no LogServ panic.
sl@0
   530
@SYMTestExpectedResults Log view has expected number of events and no LogServ panic.
sl@0
   531
@SYMDEF                 INC102412
sl@0
   532
*/
sl@0
   533
LOCAL_C void TestEventViewWithTimestampsInFilterListL(CLogClient& aClient)
sl@0
   534
	{
sl@0
   535
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3432 "));
sl@0
   536
	TTime testStartTime;
sl@0
   537
	testStartTime.UniversalTime();
sl@0
   538
	TTime tomorrow = testStartTime + (TTimeIntervalDays)1;
sl@0
   539
	TTime twoDaysFromNow = tomorrow + (TTimeIntervalDays)1;
sl@0
   540
sl@0
   541
	CTestActive* active = new(ELeave)CTestActive;
sl@0
   542
	CleanupStack::PushL(active);
sl@0
   543
sl@0
   544
	// Get rid of all the events in the log
sl@0
   545
	active->StartL();
sl@0
   546
	aClient.ClearLog(tomorrow, active->iStatus);
sl@0
   547
	CActiveScheduler::Start();
sl@0
   548
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   549
	
sl@0
   550
	// Wait a second before adding events to log.
sl@0
   551
	User::After(1100000);
sl@0
   552
sl@0
   553
	// Add two events to log
sl@0
   554
	CLogEvent* event = CLogEvent::NewL();
sl@0
   555
	CleanupStack::PushL(event);
sl@0
   556
sl@0
   557
	// Add event 1
sl@0
   558
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   559
	event->SetContact(KTestContact1);
sl@0
   560
	event->SetDirection(KTestDirection1);
sl@0
   561
	event->SetDurationType(KLogDurationNone);
sl@0
   562
	event->SetNumber(KTestNumber1);
sl@0
   563
	event->SetRemoteParty(KTestRemote1);
sl@0
   564
	event->SetStatus(KTestStatus1);
sl@0
   565
sl@0
   566
	active->StartL();
sl@0
   567
	aClient.AddEvent(*event, active->iStatus);
sl@0
   568
	CActiveScheduler::Start();
sl@0
   569
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   570
sl@0
   571
	// Add event 2
sl@0
   572
	event->SetEventType(KLogDataEventTypeUid);
sl@0
   573
	event->SetContact(KTestContact2);
sl@0
   574
	event->SetDirection(KTestDirection2);
sl@0
   575
	event->SetDurationType(KLogDurationValid);
sl@0
   576
	event->SetNumber(KTestNumber2);
sl@0
   577
	event->SetRemoteParty(KTestRemote2);
sl@0
   578
	event->SetStatus(KTestStatus2);
sl@0
   579
sl@0
   580
	active->StartL();
sl@0
   581
	aClient.AddEvent(*event, active->iStatus);
sl@0
   582
	CActiveScheduler::Start();
sl@0
   583
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   584
sl@0
   585
	// Setup filter
sl@0
   586
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   587
	CleanupStack::PushL(list);
sl@0
   588
sl@0
   589
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
   590
	CleanupStack::PushL(view);
sl@0
   591
sl@0
   592
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   593
	CleanupStack::PushL(filter);
sl@0
   594
	
sl@0
   595
	// Set half a filter
sl@0
   596
	filter->SetContact(KTestContact1);
sl@0
   597
	filter->SetDirection(KTestDirection1);
sl@0
   598
	filter->SetDurationType(KLogDurationNone);
sl@0
   599
	filter->SetStartTime(testStartTime);
sl@0
   600
	TTime t1 = filter->StartTime();
sl@0
   601
	TEST(t1 == testStartTime);
sl@0
   602
	filter->SetEndTime(tomorrow);
sl@0
   603
	TTime t2 = filter->EndTime();
sl@0
   604
	TEST(t2 == tomorrow);
sl@0
   605
sl@0
   606
	list->AppendL(filter);
sl@0
   607
	CleanupStack::Pop(); // filter
sl@0
   608
sl@0
   609
	// set the other half of filter for event 1
sl@0
   610
	filter = CLogFilter::NewL();
sl@0
   611
	CleanupStack::PushL(filter);
sl@0
   612
sl@0
   613
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   614
	filter->SetNumber(KTestNumber1);
sl@0
   615
	filter->SetRemoteParty(KTestRemote1);
sl@0
   616
	filter->SetStatus(KTestStatus1);
sl@0
   617
sl@0
   618
	// start time is duplicate of previous filter, 
sl@0
   619
	// end time is not duplicate
sl@0
   620
	filter->SetStartTime(testStartTime);
sl@0
   621
	filter->SetEndTime(twoDaysFromNow);
sl@0
   622
sl@0
   623
	list->AppendL(filter);
sl@0
   624
	CleanupStack::Pop(); // filter
sl@0
   625
sl@0
   626
	// Test View
sl@0
   627
	active->StartL();
sl@0
   628
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   629
	CActiveScheduler::Start();
sl@0
   630
	TEST2(view->CountL(),1);
sl@0
   631
sl@0
   632
	list->ResetAndDestroy();
sl@0
   633
sl@0
   634
	// check contents of the event.
sl@0
   635
	TBool res = view->FirstL(active->iStatus);
sl@0
   636
	TEST(res);
sl@0
   637
	active->StartL();
sl@0
   638
	CActiveScheduler::Start();
sl@0
   639
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   640
	
sl@0
   641
	TEST2(view->Event().Contact(), KTestContact1);
sl@0
   642
	TEST( view->Event().Number() == KTestNumber1);
sl@0
   643
	TEST( view->Event().Status() == KTestStatus1);
sl@0
   644
	TEST( view->Event().RemoteParty() == KTestRemote1);
sl@0
   645
sl@0
   646
	/////////////////////////////////////////
sl@0
   647
sl@0
   648
	filter = CLogFilter::NewL();
sl@0
   649
	CleanupStack::PushL(filter);
sl@0
   650
	
sl@0
   651
	// Set filter
sl@0
   652
	filter->SetContact(KTestContact1);
sl@0
   653
	filter->SetDirection(KTestDirection1);
sl@0
   654
	filter->SetDurationType(KLogDurationNone);
sl@0
   655
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   656
	filter->SetNumber(KTestNumber1);
sl@0
   657
	filter->SetRemoteParty(KTestRemote1);
sl@0
   658
	filter->SetStatus(KTestStatus1);
sl@0
   659
	filter->SetStartTime(testStartTime);
sl@0
   660
	filter->SetEndTime(tomorrow);
sl@0
   661
sl@0
   662
	list->AppendL(filter);
sl@0
   663
	CleanupStack::Pop(); // filter
sl@0
   664
sl@0
   665
	// Test View
sl@0
   666
	active->StartL();
sl@0
   667
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   668
	CActiveScheduler::Start();
sl@0
   669
	TEST2(view->CountL(), 1);
sl@0
   670
sl@0
   671
	filter = CLogFilter::NewL();
sl@0
   672
	CleanupStack::PushL(filter);
sl@0
   673
	
sl@0
   674
	// Set filter
sl@0
   675
	filter->SetContact(KTestContact2);
sl@0
   676
	filter->SetDirection(KTestDirection2);
sl@0
   677
	filter->SetDurationType(KLogDurationValid);
sl@0
   678
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
   679
	filter->SetNumber(KTestNumber2);
sl@0
   680
	filter->SetRemoteParty(KTestRemote2);
sl@0
   681
	filter->SetStatus(KTestStatus2);
sl@0
   682
sl@0
   683
	// start time is duplicate,
sl@0
   684
	// end time is not duplicate
sl@0
   685
	filter->SetStartTime(testStartTime);
sl@0
   686
	filter->SetEndTime(twoDaysFromNow);
sl@0
   687
sl@0
   688
	list->AppendL(filter);
sl@0
   689
	CleanupStack::Pop(); // filter
sl@0
   690
sl@0
   691
	// Test View
sl@0
   692
	active->StartL();
sl@0
   693
	TEST(view->SetFilterL(*list, active->iStatus));
sl@0
   694
	CActiveScheduler::Start();
sl@0
   695
	TEST2(view->CountL(), 2);
sl@0
   696
sl@0
   697
	list->ResetAndDestroy();
sl@0
   698
sl@0
   699
	// check contents of event 2 (most recent)
sl@0
   700
	res = view->FirstL(active->iStatus);
sl@0
   701
	TEST(res);
sl@0
   702
	active->StartL();
sl@0
   703
	CActiveScheduler::Start();
sl@0
   704
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   705
	
sl@0
   706
	TEST2(view->Event().Contact(), KTestContact2);
sl@0
   707
	TEST( view->Event().Number() == KTestNumber2);
sl@0
   708
	TEST( view->Event().Status() == KTestStatus2);
sl@0
   709
	TEST( view->Event().RemoteParty() == KTestRemote2);
sl@0
   710
sl@0
   711
	// check contents of event 1 (older)
sl@0
   712
	res = view->NextL(active->iStatus);
sl@0
   713
	TEST(res);
sl@0
   714
	active->StartL();
sl@0
   715
	CActiveScheduler::Start();
sl@0
   716
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   717
	
sl@0
   718
	TEST2(view->Event().Contact(), KTestContact1);
sl@0
   719
	TEST( view->Event().Number() == KTestNumber1);
sl@0
   720
	TEST( view->Event().Status() == KTestStatus1);
sl@0
   721
	TEST( view->Event().RemoteParty() == KTestRemote1);
sl@0
   722
sl@0
   723
	CleanupStack::PopAndDestroy(4); // list, view, event, active
sl@0
   724
	}
sl@0
   725
sl@0
   726
/**
sl@0
   727
@SYMTestCaseID          SYSLIB-LOGENG-CT-0931
sl@0
   728
@SYMTestCaseDesc	    Tests for recent view list with filters 
sl@0
   729
@SYMTestPriority 	    High
sl@0
   730
@SYMTestActions  	    Tests for recent view list,with different settings of the filter. 
sl@0
   731
@SYMTestExpectedResults Test must not fail
sl@0
   732
@SYMREQ                 REQ0000
sl@0
   733
*/
sl@0
   734
LOCAL_C void TestRecentViewWithFilterL(CLogClient& aClient)
sl@0
   735
	{
sl@0
   736
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0931 "));
sl@0
   737
	CLogEvent* event = CLogEvent::NewL();
sl@0
   738
	CleanupStack::PushL(event);
sl@0
   739
sl@0
   740
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   741
	CleanupStack::PushL(active);
sl@0
   742
sl@0
   743
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   744
	CleanupStack::PushL(view);
sl@0
   745
sl@0
   746
	// Incoming
sl@0
   747
	TLogString buf;
sl@0
   748
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   749
sl@0
   750
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   751
	event->SetDirection(buf);
sl@0
   752
	event->SetNumber(_L("1"));
sl@0
   753
sl@0
   754
	// Add event
sl@0
   755
	active->StartL();
sl@0
   756
	aClient.AddEvent(*event, active->iStatus);
sl@0
   757
	CActiveScheduler::Start();
sl@0
   758
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   759
sl@0
   760
	event->SetDurationType(KLogDurationData);
sl@0
   761
	event->SetNumber(_L("2"));
sl@0
   762
sl@0
   763
	// Add event
sl@0
   764
	active->StartL();
sl@0
   765
	aClient.AddEvent(*event, active->iStatus);
sl@0
   766
	CActiveScheduler::Start();
sl@0
   767
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   768
sl@0
   769
	event->SetStatus(KTestStatus1);
sl@0
   770
	event->SetNumber(_L("3"));
sl@0
   771
sl@0
   772
	// Add event
sl@0
   773
	active->StartL();
sl@0
   774
	aClient.AddEvent(*event, active->iStatus);
sl@0
   775
	CActiveScheduler::Start();
sl@0
   776
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   777
sl@0
   778
	event->SetContact(KTestContact1);
sl@0
   779
	event->SetNumber(_L("4"));
sl@0
   780
sl@0
   781
	// Add event
sl@0
   782
	active->StartL();
sl@0
   783
	aClient.AddEvent(*event, active->iStatus);
sl@0
   784
	CActiveScheduler::Start();
sl@0
   785
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   786
sl@0
   787
	active->StartL();
sl@0
   788
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   789
	CActiveScheduler::Start();
sl@0
   790
	TEST2(view->CountL(), 4);
sl@0
   791
sl@0
   792
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   793
	CleanupStack::PushL(filter);
sl@0
   794
sl@0
   795
	// This should make no difference
sl@0
   796
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
   797
sl@0
   798
	active->StartL();
sl@0
   799
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   800
	CActiveScheduler::Start();
sl@0
   801
	TEST2(view->CountL(), 4);
sl@0
   802
sl@0
   803
	// This should make no difference
sl@0
   804
	filter->SetDirection(buf);
sl@0
   805
sl@0
   806
	active->StartL();
sl@0
   807
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   808
	CActiveScheduler::Start();
sl@0
   809
	TEST2(view->CountL(), 4);
sl@0
   810
sl@0
   811
	filter->SetDurationType(KLogDurationData);
sl@0
   812
sl@0
   813
	active->StartL();
sl@0
   814
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   815
	CActiveScheduler::Start();
sl@0
   816
	TEST2(view->CountL(), 3);
sl@0
   817
sl@0
   818
	filter->SetStatus(KTestStatus1);
sl@0
   819
sl@0
   820
	active->StartL();
sl@0
   821
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   822
	CActiveScheduler::Start();
sl@0
   823
	TEST2(view->CountL(), 2);
sl@0
   824
sl@0
   825
	filter->SetContact(KTestContact1);
sl@0
   826
sl@0
   827
	active->StartL();
sl@0
   828
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   829
	CActiveScheduler::Start();
sl@0
   830
	TEST2(view->CountL(), 1);
sl@0
   831
sl@0
   832
	filter->SetStatus(_L("Dummy"));
sl@0
   833
	TEST(!view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
   834
sl@0
   835
	CleanupStack::PopAndDestroy(4); // filter, view, active, event
sl@0
   836
	}
sl@0
   837
sl@0
   838
/**
sl@0
   839
@SYMTestCaseID          SYSLIB-LOGENG-CT-0932
sl@0
   840
@SYMTestCaseDesc	    Tests for recent view list with filter set for the view
sl@0
   841
@SYMTestPriority 	    High
sl@0
   842
@SYMTestActions  	    Tests for recent view list set by the specified set of filters.
sl@0
   843
@SYMTestExpectedResults Test must not fail
sl@0
   844
@SYMREQ                 REQ0000
sl@0
   845
*/
sl@0
   846
LOCAL_C void TestRecentViewWithFilterListL(CLogClient& aClient)
sl@0
   847
	{
sl@0
   848
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0932 "));
sl@0
   849
	CLogEvent* event = CLogEvent::NewL();
sl@0
   850
	CleanupStack::PushL(event);
sl@0
   851
sl@0
   852
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   853
	CleanupStack::PushL(active);
sl@0
   854
sl@0
   855
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   856
	CleanupStack::PushL(view);
sl@0
   857
sl@0
   858
	// Make sure there are no entries in any recent lists
sl@0
   859
	active->StartL();
sl@0
   860
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
   861
	CActiveScheduler::Start();
sl@0
   862
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   863
sl@0
   864
	// Incoming
sl@0
   865
	TLogString buf;
sl@0
   866
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   867
sl@0
   868
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   869
	event->SetDirection(buf);
sl@0
   870
	event->SetDurationType(KLogDurationNone);
sl@0
   871
	event->SetContact(KTestContact1);
sl@0
   872
	event->SetStatus(KTestStatus1);
sl@0
   873
sl@0
   874
	// Add event
sl@0
   875
	active->StartL();
sl@0
   876
	aClient.AddEvent(*event, active->iStatus);
sl@0
   877
	CActiveScheduler::Start();
sl@0
   878
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   879
sl@0
   880
	event->SetDurationType(KLogDurationValid);
sl@0
   881
	event->SetContact(KTestContact2);
sl@0
   882
	event->SetStatus(KTestStatus2);
sl@0
   883
sl@0
   884
	// Add event
sl@0
   885
	active->StartL();
sl@0
   886
	aClient.AddEvent(*event, active->iStatus);
sl@0
   887
	CActiveScheduler::Start();
sl@0
   888
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   889
sl@0
   890
	event->SetDurationType(KLogDurationData);
sl@0
   891
	event->SetContact(KTestContact3);
sl@0
   892
	event->SetStatus(KTestStatus3);
sl@0
   893
sl@0
   894
	// Add event
sl@0
   895
	active->StartL();
sl@0
   896
	aClient.AddEvent(*event, active->iStatus);
sl@0
   897
	CActiveScheduler::Start();
sl@0
   898
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   899
sl@0
   900
	active->StartL();
sl@0
   901
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
   902
	CActiveScheduler::Start();
sl@0
   903
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   904
	TEST2(view->CountL(), 3);
sl@0
   905
sl@0
   906
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
   907
	CleanupStack::PushL(list);
sl@0
   908
sl@0
   909
	CLogFilter* filter = CLogFilter::NewL();
sl@0
   910
	CleanupStack::PushL(filter);
sl@0
   911
	list->AppendL(filter);
sl@0
   912
	CleanupStack::Pop(); // filter
sl@0
   913
sl@0
   914
	filter->SetDurationType(KLogDurationNone);
sl@0
   915
	filter->SetStatus(KTestStatus1);
sl@0
   916
	filter->SetContact(KTestContact1);
sl@0
   917
sl@0
   918
	active->StartL();
sl@0
   919
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
sl@0
   920
	CActiveScheduler::Start();
sl@0
   921
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   922
	TEST2(view->CountL(), 1);
sl@0
   923
sl@0
   924
	filter = CLogFilter::NewL();
sl@0
   925
	CleanupStack::PushL(filter);
sl@0
   926
	list->AppendL(filter);
sl@0
   927
	CleanupStack::Pop(); // filter
sl@0
   928
sl@0
   929
	filter->SetDurationType(KLogDurationValid);
sl@0
   930
	filter->SetStatus(KTestStatus2);
sl@0
   931
	filter->SetContact(KTestContact2);
sl@0
   932
sl@0
   933
	active->StartL();
sl@0
   934
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
sl@0
   935
	CActiveScheduler::Start();
sl@0
   936
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   937
	TEST2(view->CountL(), 2);
sl@0
   938
sl@0
   939
	filter = CLogFilter::NewL();
sl@0
   940
	CleanupStack::PushL(filter);
sl@0
   941
	list->AppendL(filter);
sl@0
   942
	CleanupStack::Pop(); // filter
sl@0
   943
sl@0
   944
	filter->SetDurationType(KLogDurationData);
sl@0
   945
	filter->SetStatus(KTestStatus3);
sl@0
   946
	filter->SetContact(KTestContact3);
sl@0
   947
sl@0
   948
	active->StartL();
sl@0
   949
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *list, active->iStatus));
sl@0
   950
	CActiveScheduler::Start();
sl@0
   951
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   952
	TEST2(view->CountL(), 3);
sl@0
   953
sl@0
   954
	list->ResetAndDestroy();
sl@0
   955
	CleanupStack::PopAndDestroy(4); // list, view, active, event
sl@0
   956
	}
sl@0
   957
sl@0
   958
/**
sl@0
   959
@SYMTestCaseID          SYSLIB-LOGENG-CT-0933
sl@0
   960
@SYMTestCaseDesc	    Tests for duplicate event view with filter 
sl@0
   961
@SYMTestPriority 	    High
sl@0
   962
@SYMTestActions  	    Tests for duplicate event view count. 
sl@0
   963
@SYMTestExpectedResults Test must not fail
sl@0
   964
@SYMREQ                 REQ0000
sl@0
   965
*/
sl@0
   966
LOCAL_C void TestDuplicateViewWithFilterL(CLogClient& aClient)
sl@0
   967
	{
sl@0
   968
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0933 "));
sl@0
   969
	CLogEvent* event = CLogEvent::NewL();
sl@0
   970
	CleanupStack::PushL(event);
sl@0
   971
sl@0
   972
	CTestActive* active = new(ELeave)CTestActive();
sl@0
   973
	CleanupStack::PushL(active);
sl@0
   974
sl@0
   975
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
   976
	CleanupStack::PushL(view);
sl@0
   977
sl@0
   978
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
   979
	CleanupStack::PushL(duplicate);
sl@0
   980
sl@0
   981
	// Make sure there are no entries in any recent lists
sl@0
   982
	active->StartL();
sl@0
   983
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
   984
	CActiveScheduler::Start();
sl@0
   985
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
   986
sl@0
   987
	// Incoming
sl@0
   988
	TLogString buf;
sl@0
   989
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
   990
sl@0
   991
	event->SetEventType(KLogCallEventTypeUid);
sl@0
   992
	event->SetDirection(buf);
sl@0
   993
	event->SetContact(KTestContact1);
sl@0
   994
sl@0
   995
	// Add event
sl@0
   996
	active->StartL();
sl@0
   997
	aClient.AddEvent(*event, active->iStatus);
sl@0
   998
	CActiveScheduler::Start();
sl@0
   999
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1000
sl@0
  1001
	event->SetDurationType(KLogDurationValid);
sl@0
  1002
sl@0
  1003
	// Add event
sl@0
  1004
	active->StartL();
sl@0
  1005
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1006
	CActiveScheduler::Start();
sl@0
  1007
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1008
sl@0
  1009
	event->SetStatus(KTestStatus1);
sl@0
  1010
sl@0
  1011
	// Add event
sl@0
  1012
	active->StartL();
sl@0
  1013
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1014
	CActiveScheduler::Start();
sl@0
  1015
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1016
sl@0
  1017
	event->SetDurationType(KLogDurationNone);
sl@0
  1018
	event->SetStatus(KNullDesC);
sl@0
  1019
sl@0
  1020
	// Add event - This will be the entry in recent list
sl@0
  1021
	active->StartL();
sl@0
  1022
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1023
	CActiveScheduler::Start();
sl@0
  1024
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1025
	TLogId logId1 = event->Id();
sl@0
  1026
sl@0
  1027
	// Should only be one event in recent list - the rest are duplicates
sl@0
  1028
	active->StartL();
sl@0
  1029
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1030
	CActiveScheduler::Start();
sl@0
  1031
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1032
	TEST2(view->CountL(), 1);
sl@0
  1033
	
sl@0
  1034
	TLogRecentList recentList = view->RecentList();
sl@0
  1035
	TEST(recentList == KLogRecentIncomingCalls);
sl@0
  1036
sl@0
  1037
	// Check duplicate count
sl@0
  1038
	active->StartL();
sl@0
  1039
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  1040
	CActiveScheduler::Start();
sl@0
  1041
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1042
	TEST2(duplicate->CountL(), 3);
sl@0
  1043
	
sl@0
  1044
	TLogId logId2 = duplicate->Source();
sl@0
  1045
	TEST(logId1 == logId2);
sl@0
  1046
sl@0
  1047
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1048
	CleanupStack::PushL(filter);
sl@0
  1049
sl@0
  1050
	active->StartL();
sl@0
  1051
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1052
	CActiveScheduler::Start();
sl@0
  1053
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1054
	TEST2(duplicate->CountL(), 3);
sl@0
  1055
sl@0
  1056
	filter->SetDurationType(KLogDurationValid);
sl@0
  1057
sl@0
  1058
	active->StartL();
sl@0
  1059
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1060
	CActiveScheduler::Start();
sl@0
  1061
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1062
	TEST2(duplicate->CountL(), 2);
sl@0
  1063
sl@0
  1064
	filter->SetStatus(KTestStatus1);
sl@0
  1065
sl@0
  1066
	active->StartL();
sl@0
  1067
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1068
	CActiveScheduler::Start();
sl@0
  1069
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1070
	TEST2(duplicate->CountL(), 1);
sl@0
  1071
sl@0
  1072
	filter->SetStatus(KTestStatus2);
sl@0
  1073
	TEST(!view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1074
sl@0
  1075
	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
sl@0
  1076
	}
sl@0
  1077
sl@0
  1078
/**
sl@0
  1079
@SYMTestCaseID          SYSLIB-LOGENG-CT-0934
sl@0
  1080
@SYMTestCaseDesc	    Tests for duplicate event view with filter list
sl@0
  1081
@SYMTestPriority 	    High
sl@0
  1082
@SYMTestActions  	    Tests for duplicate event view count,set by the specified set of filters.
sl@0
  1083
@SYMTestExpectedResults Test must not fail
sl@0
  1084
@SYMREQ                 REQ0000
sl@0
  1085
*/
sl@0
  1086
LOCAL_C void TestDuplicateViewWithFilterListL(CLogClient& aClient)
sl@0
  1087
	{
sl@0
  1088
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0934 "));
sl@0
  1089
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1090
	CleanupStack::PushL(event);
sl@0
  1091
sl@0
  1092
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1093
	CleanupStack::PushL(active);
sl@0
  1094
sl@0
  1095
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1096
	CleanupStack::PushL(view);
sl@0
  1097
sl@0
  1098
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  1099
	CleanupStack::PushL(duplicate);
sl@0
  1100
sl@0
  1101
	// Make sure there are no entries in any recent lists
sl@0
  1102
	active->StartL();
sl@0
  1103
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  1104
	CActiveScheduler::Start();
sl@0
  1105
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1106
sl@0
  1107
	// Incoming
sl@0
  1108
	TLogString buf;
sl@0
  1109
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  1110
sl@0
  1111
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1112
	event->SetDirection(buf);
sl@0
  1113
	event->SetContact(KTestContact1);
sl@0
  1114
sl@0
  1115
	event->SetDurationType(KLogDurationNone);
sl@0
  1116
	event->SetStatus(KNullDesC);
sl@0
  1117
sl@0
  1118
	// Add event
sl@0
  1119
	active->StartL();
sl@0
  1120
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1121
	CActiveScheduler::Start();
sl@0
  1122
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1123
sl@0
  1124
	event->SetDurationType(KLogDurationValid);
sl@0
  1125
sl@0
  1126
	active->StartL();
sl@0
  1127
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1128
	CActiveScheduler::Start();
sl@0
  1129
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1130
sl@0
  1131
	event->SetDurationType(KLogDurationData);
sl@0
  1132
sl@0
  1133
	active->StartL();
sl@0
  1134
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1135
	CActiveScheduler::Start();
sl@0
  1136
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1137
sl@0
  1138
	// Final event will be most recent
sl@0
  1139
	event->SetDurationType(KLogDurationNone);
sl@0
  1140
	event->SetStatus(KNullDesC);
sl@0
  1141
sl@0
  1142
	// Add event
sl@0
  1143
	active->StartL();
sl@0
  1144
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1145
	CActiveScheduler::Start();
sl@0
  1146
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1147
sl@0
  1148
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
  1149
	CleanupStack::PushL(list);
sl@0
  1150
sl@0
  1151
	active->StartL();
sl@0
  1152
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1153
	CActiveScheduler::Start();
sl@0
  1154
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1155
	TEST2(view->CountL(), 1);
sl@0
  1156
sl@0
  1157
	active->StartL();
sl@0
  1158
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  1159
	CActiveScheduler::Start();
sl@0
  1160
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1161
	TEST2(duplicate->CountL(), 3);
sl@0
  1162
sl@0
  1163
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1164
	CleanupStack::PushL(filter);
sl@0
  1165
	list->AppendL(filter);
sl@0
  1166
	CleanupStack::Pop(); // filter
sl@0
  1167
sl@0
  1168
	filter->SetDurationType(KLogDurationValid);
sl@0
  1169
sl@0
  1170
	active->StartL();
sl@0
  1171
	TEST(view->DuplicatesL(*duplicate, *list, active->iStatus));
sl@0
  1172
	CActiveScheduler::Start();
sl@0
  1173
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1174
	TEST2(duplicate->CountL(), 1);
sl@0
  1175
sl@0
  1176
	filter = CLogFilter::NewL();
sl@0
  1177
	CleanupStack::PushL(filter);
sl@0
  1178
	list->AppendL(filter);
sl@0
  1179
	CleanupStack::Pop(); // filter
sl@0
  1180
sl@0
  1181
	filter->SetDurationType(KLogDurationData);
sl@0
  1182
sl@0
  1183
	active->StartL();
sl@0
  1184
	TEST(view->DuplicatesL(*duplicate, *list, active->iStatus));
sl@0
  1185
	CActiveScheduler::Start();
sl@0
  1186
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1187
	TEST2(duplicate->CountL(), 2);
sl@0
  1188
sl@0
  1189
	list->ResetAndDestroy();
sl@0
  1190
	CleanupStack::PopAndDestroy(5); // list, duplicate, view, active, event
sl@0
  1191
	}
sl@0
  1192
sl@0
  1193
/**
sl@0
  1194
@SYMTestCaseID          SYSLIB-LOGENG-CT-0935
sl@0
  1195
@SYMTestCaseDesc	    Tests for null field set on filter in the event view 
sl@0
  1196
                        Tests for CLogFilter::SetNullFields() function
sl@0
  1197
@SYMTestPriority 	    High
sl@0
  1198
@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
sl@0
  1199
@SYMTestExpectedResults Test must not fail
sl@0
  1200
@SYMREQ                 REQ0000
sl@0
  1201
*/
sl@0
  1202
LOCAL_C void TestEventViewForNullFieldsL(CLogClient& aClient)
sl@0
  1203
	{
sl@0
  1204
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0935 "));
sl@0
  1205
	CTestActive* active = new(ELeave)CTestActive;
sl@0
  1206
	CleanupStack::PushL(active);
sl@0
  1207
sl@0
  1208
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1209
	CleanupStack::PushL(event);
sl@0
  1210
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1211
sl@0
  1212
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
  1213
	CleanupStack::PushL(view);
sl@0
  1214
sl@0
  1215
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1216
	CleanupStack::PushL(filter);
sl@0
  1217
sl@0
  1218
	// Wait a second
sl@0
  1219
	User::After(1000000);
sl@0
  1220
sl@0
  1221
	TTime now;
sl@0
  1222
	now.UniversalTime();
sl@0
  1223
	now += (TTimeIntervalDays)+1;
sl@0
  1224
	// Get rid of all the events in the log
sl@0
  1225
	active->StartL();
sl@0
  1226
	aClient.ClearLog(now, active->iStatus);
sl@0
  1227
	CActiveScheduler::Start();
sl@0
  1228
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1229
	
sl@0
  1230
	// Make sure there are no events
sl@0
  1231
	TEST(!view->SetFilterL(*filter, active->iStatus));
sl@0
  1232
sl@0
  1233
	active->StartL();
sl@0
  1234
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1235
	CActiveScheduler::Start();
sl@0
  1236
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1237
sl@0
  1238
	event->SetContact(KTestContact1);
sl@0
  1239
sl@0
  1240
	active->StartL();
sl@0
  1241
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1242
	CActiveScheduler::Start();
sl@0
  1243
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1244
sl@0
  1245
	event->SetDirection(KTestDirection1);
sl@0
  1246
sl@0
  1247
	active->StartL();
sl@0
  1248
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1249
	CActiveScheduler::Start();
sl@0
  1250
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1251
sl@0
  1252
	event->SetNumber(KTestNumber1);
sl@0
  1253
sl@0
  1254
	active->StartL();
sl@0
  1255
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1256
	CActiveScheduler::Start();
sl@0
  1257
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1258
sl@0
  1259
	event->SetRemoteParty(KTestRemote1);
sl@0
  1260
sl@0
  1261
	active->StartL();
sl@0
  1262
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1263
	CActiveScheduler::Start();
sl@0
  1264
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1265
sl@0
  1266
	event->SetStatus(KTestStatus1);
sl@0
  1267
sl@0
  1268
	active->StartL();
sl@0
  1269
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1270
	CActiveScheduler::Start();
sl@0
  1271
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1272
sl@0
  1273
	event->SetSubject(KTestSubject);
sl@0
  1274
sl@0
  1275
	active->StartL();
sl@0
  1276
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1277
	CActiveScheduler::Start();
sl@0
  1278
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1279
sl@0
  1280
	event->SetLink(KTestLink);
sl@0
  1281
sl@0
  1282
	active->StartL();
sl@0
  1283
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1284
	CActiveScheduler::Start();
sl@0
  1285
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1286
sl@0
  1287
	event->SetDataL(KTestData);
sl@0
  1288
sl@0
  1289
	active->StartL();
sl@0
  1290
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1291
	CActiveScheduler::Start();
sl@0
  1292
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1293
sl@0
  1294
	// Test for NULL fields
sl@0
  1295
sl@0
  1296
	active->StartL();
sl@0
  1297
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1298
	CActiveScheduler::Start();
sl@0
  1299
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1300
	TEST2(view->CountL(), 9);
sl@0
  1301
sl@0
  1302
	filter->SetNullFields(ELogContactField);
sl@0
  1303
sl@0
  1304
	active->StartL();
sl@0
  1305
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1306
	CActiveScheduler::Start();
sl@0
  1307
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1308
	TEST2(view->CountL(), 1);
sl@0
  1309
sl@0
  1310
	filter->SetNullFields(ELogContactField | ELogDirectionField);
sl@0
  1311
sl@0
  1312
	active->StartL();
sl@0
  1313
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1314
	CActiveScheduler::Start();
sl@0
  1315
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1316
	TEST2(view->CountL(), 1);
sl@0
  1317
sl@0
  1318
	filter->SetNullFields(ELogContactField | ELogDirectionField);
sl@0
  1319
sl@0
  1320
	active->StartL();
sl@0
  1321
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1322
	CActiveScheduler::Start();
sl@0
  1323
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1324
	TEST2(view->CountL(), 1);
sl@0
  1325
sl@0
  1326
	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField);
sl@0
  1327
sl@0
  1328
	active->StartL();
sl@0
  1329
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1330
	CActiveScheduler::Start();
sl@0
  1331
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1332
	TEST2(view->CountL(), 1);
sl@0
  1333
sl@0
  1334
	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField);
sl@0
  1335
sl@0
  1336
	active->StartL();
sl@0
  1337
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1338
	CActiveScheduler::Start();
sl@0
  1339
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1340
	TEST2(view->CountL(), 1);
sl@0
  1341
sl@0
  1342
	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField);
sl@0
  1343
sl@0
  1344
	active->StartL();
sl@0
  1345
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1346
	CActiveScheduler::Start();
sl@0
  1347
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1348
	TEST2(view->CountL(), 1);
sl@0
  1349
sl@0
  1350
	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField);
sl@0
  1351
sl@0
  1352
	active->StartL();
sl@0
  1353
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1354
	CActiveScheduler::Start();
sl@0
  1355
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1356
	TEST2(view->CountL(), 1);
sl@0
  1357
sl@0
  1358
	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField | ELogLinkField);
sl@0
  1359
sl@0
  1360
	active->StartL();
sl@0
  1361
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1362
	CActiveScheduler::Start();
sl@0
  1363
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1364
	TEST2(view->CountL(), 1);
sl@0
  1365
sl@0
  1366
	filter->SetNullFields(ELogContactField | ELogDirectionField | ELogNumberField | ELogRemotePartyField | ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
sl@0
  1367
sl@0
  1368
	active->StartL();
sl@0
  1369
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1370
	CActiveScheduler::Start();
sl@0
  1371
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1372
	TEST2(view->CountL(), 1);
sl@0
  1373
sl@0
  1374
	CleanupStack::PopAndDestroy(4); // filter, view, event, active
sl@0
  1375
	}
sl@0
  1376
sl@0
  1377
/**
sl@0
  1378
@SYMTestCaseID          SYSLIB-LOGENG-CT-0936
sl@0
  1379
@SYMTestCaseDesc	    Tests for null field set on filter for the recent event view list 
sl@0
  1380
@SYMTestPriority 	    High
sl@0
  1381
@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
sl@0
  1382
@SYMTestExpectedResults Test must not fail
sl@0
  1383
@SYMREQ                 REQ0000
sl@0
  1384
*/
sl@0
  1385
LOCAL_C void TestRecentViewForNullFieldsL(CLogClient& aClient)
sl@0
  1386
	{
sl@0
  1387
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0936 "));
sl@0
  1388
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1389
	CleanupStack::PushL(event);
sl@0
  1390
sl@0
  1391
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1392
	CleanupStack::PushL(active);
sl@0
  1393
sl@0
  1394
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1395
	CleanupStack::PushL(view);
sl@0
  1396
sl@0
  1397
	// Incoming
sl@0
  1398
	TLogString buf;
sl@0
  1399
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  1400
sl@0
  1401
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1402
	event->SetDirection(buf);
sl@0
  1403
	event->SetNumber(_L("1"));
sl@0
  1404
sl@0
  1405
	// Add event
sl@0
  1406
	active->StartL();
sl@0
  1407
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1408
	CActiveScheduler::Start();
sl@0
  1409
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1410
sl@0
  1411
	event->SetStatus(KTestStatus1);
sl@0
  1412
	event->SetNumber(_L("2"));
sl@0
  1413
sl@0
  1414
	// Add event
sl@0
  1415
	active->StartL();
sl@0
  1416
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1417
	CActiveScheduler::Start();
sl@0
  1418
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1419
sl@0
  1420
	event->SetSubject(KTestSubject);
sl@0
  1421
	event->SetNumber(_L("3"));
sl@0
  1422
sl@0
  1423
	active->StartL();
sl@0
  1424
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1425
	CActiveScheduler::Start();
sl@0
  1426
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1427
sl@0
  1428
	event->SetLink(KTestLink);
sl@0
  1429
	event->SetNumber(_L("4"));
sl@0
  1430
sl@0
  1431
	active->StartL();
sl@0
  1432
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1433
	CActiveScheduler::Start();
sl@0
  1434
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1435
sl@0
  1436
	event->SetDataL(KTestData);
sl@0
  1437
	event->SetNumber(_L("5"));
sl@0
  1438
sl@0
  1439
	active->StartL();
sl@0
  1440
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1441
	CActiveScheduler::Start();
sl@0
  1442
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1443
sl@0
  1444
	active->StartL();
sl@0
  1445
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1446
	CActiveScheduler::Start();
sl@0
  1447
	TEST2(view->CountL(), 5);
sl@0
  1448
sl@0
  1449
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1450
	CleanupStack::PushL(filter);
sl@0
  1451
	
sl@0
  1452
	// Test for NULL fields
sl@0
  1453
sl@0
  1454
	filter->SetNullFields(ELogStatusField);
sl@0
  1455
sl@0
  1456
	active->StartL();
sl@0
  1457
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1458
	CActiveScheduler::Start();
sl@0
  1459
	TEST2(view->CountL(), 1);
sl@0
  1460
sl@0
  1461
	filter->SetNullFields(ELogStatusField | ELogSubjectField);
sl@0
  1462
sl@0
  1463
	active->StartL();
sl@0
  1464
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1465
	CActiveScheduler::Start();
sl@0
  1466
	TEST2(view->CountL(), 1);
sl@0
  1467
sl@0
  1468
	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField);
sl@0
  1469
sl@0
  1470
	active->StartL();
sl@0
  1471
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1472
	CActiveScheduler::Start();
sl@0
  1473
	TEST2(view->CountL(), 1);
sl@0
  1474
sl@0
  1475
	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
sl@0
  1476
sl@0
  1477
	active->StartL();
sl@0
  1478
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1479
	CActiveScheduler::Start();
sl@0
  1480
	TEST2(view->CountL(), 1);
sl@0
  1481
sl@0
  1482
	CleanupStack::PopAndDestroy(4); // filter, view, active, event
sl@0
  1483
	}
sl@0
  1484
sl@0
  1485
/**
sl@0
  1486
@SYMTestCaseID          SYSLIB-LOGENG-CT-0937
sl@0
  1487
@SYMTestCaseDesc	    Tests for null field set on filter for the duplicate event view list 
sl@0
  1488
@SYMTestPriority 	    High
sl@0
  1489
@SYMTestActions  	    Clear the log events and add new events with fields set in.Define null fields in the filter and check the view
sl@0
  1490
@SYMTestExpectedResults Test must not fail
sl@0
  1491
@SYMREQ                 REQ0000
sl@0
  1492
*/
sl@0
  1493
LOCAL_C void TestDuplicateViewForNullFieldsL(CLogClient& aClient)
sl@0
  1494
	{
sl@0
  1495
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0937 "));
sl@0
  1496
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1497
	CleanupStack::PushL(event);
sl@0
  1498
sl@0
  1499
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1500
	CleanupStack::PushL(active);
sl@0
  1501
sl@0
  1502
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1503
	CleanupStack::PushL(view);
sl@0
  1504
sl@0
  1505
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  1506
	CleanupStack::PushL(duplicate);
sl@0
  1507
sl@0
  1508
	// Make sure there are no entries in any recent lists
sl@0
  1509
	active->StartL();
sl@0
  1510
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  1511
	CActiveScheduler::Start();
sl@0
  1512
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1513
sl@0
  1514
	// Incoming
sl@0
  1515
	TLogString buf;
sl@0
  1516
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  1517
sl@0
  1518
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1519
	event->SetDirection(buf);
sl@0
  1520
	event->SetContact(KTestContact1);
sl@0
  1521
sl@0
  1522
	// Add event
sl@0
  1523
	active->StartL();
sl@0
  1524
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1525
	CActiveScheduler::Start();
sl@0
  1526
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1527
sl@0
  1528
	event->SetStatus(KTestStatus1);
sl@0
  1529
sl@0
  1530
	// Add event
sl@0
  1531
	active->StartL();
sl@0
  1532
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1533
	CActiveScheduler::Start();
sl@0
  1534
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1535
sl@0
  1536
	event->SetSubject(KTestSubject);
sl@0
  1537
sl@0
  1538
	// Add event
sl@0
  1539
	active->StartL();
sl@0
  1540
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1541
	CActiveScheduler::Start();
sl@0
  1542
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1543
sl@0
  1544
	event->SetLink(KTestLink);
sl@0
  1545
sl@0
  1546
	// Add event
sl@0
  1547
	active->StartL();
sl@0
  1548
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1549
	CActiveScheduler::Start();
sl@0
  1550
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1551
sl@0
  1552
	event->SetDataL(KTestData);
sl@0
  1553
sl@0
  1554
	// Add event
sl@0
  1555
	active->StartL();
sl@0
  1556
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1557
	CActiveScheduler::Start();
sl@0
  1558
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1559
sl@0
  1560
	event->SetDurationType(KLogDurationNone);
sl@0
  1561
	event->SetStatus(KNullDesC);
sl@0
  1562
sl@0
  1563
	// Add event - This will be the entry in recent list
sl@0
  1564
	active->StartL();
sl@0
  1565
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1566
	CActiveScheduler::Start();
sl@0
  1567
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1568
sl@0
  1569
	// Should only be one event in recent list - the rest are duplicates
sl@0
  1570
	active->StartL();
sl@0
  1571
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  1572
	CActiveScheduler::Start();
sl@0
  1573
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1574
	TEST2(view->CountL(), 1);
sl@0
  1575
sl@0
  1576
	// Check duplicate count
sl@0
  1577
	active->StartL();
sl@0
  1578
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  1579
	CActiveScheduler::Start();
sl@0
  1580
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1581
	TEST2(duplicate->CountL(), 5);
sl@0
  1582
sl@0
  1583
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1584
	CleanupStack::PushL(filter);
sl@0
  1585
sl@0
  1586
	filter->SetNullFields(ELogStatusField);
sl@0
  1587
sl@0
  1588
	active->StartL();
sl@0
  1589
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1590
	CActiveScheduler::Start();
sl@0
  1591
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1592
	TEST2(duplicate->CountL(), 1);
sl@0
  1593
sl@0
  1594
	filter->SetNullFields(ELogStatusField | ELogSubjectField);
sl@0
  1595
sl@0
  1596
	active->StartL();
sl@0
  1597
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1598
	CActiveScheduler::Start();
sl@0
  1599
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1600
	TEST2(duplicate->CountL(), 1);
sl@0
  1601
sl@0
  1602
	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField);
sl@0
  1603
sl@0
  1604
	active->StartL();
sl@0
  1605
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1606
	CActiveScheduler::Start();
sl@0
  1607
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1608
	TEST2(duplicate->CountL(), 1);
sl@0
  1609
sl@0
  1610
	filter->SetNullFields(ELogStatusField | ELogSubjectField | ELogLinkField | ELogDataField);
sl@0
  1611
sl@0
  1612
	active->StartL();
sl@0
  1613
	TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1614
	CActiveScheduler::Start();
sl@0
  1615
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1616
	TEST2(duplicate->CountL(), 1);
sl@0
  1617
sl@0
  1618
	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
sl@0
  1619
	}
sl@0
  1620
sl@0
  1621
/**
sl@0
  1622
@SYMTestCaseID          SYSLIB-LOGENG-CT-0938
sl@0
  1623
@SYMTestCaseDesc	    Querying event view for flags test
sl@0
  1624
@SYMTestPriority 	    High
sl@0
  1625
@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
sl@0
  1626
@SYMTestExpectedResults Test must not fail
sl@0
  1627
@SYMREQ                 REQ0000
sl@0
  1628
*/
sl@0
  1629
LOCAL_C void TestEventViewForFlagsL(CLogClient& aClient)
sl@0
  1630
	{
sl@0
  1631
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0938 "));
sl@0
  1632
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1633
	CleanupStack::PushL(event);
sl@0
  1634
sl@0
  1635
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1636
	CleanupStack::PushL(active);
sl@0
  1637
sl@0
  1638
	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
  1639
	CleanupStack::PushL(view);
sl@0
  1640
sl@0
  1641
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1642
	CleanupStack::PushL(filter);
sl@0
  1643
sl@0
  1644
	// Wait a second
sl@0
  1645
	User::After(1000000);
sl@0
  1646
sl@0
  1647
	TTime now;
sl@0
  1648
	now.UniversalTime();
sl@0
  1649
	now += (TTimeIntervalDays)+1;
sl@0
  1650
	
sl@0
  1651
	// Get rid of all the events in the log
sl@0
  1652
	active->StartL();
sl@0
  1653
	aClient.ClearLog(now, active->iStatus);
sl@0
  1654
	CActiveScheduler::Start();
sl@0
  1655
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1656
	
sl@0
  1657
	// Make sure there are now events
sl@0
  1658
	TEST(!view->SetFilterL(*filter, active->iStatus));
sl@0
  1659
sl@0
  1660
	// Add some events
sl@0
  1661
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1662
	TLogFlags flags = KLogFlagsMask + 1;
sl@0
  1663
	TLogFlags flags2;
sl@0
  1664
sl@0
  1665
	while(flags--)
sl@0
  1666
		{
sl@0
  1667
		event->ClearFlags(0xF);
sl@0
  1668
		event->SetFlags(flags);
sl@0
  1669
sl@0
  1670
		// Add event
sl@0
  1671
		active->StartL();
sl@0
  1672
		aClient.AddEvent(*event, active->iStatus);
sl@0
  1673
		CActiveScheduler::Start();
sl@0
  1674
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1675
		}
sl@0
  1676
sl@0
  1677
	flags = KLogFlagsMask + 1;
sl@0
  1678
	while(flags--)
sl@0
  1679
		{
sl@0
  1680
		filter->ClearFlags(0xF);
sl@0
  1681
		// we use this because, since the events were all created without contact ids
sl@0
  1682
		// the log engine looked each one up in the contacts DB and set the flag so we
sl@0
  1683
		// need to set it in the flags being looked for
sl@0
  1684
		flags2 = static_cast<TLogFlags>(flags | KLogEventContactSearched);
sl@0
  1685
		filter->SetFlags(flags2);
sl@0
  1686
		active->StartL();
sl@0
  1687
		TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1688
		CActiveScheduler::Start();
sl@0
  1689
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1690
		TEST((view->Event().Flags() & flags2) == flags2);
sl@0
  1691
sl@0
  1692
		while(view->NextL(active->iStatus))
sl@0
  1693
			{
sl@0
  1694
			active->StartL();
sl@0
  1695
			CActiveScheduler::Start();
sl@0
  1696
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1697
			TEST((view->Event().Flags() & flags2) == flags2);
sl@0
  1698
			}
sl@0
  1699
		}
sl@0
  1700
	
sl@0
  1701
	// Now TEST we can query for the inverse
sl@0
  1702
	filter->SetNullFields(ELogFlagsField);
sl@0
  1703
sl@0
  1704
	flags = KLogFlagsMask + 1;
sl@0
  1705
	while(flags--)
sl@0
  1706
		{
sl@0
  1707
		filter->ClearFlags(0xF);
sl@0
  1708
		// we use this because, since the events were all created without contact ids
sl@0
  1709
		// the log engine looked each one up in the contacts DB and set the flag so we
sl@0
  1710
		// need to unset it in the flags being excluded
sl@0
  1711
		flags2 = static_cast<TLogFlags>(flags & ~KLogEventContactSearched);
sl@0
  1712
		filter->SetFlags(flags2);
sl@0
  1713
sl@0
  1714
		active->StartL();
sl@0
  1715
		TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  1716
		CActiveScheduler::Start();
sl@0
  1717
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1718
		TEST((~view->Event().Flags() & flags2) == flags2);
sl@0
  1719
sl@0
  1720
		while(view->NextL(active->iStatus))
sl@0
  1721
			{
sl@0
  1722
			active->StartL();
sl@0
  1723
			CActiveScheduler::Start();
sl@0
  1724
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1725
			TEST((~view->Event().Flags() & flags2) == flags2);
sl@0
  1726
			}
sl@0
  1727
		}
sl@0
  1728
sl@0
  1729
	CleanupStack::PopAndDestroy(4); // filter, view, active, event
sl@0
  1730
	}
sl@0
  1731
sl@0
  1732
/**
sl@0
  1733
@SYMTestCaseID          SYSLIB-LOGENG-CT-0939
sl@0
  1734
@SYMTestCaseDesc	    Querying recent event view for flags test
sl@0
  1735
@SYMTestPriority 	    High
sl@0
  1736
@SYMTestActions  	    Change the log configuration.Clear the log for any recent list and add some events.Query for flags in the recent view list
sl@0
  1737
@SYMTestExpectedResults Test must not fail
sl@0
  1738
@SYMREQ                 REQ0000
sl@0
  1739
*/
sl@0
  1740
LOCAL_C void TestRecentViewForFlagsL(CLogClient& aClient)
sl@0
  1741
	{
sl@0
  1742
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0939 "));
sl@0
  1743
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1744
	CleanupStack::PushL(event);
sl@0
  1745
sl@0
  1746
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1747
	CleanupStack::PushL(active);
sl@0
  1748
sl@0
  1749
	TLogConfig config;
sl@0
  1750
sl@0
  1751
	// Change the log engine config
sl@0
  1752
	active->StartL();
sl@0
  1753
	aClient.GetConfig(config, active->iStatus);
sl@0
  1754
	CActiveScheduler::Start();
sl@0
  1755
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1756
sl@0
  1757
	config.iMaxRecentLogSize = KLogFlagsMask + 1;
sl@0
  1758
sl@0
  1759
	// Change the log engine config
sl@0
  1760
	active->StartL();
sl@0
  1761
	aClient.ChangeConfig(config, active->iStatus);
sl@0
  1762
	CActiveScheduler::Start();
sl@0
  1763
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1764
sl@0
  1765
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1766
	CleanupStack::PushL(view);
sl@0
  1767
sl@0
  1768
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1769
	CleanupStack::PushL(filter);
sl@0
  1770
sl@0
  1771
	// Make sure there are no entries in any recent lists
sl@0
  1772
	active->StartL();
sl@0
  1773
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  1774
	CActiveScheduler::Start();
sl@0
  1775
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1776
sl@0
  1777
	// Make sure there are no events
sl@0
  1778
	TEST(!view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
sl@0
  1779
sl@0
  1780
	// Incoming
sl@0
  1781
	TLogString buf;
sl@0
  1782
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  1783
sl@0
  1784
	// Add some events
sl@0
  1785
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1786
	event->SetDirection(buf);
sl@0
  1787
sl@0
  1788
	TLogFlags flags = KLogFlagsMask + 1;
sl@0
  1789
	while(flags--)
sl@0
  1790
		{
sl@0
  1791
		event->ClearFlags(0xF);
sl@0
  1792
		event->SetFlags(flags);
sl@0
  1793
		event->SetContact(flags);
sl@0
  1794
sl@0
  1795
		// Add event
sl@0
  1796
		active->StartL();
sl@0
  1797
		aClient.AddEvent(*event, active->iStatus);
sl@0
  1798
		CActiveScheduler::Start();
sl@0
  1799
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1800
		}
sl@0
  1801
sl@0
  1802
	flags = KLogFlagsMask + 1;
sl@0
  1803
	while(flags--)
sl@0
  1804
		{
sl@0
  1805
		filter->ClearFlags(0xF);
sl@0
  1806
		filter->SetFlags(flags);
sl@0
  1807
sl@0
  1808
		active->StartL();
sl@0
  1809
		TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1810
		CActiveScheduler::Start();
sl@0
  1811
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1812
		TEST((view->Event().Flags() & flags) == flags);
sl@0
  1813
sl@0
  1814
		while(view->NextL(active->iStatus))
sl@0
  1815
			{
sl@0
  1816
			active->StartL();
sl@0
  1817
			CActiveScheduler::Start();
sl@0
  1818
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1819
			TEST((view->Event().Flags() & flags) == flags);
sl@0
  1820
			}
sl@0
  1821
		}
sl@0
  1822
	
sl@0
  1823
	// Now TEST we can query for the inverse
sl@0
  1824
	filter->SetNullFields(ELogFlagsField);
sl@0
  1825
sl@0
  1826
	flags = KLogFlagsMask + 1;
sl@0
  1827
	while(flags--)
sl@0
  1828
		{
sl@0
  1829
		filter->ClearFlags(0xF);
sl@0
  1830
		filter->SetFlags(flags);
sl@0
  1831
sl@0
  1832
		active->StartL();
sl@0
  1833
		TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1834
		CActiveScheduler::Start();
sl@0
  1835
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1836
		TEST((~view->Event().Flags() & flags) == flags);
sl@0
  1837
sl@0
  1838
		while(view->NextL(active->iStatus))
sl@0
  1839
			{
sl@0
  1840
			active->StartL();
sl@0
  1841
			CActiveScheduler::Start();
sl@0
  1842
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1843
			TEST((~view->Event().Flags() & flags) == flags);
sl@0
  1844
			}
sl@0
  1845
		}
sl@0
  1846
sl@0
  1847
	CleanupStack::PopAndDestroy(4); // filter, view, active, event
sl@0
  1848
	}
sl@0
  1849
sl@0
  1850
/**
sl@0
  1851
@SYMTestCaseID          SYSLIB-LOGENG-CT-0940
sl@0
  1852
@SYMTestCaseDesc	    Querying duplicate event view for flags test
sl@0
  1853
@SYMTestPriority 	    High
sl@0
  1854
@SYMTestActions  	    Change the log configuration.Clear the log for any recent list and add some events.Query for flags in the duplicate view list
sl@0
  1855
@SYMTestExpectedResults Test must not fail
sl@0
  1856
@SYMREQ                 REQ0000
sl@0
  1857
*/
sl@0
  1858
LOCAL_C void TestDuplicateViewForFlagsL(CLogClient& aClient)
sl@0
  1859
	{
sl@0
  1860
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0940 "));
sl@0
  1861
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1862
	CleanupStack::PushL(event);
sl@0
  1863
sl@0
  1864
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1865
	CleanupStack::PushL(active);
sl@0
  1866
sl@0
  1867
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1868
	CleanupStack::PushL(view);
sl@0
  1869
sl@0
  1870
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  1871
	CleanupStack::PushL(duplicate);
sl@0
  1872
sl@0
  1873
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  1874
	CleanupStack::PushL(filter);
sl@0
  1875
sl@0
  1876
	// Make sure there are no entries in any recent lists
sl@0
  1877
	active->StartL();
sl@0
  1878
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  1879
	CActiveScheduler::Start();
sl@0
  1880
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1881
sl@0
  1882
	// Make sure there are now events
sl@0
  1883
	TEST(!view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
sl@0
  1884
sl@0
  1885
	// Incoming
sl@0
  1886
	TLogString buf;
sl@0
  1887
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  1888
sl@0
  1889
	// Add some events
sl@0
  1890
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  1891
	event->SetDirection(buf);
sl@0
  1892
	event->SetDurationType(KLogDurationNone);
sl@0
  1893
	event->SetContact(KTestContact1);
sl@0
  1894
	event->SetStatus(KTestStatus1);
sl@0
  1895
sl@0
  1896
	TLogFlags flags = KLogFlagsMask + 1;
sl@0
  1897
	while(flags--)
sl@0
  1898
		{
sl@0
  1899
		event->ClearFlags(0xF);
sl@0
  1900
		event->SetFlags(flags);
sl@0
  1901
sl@0
  1902
		// Add event
sl@0
  1903
		active->StartL();
sl@0
  1904
		aClient.AddEvent(*event, active->iStatus);
sl@0
  1905
		CActiveScheduler::Start();
sl@0
  1906
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1907
		}
sl@0
  1908
sl@0
  1909
	// Add an extra event which will be the most recent
sl@0
  1910
	active->StartL();
sl@0
  1911
	aClient.AddEvent(*event, active->iStatus);
sl@0
  1912
	CActiveScheduler::Start();
sl@0
  1913
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1914
sl@0
  1915
	active->StartL();
sl@0
  1916
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, *filter, active->iStatus));
sl@0
  1917
	CActiveScheduler::Start();
sl@0
  1918
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1919
	TEST2(view->CountL(), 1);
sl@0
  1920
sl@0
  1921
	flags = KLogFlagsMask + 1;
sl@0
  1922
	while(flags--)
sl@0
  1923
		{
sl@0
  1924
		filter->ClearFlags(0xF);
sl@0
  1925
		filter->SetFlags(flags);
sl@0
  1926
sl@0
  1927
		active->StartL();
sl@0
  1928
		TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1929
		CActiveScheduler::Start();
sl@0
  1930
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1931
		TEST((duplicate->Event().Flags() & flags) == flags);
sl@0
  1932
sl@0
  1933
		while(duplicate->NextL(active->iStatus))
sl@0
  1934
			{
sl@0
  1935
			active->StartL();
sl@0
  1936
			CActiveScheduler::Start();
sl@0
  1937
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1938
			TEST((duplicate->Event().Flags() & flags) == flags);
sl@0
  1939
			}
sl@0
  1940
		}
sl@0
  1941
	
sl@0
  1942
	// Now TEST we can query for the inverse
sl@0
  1943
	filter->SetNullFields(ELogFlagsField);
sl@0
  1944
sl@0
  1945
	flags = KLogFlagsMask + 1;
sl@0
  1946
	while(flags--)
sl@0
  1947
		{
sl@0
  1948
		filter->ClearFlags(0xF);
sl@0
  1949
		filter->SetFlags(flags);
sl@0
  1950
sl@0
  1951
		active->StartL();
sl@0
  1952
		TEST(view->DuplicatesL(*duplicate, *filter, active->iStatus));
sl@0
  1953
		CActiveScheduler::Start();
sl@0
  1954
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1955
		TEST((~duplicate->Event().Flags() & flags) == flags);
sl@0
  1956
sl@0
  1957
		while(duplicate->NextL(active->iStatus))
sl@0
  1958
			{
sl@0
  1959
			active->StartL();
sl@0
  1960
			CActiveScheduler::Start();
sl@0
  1961
			TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1962
			TEST((~duplicate->Event().Flags() & flags) == flags);
sl@0
  1963
			}
sl@0
  1964
		}
sl@0
  1965
sl@0
  1966
	CleanupStack::PopAndDestroy(5); // filter, duplicate, view, active, event
sl@0
  1967
	}
sl@0
  1968
sl@0
  1969
/**
sl@0
  1970
@SYMTestCaseID          SYSLIB-LOGENG-CT-0941
sl@0
  1971
@SYMTestCaseDesc	    Tests for removing recent events.Tests for CLogClient::ClearLog() function 
sl@0
  1972
@SYMTestPriority 	    High
sl@0
  1973
@SYMTestActions  	    Clear log for any recent entries.Add events and create the view.Test for removing the recent events from the view
sl@0
  1974
@SYMTestExpectedResults Test must not fail
sl@0
  1975
@SYMREQ                 REQ0000
sl@0
  1976
*/
sl@0
  1977
LOCAL_C void TestRemovingRecentEventsL(CLogClient& aClient)
sl@0
  1978
	{
sl@0
  1979
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0941 "));
sl@0
  1980
	CLogEvent* event = CLogEvent::NewL();
sl@0
  1981
	CleanupStack::PushL(event);
sl@0
  1982
sl@0
  1983
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  1984
	CleanupStack::PushL(active);
sl@0
  1985
sl@0
  1986
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  1987
	CleanupStack::PushL(view);
sl@0
  1988
sl@0
  1989
	// Make sure there are no entries in any recent lists
sl@0
  1990
	active->StartL();
sl@0
  1991
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  1992
	CActiveScheduler::Start();
sl@0
  1993
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  1994
sl@0
  1995
	// Make sure there are no events
sl@0
  1996
	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
sl@0
  1997
sl@0
  1998
	// Incoming
sl@0
  1999
	TLogString buf;
sl@0
  2000
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  2001
sl@0
  2002
	// Add some events
sl@0
  2003
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  2004
	event->SetDirection(buf);
sl@0
  2005
sl@0
  2006
	TInt count = 10;
sl@0
  2007
	while(count--)
sl@0
  2008
		{
sl@0
  2009
		// Add event
sl@0
  2010
		active->StartL();
sl@0
  2011
		aClient.AddEvent(*event, active->iStatus);
sl@0
  2012
		CActiveScheduler::Start();
sl@0
  2013
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2014
		}
sl@0
  2015
sl@0
  2016
	// Create the view
sl@0
  2017
	active->StartL();
sl@0
  2018
	TEST(view->SetRecentListL(KLogNullRecentList, active->iStatus));
sl@0
  2019
	CActiveScheduler::Start();
sl@0
  2020
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2021
sl@0
  2022
	TLogId id = view->Event().Id();
sl@0
  2023
	while(view->NextL(active->iStatus))
sl@0
  2024
		{
sl@0
  2025
		active->StartL();
sl@0
  2026
		CActiveScheduler::Start();
sl@0
  2027
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2028
sl@0
  2029
		// Try removing the previous event
sl@0
  2030
		view->RemoveL(id);
sl@0
  2031
		id = view->Event().Id();
sl@0
  2032
		}
sl@0
  2033
sl@0
  2034
	// Try removing the current event
sl@0
  2035
	view->RemoveL(id);
sl@0
  2036
	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
sl@0
  2037
sl@0
  2038
	CleanupStack::PopAndDestroy(3); // view, active, event
sl@0
  2039
	}
sl@0
  2040
sl@0
  2041
/**
sl@0
  2042
@SYMTestCaseID          SYSLIB-LOGENG-CT-0942
sl@0
  2043
@SYMTestCaseDesc	    Removing duplicate events from the duplicate view
sl@0
  2044
                        Tests for CLogViewRecent::DuplicatesL() function
sl@0
  2045
@SYMTestPriority 	    High
sl@0
  2046
@SYMTestActions  	    Clear log for any recent entries.Add events and create the view and duplicate view.
sl@0
  2047
@SYMTestExpectedResults Test must not fail
sl@0
  2048
@SYMREQ                 REQ0000
sl@0
  2049
*/
sl@0
  2050
LOCAL_C void TestRemovingDuplicateEventsL(CLogClient& aClient)
sl@0
  2051
	{
sl@0
  2052
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0942 "));
sl@0
  2053
	CLogEvent* event = CLogEvent::NewL();
sl@0
  2054
	CleanupStack::PushL(event);
sl@0
  2055
sl@0
  2056
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  2057
	CleanupStack::PushL(active);
sl@0
  2058
sl@0
  2059
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  2060
	CleanupStack::PushL(view);
sl@0
  2061
sl@0
  2062
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  2063
	CleanupStack::PushL(duplicate);
sl@0
  2064
sl@0
  2065
	// Make sure there are no entries in any recent lists
sl@0
  2066
	active->StartL();
sl@0
  2067
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  2068
	CActiveScheduler::Start();
sl@0
  2069
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2070
sl@0
  2071
	// Make sure there are no events
sl@0
  2072
	TEST(!view->SetRecentListL(KLogNullRecentList, active->iStatus));
sl@0
  2073
sl@0
  2074
	// Incoming
sl@0
  2075
	TLogString buf;
sl@0
  2076
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  2077
sl@0
  2078
	// Add some events
sl@0
  2079
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  2080
	event->SetDirection(buf);
sl@0
  2081
	event->SetDurationType(KLogDurationNone);
sl@0
  2082
	event->SetContact(KTestContact1);
sl@0
  2083
	event->SetStatus(KTestStatus1);
sl@0
  2084
sl@0
  2085
	TInt count = 10;
sl@0
  2086
	while(count--)
sl@0
  2087
		{
sl@0
  2088
		// Add event
sl@0
  2089
		active->StartL();
sl@0
  2090
		aClient.AddEvent(*event, active->iStatus);
sl@0
  2091
		CActiveScheduler::Start();
sl@0
  2092
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2093
		TheTest.Printf(_L("EVENT ID: %d\n"), event->Id());
sl@0
  2094
		}
sl@0
  2095
sl@0
  2096
	// Create the view
sl@0
  2097
	active->StartL();
sl@0
  2098
	TEST(view->SetRecentListL(KLogNullRecentList, active->iStatus));
sl@0
  2099
	CActiveScheduler::Start();
sl@0
  2100
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2101
sl@0
  2102
	// Create the duplicate view
sl@0
  2103
	active->StartL();
sl@0
  2104
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  2105
	CActiveScheduler::Start();
sl@0
  2106
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2107
	TEST2(view->CountL(), 1);
sl@0
  2108
	count = duplicate->CountL();
sl@0
  2109
	TEST2(count, 9);
sl@0
  2110
sl@0
  2111
	TLogId id = duplicate->Event().Id();
sl@0
  2112
	while(duplicate->NextL(active->iStatus))
sl@0
  2113
		{
sl@0
  2114
		active->StartL();
sl@0
  2115
		CActiveScheduler::Start();
sl@0
  2116
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  2117
sl@0
  2118
		// Try removing the previous event
sl@0
  2119
		duplicate->RemoveL(id);
sl@0
  2120
		id = duplicate->Event().Id();
sl@0
  2121
		}
sl@0
  2122
sl@0
  2123
	// Try removing the current event
sl@0
  2124
	duplicate->RemoveL(id);
sl@0
  2125
	count = duplicate->CountL();
sl@0
  2126
	TEST2(count, 0);
sl@0
  2127
	//
sl@0
  2128
	TEST(!view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  2129
sl@0
  2130
	CleanupStack::PopAndDestroy(4); // duplicate, view, active, event
sl@0
  2131
	}
sl@0
  2132
sl@0
  2133
/**
sl@0
  2134
@SYMTestCaseID          SYSLIB-LOGENG-CT-0943
sl@0
  2135
s@SYMTestCaseDesc	    Multiple log event views test
sl@0
  2136
@SYMTestPriority 	    High
sl@0
  2137
@SYMTestActions  	    Add events and set the filter with different fields.Check for log event views
sl@0
  2138
@SYMTestExpectedResults Test must not fail
sl@0
  2139
@SYMREQ                 REQ0000
sl@0
  2140
*/
sl@0
  2141
LOCAL_C void TestMultipleViews1L(CLogClient& aClient)
sl@0
  2142
	{
sl@0
  2143
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0943 "));
sl@0
  2144
	CTestActive* active1 = new(ELeave)CTestActive;
sl@0
  2145
	CleanupStack::PushL(active1);
sl@0
  2146
sl@0
  2147
	// Wait a second
sl@0
  2148
	User::After(1000000);
sl@0
  2149
sl@0
  2150
	TTime now;
sl@0
  2151
	now.UniversalTime();
sl@0
  2152
	now += (TTimeIntervalDays)+1;
sl@0
  2153
sl@0
  2154
	// Get rid of all the events in the log
sl@0
  2155
	active1->StartL();
sl@0
  2156
	aClient.ClearLog(now, active1->iStatus);
sl@0
  2157
	CActiveScheduler::Start();
sl@0
  2158
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2159
sl@0
  2160
	CTestActive* active2 = new(ELeave)CTestActive;
sl@0
  2161
	CleanupStack::PushL(active2);
sl@0
  2162
sl@0
  2163
	CLogEvent* event = CLogEvent::NewL();
sl@0
  2164
	CleanupStack::PushL(event);
sl@0
  2165
sl@0
  2166
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  2167
	event->SetContact(KTestContact1);
sl@0
  2168
	event->SetDirection(KTestDirection1);
sl@0
  2169
	event->SetDurationType(KLogDurationNone);
sl@0
  2170
	event->SetNumber(KTestNumber1);
sl@0
  2171
	event->SetRemoteParty(KTestRemote1);
sl@0
  2172
	event->SetStatus(KTestStatus1);
sl@0
  2173
sl@0
  2174
	// Add event
sl@0
  2175
	active1->StartL();
sl@0
  2176
	aClient.AddEvent(*event, active1->iStatus);
sl@0
  2177
	CActiveScheduler::Start();
sl@0
  2178
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2179
sl@0
  2180
	event->SetEventType(KLogDataEventTypeUid);
sl@0
  2181
	event->SetContact(KTestContact2);
sl@0
  2182
	event->SetDirection(KTestDirection2);
sl@0
  2183
	event->SetDurationType(KLogDurationValid);
sl@0
  2184
	event->SetNumber(KTestNumber2);
sl@0
  2185
	event->SetRemoteParty(KTestRemote2);
sl@0
  2186
	event->SetStatus(KTestStatus2);
sl@0
  2187
sl@0
  2188
	// Add event
sl@0
  2189
	active1->StartL();
sl@0
  2190
	aClient.AddEvent(*event, active1->iStatus);
sl@0
  2191
	CActiveScheduler::Start();
sl@0
  2192
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2193
sl@0
  2194
	event->SetEventType(KLogFaxEventTypeUid);
sl@0
  2195
	event->SetContact(KTestContact3);
sl@0
  2196
	event->SetDirection(KTestDirection3);
sl@0
  2197
	event->SetDurationType(KLogDurationData);
sl@0
  2198
	event->SetNumber(KTestNumber3);
sl@0
  2199
	event->SetRemoteParty(KTestRemote3);
sl@0
  2200
	event->SetStatus(KTestStatus3);
sl@0
  2201
sl@0
  2202
	// Add event
sl@0
  2203
	active1->StartL();
sl@0
  2204
	aClient.AddEvent(*event, active1->iStatus);
sl@0
  2205
	CActiveScheduler::Start();
sl@0
  2206
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2207
sl@0
  2208
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
  2209
	CleanupStack::PushL(list);
sl@0
  2210
sl@0
  2211
	CLogViewEvent* view1 = CLogViewEvent::NewL(aClient);
sl@0
  2212
	CleanupStack::PushL(view1);
sl@0
  2213
sl@0
  2214
	CLogViewEvent* view2 = CLogViewEvent::NewL(aClient);
sl@0
  2215
	CleanupStack::PushL(view2);
sl@0
  2216
sl@0
  2217
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  2218
	CleanupStack::PushL(filter);
sl@0
  2219
	
sl@0
  2220
	// Set filter
sl@0
  2221
	filter->SetContact(KTestContact1);
sl@0
  2222
sl@0
  2223
	list->AppendL(filter);
sl@0
  2224
	CleanupStack::Pop(); // filter
sl@0
  2225
sl@0
  2226
	// Test Views
sl@0
  2227
	active1->StartL();
sl@0
  2228
	active2->StartL();
sl@0
  2229
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2230
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2231
	CActiveScheduler::Start();
sl@0
  2232
	CActiveScheduler::Start();
sl@0
  2233
	TEST2(view1->CountL(), 1);
sl@0
  2234
	TEST2(view2->CountL(), 1);
sl@0
  2235
sl@0
  2236
	filter = CLogFilter::NewL();
sl@0
  2237
	CleanupStack::PushL(filter);
sl@0
  2238
	
sl@0
  2239
	// Set filter
sl@0
  2240
	filter->SetContact(KTestContact2);
sl@0
  2241
sl@0
  2242
	list->AppendL(filter);
sl@0
  2243
	CleanupStack::Pop(); // filter
sl@0
  2244
sl@0
  2245
	// Test View
sl@0
  2246
	active1->StartL();
sl@0
  2247
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2248
	CActiveScheduler::Start();
sl@0
  2249
	TEST2(view1->CountL(), 2);
sl@0
  2250
sl@0
  2251
	filter = CLogFilter::NewL();
sl@0
  2252
	CleanupStack::PushL(filter);
sl@0
  2253
	
sl@0
  2254
	// Set filter
sl@0
  2255
	filter->SetContact(KTestContact3);
sl@0
  2256
sl@0
  2257
	list->AppendL(filter);
sl@0
  2258
	CleanupStack::Pop(); // filter
sl@0
  2259
sl@0
  2260
	// Test View
sl@0
  2261
	active1->StartL();
sl@0
  2262
	active2->StartL();
sl@0
  2263
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2264
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2265
	CActiveScheduler::Start();
sl@0
  2266
	CActiveScheduler::Start();
sl@0
  2267
	TEST2(view1->CountL(), 3);
sl@0
  2268
	TEST2(view2->CountL(), 3);
sl@0
  2269
sl@0
  2270
	list->ResetAndDestroy();
sl@0
  2271
sl@0
  2272
	/////////////////////////////////////////
sl@0
  2273
sl@0
  2274
	filter = CLogFilter::NewL();
sl@0
  2275
	CleanupStack::PushL(filter);
sl@0
  2276
	
sl@0
  2277
	// Set filter
sl@0
  2278
	filter->SetContact(KTestContact1);
sl@0
  2279
	filter->SetDirection(KTestDirection1);
sl@0
  2280
sl@0
  2281
	list->AppendL(filter);
sl@0
  2282
	CleanupStack::Pop(); // filter
sl@0
  2283
sl@0
  2284
	// Test View
sl@0
  2285
	active1->StartL();
sl@0
  2286
	active2->StartL();
sl@0
  2287
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2288
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2289
	CActiveScheduler::Start();
sl@0
  2290
	CActiveScheduler::Start();
sl@0
  2291
	TEST2(view1->CountL(), 1);
sl@0
  2292
	TEST2(view2->CountL(), 1);
sl@0
  2293
sl@0
  2294
	filter = CLogFilter::NewL();
sl@0
  2295
	CleanupStack::PushL(filter);
sl@0
  2296
	
sl@0
  2297
	// Set filter
sl@0
  2298
	filter->SetContact(KTestContact2);
sl@0
  2299
	filter->SetDirection(KTestDirection2);
sl@0
  2300
sl@0
  2301
	list->AppendL(filter);
sl@0
  2302
	CleanupStack::Pop(); // filter
sl@0
  2303
sl@0
  2304
	// Test View
sl@0
  2305
	active1->StartL();
sl@0
  2306
	active2->StartL();
sl@0
  2307
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2308
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2309
	CActiveScheduler::Start();
sl@0
  2310
	CActiveScheduler::Start();
sl@0
  2311
	TEST2(view1->CountL(), 2);
sl@0
  2312
	TEST2(view2->CountL(), 2);
sl@0
  2313
sl@0
  2314
	filter = CLogFilter::NewL();
sl@0
  2315
	CleanupStack::PushL(filter);
sl@0
  2316
	
sl@0
  2317
	// Set filter
sl@0
  2318
	filter->SetContact(KTestContact3);
sl@0
  2319
	filter->SetDirection(KTestDirection3);
sl@0
  2320
sl@0
  2321
	list->AppendL(filter);
sl@0
  2322
	CleanupStack::Pop(); // filter
sl@0
  2323
sl@0
  2324
	// Test View
sl@0
  2325
	active1->StartL();
sl@0
  2326
	active2->StartL();
sl@0
  2327
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2328
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2329
	CActiveScheduler::Start();
sl@0
  2330
	CActiveScheduler::Start();
sl@0
  2331
	TEST2(view1->CountL(), 3);
sl@0
  2332
	TEST2(view2->CountL(), 3);
sl@0
  2333
sl@0
  2334
	list->ResetAndDestroy();
sl@0
  2335
sl@0
  2336
	/////////////////////////////////////////
sl@0
  2337
sl@0
  2338
	filter = CLogFilter::NewL();
sl@0
  2339
	CleanupStack::PushL(filter);
sl@0
  2340
	
sl@0
  2341
	// Set filter
sl@0
  2342
	filter->SetContact(KTestContact1);
sl@0
  2343
	filter->SetDirection(KTestDirection1);
sl@0
  2344
	filter->SetDurationType(KLogDurationNone);
sl@0
  2345
sl@0
  2346
	list->AppendL(filter);
sl@0
  2347
	CleanupStack::Pop(); // filter
sl@0
  2348
sl@0
  2349
	// Test View
sl@0
  2350
	active1->StartL();
sl@0
  2351
	active2->StartL();
sl@0
  2352
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2353
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2354
	CActiveScheduler::Start();
sl@0
  2355
	CActiveScheduler::Start();
sl@0
  2356
	TEST2(view1->CountL(), 1);
sl@0
  2357
	TEST2(view2->CountL(), 1);
sl@0
  2358
sl@0
  2359
	filter = CLogFilter::NewL();
sl@0
  2360
	CleanupStack::PushL(filter);
sl@0
  2361
	
sl@0
  2362
	// Set filter
sl@0
  2363
	filter->SetContact(KTestContact2);
sl@0
  2364
	filter->SetDirection(KTestDirection2);
sl@0
  2365
	filter->SetDurationType(KLogDurationValid);
sl@0
  2366
sl@0
  2367
	list->AppendL(filter);
sl@0
  2368
	CleanupStack::Pop(); // filter
sl@0
  2369
sl@0
  2370
	// Test View
sl@0
  2371
	active1->StartL();
sl@0
  2372
	active2->StartL();
sl@0
  2373
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2374
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2375
	CActiveScheduler::Start();
sl@0
  2376
	CActiveScheduler::Start();
sl@0
  2377
	TEST2(view1->CountL(), 2);
sl@0
  2378
	TEST2(view2->CountL(), 2);
sl@0
  2379
sl@0
  2380
	filter = CLogFilter::NewL();
sl@0
  2381
	CleanupStack::PushL(filter);
sl@0
  2382
	
sl@0
  2383
	// Set filter
sl@0
  2384
	filter->SetContact(KTestContact3);
sl@0
  2385
	filter->SetDirection(KTestDirection3);
sl@0
  2386
	filter->SetDurationType(KLogDurationData);
sl@0
  2387
sl@0
  2388
	list->AppendL(filter);
sl@0
  2389
	CleanupStack::Pop(); // filter
sl@0
  2390
sl@0
  2391
	// Test View
sl@0
  2392
	active1->StartL();
sl@0
  2393
	active2->StartL();
sl@0
  2394
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2395
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2396
	CActiveScheduler::Start();
sl@0
  2397
	CActiveScheduler::Start();
sl@0
  2398
	TEST2(view1->CountL(), 3);
sl@0
  2399
	TEST2(view2->CountL(), 3);
sl@0
  2400
sl@0
  2401
	list->ResetAndDestroy();
sl@0
  2402
sl@0
  2403
	/////////////////////////////////////////
sl@0
  2404
sl@0
  2405
	filter = CLogFilter::NewL();
sl@0
  2406
	CleanupStack::PushL(filter);
sl@0
  2407
	
sl@0
  2408
	// Set filter
sl@0
  2409
	filter->SetContact(KTestContact1);
sl@0
  2410
	filter->SetDirection(KTestDirection1);
sl@0
  2411
	filter->SetDurationType(KLogDurationNone);
sl@0
  2412
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  2413
sl@0
  2414
	list->AppendL(filter);
sl@0
  2415
	CleanupStack::Pop(); // filter
sl@0
  2416
sl@0
  2417
	// Test View
sl@0
  2418
	active1->StartL();
sl@0
  2419
	active2->StartL();
sl@0
  2420
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2421
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2422
	CActiveScheduler::Start();
sl@0
  2423
	CActiveScheduler::Start();
sl@0
  2424
	TEST2(view1->CountL(), 1);
sl@0
  2425
	TEST2(view2->CountL(), 1);
sl@0
  2426
sl@0
  2427
	filter = CLogFilter::NewL();
sl@0
  2428
	CleanupStack::PushL(filter);
sl@0
  2429
	
sl@0
  2430
	// Set filter
sl@0
  2431
	filter->SetContact(KTestContact2);
sl@0
  2432
	filter->SetDirection(KTestDirection2);
sl@0
  2433
	filter->SetDurationType(KLogDurationValid);
sl@0
  2434
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  2435
sl@0
  2436
	list->AppendL(filter);
sl@0
  2437
	CleanupStack::Pop(); // filter
sl@0
  2438
sl@0
  2439
	// Test View
sl@0
  2440
	active1->StartL();
sl@0
  2441
	active2->StartL();
sl@0
  2442
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2443
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2444
	CActiveScheduler::Start();
sl@0
  2445
	CActiveScheduler::Start();
sl@0
  2446
	TEST2(view1->CountL(), 2);
sl@0
  2447
	TEST2(view2->CountL(), 2);
sl@0
  2448
sl@0
  2449
	filter = CLogFilter::NewL();
sl@0
  2450
	CleanupStack::PushL(filter);
sl@0
  2451
	
sl@0
  2452
	// Set filter
sl@0
  2453
	filter->SetContact(KTestContact3);
sl@0
  2454
	filter->SetDirection(KTestDirection3);
sl@0
  2455
	filter->SetDurationType(KLogDurationData);
sl@0
  2456
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  2457
sl@0
  2458
	list->AppendL(filter);
sl@0
  2459
	CleanupStack::Pop(); // filter
sl@0
  2460
sl@0
  2461
	// Test View
sl@0
  2462
	active1->StartL();
sl@0
  2463
	active2->StartL();
sl@0
  2464
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2465
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2466
	CActiveScheduler::Start();
sl@0
  2467
	CActiveScheduler::Start();
sl@0
  2468
	TEST2(view1->CountL(), 3);
sl@0
  2469
	TEST2(view2->CountL(), 3);
sl@0
  2470
sl@0
  2471
	list->ResetAndDestroy();
sl@0
  2472
sl@0
  2473
	/////////////////////////////////////////
sl@0
  2474
sl@0
  2475
	filter = CLogFilter::NewL();
sl@0
  2476
	CleanupStack::PushL(filter);
sl@0
  2477
	
sl@0
  2478
	// Set filter
sl@0
  2479
	filter->SetContact(KTestContact1);
sl@0
  2480
	filter->SetDirection(KTestDirection1);
sl@0
  2481
	filter->SetDurationType(KLogDurationNone);
sl@0
  2482
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  2483
	filter->SetNumber(KTestNumber1);
sl@0
  2484
sl@0
  2485
	list->AppendL(filter);
sl@0
  2486
	CleanupStack::Pop(); // filter
sl@0
  2487
sl@0
  2488
	// Test View
sl@0
  2489
	active1->StartL();
sl@0
  2490
	active2->StartL();
sl@0
  2491
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2492
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2493
	CActiveScheduler::Start();
sl@0
  2494
	CActiveScheduler::Start();
sl@0
  2495
	TEST2(view1->CountL(), 1);
sl@0
  2496
	TEST2(view2->CountL(), 1);
sl@0
  2497
sl@0
  2498
	filter = CLogFilter::NewL();
sl@0
  2499
	CleanupStack::PushL(filter);
sl@0
  2500
	
sl@0
  2501
	// Set filter
sl@0
  2502
	filter->SetContact(KTestContact2);
sl@0
  2503
	filter->SetDirection(KTestDirection2);
sl@0
  2504
	filter->SetDurationType(KLogDurationValid);
sl@0
  2505
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  2506
	filter->SetNumber(KTestNumber2);
sl@0
  2507
sl@0
  2508
	list->AppendL(filter);
sl@0
  2509
	CleanupStack::Pop(); // filter
sl@0
  2510
sl@0
  2511
	// Test View
sl@0
  2512
	active1->StartL();
sl@0
  2513
	active2->StartL();
sl@0
  2514
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2515
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2516
	CActiveScheduler::Start();
sl@0
  2517
	CActiveScheduler::Start();
sl@0
  2518
	TEST2(view1->CountL(), 2);
sl@0
  2519
	TEST2(view2->CountL(), 2);
sl@0
  2520
sl@0
  2521
	filter = CLogFilter::NewL();
sl@0
  2522
	CleanupStack::PushL(filter);
sl@0
  2523
	
sl@0
  2524
	// Set filter
sl@0
  2525
	filter->SetContact(KTestContact3);
sl@0
  2526
	filter->SetDirection(KTestDirection3);
sl@0
  2527
	filter->SetDurationType(KLogDurationData);
sl@0
  2528
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  2529
	filter->SetNumber(KTestNumber3);
sl@0
  2530
sl@0
  2531
	list->AppendL(filter);
sl@0
  2532
	CleanupStack::Pop(); // filter
sl@0
  2533
sl@0
  2534
	// Test View
sl@0
  2535
	active1->StartL();
sl@0
  2536
	active2->StartL();
sl@0
  2537
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2538
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2539
	CActiveScheduler::Start();
sl@0
  2540
	CActiveScheduler::Start();
sl@0
  2541
	TEST2(view1->CountL(), 3);
sl@0
  2542
	TEST2(view2->CountL(), 3);
sl@0
  2543
sl@0
  2544
	list->ResetAndDestroy();
sl@0
  2545
sl@0
  2546
	/////////////////////////////////////////
sl@0
  2547
sl@0
  2548
	filter = CLogFilter::NewL();
sl@0
  2549
	CleanupStack::PushL(filter);
sl@0
  2550
	
sl@0
  2551
	// Set filter
sl@0
  2552
	filter->SetContact(KTestContact1);
sl@0
  2553
	filter->SetDirection(KTestDirection1);
sl@0
  2554
	filter->SetDurationType(KLogDurationNone);
sl@0
  2555
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  2556
	filter->SetNumber(KTestNumber1);
sl@0
  2557
	filter->SetRemoteParty(KTestRemote1);
sl@0
  2558
sl@0
  2559
	list->AppendL(filter);
sl@0
  2560
	CleanupStack::Pop(); // filter
sl@0
  2561
sl@0
  2562
	// Test View
sl@0
  2563
	active1->StartL();
sl@0
  2564
	active2->StartL();
sl@0
  2565
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2566
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2567
	CActiveScheduler::Start();
sl@0
  2568
	CActiveScheduler::Start();
sl@0
  2569
	TEST2(view1->CountL(), 1);
sl@0
  2570
	TEST2(view2->CountL(), 1);
sl@0
  2571
sl@0
  2572
	filter = CLogFilter::NewL();
sl@0
  2573
	CleanupStack::PushL(filter);
sl@0
  2574
	
sl@0
  2575
	// Set filter
sl@0
  2576
	filter->SetContact(KTestContact2);
sl@0
  2577
	filter->SetDirection(KTestDirection2);
sl@0
  2578
	filter->SetDurationType(KLogDurationValid);
sl@0
  2579
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  2580
	filter->SetNumber(KTestNumber2);
sl@0
  2581
	filter->SetRemoteParty(KTestRemote2);
sl@0
  2582
sl@0
  2583
	list->AppendL(filter);
sl@0
  2584
	CleanupStack::Pop(); // filter
sl@0
  2585
sl@0
  2586
	// Test View
sl@0
  2587
	active1->StartL();
sl@0
  2588
	active2->StartL();
sl@0
  2589
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2590
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2591
	CActiveScheduler::Start();
sl@0
  2592
	CActiveScheduler::Start();
sl@0
  2593
	TEST2(view1->CountL(), 2);
sl@0
  2594
	TEST2(view2->CountL(), 2);
sl@0
  2595
sl@0
  2596
	filter = CLogFilter::NewL();
sl@0
  2597
	CleanupStack::PushL(filter);
sl@0
  2598
	
sl@0
  2599
	// Set filter
sl@0
  2600
	filter->SetContact(KTestContact3);
sl@0
  2601
	filter->SetDirection(KTestDirection3);
sl@0
  2602
	filter->SetDurationType(KLogDurationData);
sl@0
  2603
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  2604
	filter->SetNumber(KTestNumber3);
sl@0
  2605
	filter->SetRemoteParty(KTestRemote3);
sl@0
  2606
sl@0
  2607
	list->AppendL(filter);
sl@0
  2608
	CleanupStack::Pop(); // filter
sl@0
  2609
sl@0
  2610
	// Test View
sl@0
  2611
	active1->StartL();
sl@0
  2612
	active2->StartL();
sl@0
  2613
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2614
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2615
	CActiveScheduler::Start();
sl@0
  2616
	CActiveScheduler::Start();
sl@0
  2617
	TEST2(view1->CountL(), 3);
sl@0
  2618
	TEST2(view2->CountL(), 3);
sl@0
  2619
sl@0
  2620
	list->ResetAndDestroy();
sl@0
  2621
sl@0
  2622
	/////////////////////////////////////////
sl@0
  2623
sl@0
  2624
	filter = CLogFilter::NewL();
sl@0
  2625
	CleanupStack::PushL(filter);
sl@0
  2626
	
sl@0
  2627
	// Set filter
sl@0
  2628
	filter->SetContact(KTestContact1);
sl@0
  2629
	filter->SetDirection(KTestDirection1);
sl@0
  2630
	filter->SetDurationType(KLogDurationNone);
sl@0
  2631
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  2632
	filter->SetNumber(KTestNumber1);
sl@0
  2633
	filter->SetRemoteParty(KTestRemote1);
sl@0
  2634
	filter->SetStatus(KTestStatus1);
sl@0
  2635
sl@0
  2636
	list->AppendL(filter);
sl@0
  2637
	CleanupStack::Pop(); // filter
sl@0
  2638
sl@0
  2639
	// Test View
sl@0
  2640
	active1->StartL();
sl@0
  2641
	active2->StartL();
sl@0
  2642
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2643
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2644
	CActiveScheduler::Start();
sl@0
  2645
	CActiveScheduler::Start();
sl@0
  2646
	TEST2(view1->CountL(), 1);
sl@0
  2647
	TEST2(view2->CountL(), 1);
sl@0
  2648
sl@0
  2649
	filter = CLogFilter::NewL();
sl@0
  2650
	CleanupStack::PushL(filter);
sl@0
  2651
	
sl@0
  2652
	// Set filter
sl@0
  2653
	filter->SetContact(KTestContact2);
sl@0
  2654
	filter->SetDirection(KTestDirection2);
sl@0
  2655
	filter->SetDurationType(KLogDurationValid);
sl@0
  2656
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  2657
	filter->SetNumber(KTestNumber2);
sl@0
  2658
	filter->SetRemoteParty(KTestRemote2);
sl@0
  2659
	filter->SetStatus(KTestStatus2);
sl@0
  2660
sl@0
  2661
	list->AppendL(filter);
sl@0
  2662
	CleanupStack::Pop(); // filter
sl@0
  2663
sl@0
  2664
	// Test View
sl@0
  2665
	active1->StartL();
sl@0
  2666
	active2->StartL();
sl@0
  2667
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2668
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2669
	CActiveScheduler::Start();
sl@0
  2670
	CActiveScheduler::Start();
sl@0
  2671
	TEST2(view1->CountL(), 2);
sl@0
  2672
	TEST2(view2->CountL(), 2);
sl@0
  2673
sl@0
  2674
	filter = CLogFilter::NewL();
sl@0
  2675
	CleanupStack::PushL(filter);
sl@0
  2676
	
sl@0
  2677
	// Set filter
sl@0
  2678
	filter->SetContact(KTestContact3);
sl@0
  2679
	filter->SetDirection(KTestDirection3);
sl@0
  2680
	filter->SetDurationType(KLogDurationData);
sl@0
  2681
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  2682
	filter->SetNumber(KTestNumber3);
sl@0
  2683
	filter->SetRemoteParty(KTestRemote3);
sl@0
  2684
	filter->SetStatus(KTestStatus3);
sl@0
  2685
sl@0
  2686
	list->AppendL(filter);
sl@0
  2687
	CleanupStack::Pop(); // filter
sl@0
  2688
sl@0
  2689
	// Test View
sl@0
  2690
	active1->StartL();
sl@0
  2691
	active2->StartL();
sl@0
  2692
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2693
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2694
	CActiveScheduler::Start();
sl@0
  2695
	CActiveScheduler::Start();
sl@0
  2696
	TEST2(view1->CountL(), 3);
sl@0
  2697
	TEST2(view2->CountL(), 3);
sl@0
  2698
sl@0
  2699
	list->ResetAndDestroy();
sl@0
  2700
sl@0
  2701
	CleanupStack::PopAndDestroy(6); // list, view1, view2, event, active1, active2
sl@0
  2702
	}
sl@0
  2703
sl@0
  2704
/**
sl@0
  2705
@SYMTestCaseID          SYSLIB-LOGENG-CT-0944
sl@0
  2706
@SYMTestCaseDesc	    Multiple log event views test
sl@0
  2707
@SYMTestPriority 	    High
sl@0
  2708
@SYMTestActions  	    Add events and set the filter with different fields.
sl@0
  2709
						Check for log event views and the test for the count of events
sl@0
  2710
@SYMTestExpectedResults Test must not fail
sl@0
  2711
@SYMREQ                 REQ0000
sl@0
  2712
*/
sl@0
  2713
LOCAL_C void TestMultipleViews2L(CLogClient& aClient)
sl@0
  2714
	{
sl@0
  2715
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0944 "));
sl@0
  2716
	CTestActive* active1 = new(ELeave)CTestActive;
sl@0
  2717
	CleanupStack::PushL(active1);
sl@0
  2718
sl@0
  2719
	// Wait a second
sl@0
  2720
	User::After(1000000);
sl@0
  2721
sl@0
  2722
	TTime now;
sl@0
  2723
	now.UniversalTime();
sl@0
  2724
	now += (TTimeIntervalDays)+1;
sl@0
  2725
sl@0
  2726
	// Get rid of all the events in the log
sl@0
  2727
	active1->StartL();
sl@0
  2728
	aClient.ClearLog(now, active1->iStatus);
sl@0
  2729
	CActiveScheduler::Start();
sl@0
  2730
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2731
sl@0
  2732
	CTestActive* active2 = new(ELeave)CTestActive;
sl@0
  2733
	CleanupStack::PushL(active2);
sl@0
  2734
sl@0
  2735
	CLogEvent* event = CLogEvent::NewL();
sl@0
  2736
	CleanupStack::PushL(event);
sl@0
  2737
sl@0
  2738
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  2739
	event->SetContact(KTestContact1);
sl@0
  2740
	event->SetDirection(KTestDirection1);
sl@0
  2741
	event->SetDurationType(KLogDurationNone);
sl@0
  2742
	event->SetNumber(KTestNumber1);
sl@0
  2743
	event->SetRemoteParty(KTestRemote1);
sl@0
  2744
	event->SetStatus(KTestStatus1);
sl@0
  2745
sl@0
  2746
	// Add event
sl@0
  2747
	active1->StartL();
sl@0
  2748
	aClient.AddEvent(*event, active1->iStatus);
sl@0
  2749
	CActiveScheduler::Start();
sl@0
  2750
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2751
sl@0
  2752
	event->SetEventType(KLogDataEventTypeUid);
sl@0
  2753
	event->SetContact(KTestContact2);
sl@0
  2754
	event->SetDirection(KTestDirection2);
sl@0
  2755
	event->SetDurationType(KLogDurationValid);
sl@0
  2756
	event->SetNumber(KTestNumber2);
sl@0
  2757
	event->SetRemoteParty(KTestRemote2);
sl@0
  2758
	event->SetStatus(KTestStatus2);
sl@0
  2759
sl@0
  2760
	// Add event
sl@0
  2761
	active1->StartL();
sl@0
  2762
	aClient.AddEvent(*event, active1->iStatus);
sl@0
  2763
	CActiveScheduler::Start();
sl@0
  2764
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2765
sl@0
  2766
	event->SetEventType(KLogFaxEventTypeUid);
sl@0
  2767
	event->SetContact(KTestContact3);
sl@0
  2768
	event->SetDirection(KTestDirection3);
sl@0
  2769
	event->SetDurationType(KLogDurationData);
sl@0
  2770
	event->SetNumber(KTestNumber3);
sl@0
  2771
	event->SetRemoteParty(KTestRemote3);
sl@0
  2772
	event->SetStatus(KTestStatus3);
sl@0
  2773
sl@0
  2774
	// Add event
sl@0
  2775
	active1->StartL();
sl@0
  2776
	aClient.AddEvent(*event, active1->iStatus);
sl@0
  2777
	CActiveScheduler::Start();
sl@0
  2778
	TEST2(active1->iStatus.Int(), KErrNone);
sl@0
  2779
sl@0
  2780
	CLogFilterList* list = new(ELeave)CLogFilterList;
sl@0
  2781
	CleanupStack::PushL(list);
sl@0
  2782
sl@0
  2783
	CLogViewEvent* view1 = CLogViewEvent::NewL(aClient);
sl@0
  2784
	CleanupStack::PushL(view1);
sl@0
  2785
sl@0
  2786
	CLogClient* client2 = CLogClient::NewL(theFs);
sl@0
  2787
	CleanupStack::PushL(client2);
sl@0
  2788
sl@0
  2789
	CLogViewEvent* view2 = CLogViewEvent::NewL(*client2);
sl@0
  2790
	CleanupStack::PushL(view2);
sl@0
  2791
sl@0
  2792
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  2793
	CleanupStack::PushL(filter);
sl@0
  2794
	
sl@0
  2795
	// Set filter
sl@0
  2796
	filter->SetContact(KTestContact1);
sl@0
  2797
sl@0
  2798
	list->AppendL(filter);
sl@0
  2799
	CleanupStack::Pop(); // filter
sl@0
  2800
sl@0
  2801
	// Test Views
sl@0
  2802
	active1->StartL();
sl@0
  2803
	active2->StartL();
sl@0
  2804
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2805
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2806
	CActiveScheduler::Start();
sl@0
  2807
	CActiveScheduler::Start();
sl@0
  2808
	TEST2(view1->CountL(), 1);
sl@0
  2809
	TEST2(view2->CountL(), 1);
sl@0
  2810
sl@0
  2811
	filter = CLogFilter::NewL();
sl@0
  2812
	CleanupStack::PushL(filter);
sl@0
  2813
	
sl@0
  2814
	// Set filter
sl@0
  2815
	filter->SetContact(KTestContact2);
sl@0
  2816
sl@0
  2817
	list->AppendL(filter);
sl@0
  2818
	CleanupStack::Pop(); // filter
sl@0
  2819
sl@0
  2820
	// Test View
sl@0
  2821
	active1->StartL();
sl@0
  2822
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2823
	CActiveScheduler::Start();
sl@0
  2824
	TEST2(view1->CountL(), 2);
sl@0
  2825
sl@0
  2826
	filter = CLogFilter::NewL();
sl@0
  2827
	CleanupStack::PushL(filter);
sl@0
  2828
	
sl@0
  2829
	// Set filter
sl@0
  2830
	filter->SetContact(KTestContact3);
sl@0
  2831
sl@0
  2832
	list->AppendL(filter);
sl@0
  2833
	CleanupStack::Pop(); // filter
sl@0
  2834
sl@0
  2835
	// Test View
sl@0
  2836
	active1->StartL();
sl@0
  2837
	active2->StartL();
sl@0
  2838
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2839
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2840
	CActiveScheduler::Start();
sl@0
  2841
	CActiveScheduler::Start();
sl@0
  2842
	TEST2(view1->CountL(), 3);
sl@0
  2843
	TEST2(view2->CountL(), 3);
sl@0
  2844
sl@0
  2845
	list->ResetAndDestroy();
sl@0
  2846
sl@0
  2847
	/////////////////////////////////////////
sl@0
  2848
sl@0
  2849
	filter = CLogFilter::NewL();
sl@0
  2850
	CleanupStack::PushL(filter);
sl@0
  2851
	
sl@0
  2852
	// Set filter
sl@0
  2853
	filter->SetContact(KTestContact1);
sl@0
  2854
	filter->SetDirection(KTestDirection1);
sl@0
  2855
sl@0
  2856
	list->AppendL(filter);
sl@0
  2857
	CleanupStack::Pop(); // filter
sl@0
  2858
sl@0
  2859
	// Test View
sl@0
  2860
	active1->StartL();
sl@0
  2861
	active2->StartL();
sl@0
  2862
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2863
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2864
	CActiveScheduler::Start();
sl@0
  2865
	CActiveScheduler::Start();
sl@0
  2866
	TEST2(view1->CountL(), 1);
sl@0
  2867
	TEST2(view2->CountL(), 1);
sl@0
  2868
sl@0
  2869
	filter = CLogFilter::NewL();
sl@0
  2870
	CleanupStack::PushL(filter);
sl@0
  2871
	
sl@0
  2872
	// Set filter
sl@0
  2873
	filter->SetContact(KTestContact2);
sl@0
  2874
	filter->SetDirection(KTestDirection2);
sl@0
  2875
sl@0
  2876
	list->AppendL(filter);
sl@0
  2877
	CleanupStack::Pop(); // filter
sl@0
  2878
sl@0
  2879
	// Test View
sl@0
  2880
	active1->StartL();
sl@0
  2881
	active2->StartL();
sl@0
  2882
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2883
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2884
	CActiveScheduler::Start();
sl@0
  2885
	CActiveScheduler::Start();
sl@0
  2886
	TEST2(view1->CountL(), 2);
sl@0
  2887
	TEST2(view2->CountL(), 2);
sl@0
  2888
sl@0
  2889
	filter = CLogFilter::NewL();
sl@0
  2890
	CleanupStack::PushL(filter);
sl@0
  2891
	
sl@0
  2892
	// Set filter
sl@0
  2893
	filter->SetContact(KTestContact3);
sl@0
  2894
	filter->SetDirection(KTestDirection3);
sl@0
  2895
sl@0
  2896
	list->AppendL(filter);
sl@0
  2897
	CleanupStack::Pop(); // filter
sl@0
  2898
sl@0
  2899
	// Test View
sl@0
  2900
	active1->StartL();
sl@0
  2901
	active2->StartL();
sl@0
  2902
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2903
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2904
	CActiveScheduler::Start();
sl@0
  2905
	CActiveScheduler::Start();
sl@0
  2906
	TEST2(view1->CountL(), 3);
sl@0
  2907
	TEST2(view2->CountL(), 3);
sl@0
  2908
sl@0
  2909
	list->ResetAndDestroy();
sl@0
  2910
sl@0
  2911
	/////////////////////////////////////////
sl@0
  2912
sl@0
  2913
	filter = CLogFilter::NewL();
sl@0
  2914
	CleanupStack::PushL(filter);
sl@0
  2915
	
sl@0
  2916
	// Set filter
sl@0
  2917
	filter->SetContact(KTestContact1);
sl@0
  2918
	filter->SetDirection(KTestDirection1);
sl@0
  2919
	filter->SetDurationType(KLogDurationNone);
sl@0
  2920
sl@0
  2921
	list->AppendL(filter);
sl@0
  2922
	CleanupStack::Pop(); // filter
sl@0
  2923
sl@0
  2924
	// Test View
sl@0
  2925
	active1->StartL();
sl@0
  2926
	active2->StartL();
sl@0
  2927
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2928
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2929
	CActiveScheduler::Start();
sl@0
  2930
	CActiveScheduler::Start();
sl@0
  2931
	TEST2(view1->CountL(), 1);
sl@0
  2932
	TEST2(view2->CountL(), 1);
sl@0
  2933
sl@0
  2934
	filter = CLogFilter::NewL();
sl@0
  2935
	CleanupStack::PushL(filter);
sl@0
  2936
	
sl@0
  2937
	// Set filter
sl@0
  2938
	filter->SetContact(KTestContact2);
sl@0
  2939
	filter->SetDirection(KTestDirection2);
sl@0
  2940
	filter->SetDurationType(KLogDurationValid);
sl@0
  2941
sl@0
  2942
	list->AppendL(filter);
sl@0
  2943
	CleanupStack::Pop(); // filter
sl@0
  2944
sl@0
  2945
	// Test View
sl@0
  2946
	active1->StartL();
sl@0
  2947
	active2->StartL();
sl@0
  2948
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2949
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2950
	CActiveScheduler::Start();
sl@0
  2951
	CActiveScheduler::Start();
sl@0
  2952
	TEST2(view1->CountL(), 2);
sl@0
  2953
	TEST2(view2->CountL(), 2);
sl@0
  2954
sl@0
  2955
	filter = CLogFilter::NewL();
sl@0
  2956
	CleanupStack::PushL(filter);
sl@0
  2957
	
sl@0
  2958
	// Set filter
sl@0
  2959
	filter->SetContact(KTestContact3);
sl@0
  2960
	filter->SetDirection(KTestDirection3);
sl@0
  2961
	filter->SetDurationType(KLogDurationData);
sl@0
  2962
sl@0
  2963
	list->AppendL(filter);
sl@0
  2964
	CleanupStack::Pop(); // filter
sl@0
  2965
sl@0
  2966
	// Test View
sl@0
  2967
	active1->StartL();
sl@0
  2968
	active2->StartL();
sl@0
  2969
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2970
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2971
	CActiveScheduler::Start();
sl@0
  2972
	CActiveScheduler::Start();
sl@0
  2973
	TEST2(view1->CountL(), 3);
sl@0
  2974
	TEST2(view2->CountL(), 3);
sl@0
  2975
sl@0
  2976
	list->ResetAndDestroy();
sl@0
  2977
sl@0
  2978
	/////////////////////////////////////////
sl@0
  2979
sl@0
  2980
	filter = CLogFilter::NewL();
sl@0
  2981
	CleanupStack::PushL(filter);
sl@0
  2982
	
sl@0
  2983
	// Set filter
sl@0
  2984
	filter->SetContact(KTestContact1);
sl@0
  2985
	filter->SetDirection(KTestDirection1);
sl@0
  2986
	filter->SetDurationType(KLogDurationNone);
sl@0
  2987
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  2988
sl@0
  2989
	list->AppendL(filter);
sl@0
  2990
	CleanupStack::Pop(); // filter
sl@0
  2991
sl@0
  2992
	// Test View
sl@0
  2993
	active1->StartL();
sl@0
  2994
	active2->StartL();
sl@0
  2995
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  2996
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  2997
	CActiveScheduler::Start();
sl@0
  2998
	CActiveScheduler::Start();
sl@0
  2999
	TEST2(view1->CountL(), 1);
sl@0
  3000
	TEST2(view2->CountL(), 1);
sl@0
  3001
sl@0
  3002
	filter = CLogFilter::NewL();
sl@0
  3003
	CleanupStack::PushL(filter);
sl@0
  3004
	
sl@0
  3005
	// Set filter
sl@0
  3006
	filter->SetContact(KTestContact2);
sl@0
  3007
	filter->SetDirection(KTestDirection2);
sl@0
  3008
	filter->SetDurationType(KLogDurationValid);
sl@0
  3009
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  3010
sl@0
  3011
	list->AppendL(filter);
sl@0
  3012
	CleanupStack::Pop(); // filter
sl@0
  3013
sl@0
  3014
	// Test View
sl@0
  3015
	active1->StartL();
sl@0
  3016
	active2->StartL();
sl@0
  3017
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3018
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3019
	CActiveScheduler::Start();
sl@0
  3020
	CActiveScheduler::Start();
sl@0
  3021
	TEST2(view1->CountL(), 2);
sl@0
  3022
	TEST2(view2->CountL(), 2);
sl@0
  3023
sl@0
  3024
	filter = CLogFilter::NewL();
sl@0
  3025
	CleanupStack::PushL(filter);
sl@0
  3026
	
sl@0
  3027
	// Set filter
sl@0
  3028
	filter->SetContact(KTestContact3);
sl@0
  3029
	filter->SetDirection(KTestDirection3);
sl@0
  3030
	filter->SetDurationType(KLogDurationData);
sl@0
  3031
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  3032
sl@0
  3033
	list->AppendL(filter);
sl@0
  3034
	CleanupStack::Pop(); // filter
sl@0
  3035
sl@0
  3036
	// Test View
sl@0
  3037
	active1->StartL();
sl@0
  3038
	active2->StartL();
sl@0
  3039
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3040
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3041
	CActiveScheduler::Start();
sl@0
  3042
	CActiveScheduler::Start();
sl@0
  3043
	TEST2(view1->CountL(), 3);
sl@0
  3044
	TEST2(view2->CountL(), 3);
sl@0
  3045
sl@0
  3046
	list->ResetAndDestroy();
sl@0
  3047
sl@0
  3048
	/////////////////////////////////////////
sl@0
  3049
sl@0
  3050
	filter = CLogFilter::NewL();
sl@0
  3051
	CleanupStack::PushL(filter);
sl@0
  3052
	
sl@0
  3053
	// Set filter
sl@0
  3054
	filter->SetContact(KTestContact1);
sl@0
  3055
	filter->SetDirection(KTestDirection1);
sl@0
  3056
	filter->SetDurationType(KLogDurationNone);
sl@0
  3057
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  3058
	filter->SetNumber(KTestNumber1);
sl@0
  3059
sl@0
  3060
	list->AppendL(filter);
sl@0
  3061
	CleanupStack::Pop(); // filter
sl@0
  3062
sl@0
  3063
	// Test View
sl@0
  3064
	active1->StartL();
sl@0
  3065
	active2->StartL();
sl@0
  3066
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3067
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3068
	CActiveScheduler::Start();
sl@0
  3069
	CActiveScheduler::Start();
sl@0
  3070
	TEST2(view1->CountL(), 1);
sl@0
  3071
	TEST2(view2->CountL(), 1);
sl@0
  3072
sl@0
  3073
	filter = CLogFilter::NewL();
sl@0
  3074
	CleanupStack::PushL(filter);
sl@0
  3075
	
sl@0
  3076
	// Set filter
sl@0
  3077
	filter->SetContact(KTestContact2);
sl@0
  3078
	filter->SetDirection(KTestDirection2);
sl@0
  3079
	filter->SetDurationType(KLogDurationValid);
sl@0
  3080
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  3081
	filter->SetNumber(KTestNumber2);
sl@0
  3082
sl@0
  3083
	list->AppendL(filter);
sl@0
  3084
	CleanupStack::Pop(); // filter
sl@0
  3085
sl@0
  3086
	// Test View
sl@0
  3087
	active1->StartL();
sl@0
  3088
	active2->StartL();
sl@0
  3089
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3090
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3091
	CActiveScheduler::Start();
sl@0
  3092
	CActiveScheduler::Start();
sl@0
  3093
	TEST2(view1->CountL(), 2);
sl@0
  3094
	TEST2(view2->CountL(), 2);
sl@0
  3095
sl@0
  3096
	filter = CLogFilter::NewL();
sl@0
  3097
	CleanupStack::PushL(filter);
sl@0
  3098
	
sl@0
  3099
	// Set filter
sl@0
  3100
	filter->SetContact(KTestContact3);
sl@0
  3101
	filter->SetDirection(KTestDirection3);
sl@0
  3102
	filter->SetDurationType(KLogDurationData);
sl@0
  3103
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  3104
	filter->SetNumber(KTestNumber3);
sl@0
  3105
sl@0
  3106
	list->AppendL(filter);
sl@0
  3107
	CleanupStack::Pop(); // filter
sl@0
  3108
sl@0
  3109
	// Test View
sl@0
  3110
	active1->StartL();
sl@0
  3111
	active2->StartL();
sl@0
  3112
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3113
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3114
	CActiveScheduler::Start();
sl@0
  3115
	CActiveScheduler::Start();
sl@0
  3116
	TEST2(view1->CountL(), 3);
sl@0
  3117
	TEST2(view2->CountL(), 3);
sl@0
  3118
sl@0
  3119
	list->ResetAndDestroy();
sl@0
  3120
sl@0
  3121
	/////////////////////////////////////////
sl@0
  3122
sl@0
  3123
	filter = CLogFilter::NewL();
sl@0
  3124
	CleanupStack::PushL(filter);
sl@0
  3125
	
sl@0
  3126
	// Set filter
sl@0
  3127
	filter->SetContact(KTestContact1);
sl@0
  3128
	filter->SetDirection(KTestDirection1);
sl@0
  3129
	filter->SetDurationType(KLogDurationNone);
sl@0
  3130
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  3131
	filter->SetNumber(KTestNumber1);
sl@0
  3132
	filter->SetRemoteParty(KTestRemote1);
sl@0
  3133
sl@0
  3134
	list->AppendL(filter);
sl@0
  3135
	CleanupStack::Pop(); // filter
sl@0
  3136
sl@0
  3137
	// Test View
sl@0
  3138
	active1->StartL();
sl@0
  3139
	active2->StartL();
sl@0
  3140
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3141
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3142
	CActiveScheduler::Start();
sl@0
  3143
	CActiveScheduler::Start();
sl@0
  3144
	TEST2(view1->CountL(), 1);
sl@0
  3145
	TEST2(view2->CountL(), 1);
sl@0
  3146
sl@0
  3147
	filter = CLogFilter::NewL();
sl@0
  3148
	CleanupStack::PushL(filter);
sl@0
  3149
	
sl@0
  3150
	// Set filter
sl@0
  3151
	filter->SetContact(KTestContact2);
sl@0
  3152
	filter->SetDirection(KTestDirection2);
sl@0
  3153
	filter->SetDurationType(KLogDurationValid);
sl@0
  3154
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  3155
	filter->SetNumber(KTestNumber2);
sl@0
  3156
	filter->SetRemoteParty(KTestRemote2);
sl@0
  3157
sl@0
  3158
	list->AppendL(filter);
sl@0
  3159
	CleanupStack::Pop(); // filter
sl@0
  3160
sl@0
  3161
	// Test View
sl@0
  3162
	active1->StartL();
sl@0
  3163
	active2->StartL();
sl@0
  3164
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3165
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3166
	CActiveScheduler::Start();
sl@0
  3167
	CActiveScheduler::Start();
sl@0
  3168
	TEST2(view1->CountL(), 2);
sl@0
  3169
	TEST2(view2->CountL(), 2);
sl@0
  3170
sl@0
  3171
	filter = CLogFilter::NewL();
sl@0
  3172
	CleanupStack::PushL(filter);
sl@0
  3173
	
sl@0
  3174
	// Set filter
sl@0
  3175
	filter->SetContact(KTestContact3);
sl@0
  3176
	filter->SetDirection(KTestDirection3);
sl@0
  3177
	filter->SetDurationType(KLogDurationData);
sl@0
  3178
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  3179
	filter->SetNumber(KTestNumber3);
sl@0
  3180
	filter->SetRemoteParty(KTestRemote3);
sl@0
  3181
sl@0
  3182
	list->AppendL(filter);
sl@0
  3183
	CleanupStack::Pop(); // filter
sl@0
  3184
sl@0
  3185
	// Test View
sl@0
  3186
	active1->StartL();
sl@0
  3187
	active2->StartL();
sl@0
  3188
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3189
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3190
	CActiveScheduler::Start();
sl@0
  3191
	CActiveScheduler::Start();
sl@0
  3192
	TEST2(view1->CountL(), 3);
sl@0
  3193
	TEST2(view2->CountL(), 3);
sl@0
  3194
sl@0
  3195
	list->ResetAndDestroy();
sl@0
  3196
sl@0
  3197
	/////////////////////////////////////////
sl@0
  3198
sl@0
  3199
	filter = CLogFilter::NewL();
sl@0
  3200
	CleanupStack::PushL(filter);
sl@0
  3201
	
sl@0
  3202
	// Set filter
sl@0
  3203
	filter->SetContact(KTestContact1);
sl@0
  3204
	filter->SetDirection(KTestDirection1);
sl@0
  3205
	filter->SetDurationType(KLogDurationNone);
sl@0
  3206
	filter->SetEventType(KLogCallEventTypeUid);
sl@0
  3207
	filter->SetNumber(KTestNumber1);
sl@0
  3208
	filter->SetRemoteParty(KTestRemote1);
sl@0
  3209
	filter->SetStatus(KTestStatus1);
sl@0
  3210
sl@0
  3211
	list->AppendL(filter);
sl@0
  3212
	CleanupStack::Pop(); // filter
sl@0
  3213
sl@0
  3214
	// Test View
sl@0
  3215
	active1->StartL();
sl@0
  3216
	active2->StartL();
sl@0
  3217
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3218
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3219
	CActiveScheduler::Start();
sl@0
  3220
	CActiveScheduler::Start();
sl@0
  3221
	TEST2(view1->CountL(), 1);
sl@0
  3222
	TEST2(view2->CountL(), 1);
sl@0
  3223
sl@0
  3224
	filter = CLogFilter::NewL();
sl@0
  3225
	CleanupStack::PushL(filter);
sl@0
  3226
	
sl@0
  3227
	// Set filter
sl@0
  3228
	filter->SetContact(KTestContact2);
sl@0
  3229
	filter->SetDirection(KTestDirection2);
sl@0
  3230
	filter->SetDurationType(KLogDurationValid);
sl@0
  3231
	filter->SetEventType(KLogDataEventTypeUid);
sl@0
  3232
	filter->SetNumber(KTestNumber2);
sl@0
  3233
	filter->SetRemoteParty(KTestRemote2);
sl@0
  3234
	filter->SetStatus(KTestStatus2);
sl@0
  3235
sl@0
  3236
	list->AppendL(filter);
sl@0
  3237
	CleanupStack::Pop(); // filter
sl@0
  3238
sl@0
  3239
	// Test View
sl@0
  3240
	active1->StartL();
sl@0
  3241
	active2->StartL();
sl@0
  3242
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3243
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3244
	CActiveScheduler::Start();
sl@0
  3245
	CActiveScheduler::Start();
sl@0
  3246
	TEST2(view1->CountL(), 2);
sl@0
  3247
	TEST2(view2->CountL(), 2);
sl@0
  3248
sl@0
  3249
	filter = CLogFilter::NewL();
sl@0
  3250
	CleanupStack::PushL(filter);
sl@0
  3251
	
sl@0
  3252
	// Set filter
sl@0
  3253
	filter->SetContact(KTestContact3);
sl@0
  3254
	filter->SetDirection(KTestDirection3);
sl@0
  3255
	filter->SetDurationType(KLogDurationData);
sl@0
  3256
	filter->SetEventType(KLogFaxEventTypeUid);
sl@0
  3257
	filter->SetNumber(KTestNumber3);
sl@0
  3258
	filter->SetRemoteParty(KTestRemote3);
sl@0
  3259
	filter->SetStatus(KTestStatus3);
sl@0
  3260
sl@0
  3261
	list->AppendL(filter);
sl@0
  3262
	CleanupStack::Pop(); // filter
sl@0
  3263
sl@0
  3264
	// Test View
sl@0
  3265
	active1->StartL();
sl@0
  3266
	active2->StartL();
sl@0
  3267
	TEST(view1->SetFilterL(*list, active1->iStatus));
sl@0
  3268
	TEST(view2->SetFilterL(*list, active2->iStatus));
sl@0
  3269
	CActiveScheduler::Start();
sl@0
  3270
	CActiveScheduler::Start();
sl@0
  3271
	TEST2(view1->CountL(), 3);
sl@0
  3272
	TEST2(view2->CountL(), 3);
sl@0
  3273
sl@0
  3274
	list->ResetAndDestroy();
sl@0
  3275
sl@0
  3276
	CleanupStack::PopAndDestroy(7); // list, view1, view2, client2, event, active1, active2
sl@0
  3277
	}
sl@0
  3278
sl@0
  3279
/**
sl@0
  3280
@SYMTestCaseID          SYSLIB-LOGENG-CT-0945
sl@0
  3281
@SYMTestCaseDesc	    Tests for notification on changes done to the view
sl@0
  3282
                        Tests for CLogViewChangeObserver::iStatus 
sl@0
  3283
@SYMTestPriority 	    High
sl@0
  3284
@SYMTestActions  	    Tests for setting a filter on the view.Check for receiving notifications on adding events to the view
sl@0
  3285
@SYMTestExpectedResults Test must not fail
sl@0
  3286
@SYMREQ                 REQ0000
sl@0
  3287
*/
sl@0
  3288
LOCAL_C void TestViewChangeEventsL(CLogClient& aClient)
sl@0
  3289
	{
sl@0
  3290
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0945 "));
sl@0
  3291
	TestUtils::DeleteDatabaseL();
sl@0
  3292
sl@0
  3293
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3294
	CleanupStack::PushL(event);
sl@0
  3295
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3296
sl@0
  3297
	CTestActive* active = new(ELeave) CTestActive();
sl@0
  3298
	CleanupStack::PushL(active);
sl@0
  3299
sl@0
  3300
	CLogViewChangeObserver* changeObs = CLogViewChangeObserver::NewLC();
sl@0
  3301
sl@0
  3302
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
sl@0
  3303
	CleanupStack::PushL(view);
sl@0
  3304
sl@0
  3305
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  3306
	CleanupStack::PushL(filter);
sl@0
  3307
	TEST(!view->SetFilterL(*filter, active->iStatus));
sl@0
  3308
sl@0
  3309
	// Add some events and check we receive change notifications
sl@0
  3310
	TInt count;
sl@0
  3311
	TLogId logId;
sl@0
  3312
	TInt viewIndex;
sl@0
  3313
	//
sl@0
  3314
	for(count = 0; count < KTestEventNum; count++)
sl@0
  3315
		{
sl@0
  3316
		aClient.AddEvent(*event, changeObs->iStatus);
sl@0
  3317
		CLogChangeDefinition* changes = changeObs->WaitForChangesLC(CLogViewChangeObserver::EStopOnBoth);
sl@0
  3318
		TEST2(changeObs->iStatus.Int(), KErrNone);
sl@0
  3319
		TEST(event->Id() == (TLogId) count);
sl@0
  3320
		//
sl@0
  3321
		User::After(1);
sl@0
  3322
		//
sl@0
  3323
		TEST2(changes->Count(), 1);
sl@0
  3324
		TEST2(changes->At(0, logId, viewIndex), ELogChangeTypeEventAdded);
sl@0
  3325
		TEST(logId == (TLogId) count);
sl@0
  3326
		TEST2(viewIndex, 0);
sl@0
  3327
		CleanupStack::PopAndDestroy(changes);
sl@0
  3328
		}
sl@0
  3329
sl@0
  3330
	CleanupStack::PopAndDestroy(5, event); // filter, view, changeObs, active, event
sl@0
  3331
	}
sl@0
  3332
sl@0
  3333
/**
sl@0
  3334
@SYMTestCaseID          SYSLIB-LOGENG-CT-0946
sl@0
  3335
@SYMTestCaseDesc	    Tests for events in the recent view list 
sl@0
  3336
@SYMTestPriority 	    High
sl@0
  3337
@SYMTestActions  	    Tests for events in the recent view list after setting the filters for incoming,outgoing and missed calls
sl@0
  3338
@SYMTestExpectedResults Test must not fail
sl@0
  3339
@SYMREQ                 REQ0000
sl@0
  3340
*/
sl@0
  3341
LOCAL_C void TestAltEventsInRecentListL(CLogClient& aClient)
sl@0
  3342
	{
sl@0
  3343
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0946 "));
sl@0
  3344
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3345
	CleanupStack::PushL(event);
sl@0
  3346
sl@0
  3347
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  3348
	CleanupStack::PushL(active);
sl@0
  3349
sl@0
  3350
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  3351
	CleanupStack::PushL(view);
sl@0
  3352
sl@0
  3353
	// Clear recent lists
sl@0
  3354
	active->StartL();
sl@0
  3355
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  3356
	CActiveScheduler::Start();
sl@0
  3357
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3358
sl@0
  3359
	TLogString buf;
sl@0
  3360
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3361
	
sl@0
  3362
	// Add Incoming events
sl@0
  3363
	aClient.GetString(buf, R_LOG_DIR_IN);	
sl@0
  3364
	event->SetDirection(buf);
sl@0
  3365
	event->SetContact(1);
sl@0
  3366
	active->StartL();
sl@0
  3367
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3368
	CActiveScheduler::Start();
sl@0
  3369
	TEST2(active->iStatus.Int(), KErrNone);	
sl@0
  3370
	aClient.GetString(buf, R_LOG_DIR_IN_ALT);
sl@0
  3371
	event->SetDirection(buf);
sl@0
  3372
	event->SetContact(2);
sl@0
  3373
	active->StartL();
sl@0
  3374
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3375
	CActiveScheduler::Start();
sl@0
  3376
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3377
	// Verify both events in recent list
sl@0
  3378
	active->StartL();
sl@0
  3379
	TEST(view->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3380
	CActiveScheduler::Start();
sl@0
  3381
	TEST2(active->iStatus.Int(), KErrNone);  
sl@0
  3382
	TEST2(view->CountL(), 2);
sl@0
  3383
sl@0
  3384
	// Add Outgoing events
sl@0
  3385
	aClient.GetString(buf, R_LOG_DIR_OUT);
sl@0
  3386
	event->SetDirection(buf);
sl@0
  3387
	event->SetContact(3);
sl@0
  3388
	active->StartL();
sl@0
  3389
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3390
	CActiveScheduler::Start();
sl@0
  3391
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3392
	aClient.GetString(buf, R_LOG_DIR_OUT_ALT);
sl@0
  3393
	event->SetDirection(buf);
sl@0
  3394
	event->SetContact(4);
sl@0
  3395
	active->StartL();
sl@0
  3396
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3397
	CActiveScheduler::Start();
sl@0
  3398
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3399
	// Verify both events in recent list
sl@0
  3400
	active->StartL();
sl@0
  3401
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  3402
	CActiveScheduler::Start();
sl@0
  3403
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3404
	TEST2(view->CountL(), 2);
sl@0
  3405
sl@0
  3406
	// Add Missed events
sl@0
  3407
	aClient.GetString(buf, R_LOG_DIR_MISSED);
sl@0
  3408
	event->SetDirection(buf);
sl@0
  3409
	event->SetContact(5);
sl@0
  3410
	active->StartL();
sl@0
  3411
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3412
	CActiveScheduler::Start();
sl@0
  3413
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3414
	aClient.GetString(buf, R_LOG_DIR_MISSED_ALT);
sl@0
  3415
	event->SetDirection(buf);
sl@0
  3416
	event->SetContact(6);
sl@0
  3417
	active->StartL();
sl@0
  3418
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3419
	CActiveScheduler::Start();
sl@0
  3420
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3421
	// Verify both events in recent list
sl@0
  3422
	active->StartL();
sl@0
  3423
	TEST(view->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  3424
	CActiveScheduler::Start();
sl@0
  3425
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3426
	TEST2(view->CountL(), 2);
sl@0
  3427
sl@0
  3428
	CleanupStack::PopAndDestroy(3); // view, active, event, 
sl@0
  3429
	}
sl@0
  3430
sl@0
  3431
/**
sl@0
  3432
@SYMTestCaseID          SYSLIB-LOGENG-CT-0947
sl@0
  3433
@SYMTestCaseDesc	    Tests for view with filter by time 
sl@0
  3434
@SYMTestPriority 	    High
sl@0
  3435
@SYMTestActions  	    Tests for view with filters set by different time
sl@0
  3436
@SYMTestExpectedResults Test must not fail
sl@0
  3437
@SYMREQ                 REQ0000
sl@0
  3438
*/
sl@0
  3439
LOCAL_C void TestFilterByTimeL(CLogClient& aClient)
sl@0
  3440
	{
sl@0
  3441
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0947 "));
sl@0
  3442
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3443
	CleanupStack::PushL(event);
sl@0
  3444
sl@0
  3445
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  3446
	CleanupStack::PushL(active);
sl@0
  3447
sl@0
  3448
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  3449
	CleanupStack::PushL(view);
sl@0
  3450
sl@0
  3451
	// Clear recent lists
sl@0
  3452
	active->StartL();
sl@0
  3453
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  3454
	CActiveScheduler::Start();
sl@0
  3455
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3456
sl@0
  3457
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3458
	TLogString buf;
sl@0
  3459
	aClient.GetString(buf, R_LOG_DIR_IN);	
sl@0
  3460
	event->SetDirection(buf);
sl@0
  3461
	
sl@0
  3462
	// add first event (events following are added on successive days)
sl@0
  3463
	event->SetContact(1);  // ensures events are not duplicates
sl@0
  3464
	active->StartL();
sl@0
  3465
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3466
	CActiveScheduler::Start();
sl@0
  3467
	TEST2(active->iStatus.Int(), KErrNone);		
sl@0
  3468
sl@0
  3469
	TTime systemTime;
sl@0
  3470
	systemTime.UniversalTime();
sl@0
  3471
sl@0
  3472
	// set filter startDate
sl@0
  3473
	TTime startDate = systemTime + (TTimeIntervalHours)+1;
sl@0
  3474
sl@0
  3475
	// add event 2	
sl@0
  3476
	systemTime += (TTimeIntervalDays)+1;
sl@0
  3477
	event->SetContact(2);
sl@0
  3478
	active->StartL();
sl@0
  3479
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3480
	CActiveScheduler::Start();
sl@0
  3481
	TEST2(active->iStatus.Int(), KErrNone);	
sl@0
  3482
sl@0
  3483
	event->SetTime(systemTime);
sl@0
  3484
	active->StartL();
sl@0
  3485
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  3486
	CActiveScheduler::Start();
sl@0
  3487
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3488
	
sl@0
  3489
	// add event 3
sl@0
  3490
	systemTime += (TTimeIntervalDays)+1;
sl@0
  3491
	event->SetContact(3);
sl@0
  3492
	active->StartL();
sl@0
  3493
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3494
	CActiveScheduler::Start();
sl@0
  3495
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3496
sl@0
  3497
	event->SetTime(systemTime);
sl@0
  3498
	active->StartL();
sl@0
  3499
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  3500
	CActiveScheduler::Start();
sl@0
  3501
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3502
sl@0
  3503
	// set filter endDate 
sl@0
  3504
	TTime endDate = systemTime + (TTimeIntervalHours)+1;
sl@0
  3505
sl@0
  3506
	// add event 4
sl@0
  3507
	systemTime += (TTimeIntervalDays)+1;
sl@0
  3508
	event->SetContact(4);
sl@0
  3509
	active->StartL();
sl@0
  3510
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3511
	CActiveScheduler::Start();
sl@0
  3512
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3513
sl@0
  3514
	event->SetTime(systemTime);
sl@0
  3515
	active->StartL();
sl@0
  3516
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  3517
	CActiveScheduler::Start();
sl@0
  3518
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3519
sl@0
  3520
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  3521
	CleanupStack::PushL(filter);
sl@0
  3522
	
sl@0
  3523
	// check using both start and end
sl@0
  3524
	filter->SetStartTime(startDate);	
sl@0
  3525
	filter->SetEndTime(endDate);		
sl@0
  3526
	active->StartL();
sl@0
  3527
	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
sl@0
  3528
	CActiveScheduler::Start();
sl@0
  3529
	TEST2(active->iStatus.Int(), KErrNone);  
sl@0
  3530
	TEST2(view->CountL(), 2); 
sl@0
  3531
sl@0
  3532
	//  only end filter
sl@0
  3533
	filter->SetStartTime(TTime(0));	// reset	
sl@0
  3534
	filter->SetEndTime(endDate);		
sl@0
  3535
	active->StartL();
sl@0
  3536
	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
sl@0
  3537
	CActiveScheduler::Start();
sl@0
  3538
	TEST2(active->iStatus.Int(), KErrNone);  
sl@0
  3539
	TEST2(view->CountL(), 3); 
sl@0
  3540
sl@0
  3541
	//  only start filter
sl@0
  3542
	filter->SetStartTime(startDate); 
sl@0
  3543
	filter->SetEndTime(TTime(0));		
sl@0
  3544
	active->StartL();
sl@0
  3545
	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
sl@0
  3546
	CActiveScheduler::Start();
sl@0
  3547
	TEST2(active->iStatus.Int(), KErrNone);  
sl@0
  3548
	TEST2(view->CountL(), 3); 	
sl@0
  3549
sl@0
  3550
	//  no time filter
sl@0
  3551
	filter->SetStartTime(TTime(0)); 
sl@0
  3552
	filter->SetEndTime(TTime(0));		
sl@0
  3553
	active->StartL();
sl@0
  3554
	TEST(view->SetRecentListL(KLogNullRecentList, *filter, active->iStatus));
sl@0
  3555
	CActiveScheduler::Start();
sl@0
  3556
	TEST2(active->iStatus.Int(), KErrNone);  
sl@0
  3557
	TEST2(view->CountL(), 4); 	
sl@0
  3558
sl@0
  3559
	CleanupStack::PopAndDestroy(4); // view, active, event, filter 
sl@0
  3560
	}
sl@0
  3561
sl@0
  3562
/**
sl@0
  3563
@SYMTestCaseID          SYSLIB-LOGENG-CT-0948
sl@0
  3564
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  3565
@SYMTestPriority 	    High
sl@0
  3566
@SYMTestActions  	    Check that a view doesn't get change events for duplicates
sl@0
  3567
@SYMTestExpectedResults Test must not fail
sl@0
  3568
@SYMREQ                 REQ0000
sl@0
  3569
*/
sl@0
  3570
LOCAL_C void TestHiddenChangeEvents1L(CLogClient& aClient)
sl@0
  3571
	{
sl@0
  3572
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0948 "));
sl@0
  3573
	TLogId logId;
sl@0
  3574
	TInt viewIndex;
sl@0
  3575
	TLogDatabaseChangeType type;
sl@0
  3576
sl@0
  3577
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  3578
	changeObs1->StartCollectingChanges();
sl@0
  3579
sl@0
  3580
sl@0
  3581
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  3582
	CleanupStack::PushL(view);
sl@0
  3583
sl@0
  3584
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  3585
	CleanupStack::PushL(filter);
sl@0
  3586
sl@0
  3587
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3588
	CleanupStack::PushL(event);
sl@0
  3589
sl@0
  3590
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  3591
	CleanupStack::PushL(active);
sl@0
  3592
sl@0
  3593
	TTime now;
sl@0
  3594
	now.UniversalTime();
sl@0
  3595
	now += (TTimeIntervalDays)+1;
sl@0
  3596
sl@0
  3597
	// Get rid of all the events in the log
sl@0
  3598
	active->StartL();
sl@0
  3599
	aClient.ClearLog(now, active->iStatus);
sl@0
  3600
	CActiveScheduler::Start();
sl@0
  3601
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3602
sl@0
  3603
	// Incoming call event
sl@0
  3604
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3605
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  3606
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  3607
	event->SetDirection(buf);
sl@0
  3608
sl@0
  3609
	// Add an event
sl@0
  3610
	active->StartL();
sl@0
  3611
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3612
	CActiveScheduler::Start();
sl@0
  3613
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3614
sl@0
  3615
	// Setup normal event view
sl@0
  3616
	active->StartL();
sl@0
  3617
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  3618
	CActiveScheduler::Start();
sl@0
  3619
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3620
sl@0
  3621
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  3622
	changeObs2->StartCollectingChanges();
sl@0
  3623
sl@0
  3624
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  3625
	CleanupStack::PushL(recent);
sl@0
  3626
sl@0
  3627
	// Check recent view
sl@0
  3628
	active->StartL();
sl@0
  3629
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3630
	CActiveScheduler::Start();
sl@0
  3631
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3632
	TEST2(recent->CountL(), 1);
sl@0
  3633
sl@0
  3634
	// Add a new event
sl@0
  3635
	active->StartL();
sl@0
  3636
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3637
	CActiveScheduler::Start();
sl@0
  3638
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3639
sl@0
  3640
	// Check change events
sl@0
  3641
	CTestTimer* timer = CTestTimer::NewL();
sl@0
  3642
	timer->After(100000);
sl@0
  3643
	CActiveScheduler::Start();
sl@0
  3644
	delete timer;
sl@0
  3645
	
sl@0
  3646
	TEST2(changeObs2->Changes().Count(), 2);
sl@0
  3647
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  3648
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  3649
	type = changeObs2->Changes().At(1, logId, viewIndex);
sl@0
  3650
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  3651
sl@0
  3652
	// Check recent view
sl@0
  3653
	active->StartL();
sl@0
  3654
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3655
	CActiveScheduler::Start();
sl@0
  3656
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3657
	TEST2(recent->CountL(), 1);
sl@0
  3658
sl@0
  3659
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  3660
	CleanupStack::PushL(duplicate);
sl@0
  3661
sl@0
  3662
	// Check duplicate count
sl@0
  3663
	active->StartL();
sl@0
  3664
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  3665
	CActiveScheduler::Start();
sl@0
  3666
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3667
	TEST2(duplicate->CountL(), 1);
sl@0
  3668
sl@0
  3669
	// Check change events
sl@0
  3670
	User::After(100000);
sl@0
  3671
	TEST2(changeObs1->Changes().Count(), 1);
sl@0
  3672
	type = changeObs1->Changes().At(0, logId, viewIndex);
sl@0
  3673
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  3674
sl@0
  3675
	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  3676
	}
sl@0
  3677
sl@0
  3678
/**
sl@0
  3679
@SYMTestCaseID          SYSLIB-LOGENG-CT-0949
sl@0
  3680
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  3681
@SYMTestPriority 	    High
sl@0
  3682
@SYMTestActions  	    Check that a view doesn't get change events when recent list purged
sl@0
  3683
@SYMTestExpectedResults Test must not fail
sl@0
  3684
@SYMREQ                 REQ0000
sl@0
  3685
*/
sl@0
  3686
LOCAL_C void TestHiddenChangeEvents2L(CLogClient& aClient)
sl@0
  3687
	{
sl@0
  3688
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0949 "));
sl@0
  3689
	TLogId logId;
sl@0
  3690
	TInt viewIndex;
sl@0
  3691
	TLogDatabaseChangeType type;
sl@0
  3692
sl@0
  3693
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  3694
	changeObs1->StartCollectingChanges();
sl@0
  3695
sl@0
  3696
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  3697
	CleanupStack::PushL(view);
sl@0
  3698
sl@0
  3699
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  3700
	CleanupStack::PushL(filter);
sl@0
  3701
sl@0
  3702
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3703
	CleanupStack::PushL(event);
sl@0
  3704
sl@0
  3705
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  3706
	CleanupStack::PushL(active);
sl@0
  3707
sl@0
  3708
	TTime now;
sl@0
  3709
	now.UniversalTime();
sl@0
  3710
	now += (TTimeIntervalDays)+1;
sl@0
  3711
sl@0
  3712
	// Get rid of all the events in the log
sl@0
  3713
	active->StartL();
sl@0
  3714
	aClient.ClearLog(now, active->iStatus);
sl@0
  3715
	CActiveScheduler::Start();
sl@0
  3716
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3717
sl@0
  3718
	// Get config
sl@0
  3719
	TLogConfig config;
sl@0
  3720
	active->StartL();
sl@0
  3721
	aClient.GetConfig(config, active->iStatus);
sl@0
  3722
	CActiveScheduler::Start();
sl@0
  3723
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3724
sl@0
  3725
	// Incoming call event
sl@0
  3726
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3727
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  3728
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  3729
	event->SetDirection(buf);
sl@0
  3730
sl@0
  3731
	// Add max allowed events
sl@0
  3732
	TInt count = config.iMaxRecentLogSize;
sl@0
  3733
	while(count--)
sl@0
  3734
		{
sl@0
  3735
		event->SetContact(count+1);
sl@0
  3736
		active->StartL();
sl@0
  3737
		aClient.AddEvent(*event, active->iStatus);
sl@0
  3738
		CActiveScheduler::Start();
sl@0
  3739
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3740
		}
sl@0
  3741
sl@0
  3742
	// Setup normal event view
sl@0
  3743
	active->StartL();
sl@0
  3744
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  3745
	CActiveScheduler::Start();
sl@0
  3746
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3747
sl@0
  3748
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  3749
	changeObs2->StartCollectingChanges();
sl@0
  3750
sl@0
  3751
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  3752
	CleanupStack::PushL(recent);
sl@0
  3753
sl@0
  3754
	// Check recent view
sl@0
  3755
	active->StartL();
sl@0
  3756
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3757
	CActiveScheduler::Start();
sl@0
  3758
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3759
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  3760
sl@0
  3761
	// Add a new event, will cause one to be purged from recent view
sl@0
  3762
	event->SetContact(1234);
sl@0
  3763
	active->StartL();
sl@0
  3764
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3765
	CActiveScheduler::Start();
sl@0
  3766
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3767
sl@0
  3768
	// Check change events
sl@0
  3769
	CTestTimer *timer = CTestTimer::NewL();
sl@0
  3770
 	timer->After(100000);
sl@0
  3771
 	CActiveScheduler::Start();
sl@0
  3772
 	delete timer;
sl@0
  3773
		
sl@0
  3774
	TEST2(changeObs2->Changes().Count(), 2);
sl@0
  3775
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  3776
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  3777
	type = changeObs2->Changes().At(1, logId, viewIndex);
sl@0
  3778
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  3779
sl@0
  3780
	// Check recent view
sl@0
  3781
	active->StartL();
sl@0
  3782
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3783
	CActiveScheduler::Start();
sl@0
  3784
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3785
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  3786
sl@0
  3787
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  3788
	CleanupStack::PushL(duplicate);
sl@0
  3789
sl@0
  3790
	// Check duplicate count
sl@0
  3791
	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  3792
sl@0
  3793
	// Check change events
sl@0
  3794
	User::After(100000);
sl@0
  3795
	TEST2(changeObs1->Changes().Count(), 1);
sl@0
  3796
	type = changeObs1->Changes().At(0, logId, viewIndex);
sl@0
  3797
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  3798
sl@0
  3799
	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  3800
	}
sl@0
  3801
/**
sl@0
  3802
@SYMTestCaseID          SYSLIB-LOGENG-CT-0950
sl@0
  3803
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  3804
@SYMTestPriority 	    High
sl@0
  3805
@SYMTestActions  	    Check that a view doesn't get change events when recent list purged after changing config
sl@0
  3806
@SYMTestExpectedResults Test must not fail
sl@0
  3807
@SYMREQ                 REQ0000
sl@0
  3808
*/
sl@0
  3809
LOCAL_C void TestHiddenChangeEvents3L(CLogClient& aClient)
sl@0
  3810
	{
sl@0
  3811
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0950 "));
sl@0
  3812
	TLogId logId;
sl@0
  3813
	TInt viewIndex;
sl@0
  3814
	TLogDatabaseChangeType type;
sl@0
  3815
sl@0
  3816
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  3817
	changeObs1->StartCollectingChanges();
sl@0
  3818
sl@0
  3819
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  3820
	CleanupStack::PushL(view);
sl@0
  3821
sl@0
  3822
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  3823
	CleanupStack::PushL(filter);
sl@0
  3824
sl@0
  3825
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3826
	CleanupStack::PushL(event);
sl@0
  3827
sl@0
  3828
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  3829
	CleanupStack::PushL(active);
sl@0
  3830
sl@0
  3831
	TTime now;
sl@0
  3832
	now.UniversalTime();
sl@0
  3833
	now += (TTimeIntervalDays)+1;
sl@0
  3834
sl@0
  3835
	// Get rid of all the events in the log
sl@0
  3836
	active->StartL();
sl@0
  3837
	aClient.ClearLog(now, active->iStatus);
sl@0
  3838
	CActiveScheduler::Start();
sl@0
  3839
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3840
sl@0
  3841
	// Get and set config
sl@0
  3842
	TLogConfig config;
sl@0
  3843
	active->StartL();
sl@0
  3844
	aClient.GetConfig(config, active->iStatus);
sl@0
  3845
	CActiveScheduler::Start();
sl@0
  3846
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3847
	config.iMaxRecentLogSize = 2;
sl@0
  3848
	active->StartL();
sl@0
  3849
	aClient.ChangeConfig(config, active->iStatus);
sl@0
  3850
	CActiveScheduler::Start();
sl@0
  3851
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3852
sl@0
  3853
	// Incoming call event
sl@0
  3854
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3855
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  3856
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  3857
	event->SetDirection(buf);
sl@0
  3858
sl@0
  3859
	// Add max allowed events
sl@0
  3860
	TInt count = config.iMaxRecentLogSize;
sl@0
  3861
	while(count--)
sl@0
  3862
		{
sl@0
  3863
		event->SetContact(count+1);
sl@0
  3864
		active->StartL();
sl@0
  3865
		aClient.AddEvent(*event, active->iStatus);
sl@0
  3866
		CActiveScheduler::Start();
sl@0
  3867
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3868
		}
sl@0
  3869
sl@0
  3870
	// Setup normal event view
sl@0
  3871
	active->StartL();
sl@0
  3872
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  3873
	CActiveScheduler::Start();
sl@0
  3874
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3875
sl@0
  3876
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  3877
	changeObs2->StartCollectingChanges();
sl@0
  3878
sl@0
  3879
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  3880
	CleanupStack::PushL(recent);
sl@0
  3881
sl@0
  3882
	// Check recent view
sl@0
  3883
	active->StartL();
sl@0
  3884
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3885
	CActiveScheduler::Start();
sl@0
  3886
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3887
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  3888
sl@0
  3889
	// Change config, will cause one event to be purged from recent view
sl@0
  3890
	config.iMaxRecentLogSize = 1;
sl@0
  3891
	active->StartL();
sl@0
  3892
	aClient.ChangeConfig(config, active->iStatus);
sl@0
  3893
	CActiveScheduler::Start();
sl@0
  3894
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3895
sl@0
  3896
	// Check change events
sl@0
  3897
	User::After(100000);
sl@0
  3898
	TEST2(changeObs2->Changes().Count(), 1);
sl@0
  3899
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  3900
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  3901
sl@0
  3902
	// Check recent view
sl@0
  3903
	active->StartL();
sl@0
  3904
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  3905
	CActiveScheduler::Start();
sl@0
  3906
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3907
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  3908
sl@0
  3909
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  3910
	CleanupStack::PushL(duplicate);
sl@0
  3911
sl@0
  3912
	// Check duplicate count
sl@0
  3913
	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  3914
sl@0
  3915
	// Check change events
sl@0
  3916
	User::After(100000);
sl@0
  3917
	TEST(!changeObs1->HaveChanges());
sl@0
  3918
sl@0
  3919
	CleanupStack::PopAndDestroy(8); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  3920
	}
sl@0
  3921
sl@0
  3922
/**
sl@0
  3923
@SYMTestCaseID          SYSLIB-LOGENG-CT-0951
sl@0
  3924
@SYMTestCaseDesc	    Test for log view change observer
sl@0
  3925
@SYMTestPriority 	    High
sl@0
  3926
@SYMTestActions  	    Check that when deleting an event causing recent lists to be updated,views don't get unnecessary change events
sl@0
  3927
@SYMTestExpectedResults Test must not fail
sl@0
  3928
@SYMREQ                 REQ0000
sl@0
  3929
*/
sl@0
  3930
LOCAL_C void TestHiddenChangeEvents4L(CLogClient& aClient)
sl@0
  3931
	{
sl@0
  3932
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0951 "));
sl@0
  3933
	TLogId logId;
sl@0
  3934
	TInt viewIndex;
sl@0
  3935
	TLogDatabaseChangeType type;
sl@0
  3936
sl@0
  3937
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  3938
	changeObs1->StartCollectingChanges();
sl@0
  3939
sl@0
  3940
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  3941
	CleanupStack::PushL(view);
sl@0
  3942
sl@0
  3943
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  3944
	CleanupStack::PushL(filter);
sl@0
  3945
	filter->SetFlags(1); // Need to hide an event from the view
sl@0
  3946
sl@0
  3947
	CLogEvent* event = CLogEvent::NewL();
sl@0
  3948
	CleanupStack::PushL(event);
sl@0
  3949
sl@0
  3950
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  3951
	CleanupStack::PushL(active);
sl@0
  3952
sl@0
  3953
	TTime now;
sl@0
  3954
	now.UniversalTime();
sl@0
  3955
	now += (TTimeIntervalDays)+1;
sl@0
  3956
sl@0
  3957
	// Get rid of all the events in the log
sl@0
  3958
	active->StartL();
sl@0
  3959
	aClient.ClearLog(now, active->iStatus);
sl@0
  3960
	CActiveScheduler::Start();
sl@0
  3961
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3962
sl@0
  3963
	// Incoming call event
sl@0
  3964
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  3965
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  3966
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  3967
	event->SetDirection(buf);
sl@0
  3968
sl@0
  3969
	event->SetFlags(1);
sl@0
  3970
sl@0
  3971
	// Add an event
sl@0
  3972
	active->StartL();
sl@0
  3973
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3974
	CActiveScheduler::Start();
sl@0
  3975
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3976
sl@0
  3977
	// Add an event
sl@0
  3978
	active->StartL();
sl@0
  3979
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3980
	CActiveScheduler::Start();
sl@0
  3981
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3982
sl@0
  3983
	event->ClearFlags(0xF);
sl@0
  3984
sl@0
  3985
	// Add an event
sl@0
  3986
	active->StartL();
sl@0
  3987
	aClient.AddEvent(*event, active->iStatus);
sl@0
  3988
	CActiveScheduler::Start();
sl@0
  3989
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3990
sl@0
  3991
	// Setup normal event view
sl@0
  3992
	active->StartL();
sl@0
  3993
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  3994
	CActiveScheduler::Start();
sl@0
  3995
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  3996
	TEST2(view->CountL(), 2);
sl@0
  3997
sl@0
  3998
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  3999
	changeObs2->StartCollectingChanges();
sl@0
  4000
sl@0
  4001
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  4002
	CleanupStack::PushL(recent);
sl@0
  4003
sl@0
  4004
	// Check recent view
sl@0
  4005
	active->StartL();
sl@0
  4006
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4007
	CActiveScheduler::Start();
sl@0
  4008
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4009
	TEST2(recent->CountL(), 1);
sl@0
  4010
sl@0
  4011
	changeObs1->StartCollectingChanges();
sl@0
  4012
	changeObs2->StartCollectingChanges();
sl@0
  4013
sl@0
  4014
	// Delete the event in recent list
sl@0
  4015
	active->StartL();
sl@0
  4016
	aClient.DeleteEvent(event->Id(), active->iStatus);
sl@0
  4017
	CActiveScheduler::Start();
sl@0
  4018
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4019
sl@0
  4020
	// Check change events
sl@0
  4021
	User::After(1000000);
sl@0
  4022
	TEST2(changeObs2->Changes().Count(), 2);
sl@0
  4023
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  4024
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  4025
	type = changeObs2->Changes().At(1, logId, viewIndex);
sl@0
  4026
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  4027
sl@0
  4028
	TEST(!changeObs1->HaveChanges());
sl@0
  4029
sl@0
  4030
	CleanupStack::PopAndDestroy(7); // changeObs1, changeObs2, view, filter, event, active, recent
sl@0
  4031
	}
sl@0
  4032
sl@0
  4033
/**
sl@0
  4034
@SYMTestCaseID          SYSLIB-LOGENG-CT-0952
sl@0
  4035
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  4036
@SYMTestPriority 	    High
sl@0
  4037
@SYMTestActions  	    Check that a view doesn't get change events when recent list cleared
sl@0
  4038
@SYMTestExpectedResults Test must not fail
sl@0
  4039
@SYMREQ                 REQ0000
sl@0
  4040
*/
sl@0
  4041
LOCAL_C void TestHiddenChangeEvents5L(CLogClient& aClient)
sl@0
  4042
	{
sl@0
  4043
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0952 "));
sl@0
  4044
	TLogId logId;
sl@0
  4045
	TInt viewIndex;
sl@0
  4046
	TLogDatabaseChangeType type;
sl@0
  4047
sl@0
  4048
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  4049
	changeObs1->StartCollectingChanges();
sl@0
  4050
sl@0
  4051
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  4052
	CleanupStack::PushL(view);
sl@0
  4053
sl@0
  4054
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  4055
	CleanupStack::PushL(filter);
sl@0
  4056
sl@0
  4057
	CLogEvent* event = CLogEvent::NewL();
sl@0
  4058
	CleanupStack::PushL(event);
sl@0
  4059
sl@0
  4060
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  4061
	CleanupStack::PushL(active);
sl@0
  4062
sl@0
  4063
	TTime now;
sl@0
  4064
	now.UniversalTime();
sl@0
  4065
	now += (TTimeIntervalDays)+1;
sl@0
  4066
sl@0
  4067
	// Get rid of all the events in the log
sl@0
  4068
	active->StartL();
sl@0
  4069
	aClient.ClearLog(now, active->iStatus);
sl@0
  4070
	CActiveScheduler::Start();
sl@0
  4071
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4072
sl@0
  4073
	// Get config
sl@0
  4074
	TLogConfig config;
sl@0
  4075
	active->StartL();
sl@0
  4076
	aClient.GetConfig(config, active->iStatus);
sl@0
  4077
	CActiveScheduler::Start();
sl@0
  4078
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4079
sl@0
  4080
	// Incoming call event
sl@0
  4081
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  4082
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  4083
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  4084
	event->SetDirection(buf);
sl@0
  4085
sl@0
  4086
	// Add max allowed events
sl@0
  4087
	TInt count = config.iMaxRecentLogSize;
sl@0
  4088
	while(count--)
sl@0
  4089
		{
sl@0
  4090
		event->SetContact(count+1);
sl@0
  4091
		active->StartL();
sl@0
  4092
		aClient.AddEvent(*event, active->iStatus);
sl@0
  4093
		CActiveScheduler::Start();
sl@0
  4094
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4095
		}
sl@0
  4096
sl@0
  4097
	// Setup normal event view
sl@0
  4098
	active->StartL();
sl@0
  4099
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  4100
	CActiveScheduler::Start();
sl@0
  4101
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4102
sl@0
  4103
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  4104
	changeObs2->StartCollectingChanges();
sl@0
  4105
sl@0
  4106
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  4107
	CleanupStack::PushL(recent);
sl@0
  4108
sl@0
  4109
	// Check recent view
sl@0
  4110
	active->StartL();
sl@0
  4111
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4112
	CActiveScheduler::Start();
sl@0
  4113
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4114
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  4115
sl@0
  4116
	// Clear recent view
sl@0
  4117
	active->StartL();
sl@0
  4118
	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
sl@0
  4119
	CActiveScheduler::Start();
sl@0
  4120
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4121
sl@0
  4122
	// Check change events
sl@0
  4123
	User::After(100000);
sl@0
  4124
sl@0
  4125
	count = config.iMaxRecentLogSize;
sl@0
  4126
	TEST2(changeObs2->Changes().Count(), count);
sl@0
  4127
	while(count--)
sl@0
  4128
		{
sl@0
  4129
		type = changeObs2->Changes().At(count, logId, viewIndex);
sl@0
  4130
		TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  4131
		}
sl@0
  4132
sl@0
  4133
	// Check recent view
sl@0
  4134
	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4135
sl@0
  4136
	// Check change events
sl@0
  4137
	User::After(100000);
sl@0
  4138
	TEST(!changeObs1->HaveChanges());
sl@0
  4139
sl@0
  4140
	CleanupStack::PopAndDestroy(7); // changeObs1, changeObs2, view, filter, event, active, recent
sl@0
  4141
	}
sl@0
  4142
sl@0
  4143
/**
sl@0
  4144
@SYMTestCaseID          SYSLIB-LOGENG-CT-0953
sl@0
  4145
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  4146
@SYMTestPriority 	    High
sl@0
  4147
@SYMTestActions  	    Check that a view doesn't get change events when removing events from a recent or duplicate view
sl@0
  4148
@SYMTestExpectedResults Test must not fail
sl@0
  4149
@SYMREQ                 REQ0000
sl@0
  4150
*/
sl@0
  4151
LOCAL_C void TestHiddenChangeEvents6L(CLogClient& aClient)
sl@0
  4152
	{
sl@0
  4153
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0953 "));
sl@0
  4154
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  4155
	changeObs1->StartCollectingChanges();
sl@0
  4156
sl@0
  4157
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  4158
	CleanupStack::PushL(view);
sl@0
  4159
sl@0
  4160
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  4161
	CleanupStack::PushL(filter);
sl@0
  4162
sl@0
  4163
	CLogEvent* event = CLogEvent::NewL();
sl@0
  4164
	CleanupStack::PushL(event);
sl@0
  4165
sl@0
  4166
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  4167
	CleanupStack::PushL(active);
sl@0
  4168
sl@0
  4169
	TTime now;
sl@0
  4170
	now.UniversalTime();
sl@0
  4171
	now += (TTimeIntervalDays)+1;
sl@0
  4172
sl@0
  4173
	// Get rid of all the events in the log
sl@0
  4174
	active->StartL();
sl@0
  4175
	aClient.ClearLog(now, active->iStatus);
sl@0
  4176
	CActiveScheduler::Start();
sl@0
  4177
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4178
sl@0
  4179
	// Incoming call event
sl@0
  4180
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  4181
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  4182
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  4183
	event->SetDirection(buf);
sl@0
  4184
sl@0
  4185
	// Add an event
sl@0
  4186
	active->StartL();
sl@0
  4187
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4188
	CActiveScheduler::Start();
sl@0
  4189
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4190
sl@0
  4191
	// Add a duplicate
sl@0
  4192
	active->StartL();
sl@0
  4193
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4194
	CActiveScheduler::Start();
sl@0
  4195
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4196
sl@0
  4197
	// Setup normal event view
sl@0
  4198
	active->StartL();
sl@0
  4199
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  4200
	CActiveScheduler::Start();
sl@0
  4201
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4202
	TEST2(view->CountL(), 2);
sl@0
  4203
sl@0
  4204
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  4205
	changeObs2->StartCollectingChanges();
sl@0
  4206
sl@0
  4207
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  4208
	CleanupStack::PushL(recent);
sl@0
  4209
sl@0
  4210
	// Check recent view
sl@0
  4211
	active->StartL();
sl@0
  4212
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4213
	CActiveScheduler::Start();
sl@0
  4214
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4215
	TEST2(recent->CountL(), 1);
sl@0
  4216
sl@0
  4217
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  4218
	CleanupStack::PushL(duplicate);
sl@0
  4219
sl@0
  4220
	// Check duplicate count
sl@0
  4221
	active->StartL();
sl@0
  4222
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  4223
	CActiveScheduler::Start();
sl@0
  4224
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4225
	TEST2(recent->CountL(), 1);
sl@0
  4226
sl@0
  4227
	// Remove duplicate
sl@0
  4228
	duplicate->RemoveL(duplicate->Event().Id());
sl@0
  4229
sl@0
  4230
	CTestTimer* timer = CTestTimer::NewL();
sl@0
  4231
	CleanupStack::PushL(timer);
sl@0
  4232
	timer->After(100000);
sl@0
  4233
	CActiveScheduler::Start();
sl@0
  4234
sl@0
  4235
	// Check change events
sl@0
  4236
	TEST(!changeObs1->HaveChanges());
sl@0
  4237
	TEST(!changeObs2->HaveChanges());
sl@0
  4238
sl@0
  4239
	// Remove recent
sl@0
  4240
	recent->RemoveL(recent->Event().Id());
sl@0
  4241
sl@0
  4242
	// Check change events
sl@0
  4243
	timer->After(100000);
sl@0
  4244
	CActiveScheduler::Start();
sl@0
  4245
sl@0
  4246
	TEST(!changeObs1->HaveChanges());
sl@0
  4247
	TEST(!changeObs2->HaveChanges()); // No event because we should know we called Remove on ourselves
sl@0
  4248
sl@0
  4249
	CleanupStack::PopAndDestroy(9); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate, timer
sl@0
  4250
	}
sl@0
  4251
sl@0
  4252
/**
sl@0
  4253
@SYMTestCaseID          SYSLIB-LOGENG-CT-0954
sl@0
  4254
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  4255
@SYMTestPriority 	    High
sl@0
  4256
@SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates
sl@0
  4257
@SYMTestExpectedResults Test must not fail
sl@0
  4258
@SYMREQ                 REQ0000
sl@0
  4259
*/
sl@0
  4260
LOCAL_C void TestHiddenChangeEvents7L(CLogClient& aClient)
sl@0
  4261
	{
sl@0
  4262
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0954 "));
sl@0
  4263
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  4264
	changeObs1->StartCollectingChanges();
sl@0
  4265
sl@0
  4266
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  4267
	CleanupStack::PushL(view);
sl@0
  4268
sl@0
  4269
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  4270
	CleanupStack::PushL(filter);
sl@0
  4271
sl@0
  4272
	CLogEvent* event = CLogEvent::NewL();
sl@0
  4273
	CleanupStack::PushL(event);
sl@0
  4274
sl@0
  4275
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  4276
	CleanupStack::PushL(active);
sl@0
  4277
sl@0
  4278
	TTime now;
sl@0
  4279
	now.UniversalTime();
sl@0
  4280
	now += (TTimeIntervalDays)+1;
sl@0
  4281
sl@0
  4282
	// Get rid of all the events in the log
sl@0
  4283
	active->StartL();
sl@0
  4284
	aClient.ClearLog(now, active->iStatus);
sl@0
  4285
	CActiveScheduler::Start();
sl@0
  4286
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4287
sl@0
  4288
	// Incoming call event
sl@0
  4289
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  4290
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  4291
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  4292
	event->SetDirection(buf);
sl@0
  4293
sl@0
  4294
	// Add an event
sl@0
  4295
	active->StartL();
sl@0
  4296
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4297
	CActiveScheduler::Start();
sl@0
  4298
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4299
sl@0
  4300
	// Add a duplicate
sl@0
  4301
	active->StartL();
sl@0
  4302
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4303
	CActiveScheduler::Start();
sl@0
  4304
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4305
sl@0
  4306
	// Setup normal event view
sl@0
  4307
	active->StartL();
sl@0
  4308
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  4309
	CActiveScheduler::Start();
sl@0
  4310
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4311
	TEST2(view->CountL(), 2);
sl@0
  4312
sl@0
  4313
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  4314
	changeObs2->StartCollectingChanges();
sl@0
  4315
sl@0
  4316
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  4317
	CleanupStack::PushL(recent);
sl@0
  4318
sl@0
  4319
	// Check recent view
sl@0
  4320
	active->StartL();
sl@0
  4321
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4322
	CActiveScheduler::Start();
sl@0
  4323
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4324
	TEST2(recent->CountL(), 1);
sl@0
  4325
sl@0
  4326
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  4327
	CleanupStack::PushL(duplicate);
sl@0
  4328
sl@0
  4329
	// Check duplicate count
sl@0
  4330
	active->StartL();
sl@0
  4331
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  4332
	CActiveScheduler::Start();
sl@0
  4333
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4334
	TEST2(recent->CountL(), 1);
sl@0
  4335
sl@0
  4336
	// Remove duplicate
sl@0
  4337
	recent->ClearDuplicatesL();
sl@0
  4338
sl@0
  4339
	CTestTimer* timer = CTestTimer::NewL();
sl@0
  4340
	CleanupStack::PushL(timer);
sl@0
  4341
	timer->After(100000);
sl@0
  4342
	CActiveScheduler::Start();
sl@0
  4343
sl@0
  4344
	// Check change events
sl@0
  4345
	TEST(!changeObs1->HaveChanges());
sl@0
  4346
	TEST(!changeObs2->HaveChanges());
sl@0
  4347
sl@0
  4348
	CleanupStack::PopAndDestroy(9); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate, timer
sl@0
  4349
	}
sl@0
  4350
sl@0
  4351
/**
sl@0
  4352
@SYMTestCaseID          SYSLIB-LOGENG-CT-1363
sl@0
  4353
@SYMTestCaseDesc	    Tests for log view change observer 
sl@0
  4354
						Making a call from recent call list causes total freeze if log 
sl@0
  4355
						has been cleared
sl@0
  4356
@SYMTestPriority 	    High
sl@0
  4357
@SYMTestActions  	    Test that editing a recent event does not cause a panic if 
sl@0
  4358
						part of the log has been cleared
sl@0
  4359
@SYMTestExpectedResults Test must not fail
sl@0
  4360
@SYMDEF                 DEF066296
sl@0
  4361
*/
sl@0
  4362
LOCAL_C void DEF066296L(CLogClient& aClient)
sl@0
  4363
	{
sl@0
  4364
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1363 "));
sl@0
  4365
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  4366
sl@0
  4367
	CLogEvent* event = CLogEvent::NewL();
sl@0
  4368
	CleanupStack::PushL(event);
sl@0
  4369
sl@0
  4370
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  4371
	CleanupStack::PushL(active);
sl@0
  4372
sl@0
  4373
	// To reproduce this defect, we need a view to be updated
sl@0
  4374
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  4375
	CleanupStack::PushL(view);
sl@0
  4376
sl@0
  4377
	// Set up the event and log a call from number 444
sl@0
  4378
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  4379
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  4380
	event->SetDirection(buf);
sl@0
  4381
	event->SetNumber(_L("444"));
sl@0
  4382
	active->StartL();
sl@0
  4383
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4384
	CActiveScheduler::Start();
sl@0
  4385
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4386
	
sl@0
  4387
	// Set up the view to display the recent call list
sl@0
  4388
	active->StartL();
sl@0
  4389
	TEST(view->SetRecentListL(-1, active->iStatus));
sl@0
  4390
	CActiveScheduler::Start();
sl@0
  4391
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4392
sl@0
  4393
	// Get and print current UTC time
sl@0
  4394
	TTime now;
sl@0
  4395
	now.UniversalTime();
sl@0
  4396
	TBuf<0x80> testString;
sl@0
  4397
	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
sl@0
  4398
	TheTest.Printf(_L("Current  UTC  time    - %S\n"), &testString);
sl@0
  4399
sl@0
  4400
	// Move the UTC time forward by one day
sl@0
  4401
	now += TTimeIntervalDays(1);
sl@0
  4402
	User::SetUTCTime(now);
sl@0
  4403
sl@0
  4404
	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
sl@0
  4405
	TheTest.Printf(_L("Changed  UTC  time to - %S\n"), &testString);
sl@0
  4406
	
sl@0
  4407
	// Set up the event and log a call from number 555
sl@0
  4408
	event->SetNumber(_L("555"));
sl@0
  4409
	active->StartL();
sl@0
  4410
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4411
	CActiveScheduler::Start();
sl@0
  4412
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4413
	
sl@0
  4414
	// Set up the event and log a call from number 611
sl@0
  4415
	event->SetNumber(_L("611"));
sl@0
  4416
	active->StartL();
sl@0
  4417
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4418
	CActiveScheduler::Start();
sl@0
  4419
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4420
	
sl@0
  4421
	//remember this Id - we will try to change this log event later
sl@0
  4422
	TInt logId = event->Id();
sl@0
  4423
sl@0
  4424
	// Set up the event and log a call from number 777
sl@0
  4425
	event->SetNumber(_L("777"));
sl@0
  4426
	active->StartL();
sl@0
  4427
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4428
	CActiveScheduler::Start();
sl@0
  4429
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4430
sl@0
  4431
	// Delete all events occurring before today
sl@0
  4432
	// this should remove only the first call to number 444
sl@0
  4433
	TDateTime midnight = now.DateTime();
sl@0
  4434
	midnight.SetHour(0);
sl@0
  4435
	midnight.SetMinute(0);
sl@0
  4436
	midnight.SetSecond(0);
sl@0
  4437
	midnight.SetMicroSecond(0);
sl@0
  4438
sl@0
  4439
	active->StartL();
sl@0
  4440
	aClient.ClearLog(midnight, active->iStatus);
sl@0
  4441
	CActiveScheduler::Start();
sl@0
  4442
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4443
sl@0
  4444
	// Attempt to change an entry from the recent list - that for the call to number 611 
sl@0
  4445
	// without this defect fix, the call to ChangeEvent() will panic with EBadArrayPosition
sl@0
  4446
	event->SetNumber(_L("555"));
sl@0
  4447
	event->SetId(logId);
sl@0
  4448
	active->StartL();
sl@0
  4449
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4450
	CActiveScheduler::Start();
sl@0
  4451
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4452
sl@0
  4453
	// Restore and print UTC time
sl@0
  4454
	now.UniversalTime();
sl@0
  4455
	now -= TTimeIntervalDays(1);
sl@0
  4456
	User::SetUTCTime(now);
sl@0
  4457
sl@0
  4458
	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
sl@0
  4459
	TheTest.Printf(_L("Restored UTC  time to - %S\n"), &testString);
sl@0
  4460
sl@0
  4461
	CleanupStack::PopAndDestroy(3, event); //event, active, view
sl@0
  4462
	}
sl@0
  4463
sl@0
  4464
/**
sl@0
  4465
@SYMTestCaseID          SYSLIB-LOGENG-CT-1807
sl@0
  4466
@SYMTestCaseDesc	    Tests that DEF087459 works between 00:00 and 01:00am hometime
sl@0
  4467
@SYMTestPriority 	    Medium
sl@0
  4468
@SYMTestActions  	    Change the home time to 00:30 and run DEF066296 test
sl@0
  4469
@SYMTestExpectedResults Test must not fail
sl@0
  4470
@SYMDEF                 DEF087459
sl@0
  4471
*/
sl@0
  4472
LOCAL_C void DEF087459L(CLogClient& aClient)
sl@0
  4473
	{
sl@0
  4474
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1807 "));
sl@0
  4475
	RTz tz;				
sl@0
  4476
	TInt err = tz.Connect();
sl@0
  4477
	TEST2(err, KErrNone);
sl@0
  4478
	CleanupClosePushL(tz);
sl@0
  4479
	TTime now, saveNow;
sl@0
  4480
	
sl@0
  4481
	// Get and print current home time and save it
sl@0
  4482
	now.HomeTime();
sl@0
  4483
	saveNow=now;
sl@0
  4484
	
sl@0
  4485
	TBuf<0x80> testString;
sl@0
  4486
	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
sl@0
  4487
	TheTest.Printf(_L("Current  home time    - %S\n"), &testString);
sl@0
  4488
sl@0
  4489
	// Problem occurred between midnight and 01:00am hometime, so change home time to
sl@0
  4490
	// be 00:30am
sl@0
  4491
	TDateTime midnight = now.DateTime();
sl@0
  4492
	midnight.SetHour(0);
sl@0
  4493
	midnight.SetMinute(30);
sl@0
  4494
	midnight.SetSecond(0);
sl@0
  4495
	midnight.SetMicroSecond(0);
sl@0
  4496
	
sl@0
  4497
	TTime newTime=midnight;
sl@0
  4498
sl@0
  4499
	err = tz.SetHomeTime(midnight);
sl@0
  4500
	TEST2(err, KErrNone);
sl@0
  4501
sl@0
  4502
	// Get and print new home time
sl@0
  4503
	now.HomeTime();
sl@0
  4504
	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
sl@0
  4505
	TheTest.Printf(_L("Changed  home time to - %S\n"), &testString);
sl@0
  4506
	TheTest.Printf(_L("Re-running DEF066296 test\n"));
sl@0
  4507
	
sl@0
  4508
	DEF066296L(aClient);
sl@0
  4509
	
sl@0
  4510
	// Restore and print hometime
sl@0
  4511
	err = tz.SetHomeTime(saveNow);
sl@0
  4512
	TEST2(err, KErrNone);
sl@0
  4513
	now.HomeTime();
sl@0
  4514
	now.FormatL(testString,(_L("%H:%T %1\\%2\\%3 %E")));
sl@0
  4515
	TheTest.Printf(_L("Restored home time to - %S\n"), &testString);
sl@0
  4516
	
sl@0
  4517
	CleanupStack::PopAndDestroy(); //tz
sl@0
  4518
	}
sl@0
  4519
sl@0
  4520
/**
sl@0
  4521
@SYMTestCaseID          SYSLIB-LOGENG-CT-0955
sl@0
  4522
@SYMTestCaseDesc	    Tests that events can be changed to move them between recent lists
sl@0
  4523
@SYMTestPriority 	    High
sl@0
  4524
@SYMTestActions  	    Add the events to the view.Move most recent event to another recent list
sl@0
  4525
@SYMTestExpectedResults Test must not fail
sl@0
  4526
@SYMREQ                 REQ0000
sl@0
  4527
*/
sl@0
  4528
LOCAL_C void TestChangeEventRecentView1L(CLogClient& aClient)
sl@0
  4529
	{
sl@0
  4530
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0955 "));
sl@0
  4531
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  4532
	CleanupStack::PushL(active);
sl@0
  4533
sl@0
  4534
	CLogEvent* event = CLogEvent::NewL();
sl@0
  4535
	CleanupStack::PushL(event);
sl@0
  4536
sl@0
  4537
	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
sl@0
  4538
	CleanupStack::PushL(recent1);
sl@0
  4539
sl@0
  4540
	CLogViewDuplicate* duplicate1 = CLogViewDuplicate::NewL(aClient);
sl@0
  4541
	CleanupStack::PushL(duplicate1);
sl@0
  4542
sl@0
  4543
	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
sl@0
  4544
	CleanupStack::PushL(recent2);
sl@0
  4545
sl@0
  4546
	CLogViewDuplicate* duplicate2 = CLogViewDuplicate::NewL(aClient);
sl@0
  4547
	CleanupStack::PushL(duplicate2);
sl@0
  4548
sl@0
  4549
	// Make sure there are no entries in any recent lists
sl@0
  4550
	active->StartL();
sl@0
  4551
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  4552
	CActiveScheduler::Start();
sl@0
  4553
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4554
sl@0
  4555
	// Incoming call event
sl@0
  4556
	TBuf<KLogMaxDirectionLength> incoming;
sl@0
  4557
	aClient.GetString(incoming, R_LOG_DIR_IN);
sl@0
  4558
sl@0
  4559
	// Missed call event
sl@0
  4560
	TBuf<KLogMaxDirectionLength> missed;
sl@0
  4561
	aClient.GetString(missed, R_LOG_DIR_MISSED);
sl@0
  4562
sl@0
  4563
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  4564
	event->SetDirection(missed);
sl@0
  4565
	event->SetContact(1);
sl@0
  4566
sl@0
  4567
	// Add some events
sl@0
  4568
	active->StartL();
sl@0
  4569
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4570
	CActiveScheduler::Start();
sl@0
  4571
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4572
	TLogId id1 = event->Id();
sl@0
  4573
sl@0
  4574
	User::After(1000000);
sl@0
  4575
sl@0
  4576
	active->StartL();
sl@0
  4577
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4578
	CActiveScheduler::Start();
sl@0
  4579
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4580
	TLogId id2 = event->Id();
sl@0
  4581
sl@0
  4582
	User::After(1000000);
sl@0
  4583
sl@0
  4584
	active->StartL();
sl@0
  4585
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4586
	CActiveScheduler::Start();
sl@0
  4587
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4588
	TLogId id3 = event->Id();
sl@0
  4589
sl@0
  4590
	User::After(1000000);
sl@0
  4591
sl@0
  4592
	// Most recent
sl@0
  4593
	active->StartL();
sl@0
  4594
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4595
	CActiveScheduler::Start();
sl@0
  4596
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4597
	TLogId id4 = event->Id();
sl@0
  4598
sl@0
  4599
	// Check there's a recent event in the list
sl@0
  4600
	active->StartL();
sl@0
  4601
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4602
	CActiveScheduler::Start();
sl@0
  4603
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4604
	TEST2(recent1->CountL(), 1);
sl@0
  4605
	TEST2(recent1->Event().Id(), id4);
sl@0
  4606
sl@0
  4607
	// Check it has duplicates
sl@0
  4608
	active->StartL();
sl@0
  4609
	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4610
	CActiveScheduler::Start();
sl@0
  4611
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4612
	TEST2(duplicate1->CountL(), 3);
sl@0
  4613
	TEST2(duplicate1->Event().Id(), id3);
sl@0
  4614
sl@0
  4615
	// Check id
sl@0
  4616
	active->StartL();
sl@0
  4617
	TEST(duplicate1->NextL(active->iStatus));
sl@0
  4618
	CActiveScheduler::Start();
sl@0
  4619
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4620
	TEST2(duplicate1->Event().Id(), id2);
sl@0
  4621
sl@0
  4622
	// Check id
sl@0
  4623
	active->StartL();
sl@0
  4624
	TEST(duplicate1->NextL(active->iStatus));
sl@0
  4625
	CActiveScheduler::Start();
sl@0
  4626
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4627
	TEST2(duplicate1->Event().Id(), id1);
sl@0
  4628
sl@0
  4629
	// Other recent list should be empty
sl@0
  4630
	TEST(!recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4631
sl@0
  4632
	// Now move most recent event to another recent list
sl@0
  4633
	event->SetDirection(incoming);
sl@0
  4634
	active->StartL();
sl@0
  4635
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4636
	CActiveScheduler::Start();
sl@0
  4637
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4638
sl@0
  4639
	// Most recent duplicate should now be the latest
sl@0
  4640
	active->StartL();
sl@0
  4641
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4642
	CActiveScheduler::Start();
sl@0
  4643
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4644
	TEST2(recent1->CountL(), 1);
sl@0
  4645
	TEST2(recent1->Event().Id(), id3);
sl@0
  4646
	event->CopyL(recent1->Event()); // for later
sl@0
  4647
sl@0
  4648
	// There should still be some duplicates
sl@0
  4649
	active->StartL();
sl@0
  4650
	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4651
	CActiveScheduler::Start();
sl@0
  4652
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4653
	TEST2(duplicate1->CountL(), 2);
sl@0
  4654
	TEST2(duplicate1->Event().Id(), id2);
sl@0
  4655
sl@0
  4656
	// Check id
sl@0
  4657
	active->StartL();
sl@0
  4658
	TEST(duplicate1->NextL(active->iStatus));
sl@0
  4659
	CActiveScheduler::Start();
sl@0
  4660
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4661
	TEST2(duplicate1->Event().Id(), id1);
sl@0
  4662
sl@0
  4663
	// Now the event should have moved to another recent list
sl@0
  4664
	active->StartL();
sl@0
  4665
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4666
	CActiveScheduler::Start();
sl@0
  4667
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4668
	TEST2(recent2->CountL(), 1);
sl@0
  4669
	TEST2(recent2->Event().Id(), id4);
sl@0
  4670
sl@0
  4671
	// No duplicates yet
sl@0
  4672
	TEST(!recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  4673
sl@0
  4674
	// Now move most recent event to another recent list
sl@0
  4675
	event->SetDirection(incoming);
sl@0
  4676
	active->StartL();
sl@0
  4677
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4678
	CActiveScheduler::Start();
sl@0
  4679
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4680
sl@0
  4681
	// Most recent duplicate should now be the latest
sl@0
  4682
	active->StartL();
sl@0
  4683
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4684
	CActiveScheduler::Start();
sl@0
  4685
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4686
	TEST2(recent1->CountL(), 1);
sl@0
  4687
	TEST2(recent1->Event().Id(), id2);
sl@0
  4688
	event->CopyL(recent1->Event()); // for later
sl@0
  4689
sl@0
  4690
	// There should still be some duplicates
sl@0
  4691
	active->StartL();
sl@0
  4692
	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4693
	CActiveScheduler::Start();
sl@0
  4694
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4695
	TEST2(duplicate1->CountL(), 1);
sl@0
  4696
	TEST2(duplicate1->Event().Id(), id1);
sl@0
  4697
sl@0
  4698
	// Now the event should have moved to another recent list
sl@0
  4699
	active->StartL();
sl@0
  4700
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4701
	CActiveScheduler::Start();
sl@0
  4702
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4703
	TEST2(recent2->CountL(), 1);
sl@0
  4704
	TEST2(recent2->Event().Id(), id4);
sl@0
  4705
sl@0
  4706
	// There should still be some duplicates
sl@0
  4707
	active->StartL();
sl@0
  4708
	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  4709
	CActiveScheduler::Start();
sl@0
  4710
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4711
	TEST2(duplicate2->CountL(), 1);
sl@0
  4712
	TEST2(duplicate2->Event().Id(), id3);
sl@0
  4713
sl@0
  4714
	// Now move most recent event to another recent list
sl@0
  4715
	event->SetDirection(incoming);
sl@0
  4716
	active->StartL();
sl@0
  4717
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4718
	CActiveScheduler::Start();
sl@0
  4719
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4720
sl@0
  4721
	// Most recent duplicate should now be the latest
sl@0
  4722
	active->StartL();
sl@0
  4723
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4724
	CActiveScheduler::Start();
sl@0
  4725
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4726
	TEST2(recent1->CountL(), 1);
sl@0
  4727
	TEST2(recent1->Event().Id(), id1);
sl@0
  4728
	event->CopyL(recent1->Event()); // for later
sl@0
  4729
sl@0
  4730
	// Should be no more duplicates
sl@0
  4731
	TEST(!recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4732
sl@0
  4733
	// Now the event should have moved to another recent list
sl@0
  4734
	active->StartL();
sl@0
  4735
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4736
	CActiveScheduler::Start();
sl@0
  4737
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4738
	TEST2(recent2->CountL(), 1);
sl@0
  4739
	TEST2(recent2->Event().Id(), id4);
sl@0
  4740
sl@0
  4741
	// There should still be some duplicates
sl@0
  4742
	active->StartL();
sl@0
  4743
	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  4744
	CActiveScheduler::Start();
sl@0
  4745
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4746
	TEST2(duplicate2->CountL(), 2);
sl@0
  4747
	TEST2(duplicate2->Event().Id(), id3);
sl@0
  4748
sl@0
  4749
	// Check id
sl@0
  4750
	active->StartL();
sl@0
  4751
	TEST(duplicate2->NextL(active->iStatus));
sl@0
  4752
	CActiveScheduler::Start();
sl@0
  4753
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4754
	TEST2(duplicate2->Event().Id(), id2);
sl@0
  4755
sl@0
  4756
	// Now move most recent event to another recent list
sl@0
  4757
	event->SetDirection(incoming);
sl@0
  4758
	active->StartL();
sl@0
  4759
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4760
	CActiveScheduler::Start();
sl@0
  4761
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4762
sl@0
  4763
	// No more recent events
sl@0
  4764
	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4765
sl@0
  4766
	// Now the event should have moved to another recent list
sl@0
  4767
	active->StartL();
sl@0
  4768
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4769
	CActiveScheduler::Start();
sl@0
  4770
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4771
	TEST2(recent2->CountL(), 1);
sl@0
  4772
	TEST2(recent2->Event().Id(), id4);
sl@0
  4773
sl@0
  4774
	// There should still be some duplicates
sl@0
  4775
	active->StartL();
sl@0
  4776
	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  4777
	CActiveScheduler::Start();
sl@0
  4778
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4779
	TEST2(duplicate2->CountL(), 3);
sl@0
  4780
	TEST2(duplicate2->Event().Id(), id3);
sl@0
  4781
sl@0
  4782
	// Check id
sl@0
  4783
	active->StartL();
sl@0
  4784
	TEST(duplicate2->NextL(active->iStatus));
sl@0
  4785
	CActiveScheduler::Start();
sl@0
  4786
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4787
	TEST2(duplicate2->Event().Id(), id2);
sl@0
  4788
sl@0
  4789
	// Check id
sl@0
  4790
	active->StartL();
sl@0
  4791
	TEST(duplicate2->NextL(active->iStatus));
sl@0
  4792
	CActiveScheduler::Start();
sl@0
  4793
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4794
	TEST2(duplicate2->Event().Id(), id1);
sl@0
  4795
sl@0
  4796
	CleanupStack::PopAndDestroy(6); // active, event, recent1, duplicate1, recent2, duplicate2
sl@0
  4797
	}
sl@0
  4798
sl@0
  4799
/**
sl@0
  4800
Test that events can be changed to move them between recent lists
sl@0
  4801
The same as TestChangeEventRecentView1L, but the events are transferred in reverse order
sl@0
  4802
sl@0
  4803
@SYMTestCaseID          SYSLIB-LOGENG-CT-0956
sl@0
  4804
@SYMTestCaseDesc	    Tests that events can be changed to move them between recent lists
sl@0
  4805
@SYMTestPriority 	    High
sl@0
  4806
@SYMTestActions  	    Add the events to the view.Move most recent event to another recent list in reverse order
sl@0
  4807
@SYMTestExpectedResults Test must not fail
sl@0
  4808
@SYMREQ                 REQ0000
sl@0
  4809
*/
sl@0
  4810
LOCAL_C void TestChangeEventRecentView2L(CLogClient& aClient)
sl@0
  4811
	{
sl@0
  4812
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0956 "));
sl@0
  4813
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  4814
	CleanupStack::PushL(active);
sl@0
  4815
sl@0
  4816
	CLogEvent* event = CLogEvent::NewL();
sl@0
  4817
	CleanupStack::PushL(event);
sl@0
  4818
sl@0
  4819
	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
sl@0
  4820
	CleanupStack::PushL(recent1);
sl@0
  4821
sl@0
  4822
	CLogViewDuplicate* duplicate1 = CLogViewDuplicate::NewL(aClient);
sl@0
  4823
	CleanupStack::PushL(duplicate1);
sl@0
  4824
sl@0
  4825
	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
sl@0
  4826
	CleanupStack::PushL(recent2);
sl@0
  4827
sl@0
  4828
	CLogViewDuplicate* duplicate2 = CLogViewDuplicate::NewL(aClient);
sl@0
  4829
	CleanupStack::PushL(duplicate2);
sl@0
  4830
sl@0
  4831
	// Make sure there are no entries in any recent lists
sl@0
  4832
	active->StartL();
sl@0
  4833
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  4834
	CActiveScheduler::Start();
sl@0
  4835
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4836
sl@0
  4837
	// Incoming call event
sl@0
  4838
	TBuf<KLogMaxDirectionLength> incoming;
sl@0
  4839
	aClient.GetString(incoming, R_LOG_DIR_IN);
sl@0
  4840
sl@0
  4841
	// Missed call event
sl@0
  4842
	TBuf<KLogMaxDirectionLength> missed;
sl@0
  4843
	aClient.GetString(missed, R_LOG_DIR_MISSED);
sl@0
  4844
sl@0
  4845
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  4846
	event->SetDirection(missed);
sl@0
  4847
	event->SetContact(1);
sl@0
  4848
sl@0
  4849
	// Add some events
sl@0
  4850
	active->StartL();
sl@0
  4851
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4852
	CActiveScheduler::Start();
sl@0
  4853
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4854
	TLogId id1 = event->Id();
sl@0
  4855
sl@0
  4856
	User::After(1000000);
sl@0
  4857
sl@0
  4858
	active->StartL();
sl@0
  4859
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4860
	CActiveScheduler::Start();
sl@0
  4861
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4862
	TLogId id2 = event->Id();
sl@0
  4863
sl@0
  4864
	User::After(1000000);
sl@0
  4865
sl@0
  4866
	active->StartL();
sl@0
  4867
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4868
	CActiveScheduler::Start();
sl@0
  4869
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4870
	TLogId id3 = event->Id();
sl@0
  4871
sl@0
  4872
	User::After(1000000);
sl@0
  4873
sl@0
  4874
	// Most recent
sl@0
  4875
	active->StartL();
sl@0
  4876
	aClient.AddEvent(*event, active->iStatus);
sl@0
  4877
	CActiveScheduler::Start();
sl@0
  4878
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4879
	TLogId id4 = event->Id();
sl@0
  4880
sl@0
  4881
	// Check there's a recent event in the list
sl@0
  4882
	active->StartL();
sl@0
  4883
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4884
	CActiveScheduler::Start();
sl@0
  4885
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4886
	TEST2(recent1->CountL(), 1);
sl@0
  4887
	TEST2(recent1->Event().Id(), id4);
sl@0
  4888
sl@0
  4889
	// Check it has duplicates
sl@0
  4890
	active->StartL();
sl@0
  4891
	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4892
	CActiveScheduler::Start();
sl@0
  4893
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4894
	TEST2(duplicate1->CountL(), 3);
sl@0
  4895
	TEST2(duplicate1->Event().Id(), id3);
sl@0
  4896
sl@0
  4897
	// Check id
sl@0
  4898
	active->StartL();
sl@0
  4899
	TEST(duplicate1->NextL(active->iStatus));
sl@0
  4900
	CActiveScheduler::Start();
sl@0
  4901
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4902
	TEST2(duplicate1->Event().Id(), id2);
sl@0
  4903
sl@0
  4904
	// Check id
sl@0
  4905
	active->StartL();
sl@0
  4906
	TEST(duplicate1->NextL(active->iStatus));
sl@0
  4907
	CActiveScheduler::Start();
sl@0
  4908
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4909
	TEST2(duplicate1->Event().Id(), id1);
sl@0
  4910
	event->CopyL(duplicate1->Event()); // for later
sl@0
  4911
sl@0
  4912
	// Other recent list should be empty
sl@0
  4913
	TEST(!recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4914
sl@0
  4915
	// Now move latest recent event to another recent list
sl@0
  4916
	event->SetDirection(incoming);
sl@0
  4917
	active->StartL();
sl@0
  4918
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4919
	CActiveScheduler::Start();
sl@0
  4920
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4921
sl@0
  4922
	// Most recent duplicate should still be the latest
sl@0
  4923
	active->StartL();
sl@0
  4924
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4925
	CActiveScheduler::Start();
sl@0
  4926
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4927
	TEST2(recent1->CountL(), 1);
sl@0
  4928
	TEST2(recent1->Event().Id(), id4);
sl@0
  4929
sl@0
  4930
	// There should still be some duplicates
sl@0
  4931
	active->StartL();
sl@0
  4932
	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4933
	CActiveScheduler::Start();
sl@0
  4934
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4935
	TEST2(duplicate1->CountL(), 2);
sl@0
  4936
	TEST2(duplicate1->Event().Id(), id3);
sl@0
  4937
sl@0
  4938
	// Check id
sl@0
  4939
	active->StartL();
sl@0
  4940
	TEST(duplicate1->NextL(active->iStatus));
sl@0
  4941
	CActiveScheduler::Start();
sl@0
  4942
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4943
	TEST2(duplicate1->Event().Id(), id2);
sl@0
  4944
	event->CopyL(duplicate1->Event()); // for later
sl@0
  4945
sl@0
  4946
	// Now the event should have moved to another recent list
sl@0
  4947
	active->StartL();
sl@0
  4948
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4949
	CActiveScheduler::Start();
sl@0
  4950
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4951
	TEST2(recent2->CountL(), 1);
sl@0
  4952
	TEST2(recent2->Event().Id(), id1);
sl@0
  4953
sl@0
  4954
	// No duplicates yet
sl@0
  4955
	TEST(!recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  4956
sl@0
  4957
	// Now move most recent event to another recent list
sl@0
  4958
	event->SetDirection(incoming);
sl@0
  4959
	active->StartL();
sl@0
  4960
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  4961
	CActiveScheduler::Start();
sl@0
  4962
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4963
sl@0
  4964
	// Most recent duplicate should still be the latest
sl@0
  4965
	active->StartL();
sl@0
  4966
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  4967
	CActiveScheduler::Start();
sl@0
  4968
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4969
	TEST2(recent1->CountL(), 1);
sl@0
  4970
	TEST2(recent1->Event().Id(), id4);
sl@0
  4971
sl@0
  4972
	// There should still be some duplicates
sl@0
  4973
	active->StartL();
sl@0
  4974
	TEST(recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  4975
	CActiveScheduler::Start();
sl@0
  4976
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4977
	TEST2(duplicate1->CountL(), 1);
sl@0
  4978
	TEST2(duplicate1->Event().Id(), id3);
sl@0
  4979
	event->CopyL(duplicate1->Event()); // for later
sl@0
  4980
sl@0
  4981
	// Now the event should have moved to another recent list
sl@0
  4982
	active->StartL();
sl@0
  4983
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  4984
	CActiveScheduler::Start();
sl@0
  4985
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4986
	TEST2(recent2->CountL(), 1);
sl@0
  4987
	TEST2(recent2->Event().Id(), id2);
sl@0
  4988
sl@0
  4989
	// There should still be some duplicates
sl@0
  4990
	active->StartL();
sl@0
  4991
	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  4992
	CActiveScheduler::Start();
sl@0
  4993
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  4994
	TEST2(duplicate2->CountL(), 1);
sl@0
  4995
	TEST2(duplicate2->Event().Id(), id1);
sl@0
  4996
sl@0
  4997
	// Now move most recent event to another recent list
sl@0
  4998
	event->SetDirection(incoming);
sl@0
  4999
	active->StartL();
sl@0
  5000
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5001
	CActiveScheduler::Start();
sl@0
  5002
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5003
sl@0
  5004
	// Most recent duplicate should still be the latest
sl@0
  5005
	active->StartL();
sl@0
  5006
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5007
	CActiveScheduler::Start();
sl@0
  5008
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5009
	TEST2(recent1->CountL(), 1);
sl@0
  5010
	TEST2(recent1->Event().Id(), id4);
sl@0
  5011
	event->CopyL(recent1->Event()); // for later
sl@0
  5012
sl@0
  5013
	// Should be no more duplicates
sl@0
  5014
	TEST(!recent1->DuplicatesL(*duplicate1, active->iStatus));
sl@0
  5015
sl@0
  5016
	// Now the event should have moved to another recent list
sl@0
  5017
	active->StartL();
sl@0
  5018
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5019
	CActiveScheduler::Start();
sl@0
  5020
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5021
	TEST2(recent2->CountL(), 1);
sl@0
  5022
	TEST2(recent2->Event().Id(), id3);
sl@0
  5023
sl@0
  5024
	// There should still be some duplicates
sl@0
  5025
	active->StartL();
sl@0
  5026
	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  5027
	CActiveScheduler::Start();
sl@0
  5028
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5029
	TEST2(duplicate2->CountL(), 2);
sl@0
  5030
	TEST2(duplicate2->Event().Id(), id2);
sl@0
  5031
sl@0
  5032
	// Check id
sl@0
  5033
	active->StartL();
sl@0
  5034
	TEST(duplicate2->NextL(active->iStatus));
sl@0
  5035
	CActiveScheduler::Start();
sl@0
  5036
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5037
	TEST2(duplicate2->Event().Id(), id1);
sl@0
  5038
sl@0
  5039
	// Now move most recent event to another recent list
sl@0
  5040
	event->SetDirection(incoming);
sl@0
  5041
	active->StartL();
sl@0
  5042
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5043
	CActiveScheduler::Start();
sl@0
  5044
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5045
sl@0
  5046
	// No more recent events
sl@0
  5047
	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5048
sl@0
  5049
	// Now the event should have moved to another recent list
sl@0
  5050
	active->StartL();
sl@0
  5051
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5052
	CActiveScheduler::Start();
sl@0
  5053
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5054
	TEST2(recent2->CountL(), 1);
sl@0
  5055
	TEST2(recent2->Event().Id(), id4);
sl@0
  5056
sl@0
  5057
	// There should still be some duplicates
sl@0
  5058
	active->StartL();
sl@0
  5059
	TEST(recent2->DuplicatesL(*duplicate2, active->iStatus));
sl@0
  5060
	CActiveScheduler::Start();
sl@0
  5061
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5062
	TEST2(duplicate2->CountL(), 3);
sl@0
  5063
	TEST2(duplicate2->Event().Id(), id3);
sl@0
  5064
sl@0
  5065
	// Check id
sl@0
  5066
	active->StartL();
sl@0
  5067
	TEST(duplicate2->NextL(active->iStatus));
sl@0
  5068
	CActiveScheduler::Start();
sl@0
  5069
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5070
	TEST2(duplicate2->Event().Id(), id2);
sl@0
  5071
sl@0
  5072
	// Check id
sl@0
  5073
	active->StartL();
sl@0
  5074
	TEST(duplicate2->NextL(active->iStatus));
sl@0
  5075
	CActiveScheduler::Start();
sl@0
  5076
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5077
	TEST2(duplicate2->Event().Id(), id1);
sl@0
  5078
sl@0
  5079
	CleanupStack::PopAndDestroy(6); // active, event, recent1, duplicate1, recent2, duplicate2
sl@0
  5080
	}
sl@0
  5081
sl@0
  5082
/**
sl@0
  5083
@SYMTestCaseID          SYSLIB-LOGENG-CT-0957
sl@0
  5084
@SYMTestCaseDesc	    Tests that change in log view after moving an event
sl@0
  5085
@SYMTestPriority 	    High
sl@0
  5086
@SYMTestActions  	    Check recent views are purged if necessary after moving an event
sl@0
  5087
@SYMTestExpectedResults Test must not fail
sl@0
  5088
@SYMREQ                 REQ0000
sl@0
  5089
*/
sl@0
  5090
LOCAL_C void TestChangeEventRecentViewAndPurgeL(CLogClient& aClient)
sl@0
  5091
	{
sl@0
  5092
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0957 "));
sl@0
  5093
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  5094
	CleanupStack::PushL(active);
sl@0
  5095
sl@0
  5096
	CLogEvent* event = CLogEvent::NewL();
sl@0
  5097
	CleanupStack::PushL(event);
sl@0
  5098
sl@0
  5099
	CLogViewRecent* recent1 = CLogViewRecent::NewL(aClient);
sl@0
  5100
	CleanupStack::PushL(recent1);
sl@0
  5101
sl@0
  5102
	CLogViewRecent* recent2 = CLogViewRecent::NewL(aClient);
sl@0
  5103
	CleanupStack::PushL(recent2);
sl@0
  5104
sl@0
  5105
	// Make sure there are no entries in any recent lists
sl@0
  5106
	active->StartL();
sl@0
  5107
	aClient.ClearLog(KLogNullRecentList, active->iStatus);
sl@0
  5108
	CActiveScheduler::Start();
sl@0
  5109
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5110
sl@0
  5111
	// Get log config
sl@0
  5112
	TLogConfig config;
sl@0
  5113
	active->StartL();
sl@0
  5114
	aClient.GetConfig(config, active->iStatus);
sl@0
  5115
	CActiveScheduler::Start();
sl@0
  5116
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5117
sl@0
  5118
	// Set the max recent list size to something small
sl@0
  5119
	config.iMaxRecentLogSize = 3;
sl@0
  5120
	active->StartL();
sl@0
  5121
	aClient.ChangeConfig(config, active->iStatus);
sl@0
  5122
	CActiveScheduler::Start();
sl@0
  5123
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5124
sl@0
  5125
	// Incoming call event
sl@0
  5126
	TBuf<KLogMaxDirectionLength> incoming;
sl@0
  5127
	aClient.GetString(incoming, R_LOG_DIR_IN);
sl@0
  5128
sl@0
  5129
	// Missed call event
sl@0
  5130
	TBuf<KLogMaxDirectionLength> missed;
sl@0
  5131
	aClient.GetString(missed, R_LOG_DIR_MISSED);
sl@0
  5132
sl@0
  5133
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  5134
	event->SetDirection(missed);
sl@0
  5135
sl@0
  5136
	// Add an event
sl@0
  5137
	event->SetContact(1);
sl@0
  5138
	active->StartL();
sl@0
  5139
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5140
	CActiveScheduler::Start();
sl@0
  5141
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5142
	TLogId id1 = event->Id();
sl@0
  5143
sl@0
  5144
	User::After(1000000);
sl@0
  5145
	event->SetDirection(incoming);
sl@0
  5146
sl@0
  5147
	// Add an event
sl@0
  5148
	event->SetContact(2);
sl@0
  5149
	active->StartL();
sl@0
  5150
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5151
	CActiveScheduler::Start();
sl@0
  5152
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5153
	TLogId id2 = event->Id();
sl@0
  5154
sl@0
  5155
	User::After(1000000);
sl@0
  5156
sl@0
  5157
	// Add an event
sl@0
  5158
	event->SetContact(3);
sl@0
  5159
	active->StartL();
sl@0
  5160
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5161
	CActiveScheduler::Start();
sl@0
  5162
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5163
	TLogId id3 = event->Id();
sl@0
  5164
sl@0
  5165
	User::After(1000000);
sl@0
  5166
sl@0
  5167
	// Add an event
sl@0
  5168
	event->SetContact(4);
sl@0
  5169
	active->StartL();
sl@0
  5170
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5171
	CActiveScheduler::Start();
sl@0
  5172
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5173
	TLogId id4 = event->Id();
sl@0
  5174
sl@0
  5175
	// Check the views
sl@0
  5176
	active->StartL();
sl@0
  5177
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5178
	CActiveScheduler::Start();
sl@0
  5179
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5180
	TEST2(recent1->CountL(), 1);
sl@0
  5181
sl@0
  5182
	active->StartL();
sl@0
  5183
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5184
	CActiveScheduler::Start();
sl@0
  5185
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5186
	TEST2(recent2->CountL(), 3);
sl@0
  5187
sl@0
  5188
	// Retrieve event
sl@0
  5189
	event->SetId(id1);
sl@0
  5190
	active->StartL();
sl@0
  5191
	aClient.GetEvent(*event, active->iStatus);
sl@0
  5192
	CActiveScheduler::Start();
sl@0
  5193
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5194
sl@0
  5195
	// Now move the oldest event to another recent list - it should be purged
sl@0
  5196
	event->SetDirection(incoming);
sl@0
  5197
	active->StartL();
sl@0
  5198
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5199
	CActiveScheduler::Start();
sl@0
  5200
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5201
sl@0
  5202
	// Missed call list now empty
sl@0
  5203
	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5204
sl@0
  5205
	// Incoming view should be unchanged
sl@0
  5206
	active->StartL();
sl@0
  5207
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5208
	CActiveScheduler::Start();
sl@0
  5209
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5210
	TEST2(recent2->CountL(), 3);
sl@0
  5211
	TEST2(recent2->Event().Id(), id4);
sl@0
  5212
sl@0
  5213
	// Check id
sl@0
  5214
	active->StartL();
sl@0
  5215
	TEST(recent2->NextL(active->iStatus));
sl@0
  5216
	CActiveScheduler::Start();
sl@0
  5217
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5218
	TEST2(recent2->Event().Id(), id3);
sl@0
  5219
sl@0
  5220
	// Check id
sl@0
  5221
	active->StartL();
sl@0
  5222
	TEST(recent2->NextL(active->iStatus));
sl@0
  5223
	CActiveScheduler::Start();
sl@0
  5224
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5225
	TEST2(recent2->Event().Id(), id2);
sl@0
  5226
sl@0
  5227
	TTime now;
sl@0
  5228
	now.UniversalTime();
sl@0
  5229
sl@0
  5230
	// This should have no effect
sl@0
  5231
	event->SetTime(now);
sl@0
  5232
	active->StartL();
sl@0
  5233
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5234
	CActiveScheduler::Start();
sl@0
  5235
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5236
sl@0
  5237
	// Incoming view should be unchanged
sl@0
  5238
	active->StartL();
sl@0
  5239
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5240
	CActiveScheduler::Start();
sl@0
  5241
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5242
	TEST2(recent2->CountL(), 3);
sl@0
  5243
	TEST2(recent2->Event().Id(), id4);
sl@0
  5244
sl@0
  5245
	// Check id
sl@0
  5246
	active->StartL();
sl@0
  5247
	TEST(recent2->NextL(active->iStatus));
sl@0
  5248
	CActiveScheduler::Start();
sl@0
  5249
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5250
	TEST2(recent2->Event().Id(), id3);
sl@0
  5251
sl@0
  5252
	// Check id
sl@0
  5253
	active->StartL();
sl@0
  5254
	TEST(recent2->NextL(active->iStatus));
sl@0
  5255
	CActiveScheduler::Start();
sl@0
  5256
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5257
	TEST2(recent2->Event().Id(), id2);
sl@0
  5258
sl@0
  5259
	// Now add a new event to missed view (the latest)
sl@0
  5260
	User::After(1000000);
sl@0
  5261
	event->SetDirection(missed);
sl@0
  5262
	active->StartL();
sl@0
  5263
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5264
	CActiveScheduler::Start();
sl@0
  5265
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5266
sl@0
  5267
	User::After(1000000);
sl@0
  5268
	now.UniversalTime();
sl@0
  5269
sl@0
  5270
	// This should have no effect
sl@0
  5271
	event->SetTime(now);
sl@0
  5272
	active->StartL();
sl@0
  5273
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5274
	CActiveScheduler::Start();
sl@0
  5275
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5276
sl@0
  5277
	// Check the views
sl@0
  5278
	active->StartL();
sl@0
  5279
	TEST(recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5280
	CActiveScheduler::Start();
sl@0
  5281
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5282
	TEST2(recent1->CountL(), 1);
sl@0
  5283
sl@0
  5284
	active->StartL();
sl@0
  5285
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5286
	CActiveScheduler::Start();
sl@0
  5287
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5288
	TEST2(recent2->CountL(), 3);
sl@0
  5289
sl@0
  5290
	// Now move the latest event to another recent list - oldest should be purged
sl@0
  5291
	event->SetDirection(incoming);
sl@0
  5292
	active->StartL();
sl@0
  5293
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5294
	CActiveScheduler::Start();
sl@0
  5295
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5296
sl@0
  5297
	TEST(!recent1->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5298
sl@0
  5299
	active->StartL();
sl@0
  5300
	TEST(recent2->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5301
	CActiveScheduler::Start();
sl@0
  5302
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5303
	TEST2(recent2->CountL(), 3);
sl@0
  5304
	TEST2(recent2->Event().Id(), event->Id());
sl@0
  5305
sl@0
  5306
	// Check id
sl@0
  5307
	active->StartL();
sl@0
  5308
	TEST(recent2->NextL(active->iStatus));
sl@0
  5309
	CActiveScheduler::Start();
sl@0
  5310
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5311
	TEST2(recent2->Event().Id(), id4);
sl@0
  5312
sl@0
  5313
	// Check id
sl@0
  5314
	active->StartL();
sl@0
  5315
	TEST(recent2->NextL(active->iStatus));
sl@0
  5316
	CActiveScheduler::Start();
sl@0
  5317
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5318
	TEST2(recent2->Event().Id(), id3);
sl@0
  5319
sl@0
  5320
	CleanupStack::PopAndDestroy(4); // active, event, recent1, recent2
sl@0
  5321
	}
sl@0
  5322
sl@0
  5323
/**
sl@0
  5324
@SYMTestCaseID          SYSLIB-LOGENG-CT-0958
sl@0
  5325
@SYMTestCaseDesc	    Tests for the log view,on changing an event
sl@0
  5326
@SYMTestPriority 	    High
sl@0
  5327
@SYMTestActions  	    Check an event can be removed from recent lists by changing it
sl@0
  5328
@SYMTestExpectedResults Test must not fail
sl@0
  5329
@SYMREQ                 REQ0000
sl@0
  5330
*/
sl@0
  5331
LOCAL_C void TestChangeEventRecentViewRemoveL(CLogClient& aClient)
sl@0
  5332
	{
sl@0
  5333
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0958 "));
sl@0
  5334
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  5335
	CleanupStack::PushL(active);
sl@0
  5336
sl@0
  5337
	CLogEvent* event = CLogEvent::NewL();
sl@0
  5338
	CleanupStack::PushL(event);
sl@0
  5339
sl@0
  5340
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient);
sl@0
  5341
	CleanupStack::PushL(recent);
sl@0
  5342
sl@0
  5343
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  5344
	CleanupStack::PushL(duplicate);
sl@0
  5345
sl@0
  5346
	// Missed call event
sl@0
  5347
	TBuf<KLogMaxDirectionLength> missed;
sl@0
  5348
	aClient.GetString(missed, R_LOG_DIR_MISSED);
sl@0
  5349
sl@0
  5350
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  5351
	event->SetDirection(missed);
sl@0
  5352
sl@0
  5353
	// Add an event
sl@0
  5354
	event->SetContact(1);
sl@0
  5355
	active->StartL();
sl@0
  5356
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5357
	CActiveScheduler::Start();
sl@0
  5358
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5359
	TLogId id1 = event->Id();
sl@0
  5360
sl@0
  5361
	User::After(1000000);
sl@0
  5362
sl@0
  5363
	// Add some duplicates
sl@0
  5364
	active->StartL();
sl@0
  5365
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5366
	CActiveScheduler::Start();
sl@0
  5367
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5368
	TLogId id2 = event->Id();
sl@0
  5369
sl@0
  5370
	User::After(1000000);
sl@0
  5371
sl@0
  5372
	active->StartL();
sl@0
  5373
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5374
	CActiveScheduler::Start();
sl@0
  5375
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5376
	TLogId id3 = event->Id();
sl@0
  5377
sl@0
  5378
	User::After(1000000);
sl@0
  5379
sl@0
  5380
	active->StartL();
sl@0
  5381
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5382
	CActiveScheduler::Start();
sl@0
  5383
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5384
	TLogId id4 = event->Id();
sl@0
  5385
sl@0
  5386
	// Check views
sl@0
  5387
	active->StartL();
sl@0
  5388
	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5389
	CActiveScheduler::Start();
sl@0
  5390
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5391
	TEST2(recent->CountL(), 1);
sl@0
  5392
	TEST2(recent->Event().Id(), id4);
sl@0
  5393
sl@0
  5394
	active->StartL();
sl@0
  5395
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5396
	CActiveScheduler::Start();
sl@0
  5397
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5398
	TEST2(duplicate->CountL(), 3);
sl@0
  5399
	TEST2(duplicate->Event().Id(), id3);
sl@0
  5400
sl@0
  5401
	// Check id
sl@0
  5402
	active->StartL();
sl@0
  5403
	TEST(duplicate->NextL(active->iStatus));
sl@0
  5404
	CActiveScheduler::Start();
sl@0
  5405
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5406
	TEST2(duplicate->Event().Id(), id2);
sl@0
  5407
sl@0
  5408
	// Check id
sl@0
  5409
	active->StartL();
sl@0
  5410
	TEST(duplicate->NextL(active->iStatus));
sl@0
  5411
	CActiveScheduler::Start();
sl@0
  5412
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5413
	TEST2(duplicate->Event().Id(), id1);
sl@0
  5414
sl@0
  5415
	// Fetched call event
sl@0
  5416
	TBuf<KLogMaxDirectionLength> fetched;
sl@0
  5417
	aClient.GetString(missed, R_LOG_DIR_FETCHED);
sl@0
  5418
sl@0
  5419
	// Now change the event to remove it from recent lists
sl@0
  5420
	event->SetDirection(fetched);
sl@0
  5421
	active->StartL();
sl@0
  5422
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5423
	CActiveScheduler::Start();
sl@0
  5424
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5425
sl@0
  5426
	// Check views
sl@0
  5427
	active->StartL();
sl@0
  5428
	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5429
	CActiveScheduler::Start();
sl@0
  5430
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5431
	TEST2(recent->CountL(), 1);
sl@0
  5432
	TEST2(recent->Event().Id(), id3);
sl@0
  5433
sl@0
  5434
	active->StartL();
sl@0
  5435
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5436
	CActiveScheduler::Start();
sl@0
  5437
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5438
	TEST2(duplicate->CountL(), 2);
sl@0
  5439
	TEST2(duplicate->Event().Id(), id2);
sl@0
  5440
	event->CopyL(duplicate->Event()); // For later
sl@0
  5441
sl@0
  5442
	// Check id
sl@0
  5443
	active->StartL();
sl@0
  5444
	TEST(duplicate->NextL(active->iStatus));
sl@0
  5445
	CActiveScheduler::Start();
sl@0
  5446
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5447
	TEST2(duplicate->Event().Id(), id1);
sl@0
  5448
sl@0
  5449
	// Now change the event to remove it from recent lists
sl@0
  5450
	event->SetDirection(fetched);
sl@0
  5451
	active->StartL();
sl@0
  5452
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5453
	CActiveScheduler::Start();
sl@0
  5454
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5455
sl@0
  5456
	// Check views
sl@0
  5457
	active->StartL();
sl@0
  5458
	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5459
	CActiveScheduler::Start();
sl@0
  5460
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5461
	TEST2(recent->CountL(), 1);
sl@0
  5462
	TEST2(recent->Event().Id(), id3);
sl@0
  5463
sl@0
  5464
	active->StartL();
sl@0
  5465
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5466
	CActiveScheduler::Start();
sl@0
  5467
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5468
	TEST2(duplicate->CountL(), 1);
sl@0
  5469
	TEST2(duplicate->Event().Id(), id1);
sl@0
  5470
	event->CopyL(duplicate->Event()); // For later
sl@0
  5471
sl@0
  5472
	// Now change the event to remove it from recent lists
sl@0
  5473
	event->SetDirection(fetched);
sl@0
  5474
	active->StartL();
sl@0
  5475
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5476
	CActiveScheduler::Start();
sl@0
  5477
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5478
sl@0
  5479
	// Check views
sl@0
  5480
	active->StartL();
sl@0
  5481
	TEST(recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5482
	CActiveScheduler::Start();
sl@0
  5483
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5484
	TEST2(recent->CountL(), 1);
sl@0
  5485
	TEST2(recent->Event().Id(), id3);
sl@0
  5486
	event->CopyL(recent->Event()); // For later
sl@0
  5487
sl@0
  5488
	// No more duplicates
sl@0
  5489
	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5490
sl@0
  5491
	// Now change the event to remove it from recent lists
sl@0
  5492
	event->SetDirection(fetched);
sl@0
  5493
	active->StartL();
sl@0
  5494
	aClient.ChangeEvent(*event, active->iStatus);
sl@0
  5495
	CActiveScheduler::Start();
sl@0
  5496
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5497
sl@0
  5498
	TEST(!recent->SetRecentListL(KLogRecentMissedCalls, active->iStatus));
sl@0
  5499
sl@0
  5500
	CleanupStack::PopAndDestroy(4); // active, event, recent, duplicate
sl@0
  5501
	}
sl@0
  5502
sl@0
  5503
CBaBackupSessionWrapper* theBackup = NULL;
sl@0
  5504
sl@0
  5505
LOCAL_C TBool IsLogOpenL()
sl@0
  5506
	{
sl@0
  5507
	return TestUtils::IsDatabaseOpenL();
sl@0
  5508
	}
sl@0
  5509
sl@0
  5510
LOCAL_C void TestLogOpenL()
sl@0
  5511
	{
sl@0
  5512
	TEST(IsLogOpenL());
sl@0
  5513
	}
sl@0
  5514
sl@0
  5515
LOCAL_C void TestLogClosedL()
sl@0
  5516
	{
sl@0
  5517
	TEST(!IsLogOpenL());
sl@0
  5518
	}
sl@0
  5519
sl@0
  5520
LOCAL_C void StartBackupL()
sl@0
  5521
	{
sl@0
  5522
	User::InfoPrint(_L("Backup"));
sl@0
  5523
sl@0
  5524
	TDriveUnit driveUnit(EDriveC);
sl@0
  5525
	TDriveName name = driveUnit.Name();
sl@0
  5526
sl@0
  5527
	TParse parse;
sl@0
  5528
	LEAVE_IF_ERROR(parse.Set(KLogDatabaseName, &name, NULL));
sl@0
  5529
sl@0
  5530
	delete theBackup;
sl@0
  5531
	theBackup = NULL;
sl@0
  5532
	theBackup = CBaBackupSessionWrapper::NewL();
sl@0
  5533
sl@0
  5534
	theBackup->CloseFileL(parse.FullName(), MBackupObserver::EReleaseLockNoAccess);
sl@0
  5535
	User::After(1000000);
sl@0
  5536
	}
sl@0
  5537
sl@0
  5538
LOCAL_C void EndBackupL()
sl@0
  5539
	{
sl@0
  5540
	delete theBackup;
sl@0
  5541
	theBackup = NULL;
sl@0
  5542
	User::After(1000000);
sl@0
  5543
	}
sl@0
  5544
sl@0
  5545
LOCAL_C void DelayL(TInt aDelay)
sl@0
  5546
	{
sl@0
  5547
	CTestTimer* timer = CTestTimer::NewL();
sl@0
  5548
	timer->After(aDelay);
sl@0
  5549
	CActiveScheduler::Start();
sl@0
  5550
	delete timer;
sl@0
  5551
	}
sl@0
  5552
sl@0
  5553
/**
sl@0
  5554
@SYMTestCaseID          SYSLIB-LOGENG-CT-0959
sl@0
  5555
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  5556
						Test change stuff with backup
sl@0
  5557
@SYMTestPriority 	    High
sl@0
  5558
@SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates even after backup
sl@0
  5559
@SYMTestExpectedResults Test must not fail
sl@0
  5560
@SYMREQ                 REQ0000
sl@0
  5561
*/
sl@0
  5562
LOCAL_C void TestHiddenChangeEvents1aL(CLogClient& aClient)
sl@0
  5563
	{
sl@0
  5564
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0959 "));
sl@0
  5565
	TLogId logId;
sl@0
  5566
	TInt viewIndex;
sl@0
  5567
	TLogDatabaseChangeType type;
sl@0
  5568
sl@0
  5569
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  5570
	changeObs1->StartCollectingChanges();
sl@0
  5571
sl@0
  5572
sl@0
  5573
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  5574
	CleanupStack::PushL(view);
sl@0
  5575
sl@0
  5576
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  5577
	CleanupStack::PushL(filter);
sl@0
  5578
sl@0
  5579
	CLogEvent* event = CLogEvent::NewL();
sl@0
  5580
	CleanupStack::PushL(event);
sl@0
  5581
sl@0
  5582
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  5583
	CleanupStack::PushL(active);
sl@0
  5584
sl@0
  5585
	TTime now;
sl@0
  5586
	now.UniversalTime();
sl@0
  5587
	now += (TTimeIntervalDays)+1;
sl@0
  5588
sl@0
  5589
	// Get rid of all the events in the log
sl@0
  5590
	active->StartL();
sl@0
  5591
	aClient.ClearLog(now, active->iStatus);
sl@0
  5592
	CActiveScheduler::Start();
sl@0
  5593
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5594
sl@0
  5595
	// Incoming call event
sl@0
  5596
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  5597
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  5598
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  5599
	event->SetDirection(buf);
sl@0
  5600
sl@0
  5601
	// Add an event
sl@0
  5602
	active->StartL();
sl@0
  5603
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5604
	CActiveScheduler::Start();
sl@0
  5605
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5606
sl@0
  5607
	// Setup normal event view
sl@0
  5608
	active->StartL();
sl@0
  5609
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  5610
	CActiveScheduler::Start();
sl@0
  5611
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5612
sl@0
  5613
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  5614
	changeObs2->StartCollectingChanges();
sl@0
  5615
sl@0
  5616
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  5617
	CleanupStack::PushL(recent);
sl@0
  5618
sl@0
  5619
	// Check recent view
sl@0
  5620
	active->StartL();
sl@0
  5621
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5622
	CActiveScheduler::Start();
sl@0
  5623
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5624
	TEST2(recent->CountL(), 1);
sl@0
  5625
sl@0
  5626
	// Add a new event
sl@0
  5627
	active->StartL();
sl@0
  5628
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5629
	CActiveScheduler::Start();
sl@0
  5630
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5631
sl@0
  5632
	// Check that changes work after a backup
sl@0
  5633
	StartBackupL();
sl@0
  5634
	DelayL(1000000);
sl@0
  5635
	TestLogClosedL();
sl@0
  5636
	EndBackupL();
sl@0
  5637
	DelayL(1000000);
sl@0
  5638
	TestLogOpenL();
sl@0
  5639
	
sl@0
  5640
	TEST2(changeObs2->Changes().Count(), 2);
sl@0
  5641
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  5642
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  5643
	type = changeObs2->Changes().At(1, logId, viewIndex);
sl@0
  5644
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  5645
sl@0
  5646
	// Check recent view
sl@0
  5647
	active->StartL();
sl@0
  5648
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5649
	CActiveScheduler::Start();
sl@0
  5650
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5651
	TEST2(recent->CountL(), 1);
sl@0
  5652
sl@0
  5653
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  5654
	CleanupStack::PushL(duplicate);
sl@0
  5655
sl@0
  5656
	// Check duplicate count
sl@0
  5657
	active->StartL();
sl@0
  5658
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5659
	CActiveScheduler::Start();
sl@0
  5660
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5661
	TEST2(duplicate->CountL(), 1);
sl@0
  5662
sl@0
  5663
	// Check that changes work after a backup
sl@0
  5664
	StartBackupL();
sl@0
  5665
	DelayL(1000000);
sl@0
  5666
	TestLogClosedL();
sl@0
  5667
	EndBackupL();
sl@0
  5668
	TestLogOpenL();
sl@0
  5669
sl@0
  5670
	// Check change events
sl@0
  5671
	User::After(100000);
sl@0
  5672
	TEST2(changeObs1->Changes().Count(), 1);
sl@0
  5673
	type = changeObs1->Changes().At(0, logId, viewIndex);
sl@0
  5674
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  5675
sl@0
  5676
	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  5677
	}
sl@0
  5678
sl@0
  5679
/**
sl@0
  5680
Check that a view doesn't get change events when recent list purged
sl@0
  5681
sl@0
  5682
@SYMTestCaseID          SYSLIB-LOGENG-CT-0960
sl@0
  5683
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  5684
@SYMTestPriority 	    High
sl@0
  5685
@SYMTestActions  	    Check that a view doesn't get change events when recent list purged,even after backup
sl@0
  5686
@SYMTestExpectedResults Test must not fail
sl@0
  5687
@SYMREQ                 REQ0000
sl@0
  5688
*/
sl@0
  5689
LOCAL_C void TestHiddenChangeEvents2aL(CLogClient& aClient)
sl@0
  5690
	{
sl@0
  5691
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0960 "));
sl@0
  5692
	TLogId logId;
sl@0
  5693
	TInt viewIndex;
sl@0
  5694
	TLogDatabaseChangeType type;
sl@0
  5695
sl@0
  5696
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  5697
	changeObs1->StartCollectingChanges();
sl@0
  5698
sl@0
  5699
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  5700
	CleanupStack::PushL(view);
sl@0
  5701
sl@0
  5702
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  5703
	CleanupStack::PushL(filter);
sl@0
  5704
sl@0
  5705
	CLogEvent* event = CLogEvent::NewL();
sl@0
  5706
	CleanupStack::PushL(event);
sl@0
  5707
sl@0
  5708
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  5709
	CleanupStack::PushL(active);
sl@0
  5710
sl@0
  5711
	TTime now;
sl@0
  5712
	now.UniversalTime();
sl@0
  5713
	now += (TTimeIntervalDays)+1;
sl@0
  5714
sl@0
  5715
	// Get rid of all the events in the log
sl@0
  5716
	active->StartL();
sl@0
  5717
	aClient.ClearLog(now, active->iStatus);
sl@0
  5718
	CActiveScheduler::Start();
sl@0
  5719
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5720
sl@0
  5721
	// Get config
sl@0
  5722
	TLogConfig config;
sl@0
  5723
	active->StartL();
sl@0
  5724
	aClient.GetConfig(config, active->iStatus);
sl@0
  5725
	CActiveScheduler::Start();
sl@0
  5726
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5727
sl@0
  5728
	// Incoming call event
sl@0
  5729
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  5730
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  5731
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  5732
	event->SetDirection(buf);
sl@0
  5733
sl@0
  5734
	// Add max allowed events
sl@0
  5735
	TInt count = config.iMaxRecentLogSize;
sl@0
  5736
	while(count--)
sl@0
  5737
		{
sl@0
  5738
		event->SetContact(count+1);
sl@0
  5739
		active->StartL();
sl@0
  5740
		aClient.AddEvent(*event, active->iStatus);
sl@0
  5741
		CActiveScheduler::Start();
sl@0
  5742
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5743
		}
sl@0
  5744
sl@0
  5745
	// Setup normal event view
sl@0
  5746
	active->StartL();
sl@0
  5747
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  5748
	CActiveScheduler::Start();
sl@0
  5749
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5750
sl@0
  5751
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  5752
	changeObs2->StartCollectingChanges();
sl@0
  5753
sl@0
  5754
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  5755
	CleanupStack::PushL(recent);
sl@0
  5756
sl@0
  5757
	// Check recent view
sl@0
  5758
	active->StartL();
sl@0
  5759
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5760
	CActiveScheduler::Start();
sl@0
  5761
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5762
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  5763
sl@0
  5764
	// Add a new event, will cause one to be purged from recent view
sl@0
  5765
	event->SetContact(1234);
sl@0
  5766
	active->StartL();
sl@0
  5767
	aClient.AddEvent(*event, active->iStatus);
sl@0
  5768
	CActiveScheduler::Start();
sl@0
  5769
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5770
sl@0
  5771
	// Check that changes work after a backup
sl@0
  5772
	StartBackupL();
sl@0
  5773
	DelayL(1000000);
sl@0
  5774
	TestLogClosedL();
sl@0
  5775
	EndBackupL();
sl@0
  5776
	TestLogOpenL();
sl@0
  5777
	DelayL(1000000);
sl@0
  5778
		
sl@0
  5779
	TEST2(changeObs2->Changes().Count(), 2);
sl@0
  5780
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  5781
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  5782
	type = changeObs2->Changes().At(1, logId, viewIndex);
sl@0
  5783
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  5784
sl@0
  5785
	// Check recent view
sl@0
  5786
	active->StartL();
sl@0
  5787
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5788
	CActiveScheduler::Start();
sl@0
  5789
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5790
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  5791
sl@0
  5792
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  5793
	CleanupStack::PushL(duplicate);
sl@0
  5794
sl@0
  5795
	// Check duplicate count
sl@0
  5796
	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5797
sl@0
  5798
	// Check that changes work after a backup
sl@0
  5799
	StartBackupL();
sl@0
  5800
	DelayL(1000000);
sl@0
  5801
	TestLogClosedL();
sl@0
  5802
	EndBackupL();
sl@0
  5803
	TestLogOpenL();
sl@0
  5804
sl@0
  5805
	// Check change events
sl@0
  5806
	User::After(100000);
sl@0
  5807
	TEST2(changeObs1->Changes().Count(), 1);
sl@0
  5808
	type = changeObs1->Changes().At(0, logId, viewIndex);
sl@0
  5809
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  5810
sl@0
  5811
	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  5812
	}
sl@0
  5813
sl@0
  5814
/**
sl@0
  5815
Check that a view doesn't get change events when recent list purged after changing config
sl@0
  5816
sl@0
  5817
@SYMTestCaseID          SYSLIB-LOGENG-CT-0961
sl@0
  5818
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  5819
@SYMTestPriority 	    High
sl@0
  5820
@SYMTestActions  	    Check that a view doesn't get change events when recent list purged after changing config,even after backup
sl@0
  5821
@SYMTestExpectedResults Test must not fail
sl@0
  5822
@SYMREQ                 REQ0000
sl@0
  5823
*/
sl@0
  5824
LOCAL_C void TestHiddenChangeEvents3aL(CLogClient& aClient)
sl@0
  5825
	{
sl@0
  5826
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0961 "));
sl@0
  5827
	TLogId logId;
sl@0
  5828
	TInt viewIndex;
sl@0
  5829
	TLogDatabaseChangeType type;
sl@0
  5830
sl@0
  5831
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  5832
	changeObs1->StartCollectingChanges();
sl@0
  5833
sl@0
  5834
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  5835
	CleanupStack::PushL(view);
sl@0
  5836
sl@0
  5837
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  5838
	CleanupStack::PushL(filter);
sl@0
  5839
sl@0
  5840
	CLogEvent* event = CLogEvent::NewL();
sl@0
  5841
	CleanupStack::PushL(event);
sl@0
  5842
sl@0
  5843
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  5844
	CleanupStack::PushL(active);
sl@0
  5845
sl@0
  5846
	TTime now;
sl@0
  5847
	now.UniversalTime();
sl@0
  5848
	now += (TTimeIntervalDays)+1;
sl@0
  5849
sl@0
  5850
	// Get rid of all the events in the log
sl@0
  5851
	active->StartL();
sl@0
  5852
	aClient.ClearLog(now, active->iStatus);
sl@0
  5853
	CActiveScheduler::Start();
sl@0
  5854
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5855
sl@0
  5856
	// Get and set config
sl@0
  5857
	TLogConfig config;
sl@0
  5858
	active->StartL();
sl@0
  5859
	aClient.GetConfig(config, active->iStatus);
sl@0
  5860
	CActiveScheduler::Start();
sl@0
  5861
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5862
	config.iMaxRecentLogSize = 2;
sl@0
  5863
	active->StartL();
sl@0
  5864
	aClient.ChangeConfig(config, active->iStatus);
sl@0
  5865
	CActiveScheduler::Start();
sl@0
  5866
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5867
sl@0
  5868
	// Incoming call event
sl@0
  5869
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  5870
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  5871
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  5872
	event->SetDirection(buf);
sl@0
  5873
sl@0
  5874
	// Add max allowed events
sl@0
  5875
	TInt count = config.iMaxRecentLogSize;
sl@0
  5876
	while(count--)
sl@0
  5877
		{
sl@0
  5878
		event->SetContact(count+1);
sl@0
  5879
		active->StartL();
sl@0
  5880
		aClient.AddEvent(*event, active->iStatus);
sl@0
  5881
		CActiveScheduler::Start();
sl@0
  5882
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5883
		}
sl@0
  5884
sl@0
  5885
	// Setup normal event view
sl@0
  5886
	active->StartL();
sl@0
  5887
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  5888
	CActiveScheduler::Start();
sl@0
  5889
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5890
sl@0
  5891
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  5892
	changeObs2->StartCollectingChanges();
sl@0
  5893
sl@0
  5894
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  5895
	CleanupStack::PushL(recent);
sl@0
  5896
sl@0
  5897
	// Check recent view
sl@0
  5898
	active->StartL();
sl@0
  5899
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5900
	CActiveScheduler::Start();
sl@0
  5901
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5902
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  5903
sl@0
  5904
	// Change config, will cause one event to be purged from recent view
sl@0
  5905
	config.iMaxRecentLogSize = 1;
sl@0
  5906
	active->StartL();
sl@0
  5907
	aClient.ChangeConfig(config, active->iStatus);
sl@0
  5908
	CActiveScheduler::Start();
sl@0
  5909
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5910
sl@0
  5911
	// Check that changes work after a backup
sl@0
  5912
	StartBackupL();
sl@0
  5913
	DelayL(1000000);
sl@0
  5914
	TestLogClosedL();
sl@0
  5915
	EndBackupL();
sl@0
  5916
	TestLogOpenL();
sl@0
  5917
	DelayL(1000000);
sl@0
  5918
sl@0
  5919
	// Check change events
sl@0
  5920
	User::After(100000);
sl@0
  5921
	TEST2(changeObs2->Changes().Count(), 1);
sl@0
  5922
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  5923
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  5924
sl@0
  5925
	// Check recent view
sl@0
  5926
	active->StartL();
sl@0
  5927
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  5928
	CActiveScheduler::Start();
sl@0
  5929
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5930
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  5931
sl@0
  5932
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  5933
	CleanupStack::PushL(duplicate);
sl@0
  5934
sl@0
  5935
	// Check duplicate count
sl@0
  5936
	TEST(!recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  5937
sl@0
  5938
	// Check that changes work after a backup
sl@0
  5939
	StartBackupL();
sl@0
  5940
	DelayL(1000000);
sl@0
  5941
	TestLogClosedL();
sl@0
  5942
	EndBackupL();
sl@0
  5943
	TestLogOpenL();
sl@0
  5944
sl@0
  5945
	// Check change events
sl@0
  5946
	User::After(100000);
sl@0
  5947
	TEST(!changeObs1->HaveChanges());
sl@0
  5948
sl@0
  5949
	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  5950
	}
sl@0
  5951
sl@0
  5952
/**
sl@0
  5953
Check that when deleting an event causing recent lists to be updated, views don't get unnecessary change events
sl@0
  5954
sl@0
  5955
@SYMTestCaseID          SYSLIB-LOGENG-CT-0962
sl@0
  5956
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  5957
@SYMTestPriority 	    High
sl@0
  5958
@SYMTestActions  	    Check that when deleting an event causing recent lists to be updated,views don't get unnecessary change events.
sl@0
  5959
                        Check the test work even after backup operations
sl@0
  5960
@SYMTestExpectedResults Test must not fail
sl@0
  5961
@SYMREQ                 REQ0000
sl@0
  5962
*/
sl@0
  5963
LOCAL_C void TestHiddenChangeEvents4aL(CLogClient& aClient)
sl@0
  5964
	{
sl@0
  5965
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0962 "));
sl@0
  5966
	TLogId logId;
sl@0
  5967
	TInt viewIndex;
sl@0
  5968
	TLogDatabaseChangeType type;
sl@0
  5969
sl@0
  5970
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  5971
	changeObs1->StartCollectingChanges();
sl@0
  5972
sl@0
  5973
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  5974
	CleanupStack::PushL(view);
sl@0
  5975
sl@0
  5976
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  5977
	CleanupStack::PushL(filter);
sl@0
  5978
	filter->SetFlags(1); // Need to hide an event from the view
sl@0
  5979
sl@0
  5980
	CLogEvent* event = CLogEvent::NewL();
sl@0
  5981
	CleanupStack::PushL(event);
sl@0
  5982
sl@0
  5983
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  5984
	CleanupStack::PushL(active);
sl@0
  5985
sl@0
  5986
	TTime now;
sl@0
  5987
	now.UniversalTime();
sl@0
  5988
	now += (TTimeIntervalDays)+1;
sl@0
  5989
sl@0
  5990
	// Get rid of all the events in the log
sl@0
  5991
	active->StartL();
sl@0
  5992
	aClient.ClearLog(now, active->iStatus);
sl@0
  5993
	CActiveScheduler::Start();
sl@0
  5994
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  5995
sl@0
  5996
	// Incoming call event
sl@0
  5997
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  5998
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  5999
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  6000
	event->SetDirection(buf);
sl@0
  6001
sl@0
  6002
	event->SetFlags(1);
sl@0
  6003
sl@0
  6004
	// Add an event
sl@0
  6005
	active->StartL();
sl@0
  6006
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6007
	CActiveScheduler::Start();
sl@0
  6008
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6009
sl@0
  6010
	// Add an event
sl@0
  6011
	active->StartL();
sl@0
  6012
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6013
	CActiveScheduler::Start();
sl@0
  6014
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6015
sl@0
  6016
	event->ClearFlags(0xF);
sl@0
  6017
sl@0
  6018
	// Add an event
sl@0
  6019
	active->StartL();
sl@0
  6020
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6021
	CActiveScheduler::Start();
sl@0
  6022
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6023
sl@0
  6024
	// Setup normal event view
sl@0
  6025
	active->StartL();
sl@0
  6026
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  6027
	CActiveScheduler::Start();
sl@0
  6028
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6029
	TEST2(view->CountL(), 2);
sl@0
  6030
sl@0
  6031
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  6032
	changeObs2->StartCollectingChanges();
sl@0
  6033
sl@0
  6034
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  6035
	CleanupStack::PushL(recent);
sl@0
  6036
sl@0
  6037
	// Check recent view
sl@0
  6038
	active->StartL();
sl@0
  6039
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  6040
	CActiveScheduler::Start();
sl@0
  6041
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6042
	TEST2(recent->CountL(), 1);
sl@0
  6043
sl@0
  6044
	changeObs1->StartCollectingChanges();
sl@0
  6045
	changeObs2->StartCollectingChanges();
sl@0
  6046
sl@0
  6047
	// Delete the event in recent list
sl@0
  6048
	active->StartL();
sl@0
  6049
	aClient.DeleteEvent(event->Id(), active->iStatus);
sl@0
  6050
	CActiveScheduler::Start();
sl@0
  6051
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6052
sl@0
  6053
	// Check that changes work after a backup
sl@0
  6054
	StartBackupL();
sl@0
  6055
	DelayL(1000000);
sl@0
  6056
	TestLogClosedL();
sl@0
  6057
	EndBackupL();
sl@0
  6058
	TestLogOpenL();
sl@0
  6059
sl@0
  6060
	// Check change events
sl@0
  6061
	TEST2(changeObs2->Changes().Count(), 2);
sl@0
  6062
	type = changeObs2->Changes().At(0, logId, viewIndex);
sl@0
  6063
	TEST2(type, ELogChangeTypeEventAdded);
sl@0
  6064
	type = changeObs2->Changes().At(1, logId, viewIndex);
sl@0
  6065
	TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  6066
sl@0
  6067
	TEST(!changeObs1->HaveChanges());
sl@0
  6068
sl@0
  6069
	CleanupStack::PopAndDestroy(7, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent
sl@0
  6070
	}
sl@0
  6071
sl@0
  6072
/**
sl@0
  6073
@SYMTestCaseID          SYSLIB-LOGENG-CT-0963
sl@0
  6074
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  6075
@SYMTestPriority 	    High
sl@0
  6076
@SYMTestActions  	    Check that a view doesn't get change events when recent list cleared
sl@0
  6077
                        Check the test work even after backup operations
sl@0
  6078
@SYMTestExpectedResults Test must not fail
sl@0
  6079
@SYMREQ                 REQ0000
sl@0
  6080
*/
sl@0
  6081
LOCAL_C void TestHiddenChangeEvents5aL(CLogClient& aClient)
sl@0
  6082
	{
sl@0
  6083
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0963 "));
sl@0
  6084
	TLogId logId;
sl@0
  6085
	TInt viewIndex;
sl@0
  6086
	TLogDatabaseChangeType type;
sl@0
  6087
sl@0
  6088
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  6089
	changeObs1->StartCollectingChanges();
sl@0
  6090
sl@0
  6091
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  6092
	CleanupStack::PushL(view);
sl@0
  6093
sl@0
  6094
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  6095
	CleanupStack::PushL(filter);
sl@0
  6096
sl@0
  6097
	CLogEvent* event = CLogEvent::NewL();
sl@0
  6098
	CleanupStack::PushL(event);
sl@0
  6099
sl@0
  6100
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  6101
	CleanupStack::PushL(active);
sl@0
  6102
sl@0
  6103
	TTime now;
sl@0
  6104
	now.UniversalTime();
sl@0
  6105
	now += (TTimeIntervalDays)+1;
sl@0
  6106
sl@0
  6107
	// Get rid of all the events in the log
sl@0
  6108
	active->StartL();
sl@0
  6109
	aClient.ClearLog(now, active->iStatus);
sl@0
  6110
	CActiveScheduler::Start();
sl@0
  6111
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6112
sl@0
  6113
	// Get config
sl@0
  6114
	TLogConfig config;
sl@0
  6115
	active->StartL();
sl@0
  6116
	aClient.GetConfig(config, active->iStatus);
sl@0
  6117
	CActiveScheduler::Start();
sl@0
  6118
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6119
sl@0
  6120
	// Incoming call event
sl@0
  6121
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  6122
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  6123
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  6124
	event->SetDirection(buf);
sl@0
  6125
sl@0
  6126
	// Add max allowed events
sl@0
  6127
	TInt count = config.iMaxRecentLogSize;
sl@0
  6128
	while(count--)
sl@0
  6129
		{
sl@0
  6130
		event->SetContact(count+1);
sl@0
  6131
		active->StartL();
sl@0
  6132
		aClient.AddEvent(*event, active->iStatus);
sl@0
  6133
		CActiveScheduler::Start();
sl@0
  6134
		TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6135
		}
sl@0
  6136
sl@0
  6137
	// Setup normal event view
sl@0
  6138
	active->StartL();
sl@0
  6139
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  6140
	CActiveScheduler::Start();
sl@0
  6141
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6142
sl@0
  6143
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  6144
	changeObs2->StartCollectingChanges();
sl@0
  6145
sl@0
  6146
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  6147
	CleanupStack::PushL(recent);
sl@0
  6148
sl@0
  6149
	// Check recent view
sl@0
  6150
	active->StartL();
sl@0
  6151
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  6152
	CActiveScheduler::Start();
sl@0
  6153
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6154
	TEST2(recent->CountL(), config.iMaxRecentLogSize);
sl@0
  6155
sl@0
  6156
	// Clear recent view
sl@0
  6157
	active->StartL();
sl@0
  6158
	aClient.ClearLog(KLogRecentIncomingCalls, active->iStatus);
sl@0
  6159
	CActiveScheduler::Start();
sl@0
  6160
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6161
sl@0
  6162
	// Check that changes work after a backup
sl@0
  6163
	StartBackupL();
sl@0
  6164
	DelayL(1000000);
sl@0
  6165
	TestLogClosedL();
sl@0
  6166
	EndBackupL();
sl@0
  6167
	TestLogOpenL();
sl@0
  6168
sl@0
  6169
	count = config.iMaxRecentLogSize;
sl@0
  6170
	TEST2(changeObs2->Changes().Count(), count);
sl@0
  6171
	while(count--)
sl@0
  6172
		{
sl@0
  6173
		type = changeObs2->Changes().At(count, logId, viewIndex);
sl@0
  6174
		TEST2(type, ELogChangeTypeEventDeleted);
sl@0
  6175
		}
sl@0
  6176
sl@0
  6177
	// Check recent view
sl@0
  6178
	TEST(!recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  6179
sl@0
  6180
	// Check that changes work after a backup
sl@0
  6181
	StartBackupL();
sl@0
  6182
	DelayL(1000000);
sl@0
  6183
	TestLogClosedL();
sl@0
  6184
	EndBackupL();
sl@0
  6185
	TestLogOpenL();
sl@0
  6186
sl@0
  6187
	// Check change events
sl@0
  6188
	User::After(100000);
sl@0
  6189
	TEST(!changeObs1->HaveChanges());
sl@0
  6190
sl@0
  6191
	CleanupStack::PopAndDestroy(7, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent
sl@0
  6192
	}
sl@0
  6193
sl@0
  6194
/**
sl@0
  6195
@SYMTestCaseID          SYSLIB-LOGENG-CT-0964
sl@0
  6196
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  6197
@SYMTestPriority 	    High
sl@0
  6198
@SYMTestActions  	    Check that a view doesn't get change events when removing events from a recent or duplicate view
sl@0
  6199
                        Check the test work even after backup operations
sl@0
  6200
@SYMTestExpectedResults Test must not fail
sl@0
  6201
@SYMREQ                 REQ0000
sl@0
  6202
*/
sl@0
  6203
LOCAL_C void TestHiddenChangeEvents6aL(CLogClient& aClient)
sl@0
  6204
	{
sl@0
  6205
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0964 "));
sl@0
  6206
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  6207
	changeObs1->StartCollectingChanges();
sl@0
  6208
sl@0
  6209
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  6210
	CleanupStack::PushL(view);
sl@0
  6211
sl@0
  6212
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  6213
	CleanupStack::PushL(filter);
sl@0
  6214
sl@0
  6215
	CLogEvent* event = CLogEvent::NewL();
sl@0
  6216
	CleanupStack::PushL(event);
sl@0
  6217
sl@0
  6218
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  6219
	CleanupStack::PushL(active);
sl@0
  6220
sl@0
  6221
	TTime now;
sl@0
  6222
	now.UniversalTime();
sl@0
  6223
	now += (TTimeIntervalDays)+1;
sl@0
  6224
sl@0
  6225
	// Get rid of all the events in the log
sl@0
  6226
	active->StartL();
sl@0
  6227
	aClient.ClearLog(now, active->iStatus);
sl@0
  6228
	CActiveScheduler::Start();
sl@0
  6229
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6230
sl@0
  6231
	// Incoming call event
sl@0
  6232
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  6233
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  6234
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  6235
	event->SetDirection(buf);
sl@0
  6236
sl@0
  6237
	// Add an event
sl@0
  6238
	active->StartL();
sl@0
  6239
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6240
	CActiveScheduler::Start();
sl@0
  6241
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6242
sl@0
  6243
	// Add a duplicate
sl@0
  6244
	active->StartL();
sl@0
  6245
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6246
	CActiveScheduler::Start();
sl@0
  6247
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6248
sl@0
  6249
	// Setup normal event view
sl@0
  6250
	active->StartL();
sl@0
  6251
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  6252
	CActiveScheduler::Start();
sl@0
  6253
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6254
	TEST(view->CountL() == 2);
sl@0
  6255
sl@0
  6256
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  6257
	changeObs2->StartCollectingChanges();
sl@0
  6258
sl@0
  6259
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  6260
	CleanupStack::PushL(recent);
sl@0
  6261
sl@0
  6262
	// Check recent view
sl@0
  6263
	active->StartL();
sl@0
  6264
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  6265
	CActiveScheduler::Start();
sl@0
  6266
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6267
	TEST2(recent->CountL(), 1);
sl@0
  6268
sl@0
  6269
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  6270
	CleanupStack::PushL(duplicate);
sl@0
  6271
sl@0
  6272
	// Check duplicate count
sl@0
  6273
	active->StartL();
sl@0
  6274
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6275
	CActiveScheduler::Start();
sl@0
  6276
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6277
	TEST2(recent->CountL(), 1);
sl@0
  6278
sl@0
  6279
	// Remove duplicate
sl@0
  6280
	duplicate->RemoveL(duplicate->Event().Id());
sl@0
  6281
sl@0
  6282
	// Check that changes work after a backup
sl@0
  6283
	StartBackupL();
sl@0
  6284
	DelayL(1000000);
sl@0
  6285
	TestLogClosedL();
sl@0
  6286
	EndBackupL();
sl@0
  6287
	TestLogOpenL();
sl@0
  6288
sl@0
  6289
	// Check change events
sl@0
  6290
	TEST(!changeObs1->HaveChanges());
sl@0
  6291
	TEST(!changeObs2->HaveChanges());
sl@0
  6292
sl@0
  6293
	// Remove recent
sl@0
  6294
	recent->RemoveL(recent->Event().Id());
sl@0
  6295
sl@0
  6296
	// Check that changes work after a backup
sl@0
  6297
	StartBackupL();
sl@0
  6298
	DelayL(1000000);
sl@0
  6299
	TestLogClosedL();
sl@0
  6300
	EndBackupL();
sl@0
  6301
	TestLogOpenL();
sl@0
  6302
sl@0
  6303
	TEST(!changeObs1->HaveChanges());
sl@0
  6304
	TEST(!changeObs2->HaveChanges()); // No event because we should know we called Remove on ourselves
sl@0
  6305
sl@0
  6306
	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  6307
	}
sl@0
  6308
sl@0
  6309
/**
sl@0
  6310
@SYMTestCaseID          SYSLIB-LOGENG-CT-0965
sl@0
  6311
@SYMTestCaseDesc	    Tests for log view change observer
sl@0
  6312
@SYMTestPriority 	    High
sl@0
  6313
@SYMTestActions  	    Check that a view doesn't get change events when clearing duplicates
sl@0
  6314
                        Check the test work even after backup operations
sl@0
  6315
@SYMTestExpectedResults Test must not fail
sl@0
  6316
@SYMREQ                 REQ0000
sl@0
  6317
*/
sl@0
  6318
LOCAL_C void TestHiddenChangeEvents7aL(CLogClient& aClient)
sl@0
  6319
	{
sl@0
  6320
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0965 "));
sl@0
  6321
	CLogViewChangeObserver* changeObs1 = CLogViewChangeObserver::NewLC();
sl@0
  6322
	changeObs1->StartCollectingChanges();
sl@0
  6323
sl@0
  6324
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs1);
sl@0
  6325
	CleanupStack::PushL(view);
sl@0
  6326
sl@0
  6327
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  6328
	CleanupStack::PushL(filter);
sl@0
  6329
sl@0
  6330
	CLogEvent* event = CLogEvent::NewL();
sl@0
  6331
	CleanupStack::PushL(event);
sl@0
  6332
sl@0
  6333
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  6334
	CleanupStack::PushL(active);
sl@0
  6335
sl@0
  6336
	TTime now;
sl@0
  6337
	now.UniversalTime();
sl@0
  6338
	now += (TTimeIntervalDays)+1;
sl@0
  6339
sl@0
  6340
	// Get rid of all the events in the log
sl@0
  6341
	active->StartL();
sl@0
  6342
	aClient.ClearLog(now, active->iStatus);
sl@0
  6343
	CActiveScheduler::Start();
sl@0
  6344
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6345
sl@0
  6346
	// Incoming call event
sl@0
  6347
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  6348
	TBuf<KLogMaxDirectionLength> buf;
sl@0
  6349
	aClient.GetString(buf, R_LOG_DIR_IN);
sl@0
  6350
	event->SetDirection(buf);
sl@0
  6351
sl@0
  6352
	// Add an event
sl@0
  6353
	active->StartL();
sl@0
  6354
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6355
	CActiveScheduler::Start();
sl@0
  6356
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6357
sl@0
  6358
	// Add a duplicate
sl@0
  6359
	active->StartL();
sl@0
  6360
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6361
	CActiveScheduler::Start();
sl@0
  6362
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6363
sl@0
  6364
	// Setup normal event view
sl@0
  6365
	active->StartL();
sl@0
  6366
	TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  6367
	CActiveScheduler::Start();
sl@0
  6368
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6369
	TEST2(view->CountL(), 2);
sl@0
  6370
sl@0
  6371
	CLogViewChangeObserver* changeObs2 = CLogViewChangeObserver::NewLC();
sl@0
  6372
	changeObs2->StartCollectingChanges();
sl@0
  6373
sl@0
  6374
	CLogViewRecent* recent = CLogViewRecent::NewL(aClient, *changeObs2);
sl@0
  6375
	CleanupStack::PushL(recent);
sl@0
  6376
sl@0
  6377
	// Check recent view
sl@0
  6378
	active->StartL();
sl@0
  6379
	TEST(recent->SetRecentListL(KLogRecentIncomingCalls, active->iStatus));
sl@0
  6380
	CActiveScheduler::Start();
sl@0
  6381
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6382
	TEST2(recent->CountL(), 1);
sl@0
  6383
sl@0
  6384
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  6385
	CleanupStack::PushL(duplicate);
sl@0
  6386
sl@0
  6387
	// Check duplicate count
sl@0
  6388
	active->StartL();
sl@0
  6389
	TEST(recent->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6390
	CActiveScheduler::Start();
sl@0
  6391
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6392
	TEST2(recent->CountL(), 1);
sl@0
  6393
sl@0
  6394
	// Remove duplicate
sl@0
  6395
	recent->ClearDuplicatesL();
sl@0
  6396
sl@0
  6397
	// Check that changes work after a backup
sl@0
  6398
	StartBackupL();
sl@0
  6399
	DelayL(1000000);
sl@0
  6400
	TestLogClosedL();
sl@0
  6401
	EndBackupL();
sl@0
  6402
	TestLogOpenL();
sl@0
  6403
sl@0
  6404
	// Check change events
sl@0
  6405
	TEST(!changeObs1->HaveChanges());
sl@0
  6406
	TEST(!changeObs2->HaveChanges());
sl@0
  6407
sl@0
  6408
	CleanupStack::PopAndDestroy(8, changeObs1); // changeObs1, changeObs2, view, filter, event, active, recent, duplicate
sl@0
  6409
	}
sl@0
  6410
	
sl@0
  6411
/**
sl@0
  6412
@SYMTestCaseID          SYSLIB-LOGENG-CT-3511
sl@0
  6413
@SYMTestCaseDesc	    Tests an error condition for adding an event.                       
sl@0
  6414
@SYMTestPriority 	    High
sl@0
  6415
@SYMTestActions  	    A leave will be caused in an observer when a specific event is added. This test 
sl@0
  6416
                        ensures by successful test completion that there are no panics in this 
sl@0
  6417
                        situation.
sl@0
  6418
@SYMTestExpectedResults Test must not fail
sl@0
  6419
@SYMDEF                 DEF108741
sl@0
  6420
*/
sl@0
  6421
LOCAL_C void DEF108741L(CLogClient& aClient)
sl@0
  6422
	{
sl@0
  6423
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3511 "));
sl@0
  6424
	// Perform clean up
sl@0
  6425
 	TestUtils::DeleteDatabaseL();
sl@0
  6426
sl@0
  6427
	// Create a new event 
sl@0
  6428
	CLogEvent* event = CLogEvent::NewL();
sl@0
  6429
	CleanupStack::PushL(event);
sl@0
  6430
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  6431
sl@0
  6432
	CTestActive* active = new(ELeave) CTestActive();
sl@0
  6433
	CleanupStack::PushL(active);
sl@0
  6434
sl@0
  6435
	// Create a change observer. This observer will cause errors in order to verify that 
sl@0
  6436
	// the system handles them properly.
sl@0
  6437
	CLogViewChangeObserverErrorTest* changeObs = CLogViewChangeObserverErrorTest::NewLC();
sl@0
  6438
sl@0
  6439
	// Create a view for the event log  
sl@0
  6440
	CLogViewEvent* view = CLogViewEvent::NewL(aClient, *changeObs);
sl@0
  6441
	CleanupStack::PushL(view);
sl@0
  6442
	
sl@0
  6443
	// Create a filter to specify what events appear in the view
sl@0
  6444
	CLogFilter* filter = CLogFilter::NewL();
sl@0
  6445
	CleanupStack::PushL(filter);
sl@0
  6446
	TEST(!view->SetFilterL(*filter, active->iStatus));
sl@0
  6447
	 
sl@0
  6448
	TInt count;
sl@0
  6449
	TLogId logId;
sl@0
  6450
	TInt viewIndex;
sl@0
  6451
 
sl@0
  6452
 	// This code adds 3 events with ids 0,1 and 2.
sl@0
  6453
 	// The observer add event handler :
sl@0
  6454
 	// CLogViewChangeObserverErrorTest::HandleLogViewChangeEventAddedL
sl@0
  6455
 	// has been written so that it will leave if an event with log id 1 is added.
sl@0
  6456
 	// The test completion proves that the leave is dealt with gracefully without 
sl@0
  6457
 	// any panics.
sl@0
  6458
	for(count = 0; count < KTestErrorEventNum; count++)
sl@0
  6459
		{
sl@0
  6460
		// Add an event to the log database
sl@0
  6461
		aClient.AddEvent(*event, changeObs->iStatus);
sl@0
  6462
		CLogChangeDefinition* changes = changeObs->WaitForChangesLC(CLogViewChangeObserver::EStopOnBoth);
sl@0
  6463
		
sl@0
  6464
		// Check the results/notifications are as expected
sl@0
  6465
		TEST2(changeObs->iStatus.Int(), KErrNone);
sl@0
  6466
		TEST(event->Id() == (TLogId) count);
sl@0
  6467
		User::After(1);
sl@0
  6468
		TEST2(changes->Count(), 1);
sl@0
  6469
		TEST2(changes->At(0, logId, viewIndex), ELogChangeTypeEventAdded);
sl@0
  6470
		TEST(logId == (TLogId) count);
sl@0
  6471
		TEST2(viewIndex, 0);
sl@0
  6472
		CleanupStack::PopAndDestroy(changes);
sl@0
  6473
		}
sl@0
  6474
 
sl@0
  6475
	CleanupStack::PopAndDestroy(5, event); // filter, view, changeObs, active, event
sl@0
  6476
	}
sl@0
  6477
sl@0
  6478
/**
sl@0
  6479
@SYMTestCaseID          SYSLIB-LOGENG-CT-3716
sl@0
  6480
@SYMTestCaseDesc	    Tests for the defect INC108225 
sl@0
  6481
@SYMTestPriority 	    High
sl@0
  6482
@SYMTestActions  	    Tests for the count of out call list & the duplicates for CS & PS calls
sl@0
  6483
						The fields to be considered while finding duplicates records are set in the resource file named LOGWRAP.RSS
sl@0
  6484
						i.e. duplicate = ELogRemotePartyField|ELogContactField|ELogNumberField;
sl@0
  6485
						Considering this duplicate value, the where clause in the query is made to find duplicate records.
sl@0
  6486
@SYMTestExpectedResults Test must not fail
sl@0
  6487
@SYMDEF                 INC108225
sl@0
  6488
*/
sl@0
  6489
LOCAL_C void TestNumberFieldINC108225L(CLogClient& aClient)
sl@0
  6490
{
sl@0
  6491
    TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3716 ")); 
sl@0
  6492
	CLogEvent* event = CLogEvent::NewL();
sl@0
  6493
	CleanupStack::PushL(event);
sl@0
  6494
sl@0
  6495
	CLogEvent* event1 = CLogEvent::NewL();
sl@0
  6496
	CleanupStack::PushL(event1);
sl@0
  6497
sl@0
  6498
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  6499
	CleanupStack::PushL(active);
sl@0
  6500
sl@0
  6501
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  6502
	CleanupStack::PushL(view);
sl@0
  6503
sl@0
  6504
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  6505
	CleanupStack::PushL(duplicate);
sl@0
  6506
sl@0
  6507
	// Make sure there are no entries in any recent lists
sl@0
  6508
	active->StartL();
sl@0
  6509
	aClient.ClearLog(KLogRecentOutgoingCalls, active->iStatus);
sl@0
  6510
	CActiveScheduler::Start();
sl@0
  6511
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6512
	
sl@0
  6513
	TLogString buf1;
sl@0
  6514
	aClient.GetString(buf1, R_LOG_DIR_OUT);
sl@0
  6515
sl@0
  6516
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  6517
	event->SetDirection(buf1);
sl@0
  6518
	event->SetDurationType(KLogDurationNone);
sl@0
  6519
	event->SetContact(KTestContact1);
sl@0
  6520
	event->SetRemoteParty(KTestRemote1);
sl@0
  6521
	event->SetNumber(KTestNumber1);
sl@0
  6522
sl@0
  6523
	// Add event 1st CS Call with contact as KTestContact & number as KTestNumber1
sl@0
  6524
	active->StartL();
sl@0
  6525
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6526
	CActiveScheduler::Start();
sl@0
  6527
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6528
sl@0
  6529
	active->StartL();
sl@0
  6530
	TBool res = view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus);
sl@0
  6531
	CActiveScheduler::Start();
sl@0
  6532
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6533
	TEST2(view->CountL(), 1);
sl@0
  6534
		
sl@0
  6535
	// Set new event with the same contact details (i.e. KTestContact) and 
sl@0
  6536
	//...event type as KLogCallEventTypeUid & no number field
sl@0
  6537
	event1->SetEventType(KLogCallEventTypeUid);
sl@0
  6538
	event1->SetDirection(buf1);
sl@0
  6539
	event1->SetDurationType(KLogDurationNone);
sl@0
  6540
	event1->SetContact(KTestContact1);
sl@0
  6541
	event1->SetRemoteParty(KTestRemote1);
sl@0
  6542
	
sl@0
  6543
	// Add event 1st PS Call with contact as KTestContact1 & Number as Null
sl@0
  6544
	active->StartL();
sl@0
  6545
	aClient.AddEvent(*event1, active->iStatus);
sl@0
  6546
	CActiveScheduler::Start();
sl@0
  6547
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6548
sl@0
  6549
	active->StartL();
sl@0
  6550
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6551
	CActiveScheduler::Start();
sl@0
  6552
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6553
	TEST2(view->CountL(), 2);
sl@0
  6554
	
sl@0
  6555
	// Add event 2nd CS Call
sl@0
  6556
	active->StartL();
sl@0
  6557
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6558
	CActiveScheduler::Start();
sl@0
  6559
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6560
sl@0
  6561
	active->StartL();
sl@0
  6562
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6563
	CActiveScheduler::Start();
sl@0
  6564
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6565
	TEST2(view->CountL(), 2);
sl@0
  6566
	
sl@0
  6567
	// Check duplicate count for the last call made i.e. CS call
sl@0
  6568
	active->StartL();
sl@0
  6569
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6570
	CActiveScheduler::Start();
sl@0
  6571
	TEST2(duplicate->CountL(), 1);
sl@0
  6572
		
sl@0
  6573
	// Add event 2nd PS Call
sl@0
  6574
	active->StartL();
sl@0
  6575
	aClient.AddEvent(*event1, active->iStatus);
sl@0
  6576
	CActiveScheduler::Start();
sl@0
  6577
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6578
	
sl@0
  6579
	active->StartL();
sl@0
  6580
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6581
	CActiveScheduler::Start();
sl@0
  6582
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6583
	TEST2(view->CountL(), 2);
sl@0
  6584
sl@0
  6585
	// Check duplicate count for the last call made i.e. PS call
sl@0
  6586
	active->StartL();
sl@0
  6587
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6588
	CActiveScheduler::Start();
sl@0
  6589
	TEST2(duplicate->CountL(), 1);
sl@0
  6590
	
sl@0
  6591
	// Add event 3rd CS Call
sl@0
  6592
	active->StartL();
sl@0
  6593
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6594
	CActiveScheduler::Start();
sl@0
  6595
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6596
	
sl@0
  6597
	active->StartL();
sl@0
  6598
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6599
	CActiveScheduler::Start();
sl@0
  6600
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6601
	TEST2(view->CountL(), 2);
sl@0
  6602
	
sl@0
  6603
	// Check duplicate count for the last call made i.e. CS call
sl@0
  6604
	active->StartL();
sl@0
  6605
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6606
	CActiveScheduler::Start();
sl@0
  6607
	TEST2(duplicate->CountL(), 2);
sl@0
  6608
sl@0
  6609
	// Add event 3rd PS Call
sl@0
  6610
	active->StartL();
sl@0
  6611
	aClient.AddEvent(*event1, active->iStatus);
sl@0
  6612
	CActiveScheduler::Start();
sl@0
  6613
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6614
	
sl@0
  6615
	active->StartL();
sl@0
  6616
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6617
	CActiveScheduler::Start();
sl@0
  6618
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6619
	TEST2(view->CountL(), 2);
sl@0
  6620
sl@0
  6621
	// Check duplicate count for the last call made i.e. PS call
sl@0
  6622
	active->StartL();
sl@0
  6623
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6624
	CActiveScheduler::Start();
sl@0
  6625
	TEST2(duplicate->CountL(), 2);
sl@0
  6626
		
sl@0
  6627
	CleanupStack::PopAndDestroy(5);	
sl@0
  6628
}
sl@0
  6629
sl@0
  6630
/**
sl@0
  6631
@SYMTestCaseID          SYSLIB-LOGENG-CT-3755
sl@0
  6632
@SYMTestCaseDesc	    Tests for the changes made in defect INC108225 for other fields 
sl@0
  6633
@SYMTestPriority 	    High
sl@0
  6634
@SYMTestActions  	    Tests for the count of out call list & the duplicates for CS calls referring other fields
sl@0
  6635
						The fields to be considered while finding duplicates records are set in the resource file named LOGWRAP.RSS
sl@0
  6636
						i.e. duplicate = ELogRemotePartyField|ELogContactField|ELogNumberField;
sl@0
  6637
						Considering this duplicate value, the where clause in the query is made to find duplicate records.
sl@0
  6638
@SYMTestExpectedResults Test must not fail
sl@0
  6639
@SYMDEF                 INC108225
sl@0
  6640
*/
sl@0
  6641
LOCAL_C void TestOtherFieldsINC108225L(CLogClient& aClient)
sl@0
  6642
{
sl@0
  6643
    TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-3755 ")); 
sl@0
  6644
	CLogEvent* event = CLogEvent::NewL();
sl@0
  6645
	CleanupStack::PushL(event);
sl@0
  6646
sl@0
  6647
	CTestActive* active = new(ELeave)CTestActive();
sl@0
  6648
	CleanupStack::PushL(active);
sl@0
  6649
sl@0
  6650
	CLogViewRecent* view = CLogViewRecent::NewL(aClient);
sl@0
  6651
	CleanupStack::PushL(view);
sl@0
  6652
sl@0
  6653
	CLogViewDuplicate* duplicate = CLogViewDuplicate::NewL(aClient);
sl@0
  6654
	CleanupStack::PushL(duplicate);
sl@0
  6655
sl@0
  6656
	// Make sure there are no entries in any recent lists
sl@0
  6657
	active->StartL();
sl@0
  6658
	aClient.ClearLog(KLogRecentOutgoingCalls, active->iStatus);
sl@0
  6659
	CActiveScheduler::Start();
sl@0
  6660
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6661
	
sl@0
  6662
	TLogString buf1;
sl@0
  6663
	aClient.GetString(buf1, R_LOG_DIR_OUT);
sl@0
  6664
sl@0
  6665
	event->SetEventType(KLogCallEventTypeUid);
sl@0
  6666
	event->SetDirection(buf1);
sl@0
  6667
	event->SetContact(KTestContact1);
sl@0
  6668
	event->SetRemoteParty(KTestRemote1);
sl@0
  6669
	event->SetNumber(KTestNumber1);
sl@0
  6670
	event->SetDurationType(KLogDurationNone);
sl@0
  6671
sl@0
  6672
	// Add event 1st CS Call with contact as KTestContact & number as KTestNumber1 &
sl@0
  6673
	//.. durationtype as KLogDurationNone
sl@0
  6674
	active->StartL();
sl@0
  6675
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6676
	CActiveScheduler::Start();
sl@0
  6677
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6678
sl@0
  6679
	active->StartL();
sl@0
  6680
	TBool res = view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus);
sl@0
  6681
	CActiveScheduler::Start();
sl@0
  6682
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6683
	TEST2(view->CountL(), 1);
sl@0
  6684
	
sl@0
  6685
	// Add event 2nd CS Call with duration type as KLogDurationValid
sl@0
  6686
	event->SetDurationType(KLogDurationValid);
sl@0
  6687
	
sl@0
  6688
	active->StartL();
sl@0
  6689
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6690
	CActiveScheduler::Start();
sl@0
  6691
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6692
sl@0
  6693
	active->StartL();
sl@0
  6694
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6695
	CActiveScheduler::Start();
sl@0
  6696
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6697
	TEST2(view->CountL(), 1);
sl@0
  6698
	
sl@0
  6699
	// Check duplicate count for the last call made 
sl@0
  6700
	active->StartL();
sl@0
  6701
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6702
	CActiveScheduler::Start();
sl@0
  6703
	TEST2(duplicate->CountL(), 1);
sl@0
  6704
	
sl@0
  6705
	// Add event 3rd CS Call with Flag as KLogNullFlags	
sl@0
  6706
	event->SetFlags(KLogNullFlags);
sl@0
  6707
	
sl@0
  6708
	active->StartL();
sl@0
  6709
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6710
	CActiveScheduler::Start();
sl@0
  6711
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6712
	
sl@0
  6713
	active->StartL();
sl@0
  6714
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6715
	CActiveScheduler::Start();
sl@0
  6716
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6717
	TEST2(view->CountL(), 1);
sl@0
  6718
	
sl@0
  6719
	// Check duplicate count for the last call made 
sl@0
  6720
	active->StartL();
sl@0
  6721
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6722
	CActiveScheduler::Start();
sl@0
  6723
	TEST2(duplicate->CountL(), 2);
sl@0
  6724
	
sl@0
  6725
	// Add event 4th CS Call with Flag as KLogFlagsMask
sl@0
  6726
	event->SetFlags(KLogFlagsMask);
sl@0
  6727
	
sl@0
  6728
	active->StartL();
sl@0
  6729
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6730
	CActiveScheduler::Start();
sl@0
  6731
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6732
	
sl@0
  6733
	active->StartL();
sl@0
  6734
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6735
	CActiveScheduler::Start();
sl@0
  6736
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6737
	TEST2(view->CountL(), 1);
sl@0
  6738
	
sl@0
  6739
	// Check duplicate count for the last call made 
sl@0
  6740
	active->StartL();
sl@0
  6741
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6742
	CActiveScheduler::Start();
sl@0
  6743
	TEST2(duplicate->CountL(), 3);
sl@0
  6744
sl@0
  6745
	// Add event 5th CS Call with Status as KNullDesC
sl@0
  6746
	event->SetStatus(KNullDesC);
sl@0
  6747
	
sl@0
  6748
	active->StartL();
sl@0
  6749
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6750
	CActiveScheduler::Start();
sl@0
  6751
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6752
	
sl@0
  6753
	active->StartL();
sl@0
  6754
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6755
	CActiveScheduler::Start();
sl@0
  6756
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6757
	TEST2(view->CountL(), 1);
sl@0
  6758
	
sl@0
  6759
	// Check duplicate count for the last call made 
sl@0
  6760
	active->StartL();
sl@0
  6761
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6762
	CActiveScheduler::Start();
sl@0
  6763
	TEST2(duplicate->CountL(), 4);
sl@0
  6764
	
sl@0
  6765
	// Add event 6th CS Call with Status as KTestStatus1
sl@0
  6766
	event->SetStatus(KTestStatus1);
sl@0
  6767
	
sl@0
  6768
	active->StartL();
sl@0
  6769
	aClient.AddEvent(*event, active->iStatus);
sl@0
  6770
	CActiveScheduler::Start();
sl@0
  6771
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6772
	
sl@0
  6773
	active->StartL();
sl@0
  6774
	TEST(view->SetRecentListL(KLogRecentOutgoingCalls, active->iStatus));
sl@0
  6775
	CActiveScheduler::Start();
sl@0
  6776
	TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6777
	TEST2(view->CountL(), 1);
sl@0
  6778
	
sl@0
  6779
	// Check duplicate count for the last call made
sl@0
  6780
	active->StartL();
sl@0
  6781
	TEST(view->DuplicatesL(*duplicate, active->iStatus));
sl@0
  6782
	CActiveScheduler::Start();
sl@0
  6783
	TEST2(duplicate->CountL(), 5);
sl@0
  6784
	
sl@0
  6785
	CleanupStack::PopAndDestroy(4);	
sl@0
  6786
}
sl@0
  6787
sl@0
  6788
/**
sl@0
  6789
@SYMTestCaseID          PDS-LOGENG-CT-4050
sl@0
  6790
@SYMTestCaseDesc        Tests for the changes made in defect DEF144552 
sl@0
  6791
@SYMTestPriority        High
sl@0
  6792
@SYMTestActions         Tests for the sucessful completion of the following operation - 
sl@0
  6793
                        1)Applying a filter where the event's start time matches the end time.
sl@0
  6794
                        2)Clearing the log where the clear log time is 1 microsecs after the 
sl@0
  6795
                        timestamp of the event.
sl@0
  6796
@SYMTestExpectedResults Test must not fail
sl@0
  6797
@SYMREQ                 DEF144552
sl@0
  6798
*/
sl@0
  6799
LOCAL_C void DEF144552L(CLogClient& aClient)
sl@0
  6800
    {
sl@0
  6801
    TheTest.Next(_L(" @SYMTestCaseID:PDS-LOGENG-CT-4050 ")); 
sl@0
  6802
    TestUtils::DeleteDatabaseL(EFalse);
sl@0
  6803
    
sl@0
  6804
    CTestActive* active = new(ELeave)CTestActive();
sl@0
  6805
    CleanupStack::PushL(active);
sl@0
  6806
sl@0
  6807
    //Setup the database by adding a event and changing the timestamp for the event
sl@0
  6808
    //Add 1 event
sl@0
  6809
    CLogEvent* event = CLogEvent::NewL();
sl@0
  6810
    CleanupStack::PushL(event);
sl@0
  6811
    event->SetEventType(KLogCallEventTypeUid);
sl@0
  6812
    event->SetContact(KTestContact1);
sl@0
  6813
    event->SetNumber(KTestNumber2);
sl@0
  6814
    event->SetDuration(0);
sl@0
  6815
    active->StartL();
sl@0
  6816
    aClient.AddEvent(*event, active->iStatus);
sl@0
  6817
    CActiveScheduler::Start();
sl@0
  6818
    TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6819
    
sl@0
  6820
    //Change the event
sl@0
  6821
    TTime now;
sl@0
  6822
    now.UniversalTime();
sl@0
  6823
    event->SetTime(now);
sl@0
  6824
    active->StartL();
sl@0
  6825
    aClient.ChangeEvent(*event, active->iStatus);
sl@0
  6826
    CActiveScheduler::Start();
sl@0
  6827
    TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6828
    
sl@0
  6829
    //Test 1: Setup and apply a filter where the start time matches the end time
sl@0
  6830
    //If the defect is fixed then the view will contain the event previously added,
sl@0
  6831
    //Otherwise the time parameters will be truncated and the event will not be found
sl@0
  6832
    
sl@0
  6833
    //Setup filter so that the start and the end time matches
sl@0
  6834
    CLogFilter* filter = CLogFilter::NewL();
sl@0
  6835
    CleanupStack::PushL(filter);
sl@0
  6836
    filter->SetStartTime(now);
sl@0
  6837
    filter->SetEndTime(now);
sl@0
  6838
    
sl@0
  6839
    //Apply the filter and check that 1 event is in the view
sl@0
  6840
    CLogViewEvent* view = CLogViewEvent::NewL(aClient);
sl@0
  6841
    CleanupStack::PushL(view);
sl@0
  6842
    active->StartL();
sl@0
  6843
    TEST(view->SetFilterL(*filter, active->iStatus));
sl@0
  6844
    CActiveScheduler::Start();
sl@0
  6845
    TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6846
    TEST2(view->CountL(), 1);
sl@0
  6847
    
sl@0
  6848
    //Retrieve and check the event
sl@0
  6849
    active->StartL();
sl@0
  6850
    TEST(view->FirstL(active->iStatus));
sl@0
  6851
    CActiveScheduler::Start();
sl@0
  6852
    TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6853
    const CLogEvent& currentEvent(view->Event());
sl@0
  6854
    TEST2(currentEvent.EventType().iUid, KLogCallEventTypeUid.iUid);
sl@0
  6855
    TEST2(currentEvent.Duration(), 0);
sl@0
  6856
    TEST2(currentEvent.Time().Int64(), now.Int64());
sl@0
  6857
    
sl@0
  6858
    // Test 2: Clearing a log where the time specified in ClearLog() is just
sl@0
  6859
    // after the timestamp of the event by 1 microsecond. If the defect is fixed
sl@0
  6860
    // then the event will be deleted. However if the defect is not fixed then the
sl@0
  6861
    // time specified in ClearLog() will be truncated and the event will not be 
sl@0
  6862
    // deleted
sl@0
  6863
    
sl@0
  6864
    //Clear the log
sl@0
  6865
    active->StartL();
sl@0
  6866
    TTimeIntervalMicroSeconds microsecond(1);
sl@0
  6867
    now += microsecond;
sl@0
  6868
    aClient.ClearLog(now, active->iStatus);
sl@0
  6869
    CActiveScheduler::Start();
sl@0
  6870
    TEST2(active->iStatus.Int(), KErrNone);
sl@0
  6871
    
sl@0
  6872
    //Check that the event has been deleted in the view
sl@0
  6873
    CleanupStack::PopAndDestroy(2);
sl@0
  6874
    view = CLogViewEvent::NewL(aClient);
sl@0
  6875
    CleanupStack::PushL(view);
sl@0
  6876
    filter = CLogFilter::NewL();
sl@0
  6877
    CleanupStack::PushL(filter);
sl@0
  6878
    active->StartL();
sl@0
  6879
    TEST(!view->SetFilterL(*filter, active->iStatus));
sl@0
  6880
sl@0
  6881
    CleanupStack::PopAndDestroy(4, active); 
sl@0
  6882
    }
sl@0
  6883
sl@0
  6884
void doTestsL()
sl@0
  6885
	{
sl@0
  6886
	TestUtils::Initialize(_L("t_logview2"));
sl@0
  6887
	TestUtils::DeleteDatabaseL();
sl@0
  6888
sl@0
  6889
	CLogClient* client = CLogClient::NewL(theFs);
sl@0
  6890
	CleanupStack::PushL(client);
sl@0
  6891
sl@0
  6892
	CLogChangeNotifier* notifier = CLogChangeNotifier::NewL();
sl@0
  6893
	CleanupStack::PushL(notifier);	
sl@0
  6894
sl@0
  6895
	TheTest.Start(_L("Event View With Filter List"));
sl@0
  6896
	TestEventViewWithFilterListL(*client);
sl@0
  6897
	theLog.Write(_L8("Test 1 OK\n"));
sl@0
  6898
sl@0
  6899
	TheTest.Next(_L("View change observer"));
sl@0
  6900
	TestViewChangeEventsL(*client);
sl@0
  6901
	theLog.Write(_L8("Test 2 OK\n"));
sl@0
  6902
sl@0
  6903
	TheTest.Next(_L("Recent View With Filter"));
sl@0
  6904
	TestRecentViewWithFilterL(*client);
sl@0
  6905
	theLog.Write(_L8("Test 3 OK\n"));
sl@0
  6906
sl@0
  6907
	TheTest.Next(_L("Recent View With Filter List"));
sl@0
  6908
	TestRecentViewWithFilterListL(*client);
sl@0
  6909
	theLog.Write(_L8("Test 4 OK\n"));
sl@0
  6910
sl@0
  6911
	TheTest.Next(_L("Duplicate View With Filter"));
sl@0
  6912
	TestDuplicateViewWithFilterL(*client);
sl@0
  6913
	theLog.Write(_L8("Test 5 OK\n"));
sl@0
  6914
sl@0
  6915
	TheTest.Next(_L("Duplicate View With Filter List"));
sl@0
  6916
	TestDuplicateViewWithFilterListL(*client);
sl@0
  6917
	theLog.Write(_L8("Test 6 OK\n"));
sl@0
  6918
sl@0
  6919
	TheTest.Next(_L("Querying Event View For Null Fields"));
sl@0
  6920
	TestEventViewForNullFieldsL(*client);
sl@0
  6921
	theLog.Write(_L8("Test 7 OK\n"));
sl@0
  6922
sl@0
  6923
	TheTest.Next(_L("Querying Recent View For Null Fields"));
sl@0
  6924
	TestRecentViewForNullFieldsL(*client);
sl@0
  6925
	theLog.Write(_L8("Test 8 OK\n"));
sl@0
  6926
sl@0
  6927
	TheTest.Next(_L("Querying Duplicate View For Null Fields"));
sl@0
  6928
	TestDuplicateViewForNullFieldsL(*client);
sl@0
  6929
	theLog.Write(_L8("Test 9 OK\n"));
sl@0
  6930
sl@0
  6931
	TheTest.Next(_L("Querying Event View For Flags"));
sl@0
  6932
	TestEventViewForFlagsL(*client);
sl@0
  6933
	theLog.Write(_L8("Test 10 OK\n"));
sl@0
  6934
sl@0
  6935
	TheTest.Next(_L("Querying Recent View For Flags"));
sl@0
  6936
	TestRecentViewForFlagsL(*client);
sl@0
  6937
	theLog.Write(_L8("Test 11 OK\n"));
sl@0
  6938
sl@0
  6939
	TheTest.Next(_L("Querying Duplicate View For Flags"));
sl@0
  6940
	TestDuplicateViewForFlagsL(*client);
sl@0
  6941
	theLog.Write(_L8("Test 12 OK\n"));
sl@0
  6942
sl@0
  6943
	TheTest.Next(_L("Removing Recent Events"));
sl@0
  6944
	TestRemovingRecentEventsL(*client);
sl@0
  6945
	theLog.Write(_L8("Test 13 OK\n"));
sl@0
  6946
sl@0
  6947
	TheTest.Next(_L("Removing Duplicate Events"));
sl@0
  6948
	TestRemovingDuplicateEventsL(*client);
sl@0
  6949
	theLog.Write(_L8("Test 14 OK\n"));
sl@0
  6950
sl@0
  6951
	TheTest.Next(_L("Multiple Views"));
sl@0
  6952
	TestMultipleViews1L(*client);
sl@0
  6953
	TestMultipleViews2L(*client);
sl@0
  6954
	theLog.Write(_L8("Test 15 OK\n"));
sl@0
  6955
	
sl@0
  6956
	TheTest.Next(_L("Test _ALT Events In Recent List")); 
sl@0
  6957
	TestAltEventsInRecentListL(*client);   
sl@0
  6958
	theLog.Write(_L8("Test 16 OK\n"));
sl@0
  6959
sl@0
  6960
	TheTest.Next(_L("Test filtering Events by time")); 
sl@0
  6961
	// This TEST sets system's 'Home Time'
sl@0
  6962
	TestFilterByTimeL(*client);
sl@0
  6963
	theLog.Write(_L8("Test 17 OK\n"));
sl@0
  6964
sl@0
  6965
	TheTest.Next(_L("Test hidden change events")); 
sl@0
  6966
	TestUtils::DeleteDatabaseL();
sl@0
  6967
	TestHiddenChangeEvents1L(*client);
sl@0
  6968
	TestHiddenChangeEvents1aL(*client);
sl@0
  6969
	TestHiddenChangeEvents2L(*client);
sl@0
  6970
	TestHiddenChangeEvents2aL(*client);
sl@0
  6971
	TestHiddenChangeEvents3L(*client);
sl@0
  6972
	TestHiddenChangeEvents3aL(*client);
sl@0
  6973
	TestHiddenChangeEvents4L(*client);
sl@0
  6974
	TestHiddenChangeEvents4aL(*client);
sl@0
  6975
	TestHiddenChangeEvents5L(*client);
sl@0
  6976
	TestHiddenChangeEvents5aL(*client);
sl@0
  6977
	TestHiddenChangeEvents6L(*client);
sl@0
  6978
	TestHiddenChangeEvents6aL(*client);
sl@0
  6979
	TestHiddenChangeEvents7L(*client);
sl@0
  6980
	TestHiddenChangeEvents7aL(*client);
sl@0
  6981
	theLog.Write(_L8("Test 18 OK\n"));
sl@0
  6982
sl@0
  6983
	TheTest.Next(_L("Changing events and recent views"));
sl@0
  6984
	TestChangeEventRecentView1L(*client);
sl@0
  6985
	TestChangeEventRecentView2L(*client);
sl@0
  6986
	TestChangeEventRecentViewAndPurgeL(*client);
sl@0
  6987
	TestChangeEventRecentViewRemoveL(*client);
sl@0
  6988
	theLog.Write(_L8("Test 19 OK\n"));
sl@0
  6989
sl@0
  6990
	TheTest.Next(_L("Test for DEF066296"));
sl@0
  6991
	DEF066296L(*client);
sl@0
  6992
	TheTest.Next(_L("Test for DEF087459"));
sl@0
  6993
	DEF087459L(*client);
sl@0
  6994
	theLog.Write(_L8("Test 20 OK\n"));
sl@0
  6995
sl@0
  6996
	TheTest.Next(_L("Event View With Filter List containing StartTime and EndTime"));
sl@0
  6997
	TestEventViewWithTimestampsInFilterListL(*client);
sl@0
  6998
	theLog.Write(_L8("Test 21 OK\n"));
sl@0
  6999
		
sl@0
  7000
	TheTest.Next(_L("Test for DEF108741 - View change observer, error condition"));
sl@0
  7001
	DEF108741L(*client);
sl@0
  7002
	theLog.Write(_L8("Test 22 OK\n"));
sl@0
  7003
	
sl@0
  7004
	TheTest.Next(_L("Test Defect INC108225: Call history check for the CS & PS(VOIP) calls "));
sl@0
  7005
	TestNumberFieldINC108225L(*client);
sl@0
  7006
	TestOtherFieldsINC108225L(*client);
sl@0
  7007
	theLog.Write(_L8("Test 23 OK\n"));
sl@0
  7008
sl@0
  7009
	TheTest.Next(_L("Test Defect DEF144552: CLogFilter doesn't work when Starttime is the same as EndTime"));
sl@0
  7010
	DEF144552L(*client);
sl@0
  7011
	theLog.Write(_L8("Test 24 OK\n"));
sl@0
  7012
	
sl@0
  7013
	CleanupStack::PopAndDestroy(2); // client, notifier
sl@0
  7014
	}