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