2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <dali-toolkit-test-suite-utils.h>
23 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/internal/text/cursor-helper-functions.h>
25 #include <toolkit-text-utils.h>
28 using namespace Toolkit;
31 // Tests the following functions.
33 // LineIndex GetClosestLine( VisualModelPtr visualModel,
36 // CharacterIndex GetClosestCursorIndex( VisualModelPtr visualModel,
37 // LogicalModelPtr logicalModel,
38 // MetricsPtr metrics,
41 // CharacterHitTest::Mode mode,
42 // bool& isCharacterHit )
44 //////////////////////////////////////////////////////////
48 const std::string DEFAULT_FONT_DIR("/resources/fonts");
49 const unsigned int DEFAULT_FONT_SIZE = 1152u;
51 struct GetClosestLineData
53 std::string description; ///< Description of the test.
54 std::string text; ///< Input text.
55 unsigned int numberOfTests; ///< The number of tests.
56 float* visualY; ///< The visual 'y' position for each test.
57 LineIndex* lineIndex; ///< The expected line index for each test.
58 bool* isLineHit; ///< The expected line hit value for each test.
61 struct GetClosestCursorIndexData
63 std::string description; ///< Description of the test.
64 std::string text; ///< Input text.
65 unsigned int numberOfTests; ///< The number of tests.
66 float* visualX; ///< The visual 'x' position for each test.
67 float* visualY; ///< The visual 'y' position for each test.
68 CharacterHitTest::Mode* mode; ///< The type of hit test.
69 CharacterIndex* logicalIndex; ///< The expected logical cursor index for each test.
70 bool* isCharacterHit; ///< The expected character hit value for each test.
73 struct GetCursorPositionData
75 std::string description; ///< Description of the test.
76 std::string text; ///< Input text.
77 unsigned int numberOfTests; ///< The number of tests.
78 CharacterIndex* logicalIndex; ///< The logical cursor index for each test.
79 float* visualX; ///< The expected visual 'x' position for each test.
80 float* visualY; ///< The expected visual 'y' position for each test.
83 struct FindSelectionIndicesData
85 std::string description; ///< Description of the test.
86 std::string text; ///< Input text.
87 unsigned int numberOfTests; ///< The number of tests.
88 float* visualX; ///< The visual 'x' position for each test.
89 float* visualY; ///< The visual 'y' position for each test.
90 bool* found; ///< Whether selection indices are found.
91 CharacterIndex* startIndex; ///< The expected start cursor index for each test.
92 CharacterIndex* endIndex; ///< The expected end cursor index for each test.
93 CharacterIndex* noTextHitIndex; ///< The expected character index when there is no hit.
96 struct PrimaryCursorHeightData
98 std::string description; ///< Description of the test.
99 std::string text; ///< Input text.
100 unsigned int numberOfTests; ///< The number of tests.
101 CharacterIndex* logicalIndex; ///< The logical cursor index for each test.
102 float* heights; ///< The expected primary cursor height for each test.
105 bool GetClosestLineTest(const GetClosestLineData& data)
107 std::cout << " testing : " << data.description << std::endl;
109 // 1) Create the model.
112 Size textArea(400.f, 600.f);
115 Vector<FontDescriptionRun> fontDescriptionRuns;
116 LayoutOptions options;
117 CreateTextModel(data.text,
127 Toolkit::DevelText::EllipsisPosition::END,
129 0.0f // characterSpacing
132 LogicalModelPtr logicalModel = textModel->mLogicalModel;
133 VisualModelPtr visualModel = textModel->mVisualModel;
135 for(unsigned int index = 0; index < data.numberOfTests; ++index)
137 bool isLineHit = false;
138 const LineIndex lineIndex = GetClosestLine(visualModel,
142 if(lineIndex != data.lineIndex[index])
144 std::cout << " test " << index << " failed. Different line index : " << lineIndex << ", expected : " << data.lineIndex[index] << std::endl;
147 if(isLineHit != data.isLineHit[index])
149 std::cout << " test " << index << " failed. Different line hit value : " << isLineHit << ", expected : " << data.isLineHit[index] << std::endl;
157 bool GetClosestCursorIndexTest(const GetClosestCursorIndexData& data)
159 std::cout << " testing : " << data.description << std::endl;
161 // 1) Create the model.
164 Size textArea(400.f, 600.f);
167 Vector<FontDescriptionRun> fontDescriptionRuns;
168 LayoutOptions options;
169 CreateTextModel(data.text,
179 Toolkit::DevelText::EllipsisPosition::END,
181 0.0f // characterSpacing
184 LogicalModelPtr logicalModel = textModel->mLogicalModel;
185 VisualModelPtr visualModel = textModel->mVisualModel;
187 for(unsigned int index = 0; index < data.numberOfTests; ++index)
189 bool isCharacterHit = false;
190 const CharacterIndex logicalCursorIndex = GetClosestCursorIndex(visualModel,
198 if(logicalCursorIndex != data.logicalIndex[index])
200 std::cout << " test " << index << " failed. Different logical cursor index : " << logicalCursorIndex << ", expected : " << data.logicalIndex[index] << std::endl;
203 if(isCharacterHit != data.isCharacterHit[index])
205 std::cout << " test " << index << " failed. Different character hit value : " << isCharacterHit << ", expected : " << data.isCharacterHit[index] << std::endl;
213 bool GetCursorPositionTest(const GetCursorPositionData& data)
215 std::cout << " testing : " << data.description << std::endl;
217 // 1) Create the model.
220 Size textArea(400.f, 600.f);
223 Vector<FontDescriptionRun> fontDescriptionRuns;
224 LayoutOptions options;
225 CreateTextModel(data.text,
235 Toolkit::DevelText::EllipsisPosition::END,
237 0.0f // characterSpacing
240 LogicalModelPtr logicalModel = textModel->mLogicalModel;
241 VisualModelPtr visualModel = textModel->mVisualModel;
243 GetCursorPositionParameters parameters;
244 parameters.visualModel = visualModel;
245 parameters.logicalModel = logicalModel;
246 parameters.metrics = metrics;
247 parameters.isMultiline = true;
249 for(unsigned int index = 0; index < data.numberOfTests; ++index)
251 CursorInfo cursorInfo;
252 parameters.logical = data.logicalIndex[index];
254 GetCursorPosition(parameters,
255 0.f, // Since this test case is not testing the primary cursor height, the default font line height can be set to 0.f.
258 if(floor(cursorInfo.primaryPosition.x) != data.visualX[index])
260 std::cout << " test " << index << " failed. Different 'x' cursor position : " << cursorInfo.primaryPosition.x << ", expected : " << data.visualX[index] << std::endl;
263 if(floor(cursorInfo.primaryPosition.y) != data.visualY[index])
265 std::cout << " test " << index << " failed. Different 'y' cursor position : " << cursorInfo.primaryPosition.y << ", expected : " << data.visualY[index] << std::endl;
273 bool FindSelectionIndicesTest(const FindSelectionIndicesData& data)
275 std::cout << " testing : " << data.description << std::endl;
277 // 1) Create the model.
280 Size textArea(400.f, 600.f);
283 Vector<FontDescriptionRun> fontDescriptionRuns;
284 LayoutOptions options;
285 CreateTextModel(data.text,
295 Toolkit::DevelText::EllipsisPosition::END,
297 0.0f // characterSpacing
300 LogicalModelPtr logicalModel = textModel->mLogicalModel;
301 VisualModelPtr visualModel = textModel->mVisualModel;
303 for(unsigned int index = 0; index < data.numberOfTests; ++index)
305 CharacterIndex startIndex = 0;
306 CharacterIndex endIndex = 0;
307 CharacterIndex noTextHitIndex = 0;
308 const bool found = FindSelectionIndices(visualModel,
317 if(found != data.found[index])
319 std::cout << " test " << index << " failed. Different found value : " << found << ", expected : " << data.found[index] << std::endl;
322 if(startIndex != data.startIndex[index])
324 std::cout << " test " << index << " failed. Different start index : " << startIndex << ", expected : " << data.startIndex[index] << std::endl;
327 if(endIndex != data.endIndex[index])
329 std::cout << " test " << index << " failed. Different end index : " << endIndex << ", expected : " << data.endIndex[index] << std::endl;
332 if(noTextHitIndex != data.noTextHitIndex[index])
334 std::cout << " test " << index << " failed. Different no text hit index : " << noTextHitIndex << ", expected : " << data.noTextHitIndex[index] << std::endl;
341 bool PrimaryCursorHeightTest(const PrimaryCursorHeightData& data)
343 std::cout << " testing : " << data.description << std::endl;
345 // 1) Create the model.
348 Size textArea(400.f, 600.f);
351 Vector<FontDescriptionRun> fontDescriptionRuns;
353 const std::string fontFamily("DejaVuSans");
355 // Set a known font description
356 FontDescriptionRun fontDescriptionRun1;
357 fontDescriptionRun1.characterRun.characterIndex = 0u;
358 fontDescriptionRun1.characterRun.numberOfCharacters = 13u;
359 fontDescriptionRun1.familyLength = fontFamily.size();
360 fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
361 memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
362 fontDescriptionRun1.familyDefined = true;
363 fontDescriptionRun1.weightDefined = false;
364 fontDescriptionRun1.widthDefined = false;
365 fontDescriptionRun1.slantDefined = false;
366 fontDescriptionRun1.sizeDefined = true;
367 fontDescriptionRun1.size = 768u; //Font size = 12.0f (768/64 = 12)
369 fontDescriptionRuns.PushBack(fontDescriptionRun1);
371 LayoutOptions options;
372 CreateTextModel(data.text,
382 Toolkit::DevelText::EllipsisPosition::END,
383 50.0f, // lineSpacing
384 50.0f // characterSpacing
387 LogicalModelPtr logicalModel = textModel->mLogicalModel;
388 VisualModelPtr visualModel = textModel->mVisualModel;
390 GetCursorPositionParameters parameters;
391 parameters.visualModel = visualModel;
392 parameters.logicalModel = logicalModel;
393 parameters.metrics = metrics;
394 parameters.isMultiline = true;
396 for(unsigned int index = 0; index < data.numberOfTests; ++index)
398 CursorInfo cursorInfo;
399 parameters.logical = data.logicalIndex[index];
402 TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
403 fontClient.SetDpi(93u, 93u);
405 char* pathNamePtr = get_current_dir_name();
406 const std::string pathName(pathNamePtr);
409 FontId fontID = fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSans.ttf");
411 Text::FontMetrics fontMetrics;
412 MetricsPtr mMetrics = Metrics::New(fontClient);
413 mMetrics->GetFontMetrics(fontID, fontMetrics);
414 float defaultFontLineHeight = (fontMetrics.ascender - fontMetrics.descender);
416 GetCursorPosition(parameters,
417 defaultFontLineHeight,
420 if(floor(cursorInfo.primaryCursorHeight) != data.heights[index])
422 std::cout << " test " << index << " failed. Different primaryCursorHeight : " << cursorInfo.primaryCursorHeight << ", expected : " << data.heights[index] << std::endl;
432 //////////////////////////////////////////////////////////
434 // UtcDaliGetClosestLine
435 // UtcDaliGetClosestCursorIndex
436 // UtcDaliGetCursorPosition
437 // UtcDaliFindSelectionIndices
438 // UtcDaliPrimaryCursorHeight
440 //////////////////////////////////////////////////////////
442 int UtcDaliGetClosestLine(void)
444 tet_infoline(" UtcDaliGetClosestLine");
446 float visualY01[] = {-4.f, 3.f, 1000.f};
447 LineIndex lineIndices01[] = {0, 0, 0};
448 bool isLineHit01[] = {false, false, false};
450 float visualY02[] = {-4.f, 3.f, 1000.f};
451 LineIndex lineIndices02[] = {0, 0, 0};
452 bool isLineHit02[] = {false, true, false};
454 float visualY03[] = {-4.f, 11.f, 30.f, 51.f, 68.f, 87.f, 109.f, 130.f};
455 LineIndex lineIndices03[] = {0, 0, 1u, 2u, 3u, 4u, 5u, 5u};
456 bool isLineHit03[] = {false, true, true, true, true, true, true, false};
458 struct GetClosestLineData data[] =
466 {"Single line text.",
473 "abcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuדאוvwxה"
474 "סתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuד"
475 "אוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqr"
476 "פרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmno"
477 "צמםpqrפרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjkl"
478 "חלךmnoצמםpqrפרףstuדאוvwxהסתyzטזץ",
483 const unsigned int numberOfTests = 3u;
485 for(unsigned int index = 0; index < numberOfTests; ++index)
487 ToolkitTestApplication application;
488 if(!GetClosestLineTest(data[index]))
490 tet_result(TET_FAIL);
494 tet_result(TET_PASS);
498 int UtcDaliGetClosestCursorIndex(void)
500 tet_infoline(" UtcDaliGetClosestCursorIndex");
502 float visualX01[] = {-100.f};
503 float visualY01[] = {-100.f};
504 CharacterHitTest::Mode mode01[] = {CharacterHitTest::TAP};
505 CharacterIndex logicalIndex01[] = {0};
506 bool isCharacterHit01[] = {false};
508 float visualX02[] = {-100.f, 1000.f, 60.f, 79.f, 83.f, 148.f, 99.f};
509 float visualY02[] = {-100.f, 1000.f, 12.f, 12.f, 12.f, 12.f, 12.f};
510 CharacterHitTest::Mode mode02[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
511 CharacterIndex logicalIndex02[] = {0, 21u, 7u, 10u, 10u, 14u, 12u};
512 bool isCharacterHit02[] = {false, false, true, true, true, true, true};
514 float visualX03[] = {19.f, 104.f, -2.f, 127.f};
515 float visualY03[] = {12.f, 12.f, 12.f, 12.f};
516 CharacterHitTest::Mode mode03[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
517 CharacterIndex logicalIndex03[] = {3u, 13u, 0, 18u};
518 bool isCharacterHit03[] = {true, true, false, false};
525 // different الأربعاء \n
526 float visualX04[] = {-100.f, 40.f, 44.f, 85.f, 500.f, 500.f, 367.f, 359.f, 329.f, -100.f, -100.f, 19.f, 64.f, 72.f, 104.f, 111.f, 500.f};
527 float visualY04[] = {-100.f, 12.f, 12.f, 12.f, 12.f, 30.f, 30.f, 30.f, 30.f, 30.f, 50.f, 50.f, 50.f, 50.f, 50.f, 50.f, 50.f};
528 CharacterHitTest::Mode mode04[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
529 CharacterIndex logicalIndex04[] = {0, 5u, 6u, 11u, 11u, 12u, 16u, 17u, 21u, 21u, 22u, 25u, 30u, 32u, 35u, 34u, 40u, 41u};
530 bool isCharacterHit04[] = {false, true, true, true, false, false, true, true, true, false, false, true, true, true, true, true, false};
533 // abcשנבdefג קכghiעיןjk lחלךmnoצמם pqrפרףstuד אוvwxה
535 // סתyz טזץabcשנבd efגקכghiעי ןjklחלךmno צמםpqrפרףstuד
536 // 93 100 110 120 130 139
537 // אוvwxהס תyzטזץabcש נבdefגקכgh iעיןjklחלך mnoצמםpqr
538 // 139 150 160 170 180 186
539 // פרףstuדאוvw xהסתyzטזץa bcשנבdefגק כghiעיןjkl חלךmno
540 // 186 190 200 210 220 233
541 // צמםp qrפרףstuדא וvwxהסתyzט זץabcשנבde fגקכghiעיןjkl
542 // 233 240 250 260 265
543 // חלךmnoצ מםpqrפרףst uדאוvwxהסת yzטזץ
545 float visualX05[] = {-100.f, 96.f, 155.f, 250.f, 344.f, 500.f, -100.f, 36.f, 124.f, 190.f, 280.f, 500.f, -100.f, 56.f, 158.f, 237.f, 303.f, 500.f, -100.f, 98.f, 184.f, 261.f, 337.f, 500.f, -100.f, 40.f, 113.f, 223.f, 302.f, 500.f, -100.f, 82.f, 160.f, 253.f, 500.f};
546 float visualY05[] = {-100.f, 12.f, 12.f, 12.f, 12.f, 12.f, 30.f, 30.f, 30.f, 30.f, 30.f, 30.f, 50.f, 50.f, 50.f, 50.f, 50.f, 50.f, 67.f, 67.f, 67.f, 67.f, 67.f, 67.f, 87.f, 87.f, 87.f, 87.f, 87.f, 87.f, 107.f, 107.f, 107.f, 107.f, 107.f};
547 CharacterHitTest::Mode mode05[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
548 CharacterIndex logicalIndex05[] = {0, 10u, 19u, 28u, 39u, 44u, 45u, 48u, 59u, 66u, 78u, 87u, 89u, 96u, 106u, 115u, 124u, 133u, 134u, 145u, 154u, 162u, 171u, 179u, 180u, 184u, 191u, 203u, 212u, 221u, 222u, 233u, 241u, 251u, 265u};
549 bool isCharacterHit05[] = {false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, false};
552 // שנבabcגקכd efעיןghiחל ךjklצמםmno פרףpqrדאוs tuהסתv
554 // wxטז ץyzשנבabcג קכdefעיןgh iחלךjklצמם mnoפרףpqrדאוs
555 // 93 100 110 120 130 139
556 // tuהסתvw xטזץyzשנבa bcגקכdefעי ןghiחלךjkl צמםmnoפרף
557 // 139 150 160 170 180 186
558 // pqrדאוstuהס תvwxטזץyzש נבabcגקכde fעיןghiחלך jklצמם
559 // 186 190 200 210 220 232
560 // mnoפ רףpqrדאוst uהסתvwxטזץ yzשנבabcגק כdefעיןghiחל
561 // 232 240 250 260 265
562 // ךjklצמםm noפרףpqrדא וstuהסתvwx טזץyz
564 float visualX06[] = {500.f, 307.f, 237.f, 148.f, 55.f, -100.f, 500.f, 362.f, 276.f, 213.f, 121.f, -100.f, 500.f, 344.f, 238.f, 167.f, 93.f, -100.f, 500.f, 306.f, 216.f, 142.f, 58.f, -100.f, 500.f, 355.f, 279.f, 182.f, 92.f, -100.f, 500.f, 326.f, 238.f, 150.f, -100.f};
565 float visualY06[] = {-100.f, 12.f, 12.f, 12.f, 12.f, 12.f, 30.f, 30.f, 30.f, 30.f, 30.f, 30.f, 50.f, 50.f, 50.f, 50.f, 50.f, 50.f, 67.f, 67.f, 67.f, 67.f, 67.f, 67.f, 87.f, 87.f, 87.f, 87.f, 87.f, 87.f, 107.f, 107.f, 107.f, 107.f, 107.f};
566 CharacterHitTest::Mode mode06[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
567 CharacterIndex logicalIndex06[] = {0, 11u, 19u, 28u, 39u, 44u, 45u, 48u, 57u, 65u, 78u, 87u, 89u, 96u, 107u, 114u, 124u, 133u, 134u, 144u, 154u, 162u, 171u, 178u, 179u, 185u, 192u, 203u, 212u, 221u, 222u, 232u, 240u, 251u, 265u};
568 bool isCharacterHit06[] = {false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, true, false, false, true, true, true, false};
570 float visualX07[] = {395.f};
571 float visualY07[] = {12.f};
572 CharacterHitTest::Mode mode07[] = {CharacterHitTest::TAP};
573 CharacterIndex logicalIndex07[] = {1u};
574 bool isCharacterHit07[] = {true};
576 float visualX08[] = {7.f};
577 float visualY08[] = {12.f};
578 CharacterHitTest::Mode mode08[] = {CharacterHitTest::TAP};
579 CharacterIndex logicalIndex08[] = {1u};
580 bool isCharacterHit08[] = {true};
582 struct GetClosestCursorIndexData data[] =
592 {"Single line text.",
593 "Hello world שלום עולם",
600 {"Single line with ligatures",
601 "different الأربعاء",
608 {"Multiline. Single line paragraphs",
611 "different الأربعاء\n",
618 {"Multiline. Single bidirectional paragraph, starts LTR, wrapped lines",
619 "abcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuדאוvwxה"
620 "סתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuד"
621 "אוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqr"
622 "פרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmno"
623 "צמםpqrפרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjkl"
624 "חלךmnoצמםpqrפרףstuדאוvwxהסתyzטזץ",
631 {"Multiline. Single bidirectional paragraph, starts RTL, wrapped lines",
632 "שנבabcגקכdefעיןghiחלךjklצמםmnoפרףpqrדאוstuהסתv"
633 "wxטזץyzשנבabcגקכdefעיןghiחלךjklצמםmnoפרףpqrדאוs"
634 "tuהסתvwxטזץyzשנבabcגקכdefעיןghiחלךjklצמםmnoפרף"
635 "pqrדאוstuהסתvwxטזץyzשנבabcגקכdefעיןghiחלךjklצמם"
636 "mnoפרףpqrדאוstuהסתvwxטזץyzשנבabcגקכdefעיןghiחל"
637 "ךjklצמםmnoפרףpqrדאוstuהסתvwxטזץyz",
644 {"Testing complex characters. Arabic ligatures",
645 "الأَبْجَدِيَّة العَرَبِيَّة",
652 {"Testing complex characters. Latin ligatures",
660 const unsigned int numberOfTests = 8u;
662 for(unsigned int index = 0; index < numberOfTests; ++index)
664 ToolkitTestApplication application;
665 if(!GetClosestCursorIndexTest(data[index]))
667 tet_result(TET_FAIL);
671 tet_result(TET_PASS);
675 int UtcDaliGetCursorPosition(void)
677 tet_infoline(" UtcDaliGetCursorPosition");
679 float visualX08[] = {5.f};
680 float visualY08[] = {0.f};
681 CharacterIndex logicalIndex08[] = {1u};
683 struct GetCursorPositionData data[] =
686 "Testing complex characters. Latin ligatures",
693 const unsigned int numberOfTests = 1u;
695 for(unsigned int index = 0; index < numberOfTests; ++index)
697 ToolkitTestApplication application;
698 if(!GetCursorPositionTest(data[index]))
700 tet_result(TET_FAIL);
704 tet_result(TET_PASS);
708 int UtcDaliFindSelectionIndices(void)
710 tet_infoline(" UtcDaliFindSelectionIndices");
712 float visualX01[] = {-100.f};
713 float visualY01[] = {-100.f};
714 bool found01[] = {false};
715 CharacterIndex startIndex01[] = {0};
716 CharacterIndex endIndex01[] = {0};
717 CharacterIndex noHitText01[] = {0};
719 float visualX02[] = {-100.f, 1000.f, 1000.f};
720 float visualY02[] = {-100.f, 12.f, 1000.f};
721 bool found02[] = {false, false, false};
722 CharacterIndex startIndex02[] = {0, 6u, 6u};
723 CharacterIndex endIndex02[] = {5u, 11u, 11u};
724 CharacterIndex noHitText02[] = {0, 11u, 11u};
726 float visualX03[] = {70.f};
727 float visualY03[] = {12.f};
728 bool found03[] = {true};
729 CharacterIndex startIndex03[] = {6u};
730 CharacterIndex endIndex03[] = {11u};
731 CharacterIndex noHitText03[] = {0u};
733 float visualX04[] = {131.f};
734 float visualY04[] = {12.f};
735 bool found04[] = {true};
736 CharacterIndex startIndex04[] = {12u};
737 CharacterIndex endIndex04[] = {16u};
738 CharacterIndex noHitText04[] = {0u};
740 float visualX05[] = {0.f};
741 float visualY05[] = {12.f};
742 bool found05[] = {true};
743 CharacterIndex startIndex05[] = {0};
744 CharacterIndex endIndex05[] = {1u};
745 CharacterIndex noHitText05[] = {0};
747 float visualX06[] = {10.f};
748 float visualY06[] = {12.f};
749 bool found06[] = {true};
750 CharacterIndex startIndex06[] = {0};
751 CharacterIndex endIndex06[] = {1u};
752 CharacterIndex noHitText06[] = {0u};
754 struct FindSelectionIndicesData data[] =
765 {"touch out of text's boundaries",
774 {"touch on the text",
783 {"touch on the new paragraph character at the end of line",
784 "Hello world demo\n",
792 {"touch on a white space character. is the unique character of the line",
801 {"touch on a white space character. is between two words",
811 const unsigned int numberOfTests = 6u;
813 for(unsigned int index = 0; index < numberOfTests; ++index)
815 ToolkitTestApplication application;
816 if(!FindSelectionIndicesTest(data[index]))
818 tet_result(TET_FAIL);
822 tet_result(TET_PASS);
826 int UtcDaliPrimaryCursorHeight(void)
828 tet_infoline(" UtcDaliPrimaryCursorHeight");
830 float heights[] = {19.f};
831 CharacterIndex logicalIndex[] = {1u};
833 struct PrimaryCursorHeightData data[] =
836 "Testing primary cursor height when line spacing is used.",
842 const unsigned int numberOfTests = 1u;
844 for(unsigned int index = 0; index < numberOfTests; ++index)
846 ToolkitTestApplication application;
847 if(!PrimaryCursorHeightTest(data[index]))
849 tet_result(TET_FAIL);
853 tet_result(TET_PASS);