10 // |
10 // |
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 // If this test starts failing, then go and check the CentralRepository private data cage |
|
16 // (c:\\private\\10202be9 or z:\\private\\10202be9) if 101f401d.txt file is there. |
|
17 // If it is then delete it and try the test again. |
|
18 // (The problem is that if there is an existing 101f401d.txt file, then the contact match count value |
|
19 // will be loaded from that file, not from the LogEng resource file) |
|
20 // |
|
21 |
|
22 #include <bautils.h> |
|
23 #include <logserv.rsg> |
|
24 #include <barsc.h> |
|
25 #include "t_logutil2.h" |
15 #include "t_logutil2.h" |
|
16 #include "t_logutil3.h" |
26 #include "t_logcntmatchplugin.h" |
17 #include "t_logcntmatchplugin.h" |
27 |
18 |
28 RTest TheTest(_L("t_logcntmatch")); |
19 RTest TheTest(_L("t_logcntmatch")); |
29 |
20 |
30 TBool TheMatchingIsEnabled = EFalse; |
21 TBool TheMatchingIsEnabled = EFalse; |
32 //It gives an information what is the contact name format in the logs. |
23 //It gives an information what is the contact name format in the logs. |
33 TLogContactNameFormat TheContactNameFmt = ELogWesternFormat; |
24 TLogContactNameFormat TheContactNameFmt = ELogWesternFormat; |
34 |
25 |
35 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
26 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
36 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
27 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// |
37 |
|
38 //The function opens the LogEng server resource file (logserv.rsc) and gets the value of |
|
39 //R_LOG_CONTACT_NAME_FORMAT resource. This value will be retured as a result of the call. |
|
40 //It gives an information what is the contact name format in the logs. |
|
41 static TLogContactNameFormat GetContactNameFormatL() |
|
42 { |
|
43 // Get language of resource file |
|
44 _LIT(KLogResourceFile,"z:\\private\\101f401d\\logserv.rsc"); |
|
45 TFileName fileName(KLogResourceFile); |
|
46 BaflUtils::NearestLanguageFile(theFs, fileName); |
|
47 |
|
48 // Open resource file |
|
49 RResourceFile rscFile; |
|
50 CleanupClosePushL(rscFile); |
|
51 rscFile.OpenL(theFs, fileName); |
|
52 HBufC8* buf = rscFile.AllocReadLC(R_LOG_CONTACT_NAME_FORMAT); |
|
53 |
|
54 TResourceReader reader; |
|
55 reader.SetBuffer(buf); |
|
56 |
|
57 TLogContactNameFormat contactNameFmt = static_cast <TLogContactNameFormat> (reader.ReadInt16()); |
|
58 CleanupStack::PopAndDestroy(2, &rscFile); |
|
59 return contactNameFmt; |
|
60 } |
|
61 |
28 |
62 //This function checks the logged name is the same as the event name. |
29 //This function checks the logged name is the same as the event name. |
63 //Contact name logging format is taken into account. |
30 //Contact name logging format is taken into account. |
64 static void CheckContactName(CLogEvent& aEvent, const TDesC& aGivenName, const TDesC& aFamilyName) |
31 static void CheckContactName(CLogEvent& aEvent, const TDesC& aGivenName, const TDesC& aFamilyName) |
65 { |
32 { |
327 { |
294 { |
328 TheTest.Printf(_L("Contacts matching not enabled. Contacts matching tests NOT run\n")); |
295 TheTest.Printf(_L("Contacts matching not enabled. Contacts matching tests NOT run\n")); |
329 return; |
296 return; |
330 } |
297 } |
331 |
298 |
332 TheContactNameFmt = ::GetContactNameFormatL(); |
299 TInt contactMatchCount = 0; |
|
300 LogGetContactmatchCountAndNameFormatL(contactMatchCount, TheContactNameFmt); |
|
301 TheTest.Printf(_L("Contact match count = %d, TheContactNameFmt = %d\r\n"), contactMatchCount, (TInt)TheContactNameFmt); |
333 |
302 |
334 TestUtils::DeleteDatabaseL(); |
303 TestUtils::DeleteDatabaseL(); |
335 |
304 |
336 CLogClient* client = CLogClient::NewL(theFs); |
305 CLogClient* client = CLogClient::NewL(theFs); |
337 CleanupStack::PushL(client); |
306 CleanupStack::PushL(client); |
338 |
307 |
339 //All tests bellow are likely to fail if: |
308 //All tests bellow are likely to fail if |
340 // 1. 101f401d.txt file exists in CentralRepository private data cage and the contact mach count is set to 0 in that file. |
309 // 101f401d.txt file exists in CentralRepository private data cage and the contact mach count is set to 0 in that file. |
341 // 2. SYSLIB_TEST macro is not defined. |
|
342 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1392: DEF068087: Chinese names don't display in Chinese name format")); |
310 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1392: DEF068087: Chinese names don't display in Chinese name format")); |
343 ::DEF068087L(*client); |
311 ::DEF068087L(*client); |
344 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1016: Contacts matching - test1")); |
312 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1016: Contacts matching - test1")); |
345 TestContactMatch1L(*client); |
313 TestContactMatch1L(*client); |
346 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1017: Contacts matching - test2")); |
314 TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-1017: Contacts matching - test2")); |