+ visualToLogical06,
+ cachedBidiLine06
+ },
+ };
+ const unsigned int numberOfTests = 6u;
+
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !GetLogicalCharacterIndexTest( data[index] ) )
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliGetLogicalCursorIndex(void)
+{
+ tet_infoline(" UtcDaliGetLogicalCursorIndex");
+
+ const std::string fontFamily( "TizenSans" );
+ const std::string fontFamilyHebrew( "TizenSansHebrew" );
+
+
+
+ unsigned int visualIndex01[] = { 10u };
+ unsigned int characterIndex01[] = { 0u };
+ unsigned int logicalIndex01[] = { 10u };
+ unsigned int bidirectionalLineIndex01[] = { 0u };
+
+ // 0 11
+ // Hello world \n
+ // 12 16
+ // demo
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun02;
+ fontDescriptionRun02.characterRun.characterIndex = 0u;
+ fontDescriptionRun02.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun02.familyLength = fontFamily.size();
+ fontDescriptionRun02.familyName = new char[fontDescriptionRun02.familyLength];
+ memcpy( fontDescriptionRun02.familyName, fontFamily.c_str(), fontDescriptionRun02.familyLength );
+ fontDescriptionRun02.familyDefined = true;
+ fontDescriptionRun02.weightDefined = false;
+ fontDescriptionRun02.widthDefined = false;
+ fontDescriptionRun02.slantDefined = false;
+ fontDescriptionRun02.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns02;
+ fontDescriptionRuns02.PushBack( fontDescriptionRun02 );
+
+ unsigned int visualIndex02[] = { 0u, 16u, 11u, 12u };
+ unsigned int characterIndex02[] = { 0u, 0u, 0u, 0u };
+ unsigned int logicalIndex02[] = { 0u, 16u, 11u, 12u };
+ unsigned int bidirectionalLineIndex02[] = { 0u, 0u, 0u, 0u };
+
+// LO H e l l o _ w o r l d \n
+// 0 1 2 3 4 5 6 7 8 9 10 11 12
+// VO H e l l o _ w o r l d \n
+
+// LO ש ל ו ם _ ע ו ל ם \n
+// 12 13 14 15 16 17 18 19 20 21 22
+// VO \n ם ל ו ע _ ם ו ל ש
+
+// LO h e l l o _ w o r l d _ ש ל ו ם _ ע ו ל ם \n
+// 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
+// VO h e l l o _ w o r l d _ ם ל ו ע _ ם ו ל ש \n
+
+// LO ש ל ו ם _ ע ו ל ם _ h e l l o _ w o r l d \n
+// 44 45 46 47 48 49 50 51 52 52 54 55 56 57 58 59 60 61 62 63 64 65 66
+// VO \n h e l l o _ w o r l d _ ם ל ו ע _ ם ו ל ש
+
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0301;
+ fontDescriptionRun0301.characterRun.characterIndex = 0u;
+ fontDescriptionRun0301.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun0301.familyLength = fontFamily.size();
+ fontDescriptionRun0301.familyName = new char[fontDescriptionRun0301.familyLength];
+ memcpy( fontDescriptionRun0301.familyName, fontFamily.c_str(), fontDescriptionRun0301.familyLength );
+ fontDescriptionRun0301.familyDefined = true;
+ fontDescriptionRun0301.weightDefined = false;
+ fontDescriptionRun0301.widthDefined = false;
+ fontDescriptionRun0301.slantDefined = false;
+ fontDescriptionRun0301.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0302;
+ fontDescriptionRun0302.characterRun.characterIndex = 12u;
+ fontDescriptionRun0302.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun0302.familyLength = fontFamilyHebrew.size();
+ fontDescriptionRun0302.familyName = new char[fontDescriptionRun0302.familyLength];
+ memcpy( fontDescriptionRun0302.familyName, fontFamilyHebrew.c_str(), fontDescriptionRun0302.familyLength );
+ fontDescriptionRun0302.familyDefined = true;
+ fontDescriptionRun0302.weightDefined = false;
+ fontDescriptionRun0302.widthDefined = false;
+ fontDescriptionRun0302.slantDefined = false;
+ fontDescriptionRun0302.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0303;
+ fontDescriptionRun0303.characterRun.characterIndex = 22u;
+ fontDescriptionRun0303.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun0303.familyLength = fontFamily.size();
+ fontDescriptionRun0303.familyName = new char[fontDescriptionRun0303.familyLength];
+ memcpy( fontDescriptionRun0303.familyName, fontFamily.c_str(), fontDescriptionRun0303.familyLength );
+ fontDescriptionRun0303.familyDefined = true;
+ fontDescriptionRun0303.weightDefined = false;
+ fontDescriptionRun0303.widthDefined = false;
+ fontDescriptionRun0303.slantDefined = false;
+ fontDescriptionRun0303.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0304;
+ fontDescriptionRun0304.characterRun.characterIndex = 34u;
+ fontDescriptionRun0304.characterRun.numberOfCharacters = 20u;
+ fontDescriptionRun0304.familyLength = fontFamilyHebrew.size();
+ fontDescriptionRun0304.familyName = new char[fontDescriptionRun0304.familyLength];
+ memcpy( fontDescriptionRun0304.familyName, fontFamilyHebrew.c_str(), fontDescriptionRun0304.familyLength );
+ fontDescriptionRun0304.familyDefined = true;
+ fontDescriptionRun0304.weightDefined = false;
+ fontDescriptionRun0304.widthDefined = false;
+ fontDescriptionRun0304.slantDefined = false;
+ fontDescriptionRun0304.sizeDefined = false;
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0305;
+ fontDescriptionRun0305.characterRun.characterIndex = 54u;
+ fontDescriptionRun0305.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun0305.familyLength = fontFamily.size();
+ fontDescriptionRun0305.familyName = new char[fontDescriptionRun0305.familyLength];
+ memcpy( fontDescriptionRun0305.familyName, fontFamily.c_str(), fontDescriptionRun0305.familyLength );
+ fontDescriptionRun0305.familyDefined = true;
+ fontDescriptionRun0305.weightDefined = false;
+ fontDescriptionRun0305.widthDefined = false;
+ fontDescriptionRun0305.slantDefined = false;
+ fontDescriptionRun0305.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns03;
+ fontDescriptionRuns03.PushBack( fontDescriptionRun0301 );
+ fontDescriptionRuns03.PushBack( fontDescriptionRun0302 );
+ fontDescriptionRuns03.PushBack( fontDescriptionRun0303 );
+ fontDescriptionRuns03.PushBack( fontDescriptionRun0304 );
+ fontDescriptionRuns03.PushBack( fontDescriptionRun0305 );
+
+ unsigned int visualIndex03[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u,
+ 13u, 14u, 15u, 16u, 17u, 18u, 19u, 20u, 21u, 22u,
+ 22u, 23u, 24u, 25u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 40u, 41u, 42u, 43u,
+ 45u, 46u, 47u, 48u, 49u, 50u, 51u, 52u, 53u, 54u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 66u };
+
+ unsigned int characterIndex03[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 12u, 12u, 12u, 12u, 12u, 12u, 12u, 12u, 12u, 12u,
+ 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u,
+ 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u};
+
+ unsigned int logicalIndex03[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u,
+ 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 12u,
+ 22u, 23u, 24u, 25u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 42u, 41u, 40u, 39u, 38u, 37u, 36u, 35u, 43u,
+ 65u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u };
+
+ unsigned int bidirectionalLineIndex03[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+ 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u };
+
+
+// LO ש ל ו ם _ ע ו ל ם \n
+// 0 1 2 3 4 5 6 7 8 9 10
+// VO \n ם ל ו ע _ ם ו ל ש
+
+// h e l l o _ w o r l d \n
+// LO 10 11 12 13 14 15 16 17 18 19 20 21 22
+// h e l l o _ w o r l d \n
+
+// ש ל ו ם _ ע ו ל ם _ h e l l o _ w o r l d \n
+// LO 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
+// \n h e l l o _ w o r l d _ ם ל ו ע _ ם ו ל ש
+
+// h e l l o _ w o r l d _ ש ל ו ם _ ע ו ל ם \n
+// LO 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
+// h e l l o _ w o r l d _ ם ל ו ע _ ם ו ל ש \n
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0401;
+ fontDescriptionRun0401.characterRun.characterIndex = 0u;
+ fontDescriptionRun0401.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun0401.familyLength = fontFamilyHebrew.size();
+ fontDescriptionRun0401.familyName = new char[fontDescriptionRun0401.familyLength];
+ memcpy( fontDescriptionRun0401.familyName, fontFamilyHebrew.c_str(), fontDescriptionRun0401.familyLength );
+ fontDescriptionRun0401.familyDefined = true;
+ fontDescriptionRun0401.weightDefined = false;
+ fontDescriptionRun0401.widthDefined = false;
+ fontDescriptionRun0401.slantDefined = false;
+ fontDescriptionRun0401.sizeDefined = false;
+
+ FontDescriptionRun fontDescriptionRun0402;
+ fontDescriptionRun0402.characterRun.characterIndex = 10u;
+ fontDescriptionRun0402.characterRun.numberOfCharacters = 12u;
+ fontDescriptionRun0402.familyLength = fontFamily.size();
+ fontDescriptionRun0402.familyName = new char[fontDescriptionRun0402.familyLength];
+ memcpy( fontDescriptionRun0402.familyName, fontFamily.c_str(), fontDescriptionRun0402.familyLength );
+ fontDescriptionRun0402.familyDefined = true;
+ fontDescriptionRun0402.weightDefined = false;
+ fontDescriptionRun0402.widthDefined = false;
+ fontDescriptionRun0402.slantDefined = false;
+ fontDescriptionRun0402.sizeDefined = false;
+
+ FontDescriptionRun fontDescriptionRun0403;
+ fontDescriptionRun0403.characterRun.characterIndex = 22u;
+ fontDescriptionRun0403.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun0403.familyLength = fontFamilyHebrew.size();
+ fontDescriptionRun0403.familyName = new char[fontDescriptionRun0403.familyLength];
+ memcpy( fontDescriptionRun0403.familyName, fontFamilyHebrew.c_str(), fontDescriptionRun0403.familyLength );
+ fontDescriptionRun0403.familyDefined = true;
+ fontDescriptionRun0403.weightDefined = false;
+ fontDescriptionRun0403.widthDefined = false;
+ fontDescriptionRun0403.slantDefined = false;
+ fontDescriptionRun0403.sizeDefined = false;
+
+ FontDescriptionRun fontDescriptionRun0404;
+ fontDescriptionRun0404.characterRun.characterIndex = 32u;
+ fontDescriptionRun0404.characterRun.numberOfCharacters = 24u;
+ fontDescriptionRun0404.familyLength = fontFamily.size();
+ fontDescriptionRun0404.familyName = new char[fontDescriptionRun0404.familyLength];
+ memcpy( fontDescriptionRun0404.familyName, fontFamily.c_str(), fontDescriptionRun0404.familyLength );
+ fontDescriptionRun0404.familyDefined = true;
+ fontDescriptionRun0404.weightDefined = false;
+ fontDescriptionRun0404.widthDefined = false;
+ fontDescriptionRun0404.slantDefined = false;
+ fontDescriptionRun0404.sizeDefined = false;
+
+ FontDescriptionRun fontDescriptionRun0405;
+ fontDescriptionRun0405.characterRun.characterIndex = 56u;
+ fontDescriptionRun0405.characterRun.numberOfCharacters = 10u;
+ fontDescriptionRun0405.familyLength = fontFamilyHebrew.size();
+ fontDescriptionRun0405.familyName = new char[fontDescriptionRun0405.familyLength];
+ memcpy( fontDescriptionRun0405.familyName, fontFamilyHebrew.c_str(), fontDescriptionRun0405.familyLength );
+ fontDescriptionRun0405.familyDefined = true;
+ fontDescriptionRun0405.weightDefined = false;
+ fontDescriptionRun0405.widthDefined = false;
+ fontDescriptionRun0405.slantDefined = false;
+ fontDescriptionRun0405.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns04;
+ fontDescriptionRuns04.PushBack( fontDescriptionRun0401 );
+ fontDescriptionRuns04.PushBack( fontDescriptionRun0402 );
+ fontDescriptionRuns04.PushBack( fontDescriptionRun0403 );
+ fontDescriptionRuns04.PushBack( fontDescriptionRun0404 );
+ fontDescriptionRuns04.PushBack( fontDescriptionRun0405 );
+
+ unsigned int visualIndex04[] = { 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u,
+ 10u, 12u, 13u, 14u, 15u, 16u, 17u, 18u, 19u, 20u, 21u,
+ 23u, 24u, 25u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 40u, 41u, 42u, 43u, 44u,
+ 44u, 45u, 46u, 47u, 48u, 49u, 50u, 51u, 52u, 53u, 54u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u };
+
+ unsigned int characterIndex04[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 10u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 10u, 10u,
+ 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u, 22u,
+ 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u, 44u };
+
+ unsigned int logicalIndex04[] = { 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u,
+ 10u, 12u, 13u, 14u, 15u, 16u, 17u, 18u, 19u, 20u, 21u,
+ 43u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 40u, 41u, 42u, 32u, 31u, 30u, 29u, 28u, 27u, 26u, 25u, 24u, 23u, 22u,
+ 44u, 45u, 46u, 47u, 48u, 49u, 50u, 51u, 52u, 53u, 54u, 55u, 56u, 64u, 63u, 62u, 61u, 60u, 59u, 58u, 57u, 65u };
+
+ unsigned int bidirectionalLineIndex04[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u,
+ 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u };
+
+// LO A B C D E F G H I J K
+// 0 1 2 3 4 5 6 7 8 9 10 11
+// LO L M N
+// 11 12 13 14
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0501;
+ fontDescriptionRun0501.characterRun.characterIndex = 0u;
+ fontDescriptionRun0501.characterRun.numberOfCharacters = 14u;
+ fontDescriptionRun0501.familyLength = fontFamily.size();
+ fontDescriptionRun0501.familyName = new char[fontDescriptionRun0501.familyLength];
+ memcpy( fontDescriptionRun0501.familyName, fontFamily.c_str(), fontDescriptionRun0501.familyLength );
+ fontDescriptionRun0501.familyDefined = true;
+ fontDescriptionRun0501.weightDefined = false;
+ fontDescriptionRun0501.widthDefined = false;
+ fontDescriptionRun0501.slantDefined = false;
+ fontDescriptionRun0501.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns05;
+ fontDescriptionRuns05.PushBack( fontDescriptionRun0501 );
+
+ unsigned int visualIndex05[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u,
+ 11u, 12u, 13u, 14u };
+
+ unsigned int characterIndex05[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 11u, 11u, 11u, 11u };
+
+ unsigned int logicalIndex05[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u,
+ 11u, 12u, 13u, 14u };
+
+ unsigned int bidirectionalLineIndex05[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 0u, 0u, 0u, 0u };
+
+// LO ק ר א ט ו ן ם פ ש ד ג כ
+// 0 1 2 3 4 5 6 7 8 9 10 11 12
+// VO כ ג ד ש פ ם ן ו ט א ר ק
+
+// LO ע י ח ל
+// 12 13 14 15 16
+// VO ל ח י ע
+
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun0601;
+ fontDescriptionRun0601.characterRun.characterIndex = 0u;
+ fontDescriptionRun0601.characterRun.numberOfCharacters = 16u;
+ fontDescriptionRun0601.familyLength = fontFamilyHebrew.size();
+ fontDescriptionRun0601.familyName = new char[fontDescriptionRun0601.familyLength];
+ memcpy( fontDescriptionRun0601.familyName, fontFamilyHebrew.c_str(), fontDescriptionRun0601.familyLength );
+ fontDescriptionRun0601.familyDefined = true;
+ fontDescriptionRun0601.weightDefined = false;
+ fontDescriptionRun0601.widthDefined = false;
+ fontDescriptionRun0601.slantDefined = false;
+ fontDescriptionRun0601.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns06;
+ fontDescriptionRuns06.PushBack( fontDescriptionRun0601 );
+
+ unsigned int visualIndex06[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u,
+ 12u, 13u, 14u, 15u, 16u };
+
+ unsigned int characterIndex06[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 12u, 12u, 12u, 12u, 12u };
+
+ unsigned int logicalIndex06[] = { 12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u,
+ 16u, 15u, 14u, 13u, 12u };
+
+ unsigned int bidirectionalLineIndex06[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
+ 1u, 1u, 1u, 1u, 1u, };
+
+ struct GetLogicalCursorIndexData data[] =
+ {
+ {
+ "Zero characters text",
+ "",
+ Size( 300.f, 300.f ),
+ 0u,
+ nullptr,
+ 1u,
+ visualIndex01,
+ characterIndex01,
+ logicalIndex01,
+ bidirectionalLineIndex01,
+ },
+ {
+ "All left to right text 01.",
+ "Hello world\ndemo",
+ Size( 300.f, 300.f ),
+ 1u,
+ fontDescriptionRuns02.Begin(),
+ 4u,
+ visualIndex02,
+ characterIndex02,
+ logicalIndex02,
+ bidirectionalLineIndex02,
+ },
+ {
+ "bidirectional text 01.",
+ "Hello world\nשלום עולם\nhello world שלום עולם\nשלום עולם hello world\n",
+ Size( 300.f, 300.f ),
+ 5u,
+ fontDescriptionRuns03.Begin(),
+ 65u,
+ visualIndex03,
+ characterIndex03,
+ logicalIndex03,
+ bidirectionalLineIndex03,
+ },
+ {
+ "bidirectional text 02.",
+ "שלום עולם\nhello world\nשלום עולם hello world\nhello world שלום עולם\n",
+ Size( 300.f, 300.f ),
+ 5u,
+ fontDescriptionRuns04.Begin(),
+ 65u,
+ visualIndex04,
+ characterIndex04,
+ logicalIndex04,
+ bidirectionalLineIndex04,
+ },
+ {
+ "long line 01.",
+ "ABCDEFGHIJKLMN",