450 @SYMTestExpectedResults The test must not fail or panic . |
460 @SYMTestExpectedResults The test must not fail or panic . |
451 @SYMDEF DEF092140, DEF092139 |
461 @SYMDEF DEF092140, DEF092139 |
452 */ |
462 */ |
453 void RunEnglishArabicJapaneseBenchmarksL(TFormattingObjects& aFormattingObjects) |
463 void RunEnglishArabicJapaneseBenchmarksL(TFormattingObjects& aFormattingObjects) |
454 { |
464 { |
455 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1898 ")); |
465 TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1898 ")); |
456 SetTextL(*aFormattingObjects.iRichText, KEnglish, KEnglishRepeats, KEnglishRepeats); |
466 SetTextL(*aFormattingObjects.iRichText, KEnglish, KEnglishRepeats, KEnglishRepeats); |
457 TTimeIntervalMicroSeconds opening = MeasureOpeningL(*aFormattingObjects.iView); |
467 TTimeIntervalMicroSeconds opening = MeasureOpeningL(*aFormattingObjects.iView); |
458 TTimeIntervalMicroSeconds rmsCursorDown = MeasureRmsCursorDownL(*aFormattingObjects.iView); |
468 TTimeIntervalMicroSeconds rmsCursorDown = MeasureRmsCursorDownL(*aFormattingObjects.iView); |
459 TTimeIntervalMicroSeconds englishFormatting = MeasureFormattingL(*aFormattingObjects.iView); |
469 TTimeIntervalMicroSeconds englishFormatting = MeasureFormattingL(*aFormattingObjects.iView); |
460 TInt englishLines = NumberOfLines(*aFormattingObjects.iLayout); |
470 TInt englishLines = NumberOfLines(*aFormattingObjects.iLayout); |
482 minLines = japaneseLines; |
492 minLines = japaneseLines; |
483 else if (maxLines < japaneseLines) |
493 else if (maxLines < japaneseLines) |
484 maxLines = japaneseLines; |
494 maxLines = japaneseLines; |
485 |
495 |
486 //Tests that the number of lines in each test is more or less balanced |
496 //Tests that the number of lines in each test is more or less balanced |
487 test(maxLines * 100 <= minLines * 105); |
497 TESTPOINT(maxLines * 100 <= minLines * 105); |
488 |
498 |
489 RDebug::Printf("PERFORMANCE: Syslibs;Form_OpeningLargeParagraph;microseconds: %d", |
499 TBuf<256> buf; |
|
500 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_OpeningLargeParagraph;microseconds: %d"), |
490 static_cast<TInt>(opening.Int64())); |
501 static_cast<TInt>(opening.Int64())); |
491 RDebug::Printf("PERFORMANCE: Syslibs;Form_RmsCursorDown;microseconds: %d", |
502 TESTPRINT(buf); |
|
503 buf.Zero(); |
|
504 |
|
505 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_RmsCursorDown;microseconds: %d"), |
492 static_cast<TInt>(rmsCursorDown.Int64())); |
506 static_cast<TInt>(rmsCursorDown.Int64())); |
493 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormattingEnglish;microseconds: %d", |
507 TESTPRINT(buf); |
|
508 buf.Zero(); |
|
509 |
|
510 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingEnglish;microseconds: %d"), |
494 static_cast<TInt>(englishFormatting.Int64())); |
511 static_cast<TInt>(englishFormatting.Int64())); |
495 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormattingArabic;microseconds: %d", |
512 TESTPRINT(buf); |
|
513 buf.Zero(); |
|
514 |
|
515 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingArabic;microseconds: %d"), |
496 static_cast<TInt>(arabicFormatting.Int64())); |
516 static_cast<TInt>(arabicFormatting.Int64())); |
497 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormattingJapanese;microseconds: %d", |
517 TESTPRINT(buf); |
|
518 buf.Zero(); |
|
519 |
|
520 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingJapanese;microseconds: %d"), |
498 static_cast<TInt>(japaneseFormatting.Int64())); |
521 static_cast<TInt>(japaneseFormatting.Int64())); |
|
522 TESTPRINT(buf); |
499 } |
523 } |
500 |
524 |
501 /** |
525 /** |
502 @SYMTestCaseID SYSLIB-FORMA-UT-1896 |
526 @SYMTestCaseID SYSLIB-FORMA-UT-1896 |
503 @SYMTestCaseDesc Benchmarks inserting text from the beginning of a paragraph |
527 @SYMTestCaseDesc Benchmarks inserting text from the beginning of a paragraph |
508 @SYMDEF DEF092140, DEF092139 |
532 @SYMDEF DEF092140, DEF092139 |
509 */ |
533 */ |
510 void RunInsertTextTestsL(TInt aRepeats, TInt aRepeatsPerParagraph, |
534 void RunInsertTextTestsL(TInt aRepeats, TInt aRepeatsPerParagraph, |
511 RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo) |
535 RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo) |
512 { |
536 { |
513 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1896 ")); |
537 TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1896 ")); |
514 TFormattingObjects o; |
538 TFormattingObjects o; |
515 CreateFormattingObjectsLC(o); |
539 CreateFormattingObjectsLC(o); |
516 TInt64 slowest = 0; |
540 TInt64 slowest = 0; |
517 o.iLayout->SetWrapWidth(KInsertDisplayWidth); |
541 o.iLayout->SetWrapWidth(KInsertDisplayWidth); |
518 o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand); |
542 o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand); |
519 MeasureInsertTextAtStartL(aRepeats, aRepeatsPerParagraph, aTimeStamps, o, slowest); |
543 MeasureInsertTextAtStartL(aRepeats, aRepeatsPerParagraph, aTimeStamps, o, slowest); |
520 aDocInfo = GetSampleDocInfoL(o); |
544 aDocInfo = GetSampleDocInfoL(o); |
521 |
545 |
522 RDebug::Printf("PERFORMANCE: Syslibs;Form_InsertText_Slowest;microseconds: %Ld", slowest); |
546 TBuf<256> buf; |
523 |
547 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_InsertText_Slowest;microseconds: %Ld"), slowest); |
|
548 TESTPRINT(buf); |
|
549 |
524 DestroyFormattingObjects(o); |
550 DestroyFormattingObjects(o); |
525 } |
551 } |
526 |
552 |
527 /** |
553 /** |
528 @SYMTestCaseID SYSLIB-FORMA-UT-1895 |
554 @SYMTestCaseID SYSLIB-FORMA-UT-1895 |
547 TTimeIntervalMicroSeconds opening = MeasureOpeningL(*o.iView); |
573 TTimeIntervalMicroSeconds opening = MeasureOpeningL(*o.iView); |
548 |
574 |
549 MeasureDeleteTextFromStartL(aTimeStamps, o, slowest); |
575 MeasureDeleteTextFromStartL(aTimeStamps, o, slowest); |
550 aDocInfo = GetSampleDocInfoL(o); |
576 aDocInfo = GetSampleDocInfoL(o); |
551 |
577 |
552 RDebug::Printf("PERFORMANCE: Syslibs;Form_DeleteText_Slowest;microseconds: %Ld", slowest); |
578 TBuf<256> buf; |
|
579 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_DeleteText_Slowest;microseconds: %Ld"), slowest); |
|
580 TESTPRINT(buf); |
553 |
581 |
554 CleanupStack::PopAndDestroy();//bigbuf |
582 CleanupStack::PopAndDestroy();//bigbuf |
555 DestroyFormattingObjects(o); |
583 DestroyFormattingObjects(o); |
556 } |
584 } |
557 |
585 |
558 void GetFormattingBenchmarkL(TInt aNumberOfIterations, TInt& aNumberOfCharacters, TInt64& aNormalisedBenchmark) |
586 void GetFormattingBenchmarkL(TInt aNumberOfIterations, TInt& aNumberOfCharacters, TInt64& aNormalisedBenchmark) |
559 { |
587 { |
560 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 ")); |
588 TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 ")); |
561 TFormattingObjects o; |
589 TFormattingObjects o; |
562 CreateFormattingObjectsLC(o); |
590 CreateFormattingObjectsLC(o); |
563 o.iLayout->SetWrapWidth(KInsertDisplayWidth); |
591 o.iLayout->SetWrapWidth(KInsertDisplayWidth); |
564 o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand); |
592 o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand); |
565 |
593 |
594 roughly linear with the document size. |
622 roughly linear with the document size. |
595 @SYMDEF DEF095401 |
623 @SYMDEF DEF095401 |
596 */ |
624 */ |
597 void RunFormattingBenchmarksL() |
625 void RunFormattingBenchmarksL() |
598 { |
626 { |
599 test.Next(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1894 ")); |
627 TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1894 ")); |
600 TInt numberOfCharacters = 0; |
628 TInt numberOfCharacters = 0; |
601 TInt numberOfIterations; |
629 TInt numberOfIterations; |
602 TInt64 normalisedBenchmark = 0; |
630 TInt64 normalisedBenchmark = 0; |
603 |
631 |
|
632 TBuf<256> buf; |
|
633 |
604 numberOfIterations = 1; |
634 numberOfIterations = 1; |
605 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
635 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
606 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
636 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
607 |
637 TESTPRINT(buf); |
|
638 |
|
639 buf.Zero(); |
608 numberOfIterations = 5; |
640 numberOfIterations = 5; |
609 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
641 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
610 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
642 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
611 |
643 TESTPRINT(buf); |
|
644 |
|
645 buf.Zero(); |
612 numberOfIterations = 10; |
646 numberOfIterations = 10; |
613 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
647 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
614 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
648 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
615 |
649 TESTPRINT(buf); |
|
650 |
|
651 buf.Zero(); |
616 numberOfIterations = 50; |
652 numberOfIterations = 50; |
617 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
653 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
618 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
654 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
619 |
655 TESTPRINT(buf); |
|
656 |
|
657 buf.Zero(); |
620 numberOfIterations = 100; |
658 numberOfIterations = 100; |
621 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
659 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
622 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
660 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
623 |
661 TESTPRINT(buf); |
|
662 |
|
663 buf.Zero(); |
624 numberOfIterations = 250; |
664 numberOfIterations = 250; |
625 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
665 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
626 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
666 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
627 |
667 TESTPRINT(buf); |
|
668 |
|
669 buf.Zero(); |
628 numberOfIterations = 500; |
670 numberOfIterations = 500; |
629 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
671 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
630 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
672 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
631 |
673 TESTPRINT(buf); |
|
674 |
|
675 buf.Zero(); |
632 numberOfIterations = 750; |
676 numberOfIterations = 750; |
633 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
677 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
634 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
678 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
635 |
679 TESTPRINT(buf); |
|
680 |
|
681 buf.Zero(); |
636 numberOfIterations = 1000; |
682 numberOfIterations = 1000; |
637 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
683 GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark); |
638 RDebug::Printf("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration", numberOfCharacters, normalisedBenchmark); |
684 buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark); |
|
685 TESTPRINT(buf); |
639 } |
686 } |
640 |
687 |
641 void RunBenchmarksL() |
688 void RunBenchmarksL() |
642 { |
689 { |
643 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
690 CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
683 CleanupStack::PopAndDestroy(2); |
730 CleanupStack::PopAndDestroy(2); |
684 CleanupStack::PopAndDestroy(scheduler); |
731 CleanupStack::PopAndDestroy(scheduler); |
685 |
732 |
686 } |
733 } |
687 |
734 |
688 TInt E32Main() |
735 TVerdict CTFormBenchmarkStep::doTestStepL() |
689 { |
736 { |
690 test.Title(); |
737 SetTestStepResult(EPass); |
691 test.Start(_L("Start Font/Bitmap Server")); |
738 TestStep = this; |
692 static CTrapCleanup* TrapCleanup = CTrapCleanup::New(); |
739 |
|
740 TESTPRINT(KFormBenchmark); |
|
741 TESTPRINT(_L("Start Font/Bitmap Server")); |
|
742 |
693 TInt error = RFbsSession::Connect(); |
743 TInt error = RFbsSession::Connect(); |
694 if (error == KErrNotFound) |
744 if (error == KErrNotFound) |
695 { |
745 { |
696 FbsStartup(); |
746 FbsStartup(); |
697 error = RFbsSession::Connect(); |
747 error = RFbsSession::Connect(); |
698 } |
748 } |
699 // Tests that FBServ actually starts |
749 // Tests that FBServ actually starts |
700 test(error == KErrNone); |
750 TESTPOINT(error == KErrNone); |
701 error = fs.Connect(); |
751 error = fs.Connect(); |
702 test(error == KErrNone); |
752 TESTPOINT(error == KErrNone); |
703 |
753 |
704 error = fileTimeStamps.Replace(fs, KLogTimeStampsName, EFileWrite); |
754 error = fileTimeStamps.Replace(fs, KLogTimeStampsName, EFileWrite); |
705 RDebug::Printf("> fileTimeStamps.Replace %d", error); |
755 |
706 test(error == KErrNone); |
756 TBuf<256> buf; |
707 |
757 buf.AppendFormat(_L("> fileTimeStamps.Replace %d"), error); |
708 test.Next(_L("Run Benchmarks")); |
758 TESTPRINT(buf); |
|
759 |
|
760 TESTPOINT(error == KErrNone); |
|
761 |
|
762 TESTPRINT(_L("Run Benchmarks")); |
709 TRAP(error, RunBenchmarksL()); |
763 TRAP(error, RunBenchmarksL()); |
710 // Tests that the Benchmarks did not run out of memory |
764 // Tests that the Benchmarks did not run out of memory |
711 // or otherwise leave |
765 // or otherwise leave |
712 test(error == KErrNone); |
766 TESTPOINT(error == KErrNone); |
713 |
767 |
714 fileTimeStamps.Close(); |
768 fileTimeStamps.Close(); |
715 fs.Close(); |
769 fs.Close(); |
716 RFbsSession::Disconnect(); |
770 RFbsSession::Disconnect(); |
717 delete TrapCleanup; |
771 |
718 test.End(); |
772 return TestStepResult(); |
719 test.Close(); |
773 } |
720 return error; |
774 |
721 } |
|
722 |
|