/** @SYMTestCaseID SYSLIB-FORMA-UT-1899 @SYMTestCaseDesc This function runs the scrolling tests. It sets up the documents then calls the ScrollTestL function to scroll through them. @SYMTestPriority High @SYMTestActions The following paragraphs are tested by scrolling up and down through them: A LTR paragraph containing a few lines of RTL text A LTR paragraph containing less than a line of RTL text A LTR paragraph containing a portion of RTL text which is greater than the band A RTL paragraph containing a few lines of LTR text A RTL paragraph containing less than a line of LTR text A RTL paragraph containing a portion of LTR text which is greater than the band @SYMTestExpectedResults The test must not fail or panic . @SYMDEF DEF092140, DEF092139 */ void RunScrollingTestsL(CRichText& aRichText, CBandMaintainer& aMaintainer, CBandValidator& aValidator) { // set up 3 paragraphs of LTR with runs of RTL embedded in each paragraph aRichText.Reset(); test.Start(_L("Scrolling LTR document with embedded RTL")); aMaintainer.InitialiseViewL(); //LTR paragraph containing a few lines of RTL text aRichText.InsertL(aRichText.DocumentLength(), KLTRWithRTL); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); //LTR paragraph containing less than a line of RTL text aRichText.InsertL(aRichText.DocumentLength(), KLTRWithSmallRTL); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); //LTR paragraph containing a portion of RTL text which is greater than the band aRichText.InsertL(aRichText.DocumentLength(), KLTRWithLargeRTL); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); ScrollingTestL(aMaintainer, aValidator); // 3 paragraphs of RTL with runs of LTR embedded in each paragraph aRichText.Reset(); test.Next(_L("Scrolling RTL document with embedded LTR")); aMaintainer.InitialiseViewL(); //RTL paragraph containing a few lines of LTR text aRichText.InsertL(aRichText.DocumentLength(), KRTLWithLTR); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); //RTL paragraph containing less than a line of LTR text aRichText.InsertL(aRichText.DocumentLength(), KRTLWithSmallLTR); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); //RTL paragraph containing a portion of LTR text which is greater than the band aRichText.InsertL(aRichText.DocumentLength(), KRTLWithLargeLTR); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); ScrollingTestL(aMaintainer, aValidator); test.End(); }
LOCAL_C TBool TestGetBodyTextL() { __UHEAP_MARK; // Retrieve the store from the current context... CMsvStore* store = pContext->EditStoreL(); CleanupStack::PushL(store); // Populate CMsvBodyText from the data in the store... CMsvBodyText* obj = CMsvBodyText::NewLC(); obj->RestoreL(*store); // Create a rich text object... CParaFormatLayer* paraLayer = CParaFormatLayer::NewL(); CleanupStack::PushL(paraLayer); CCharFormatLayer* charLayer = CCharFormatLayer::NewL(); CleanupStack::PushL(charLayer); CRichText* richText = CRichText::NewL(paraLayer, charLayer); CleanupStack::PushL(richText); // Create an array of available character sets... CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* charSets; CCnvCharacterSetConverter* converter = CCnvCharacterSetConverter::NewL(); CleanupStack::PushL(converter); charSets = converter->CreateArrayOfCharacterSetsAvailableLC(gFs); // For each available character set, call GetBodyTextL... TInt i; for (i = 0; i < charSets->Count(); i++) { // Over-ride the stored character set. obj->SetCharacterSet((*charSets)[i].Identifier()); // Convert the 8 bit data to the specified character set. obj->GetBodyTextL(gFs, *store, *richText); test(richText->HasChanged()); richText->Reset(); } // Instead of decoding 10 bytes of data, increase the amount of data to 4000 bytes. obj->SetCharacterSet(0); obj->SetDefaultCharacterSet((*charSets)[0].Identifier()); const TInt KTextBufferSize=4000; CBufBase *buffer=CBufFlat::NewL(KTextBufferSize); CleanupStack::PushL(buffer); while(buffer->Size()<KTextBufferSize) { buffer->InsertL(buffer->Size(),K10BytesData); } obj->StoreL(*store, *buffer); CleanupStack::PopAndDestroy(buffer); store->CommitL(); obj->RestoreL(*store); obj->GetBodyTextL(gFs, *store, *richText); test(richText->HasChanged()); // Clean up and release resources... CleanupStack::PopAndDestroy(charSets); CleanupStack::PopAndDestroy(converter); CleanupStack::PopAndDestroy(richText); CleanupStack::PopAndDestroy(charLayer); CleanupStack::PopAndDestroy(paraLayer); CleanupStack::PopAndDestroy(obj); CleanupStack::PopAndDestroy(store); __UHEAP_MARKEND; return ETrue; }
/** @SYMTestCaseID SYSLIB-FORMA-UT-1900 @SYMTestCaseDesc This function will run tests to check if the bidirectional state is being maintained correctly. Documents containing a mix of different directionality are created and specific edits which are of interest for each document are performed. These edits are location specific and will depend on the bidirectional state of surrounding text. @SYMTestPriority High @SYMTestActions Edits are performed: changing the base directionality of a paragraph changing the directionality of text above the edit position changing the directionality of neutral characters before and after edit position changing the directionality of mirrored characters such as parenthesis changing text directinality by adding explicit embedding @SYMTestExpectedResults The test must not fail or panic . @SYMDEF DEF092140, DEF092139 */ void RunBidirectionalTestL(CRichText& aRichText, CBandMaintainer& aMaintainer, CBandValidator& aValidator) { aRichText.Reset(); aMaintainer.InitialiseViewL(); //set up paragraph of just LTR text aRichText.InsertL(0, KBleak2); aMaintainer.InitialiseViewL(); User::After(3000000); //change paragraph base directionality by inserting a RLM marker at the beginning of the paragraph TInsertText insertRLM(aMaintainer, aRichText, aValidator, KRLM()); insertRLM.ExecuteL(0, 1); User::After(3000000); aRichText.Reset(); aMaintainer.InitialiseViewL(); //set up paragraph of LLL-RRR-LLL-NNN-RRR-LLL aRichText.InsertL(0, KEnglishLongWords_1); aRichText.InsertL(aRichText.DocumentLength(), KArabicLessThanALine); aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_1); aRichText.InsertL(aRichText.DocumentLength(), KPuncs); aRichText.InsertL(aRichText.DocumentLength(), KArabicLessThanALine); aRichText.InsertL(aRichText.DocumentLength(), KBleak2); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); aMaintainer.InitialiseViewL(); User::After(1000000); //delete the second run of LTR changing the directionality of the neutrals TDeleteText deleteText(aMaintainer, aRichText, aValidator); TInt editPos = KEnglishLongWords_1().Length()+KArabicLessThanALine().Length(); deleteText.ExecuteL(editPos,KEnglishLessThanALine_1().Length()); User::After(1000000); //delete the second run of RTL characters to check if neutral directionality is maintained editPos = KEnglishLongWords_1().Length()+KArabicLessThanALine().Length()+KPuncs().Length(); deleteText.ExecuteL(editPos,KArabicLessThanALine().Length()); User::After(1000000); aRichText.Reset(); aMaintainer.InitialiseViewL(); //set up band to be a paragraph of numbers followed by LTR i.e. EN-EN-EN-LLL aRichText.InsertL(aRichText.DocumentLength(), KNumbers); aRichText.InsertL(aRichText.DocumentLength(), KBleak2); aMaintainer.InitialiseViewL(); User::After(3000000); //edit to change directionality of numbers above the edit by inserting RTL text before the LTR //This RLM works perfectly TInsertText insertArabic(aMaintainer, aRichText, aValidator, KArabicMoreThanALine()); insertArabic.ExecuteL(KNumbers().Length(), KArabicMoreThanALine().Length()); User::After(3000000); //undo previous edit text will return to previous directionality deleteText.ExecuteL(KNumbers().Length(),KArabicMoreThanALine().Length()); User::After(10000000); aRichText.Reset(); aMaintainer.InitialiseViewL(); // Document containing RRRRR ( LLLL ) LLLL aRichText.InsertL(0, KArabicMoreThanALine); aRichText.InsertL(aRichText.DocumentLength(), KOpenBracket); aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_1); aRichText.InsertL(aRichText.DocumentLength(), KCloseBracket); aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_2); aRichText.InsertL(aRichText.DocumentLength(), KOpenBracket); aRichText.InsertL(aRichText.DocumentLength(), KEnglishLessThanALine_4); aRichText.InsertL(aRichText.DocumentLength(), KCloseBracket); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); aMaintainer.InitialiseViewL(); // Insert LTR after RTL test Doc should now be RRRR LLLL ( LLLL ) LLLL TInsertText insertEnglish(aMaintainer, aRichText, aValidator, KEnglishLessThanALine_3()); insertEnglish.ExecuteL(KArabicMoreThanALine().Length(), KEnglishLessThanALine_3().Length()); // The brackets are now being displayed correctly // BUT is the neutral English text meant to be displayed as RTL as initially inserted (no RLM)?? User::After(10000000); aRichText.Reset(); aMaintainer.InitialiseViewL(); // Just an arabic RTL sentence. aRichText.InsertL(0, KArabicMoreThanALine); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); aMaintainer.InitialiseViewL(); // Test formatting when inserting RTL enclosed in parenthesis TInsertText insertArabBrackets(aMaintainer, aRichText, aValidator, KArabicInParenthesis()); insertArabBrackets.ExecuteL(KArabicMoreThanALine().Length(), KArabicInParenthesis().Length()); User::After(1000000); aRichText.Reset(); aMaintainer.InitialiseViewL(); // Just an arabic RTL sentence. aRichText.InsertL(0, KArabicMoreThanALine); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); aMaintainer.InitialiseViewL(); // Test formatting when inserting open parenthesis TInsertText insertOpen(aMaintainer, aRichText, aValidator, KOpenBracket()); insertOpen.ExecuteL(KArabicMoreThanALine().Length(), KOpenBracket().Length()); User::After(1000000); // Test formatting when inserting RTL after opening parenthesis TInsertText insertArabicLessLine(aMaintainer, aRichText, aValidator, KArabicLessThanALine()); insertArabicLessLine.ExecuteL(aRichText.DocumentLength()-1, KArabicLessThanALine().Length()); User::After(1000000); // Test formatting when inserting closing parenthesis after RTL text TInsertText insertClose(aMaintainer, aRichText, aValidator, KCloseBracket()); insertClose.ExecuteL(aRichText.DocumentLength()-1, KOpenBracket().Length()); // This is now being displayed correctly User::After(10000000); // Insert RTL text after parenthesis insertArabicLessLine.ExecuteL(aRichText.DocumentLength()-1, KArabicLessThanALine().Length()); // This is now being displayed correctly User::After(10000000); aRichText.Reset(); aMaintainer.InitialiseViewL(); //Explicit Embedding testing aRichText.InsertL(0, KEnglishShortParagraph); aRichText.InsertL(aRichText.DocumentLength(), KRLE); aRichText.InsertL(aRichText.DocumentLength(), KFirstWordArabic); aRichText.InsertL(aRichText.DocumentLength(), KFirstWord); aRichText.InsertL(aRichText.DocumentLength(), KSecondWordArabic); aRichText.InsertL(aRichText.DocumentLength(), KSecondWord); aRichText.InsertL(aRichText.DocumentLength(), KThirdWordArabic); aRichText.InsertL(aRichText.DocumentLength(), KPDF); aRichText.InsertL(aRichText.DocumentLength(), KEnglishMoreThanALine_1); aRichText.InsertL(aRichText.DocumentLength(), KParagraphDelimiter); aMaintainer.InitialiseViewL(); User::After(1000000); editPos=KEnglishShortParagraph().Length()+1; // TInsertText insertText2(aMaintainer, aRichText, aValidator, KEnglishLessThanALine_1()); insertEnglish.ExecuteL(editPos,KEnglishLessThanALine_3().Length()); User::After(1000000); }