equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <e32std.h> |
19 #include <e32std.h> |
20 #include <e32base.h> |
20 #include <e32base.h> |
|
21 #include <e32test.h> |
21 #include <e32svr.h> |
22 #include <e32svr.h> |
22 |
23 |
23 #include <txtetext.h> |
24 #include <txtetext.h> |
24 #include <txtfrmat.h> |
25 #include <txtfrmat.h> |
25 #include <txtfmlyr.h> |
26 #include <txtfmlyr.h> |
26 #include <txtrich.h> |
27 #include <txtrich.h> |
27 #include <txtglobl.h> |
28 #include <txtglobl.h> |
28 #include <gdi.h> |
29 #include <gdi.h> |
29 #include <s32mem.h> |
30 #include <s32mem.h> |
30 #include <charconv.h> |
31 #include <charconv.h> |
31 #include "T_IMPORT.h" |
|
32 |
|
33 LOCAL_D CTestStep *pTestStep = NULL; |
|
34 #define test(cond) \ |
|
35 { \ |
|
36 TBool __bb = (cond); \ |
|
37 pTestStep->TEST(__bb); \ |
|
38 if (!__bb) \ |
|
39 { \ |
|
40 pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed")); \ |
|
41 User::Leave(1); \ |
|
42 } \ |
|
43 } |
|
44 #undef INFO_PRINTF1 |
|
45 #undef INFO_PRINTF2 |
|
46 // copy from tefexportconst.h |
|
47 #define INFO_PRINTF1(p1) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1)) |
|
48 #define INFO_PRINTF2(p1, p2) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2)) |
|
49 |
32 |
50 /* this fixes a MSVC link warning */ |
33 /* this fixes a MSVC link warning */ |
51 #ifdef __VC32__ |
34 #ifdef __VC32__ |
52 #pragma comment (linker, "/opt:noref") |
35 #pragma comment (linker, "/opt:noref") |
53 #endif |
36 #endif |
57 const TInt KTestCleanupStack=0x40; |
40 const TInt KTestCleanupStack=0x40; |
58 |
41 |
59 _LIT(KTestFileName1, "c:\\etext\\climb.txg"); |
42 _LIT(KTestFileName1, "c:\\etext\\climb.txg"); |
60 _LIT(KTestFileName2, "c:\\etext\\import1.txg"); |
43 _LIT(KTestFileName2, "c:\\etext\\import1.txg"); |
61 |
44 |
62 LOCAL_D void EnsureFileExists(const TDesC& aName) |
45 void EnsureFileExists(const TDesC& aName) |
63 { |
46 { |
64 RFs fs; |
47 RFs fs; |
65 fs.Connect(); |
48 fs.Connect(); |
66 fs.MkDirAll(aName); |
49 fs.MkDirAll(aName); |
67 RFile file; |
50 RFile file; |
68 file.Create(fs, aName, EFileRead|EFileWrite); |
51 file.Create(fs, aName, EFileRead|EFileWrite); |
69 file.Close(); |
52 file.Close(); |
70 fs.Close(); |
53 fs.Close(); |
71 } |
54 } |
72 |
55 |
|
56 LOCAL_D RTest test(_L("Plain Text File Imports")); |
73 LOCAL_D CTrapCleanup* TheTrapCleanup=NULL; |
57 LOCAL_D CTrapCleanup* TheTrapCleanup=NULL; |
74 LOCAL_D CPlainText* TheText=NULL; |
58 LOCAL_D CPlainText* TheText=NULL; |
75 LOCAL_D CRichText* richText=NULL; |
59 LOCAL_D CRichText* richText=NULL; |
76 LOCAL_D CParaFormatLayer* TheGlobalParaLayer=NULL; |
60 LOCAL_D CParaFormatLayer* TheGlobalParaLayer=NULL; |
77 LOCAL_D CCharFormatLayer* TheGlobalCharLayer=NULL; |
61 LOCAL_D CCharFormatLayer* TheGlobalCharLayer=NULL; |
323 TPtrC p2 = plain2->Read(pos); |
307 TPtrC p2 = plain2->Read(pos); |
324 test(p1 == p2); |
308 test(p1 == p2); |
325 pos += p1.Length(); |
309 pos += p1.Length(); |
326 } while (pos < length1); |
310 } while (pos < length1); |
327 |
311 |
328 INFO_PRINTF1(_L("DEF058651 - Propagated:NTT - Received MMS with line break CR set does not cause line feed.")); |
312 test.Next(_L("DEF058651 - Propagated:NTT - Received MMS with line break CR set does not cause line feed.")); |
329 buffer->Reset(); |
313 buffer->Reset(); |
330 plain1->Reset(); |
314 plain1->Reset(); |
331 |
315 |
332 TBuf8<100> testString(_L8("This Is Test Message")); |
316 TBuf8<100> testString(_L8("This Is Test Message")); |
333 testString[4] = 0x0D; |
317 testString[4] = 0x0D; |
348 |
332 |
349 LOCAL_C void DoTestL() |
333 LOCAL_C void DoTestL() |
350 // Main routine |
334 // Main routine |
351 // |
335 // |
352 { |
336 { |
353 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-T_IMPORT-0001 CPlainText ")); |
337 test.Start(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-T_IMPORT-0001 CPlainText ")); |
354 CreateTextL(); |
338 CreateTextL(); |
355 |
339 |
356 ImportText1(); |
340 ImportText1(); |
357 ImportText2(); |
341 ImportText2(); |
358 |
342 |
359 TestUnicodeCompressionL(); |
343 TestUnicodeCompressionL(); |
360 TestEncodingConversionL(); |
344 TestEncodingConversionL(); |
361 |
345 |
362 INFO_PRINTF1(_L("CRichText")); |
346 test.Next(_L("CRichText")); |
363 delete TheText; |
347 delete TheText; |
364 TheText=richText; |
348 TheText=richText; |
365 |
349 |
366 ImportText1(); |
350 ImportText1(); |
367 ImportText2(); |
351 ImportText2(); |
368 |
352 |
369 INFO_PRINTF1(_L("CRichText - more than 256 styles, defect INC044582")); |
353 test.Next(_L("CRichText - more than 256 styles, defect INC044582")); |
370 TestInc044582(); |
354 TestInc044582(); |
371 |
355 |
372 DestroyText(); |
356 DestroyText(); |
373 } |
357 } |
374 |
358 |
416 { |
400 { |
417 RDebug::Print(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName); |
401 RDebug::Print(_L("Error %d connecting file session. File: %S.\n"), err, &aFullName); |
418 } |
402 } |
419 } |
403 } |
420 |
404 |
421 CT_IMPORT::CT_IMPORT() |
405 GLDEF_C TInt E32Main() |
|
406 // |
|
407 // Test the streaming framework. |
|
408 // |
422 { |
409 { |
423 SetTestStepName(KTestStep_T_IMPORT); |
410 |
424 pTestStep = this; |
411 test.Title(); |
|
412 __UHEAP_MARK; |
|
413 setupCleanup(); |
|
414 TRAPD(r, DoTestL()); |
|
415 |
|
416 test(r == KErrNone); |
|
417 |
|
418 ::DeleteDataFile(KTestFileName1); //deletion of data files must be before call to End() - DEF047652 |
|
419 ::DeleteDataFile(KTestFileName2); |
|
420 |
|
421 test.End(); |
|
422 |
|
423 delete TheTrapCleanup; |
|
424 |
|
425 __UHEAP_MARKEND; |
|
426 |
|
427 test.Close(); |
|
428 |
|
429 return 0; |
425 } |
430 } |
426 |
|
427 TVerdict CT_IMPORT::doTestStepL() |
|
428 { |
|
429 SetTestStepResult(EFail); |
|
430 |
|
431 INFO_PRINTF1(_L("Plain Text File Imports")); |
|
432 __UHEAP_MARK; |
|
433 setupCleanup(); |
|
434 TRAPD(r, DoTestL()); |
|
435 |
|
436 ::DeleteDataFile(KTestFileName1); //deletion of data files must be before call to End() - DEF047652 |
|
437 ::DeleteDataFile(KTestFileName2); |
|
438 |
|
439 delete TheTrapCleanup; |
|
440 |
|
441 __UHEAP_MARKEND; |
|
442 |
|
443 if (r == KErrNone) |
|
444 { |
|
445 SetTestStepResult(EPass); |
|
446 } |
|
447 |
|
448 return TestStepResult(); |
|
449 } |
|