utc-Dali-VisualUrl.cpp
utc-Dali-Text-Hyphen-Wrapping.cpp
utc-Dali-Text-Ellipsis.cpp
+ utc-Dali-Text-CharacterSpacing.cpp
)
IF(ELDBUS_AVAILABLE)
LineWrap::Mode wrapMode,
bool ellipsisEnabled,
DevelText::EllipsisPosition::Type ellipsisPosition,
- float lineSpacing)
+ float lineSpacing,
+ float characterSpacing)
{
textModel = Model::New(); ///< Pointer to the text's model.
LogicalModelPtr logicalModel = textModel->mLogicalModel;
visualModel->CreateGlyphsPerCharacterTable(0u, 0u, characterCount);
visualModel->CreateCharacterToGlyphTable(0u, 0u, characterCount);
+ visualModel->SetCharacterSpacing(characterSpacing);
+
const Length numberOfGlyphs = glyphs.Count();
// 8) Get the glyph metrics
#define DALI_TOOLKIT_TEXT_UTILS_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Toolkit
{
-
namespace Text
{
-
/**
* @brief Some layout options.
*/
struct LayoutOptions
{
LayoutOptions()
- : align{ true }
- {}
+ : align{true}
+ {
+ }
- bool align : 1; ///< Whether to align the lines.
+ bool align : 1; ///< Whether to align the lines.
};
/**
* @param[in] ellipsisEnabled Whether the ellipsis layout option is enabled.
* @param[in] ellipsisPosition Where is the location the text elide.
* @param[in] lineSpacing The height of the line in points.
+ * @param[in] characterSpacing The spacing between the characters.
*/
-void CreateTextModel( const std::string& text,
- const Size& textArea,
- const Vector<FontDescriptionRun>& fontDescriptions,
- const LayoutOptions& options,
- Size& layoutSize,
- ModelPtr& textModel,
- MetricsPtr& metrics,
- bool markupProcessorEnabled,
- LineWrap::Mode wrapMode,
- bool ellipsisEnabled,
- DevelText::EllipsisPosition::Type ellipsisPosition,
- float lineSpacing);
+void CreateTextModel(const std::string& text,
+ const Size& textArea,
+ const Vector<FontDescriptionRun>& fontDescriptions,
+ const LayoutOptions& options,
+ Size& layoutSize,
+ ModelPtr& textModel,
+ MetricsPtr& metrics,
+ bool markupProcessorEnabled,
+ LineWrap::Mode wrapMode,
+ bool ellipsisEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition,
+ float lineSpacing,
+ float characterSpacing);
/**
* @brief Configures the text @p controller similarly to the one configured by the text-label.
*
* @param[in,out] The text controller to configure.
*/
-void ConfigureTextLabel( ControllerPtr controller );
+void ConfigureTextLabel(ControllerPtr controller);
/**
* @brief Configures the text @p controller similarly to the one configured by the text-field.
*
* @param[in,out] The text controller to configure.
*/
-void ConfigureTextField( ControllerPtr controller );
+void ConfigureTextField(ControllerPtr controller);
/**
* @brief Configures the text @p controller similarly to the one configured by the text-editor.
*
* @param[in,out] The text controller to configure.
*/
-void ConfigureTextEditor( ControllerPtr controller );
-
+void ConfigureTextEditor(ControllerPtr controller);
/**
* @brief Creates one FontDescriptionRun then add it to FontDescription list.
* @return vector contains one FontDescriptionRun.
*/
Vector<FontDescriptionRun> CreateSingleFontDescription(
- const CharacterRun& characterRun,
- const std::string fontFamilyName,
- const FontWeight weight,
- const FontWidth width,
- const FontSlant slant,
- const PointSize26Dot6 size,
- const bool familyDefined,
- const bool weightDefined,
- const bool widthDefined,
- const bool slantDefined,
- const bool sizeDefined);
+ const CharacterRun& characterRun,
+ const std::string fontFamilyName,
+ const FontWeight weight,
+ const FontWidth width,
+ const FontSlant slant,
+ const PointSize26Dot6 size,
+ const bool familyDefined,
+ const bool weightDefined,
+ const bool widthDefined,
+ const bool slantDefined,
+ const bool sizeDefined);
} // namespace Text
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
#include <stdlib.h>
+#include <iostream>
-#include <dali/devel-api/text-abstraction/bidirectional-support.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/internal/text/bidirectional-support.h>
#include <dali-toolkit/internal/text/character-set-conversion.h>
#include <dali-toolkit/internal/text/text-run-container.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
+#include <dali/devel-api/text-abstraction/bidirectional-support.h>
#include <toolkit-text-utils.h>
using namespace Dali;
namespace
{
-
struct SetBidirectionalInfoData
{
std::string description; ///< Description of the test.
bool markupProcessorEnabled; ///< Enable markup processor to use markup text.
};
-bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
+bool SetBidirectionalInfoTest(const SetBidirectionalInfoData& data)
{
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(100.f, 60.f);
- Size layoutSize;
+ Size textArea(100.f, 60.f);
+ Size layoutSize;
// Create the model.
const Vector<FontDescriptionRun> fontDescriptions;
- const LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptions,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ const LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptions,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
// 2) Clear the bidirectional paragraph info data.
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
- if( 0u != data.numberOfCharacters )
+ if(0u != data.numberOfCharacters)
{
- ClearCharacterRuns( data.startIndex,
- data.startIndex + data.numberOfCharacters - 1u,
- bidirectionalInfo );
+ ClearCharacterRuns(data.startIndex,
+ data.startIndex + data.numberOfCharacters - 1u,
+ bidirectionalInfo);
}
// 3) Call the SetBidirectionalInfo() function.
- SetBidirectionalInfo( logicalModel->mText,
- logicalModel->mScriptRuns,
- logicalModel->mLineBreakInfo,
- data.startIndex,
- data.numberOfCharacters,
- bidirectionalInfo );
+ SetBidirectionalInfo(logicalModel->mText,
+ logicalModel->mScriptRuns,
+ logicalModel->mLineBreakInfo,
+ data.startIndex,
+ data.numberOfCharacters,
+ bidirectionalInfo);
// 4) Compare with the expected results.
TextAbstraction::BidirectionalSupport bidirectionalSupport = TextAbstraction::BidirectionalSupport::Get();
- if( data.numberOfParagraphs != bidirectionalInfo.Count() )
+ if(data.numberOfParagraphs != bidirectionalInfo.Count())
{
// Different number of expected bidirectional paragraphs.
std::cout << " Different number of bidi paragraphs : " << bidirectionalInfo.Count() << ", expected : " << data.numberOfParagraphs << std::endl;
return false;
}
- for( unsigned int index = 0u; index < data.numberOfParagraphs; ++index )
+ for(unsigned int index = 0u; index < data.numberOfParagraphs; ++index)
{
const BidirectionalParagraphInfoRun& run = bidirectionalInfo[index];
- const CharacterDirection direction = bidirectionalSupport.GetParagraphDirection( run.bidirectionalInfoIndex );
- if( direction != data.directions[index] )
+ const CharacterDirection direction = bidirectionalSupport.GetParagraphDirection(run.bidirectionalInfoIndex);
+ if(direction != data.directions[index])
{
std::cout << " Different direction" << std::endl;
std::cout << " paragraph : " << index << std::endl;
return false;
}
- if( run.characterRun.characterIndex != data.indices[index] )
+ if(run.characterRun.characterIndex != data.indices[index])
{
std::cout << " Different index" << std::endl;
std::cout << " paragraph : " << index << std::endl;
std::cout << " expected, index : " << data.indices[index] << ", num chars : " << data.numberOfParagraphCharacters[index] << ", direction : " << data.directions[index] << std::endl;
return false;
}
- if( run.characterRun.numberOfCharacters != data.numberOfParagraphCharacters[index] )
+ if(run.characterRun.numberOfCharacters != data.numberOfParagraphCharacters[index])
{
std::cout << " Different number of characters" << std::endl;
std::cout << " paragraph : " << index << std::endl;
return true;
}
-bool GetMirroredTextTest( const GetMirroredTextData& data )
+bool GetMirroredTextTest(const GetMirroredTextData& data)
{
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(100.f, 60.f);
- Size layoutSize;
+ Size textArea(100.f, 60.f);
+ Size layoutSize;
// Create the model.
const Vector<FontDescriptionRun> fontDescriptions;
- const LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptions,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ const LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptions,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
// 2) Call the GetMirroredText() function for the whole text
Vector<Character> mirroredText;
- bool mirrored = false;
- mirrored = GetMirroredText( logicalModel->mText,
- logicalModel->mCharacterDirections,
- logicalModel->mBidirectionalParagraphInfo,
- 0u,
- logicalModel->mText.Count(),
- mirroredText );
+ bool mirrored = false;
+ mirrored = GetMirroredText(logicalModel->mText,
+ logicalModel->mCharacterDirections,
+ logicalModel->mBidirectionalParagraphInfo,
+ 0u,
+ logicalModel->mText.Count(),
+ mirroredText);
// 3) Call the GetMirroredText() function for the given index + number of characters
- mirrored = GetMirroredText( logicalModel->mText,
- logicalModel->mCharacterDirections,
- logicalModel->mBidirectionalParagraphInfo,
- data.startIndex,
- data.numberOfCharacters,
- mirroredText );
+ mirrored = GetMirroredText(logicalModel->mText,
+ logicalModel->mCharacterDirections,
+ logicalModel->mBidirectionalParagraphInfo,
+ data.startIndex,
+ data.numberOfCharacters,
+ mirroredText);
// 4) Compare the results.
// Convert to utf8
std::string mirroredString;
- Utf32ToUtf8( mirroredText.Begin(),
- mirroredText.Count(),
- mirroredString );
+ Utf32ToUtf8(mirroredText.Begin(),
+ mirroredText.Count(),
+ mirroredString);
- if( !mirrored && ( mirroredString != data.text ) )
+ if(!mirrored && (mirroredString != data.text))
{
std::cout << " No mirrored text and mirroredString != data.text." << std::endl;
std::cout << " mirrored string : [" << mirroredString << "]" << std::endl;
return false;
}
- if( mirrored && ( mirroredString == data.text ) )
+ if(mirrored && (mirroredString == data.text))
{
std::cout << " Mirrored text and mirroredString == data.text." << std::endl;
std::cout << " mirrored string : [" << mirroredString << "]" << std::endl;
return false;
}
- if( mirrored && ( mirroredString != data.mirroredText ) )
+ if(mirrored && (mirroredString != data.mirroredText))
{
std::cout << " Mirrored text and mirroredString != data.mirroredText." << std::endl;
std::cout << " mirrored string : [" << mirroredString << "]" << std::endl;
return true;
}
-bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
+bool GetCharactersDirectionTest(const GetCharactersDirectionData& data)
{
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(100.f, 60.f);
- Size layoutSize;
+ Size textArea(100.f, 60.f);
+ Size layoutSize;
// Create the model.
const Vector<FontDescriptionRun> fontDescriptions;
- const LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptions,
- options,
- layoutSize,
- textModel,
- metrics,
- data.markupProcessorEnabled,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ const LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptions,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ data.markupProcessorEnabled,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = logicalModel->mBidirectionalParagraphInfo;
// 2) Clear the direction info data.
Vector<CharacterDirection>& directions = logicalModel->mCharacterDirections;
- if( directions.Count() >= data.startIndex + data.numberOfCharacters )
+ if(directions.Count() >= data.startIndex + data.numberOfCharacters)
{
- directions.Erase( directions.Begin() + data.startIndex,
- directions.Begin() + data.startIndex + data.numberOfCharacters );
+ directions.Erase(directions.Begin() + data.startIndex,
+ directions.Begin() + data.startIndex + data.numberOfCharacters);
}
// 3) Call GetCharactersDirection() function.
- GetCharactersDirection( bidirectionalInfo,
- logicalModel->mText.Count(),
- data.startIndex,
- data.numberOfCharacters,
- directions );
+ GetCharactersDirection(bidirectionalInfo,
+ logicalModel->mText.Count(),
+ data.startIndex,
+ data.numberOfCharacters,
+ directions);
- for( unsigned int index = 0u; index < logicalModel->mText.Count(); ++index )
+ for(unsigned int index = 0u; index < logicalModel->mText.Count(); ++index)
{
- if( data.directions[index] != directions[index] )
+ if(data.directions[index] != directions[index])
{
return false;
}
{
tet_infoline(" UtcDaliSetBidirectionalInfo");
- unsigned int indices01[] = {};
+ unsigned int indices01[] = {};
unsigned int numberOfCharacters01[] = {};
- bool direction01[] = {};
- unsigned int indices02[] = {};
+ bool direction01[] = {};
+ unsigned int indices02[] = {};
unsigned int numberOfCharacters02[] = {};
- bool direction02[] = {};
- unsigned int indices03[] = { 17u, 48u };
- unsigned int numberOfCharacters03[] = { 14u, 14u };
- bool direction03[] = { true, true };
- unsigned int indices04[] = { 17u, 31u, 79u };
- unsigned int numberOfCharacters04[] = { 14u, 48u, 31u };
- bool direction04[] = { true, false, true };
- unsigned int indices05[] = { 17u, 41u, 117u };
- unsigned int numberOfCharacters05[] = { 24u, 76u, 49u };
- bool direction05[] = { true, false, true };
- unsigned int indices06[] = { 17u, 48u };
- unsigned int numberOfCharacters06[] = { 14u, 14u };
- bool direction06[] = { true, true };
- unsigned int indices07[] = { 17u, 31u, 79u };
- unsigned int numberOfCharacters07[] = { 14u, 48u, 31u };
- bool direction07[] = { true, false, true };
- unsigned int indices08[] = { 17u, 41u, 117u };
- unsigned int numberOfCharacters08[] = { 24u, 76u, 49u };
- bool direction08[] = { true, false, true };
+ bool direction02[] = {};
+ unsigned int indices03[] = {17u, 48u};
+ unsigned int numberOfCharacters03[] = {14u, 14u};
+ bool direction03[] = {true, true};
+ unsigned int indices04[] = {17u, 31u, 79u};
+ unsigned int numberOfCharacters04[] = {14u, 48u, 31u};
+ bool direction04[] = {true, false, true};
+ unsigned int indices05[] = {17u, 41u, 117u};
+ unsigned int numberOfCharacters05[] = {24u, 76u, 49u};
+ bool direction05[] = {true, false, true};
+ unsigned int indices06[] = {17u, 48u};
+ unsigned int numberOfCharacters06[] = {14u, 14u};
+ bool direction06[] = {true, true};
+ unsigned int indices07[] = {17u, 31u, 79u};
+ unsigned int numberOfCharacters07[] = {14u, 48u, 31u};
+ bool direction07[] = {true, false, true};
+ unsigned int indices08[] = {17u, 41u, 117u};
+ unsigned int numberOfCharacters08[] = {24u, 76u, 49u};
+ bool direction08[] = {true, false, true};
struct SetBidirectionalInfoData data[] =
- {
{
- "Zero characters",
- "",
- 0u,
- 0u,
- 0u,
- indices01,
- numberOfCharacters01,
- direction01
- },
- {
- "Some left to right paragraphs",
- "Hello world\ndemo\n\n",
- 0u,
- 18u,
- 0u,
- indices02,
- numberOfCharacters02,
- direction02
- },
- {
- "A mix of left to right and right to left paragraphs.",
- "Hello world demo\nمرحبا بالعالم\nhello world demo\nمرحبا بالعالم\nhello world demo",
- 0u,
- 78u,
- 2u,
- indices03,
- numberOfCharacters03,
- direction03
- },
- {
- "A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text.",
- "Hello world demo\nمرحبا بالعالم\nhello world demo مرحبا بالعالم hello world demo\nمرحبا hello world demo بالعالم\nhello world demo",
- 0u,
- 126u,
- 3u,
- indices04,
- numberOfCharacters04,
- direction04
- },
- {
- "A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts.",
- "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
- 0u,
- 182u,
- 3u,
- indices05,
- numberOfCharacters05,
- direction05
- },
- {
- "A mix of left to right and right to left paragraphs. Updates a left to right paragraph.",
- "Hello world demo\nمرحبا بالعالم\nhello world demo\nمرحبا بالعالم\nhello world demo",
- 31u,
- 17u,
- 2u,
- indices06,
- numberOfCharacters06,
- direction06
- },
- {
- "A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text.",
- "Hello world demo\nمرحبا بالعالم\nhello world demo مرحبا بالعالم hello world demo\nمرحبا hello world demo بالعالم\nhello world demo",
- 0u,
- 126u,
- 3u,
- indices07,
- numberOfCharacters07,
- direction07
- },
- {
- "A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts. Updates initial paragraphs.",
- "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
- 0u,
- 41u,
- 3u,
- indices08,
- numberOfCharacters08,
- direction08
- },
- {
- "A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts. Updates mid paragraphs.",
- "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
- 41u,
- 76u,
- 3u,
- indices08,
- numberOfCharacters08,
- direction08
- },
- {
- "A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts. Updates from character 85",
- "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
- 117u,
- 65u,
- 3u,
- indices08,
- numberOfCharacters08,
- direction08
- },
- };
+ {"Zero characters",
+ "",
+ 0u,
+ 0u,
+ 0u,
+ indices01,
+ numberOfCharacters01,
+ direction01},
+
+ {"Some left to right paragraphs",
+ "Hello world\ndemo\n\n",
+ 0u,
+ 18u,
+ 0u,
+ indices02,
+ numberOfCharacters02,
+ direction02},
+
+ {"A mix of left to right and right to left paragraphs.",
+ "Hello world demo\nمرحبا بالعالم\nhello world demo\nمرحبا بالعالم\nhello world demo",
+ 0u,
+ 78u,
+ 2u,
+ indices03,
+ numberOfCharacters03,
+ direction03},
+
+ {"A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text.",
+ "Hello world demo\nمرحبا بالعالم\nhello world demo مرحبا بالعالم hello world demo\nمرحبا hello world demo بالعالم\nhello world demo",
+ 0u,
+ 126u,
+ 3u,
+ indices04,
+ numberOfCharacters04,
+ direction04},
+
+ {"A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts.",
+ "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
+ 0u,
+ 182u,
+ 3u,
+ indices05,
+ numberOfCharacters05,
+ direction05},
+
+ {"A mix of left to right and right to left paragraphs. Updates a left to right paragraph.",
+ "Hello world demo\nمرحبا بالعالم\nhello world demo\nمرحبا بالعالم\nhello world demo",
+ 31u,
+ 17u,
+ 2u,
+ indices06,
+ numberOfCharacters06,
+ direction06},
+
+ {"A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text.",
+ "Hello world demo\nمرحبا بالعالم\nhello world demo مرحبا بالعالم hello world demo\nمرحبا hello world demo بالعالم\nhello world demo",
+ 0u,
+ 126u,
+ 3u,
+ indices07,
+ numberOfCharacters07,
+ direction07},
+
+ {"A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts. Updates initial paragraphs.",
+ "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
+ 0u,
+ 41u,
+ 3u,
+ indices08,
+ numberOfCharacters08,
+ direction08},
+
+ {"A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts. Updates mid paragraphs.",
+ "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
+ 41u,
+ 76u,
+ 3u,
+ indices08,
+ numberOfCharacters08,
+ direction08},
+
+ {"A mix of left to right and right to left paragraphs. Paragraphs also contain a mix of bidirectional text and a mix of right to left scripts. Updates from character 85",
+ "Hello world demo\nمرحبا שלום עולם بالعالم\nhello world שלום بالعالم עולם demo مرحبا שלום עולם بالعالم hello world demo\nمرحبا hello שלום بالعالم עולם world demo بالعالم\nhello world demo",
+ 117u,
+ 65u,
+ 3u,
+ indices08,
+ numberOfCharacters08,
+ direction08},
+ };
const unsigned int numberOfTests = 10u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !SetBidirectionalInfoTest( data[index] ) )
+ if(!SetBidirectionalInfoTest(data[index]))
{
tet_result(TET_FAIL);
}
tet_infoline(" UtcDaliGetMirroredText");
struct GetMirroredTextData data[] =
- {
{
- "Zero characters.",
- "",
- 0u,
- 0u,
- ""
- },
- {
- "Left to right characters only.",
- "Hello world\nhello world demo.",
- 0u,
- 29u,
- "Hello world\nhello world demo."
- },
- {
- "Right to left characters but with no characters to mirror.",
- "שלום עולם\nمرحبا بالعالم",
- 0u,
- 23u,
- "שלום עולם\nمرحبا بالعالم"
- },
- {
- "Right to left characters with some characters to mirror.",
- "שלום עולם\n(مرحبا بالعالم)",
- 0u,
- 25u,
- "שלום עולם\n)مرحبا بالعالم("
- },
- {
- "Right to left characters with some characters to mirror. Update last paragraph.",
- "שלום עולם\n(مرحبا بالعالم)",
- 10u,
- 15u,
- "שלום עולם\n)مرحبا بالعالم("
- },
- {
- "Mix of bidirectional text. With more paragraphs.",
- "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)",
- 0u,
- 239u,
- "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום( עולם\nשלום مرحبا بالعالم עולם )hello( مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום )hello) world demo )עולם(\nשלום )مرحبا بالعالم עולם( )hello("
- },
- {
- "Mix of bidirectional text. With more paragraphs. Update middle paragraphs.",
- "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)",
- 29u,
- 38u,
- "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום( עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)"
- },
- {
- "Mix of bidirectional text. With more paragraphs. Update middle paragraphs (2).",
- "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)",
- 67u,
- 100u,
- "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם )hello( مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)"
- },
- };
+ {"Zero characters.",
+ "",
+ 0u,
+ 0u,
+ ""},
+
+ {"Left to right characters only.",
+ "Hello world\nhello world demo.",
+ 0u,
+ 29u,
+ "Hello world\nhello world demo."},
+
+ {"Right to left characters but with no characters to mirror.",
+ "שלום עולם\nمرحبا بالعالم",
+ 0u,
+ 23u,
+ "שלום עולם\nمرحبا بالعالم"},
+
+ {"Right to left characters with some characters to mirror.",
+ "שלום עולם\n(مرحبا بالعالم)",
+ 0u,
+ 25u,
+ "שלום עולם\n)مرحبا بالعالم("},
+
+ {"Right to left characters with some characters to mirror. Update last paragraph.",
+ "שלום עולם\n(مرحبا بالعالم)",
+ 10u,
+ 15u,
+ "שלום עולם\n)مرحبا بالعالم("},
+
+ {"Mix of bidirectional text. With more paragraphs.",
+ "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)",
+ 0u,
+ 239u,
+ "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום( עולם\nשלום مرحبا بالعالم עולם )hello( مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום )hello) world demo )עולם(\nשלום )مرحبا بالعالم עולם( )hello("},
+
+ {"Mix of bidirectional text. With more paragraphs. Update middle paragraphs.",
+ "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)",
+ 29u,
+ 38u,
+ "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום( עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)"},
+
+ {"Mix of bidirectional text. With more paragraphs. Update middle paragraphs (2).",
+ "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם (hello) مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)",
+ 67u,
+ 100u,
+ "Hello world demo\nhello world\nhello world (مرحبا بالعالم שלום) עולם\nשלום مرحبا بالعالم עולם )hello( مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום (hello) world demo (עולם)\nשלום (مرحبا بالعالم עולם) (hello)"},
+ };
const unsigned int numberOfTests = 8u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetMirroredTextTest( data[index] ) )
+ if(!GetMirroredTextTest(data[index]))
{
tet_result(TET_FAIL);
}
bool directions01[] = {};
bool directions02[] = {
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false };
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
bool directions03[] = {
- true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true };
+ true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
bool directions04[] = {
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, true, true, true, true, true, true,
- true, true, true, false, true, true, true, true, true, true,
- true, true, true, true, false, false, false, false, false, false,
- false, false, false, false, false };
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false};
bool directions05[] = {
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, false, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, false,
- false, false, false, false, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, false,
- false, false, false, false, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, false, false, false, false,
- false, false, false, false, false, false, false, false, false, false,
- false, false, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, true, true, true, true, true, true,
- true, true, false, false, false, false, false };
-
- bool directions06[] = {
- true, true, true, true, true, true, true, true, true, true,
- false, false, false, false, false, false, false, false, false, false,
- false, false, false, false, false, false };
+ false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false};
+
+ bool directions06[] = {
+ true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false};
struct GetCharactersDirectionData data[] =
- {
- {
- "Zero characters",
- "",
- 0u,
- 0u,
- directions01,
- false
- },
{
- "Left to right characters only",
- "Hello world\nhello world demo",
- 0u,
- 28u,
- directions02,
- false
- },
- {
- "Right to left characters only",
- "שלום עולם\nשלום עולם",
- 0u,
- 19u,
- directions03,
- false
- },
- {
- "Mix of bidirectional text",
- "Hello world\nhello world שלום עולם\nשלום עולם hello world",
- 0u,
- 55u,
- directions04,
- false
- },
- {
- "Mix of bidirectional text. With more paragraphs.",
- "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
- 0u,
- 227u,
- directions05,
- false
- },
- {
- "Mix of bidirectional text. With more paragraphs. Update first paragraph.",
- "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
- 0u,
- 17u,
- directions05,
- false
- },
- {
- "Mix of bidirectional text. With more paragraphs. Update from character 29",
- "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
- 29u,
- 134u,
- directions05,
- false
- },
- {
- "Mix of bidirectional text. With more paragraphs. Update from character 163",
- "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
- " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
- 163u,
- 35u,
- directions05,
- false
- },
- {
- "Mix of bidirectional text. With brackets and LRM",
- "שלום עולם ‎(hello)[world]‎",
- 0u,
- 26u,
- directions06,
- true
- }
- };
+ {"Zero characters",
+ "",
+ 0u,
+ 0u,
+ directions01,
+ false},
+
+ {"Left to right characters only",
+ "Hello world\nhello world demo",
+ 0u,
+ 28u,
+ directions02,
+ false},
+
+ {"Right to left characters only",
+ "שלום עולם\nשלום עולם",
+ 0u,
+ 19u,
+ directions03,
+ false},
+
+ {"Mix of bidirectional text",
+ "Hello world\nhello world שלום עולם\nשלום עולם hello world",
+ 0u,
+ 55u,
+ directions04,
+ false},
+
+ {"Mix of bidirectional text. With more paragraphs.",
+ "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
+ 0u,
+ 227u,
+ directions05,
+ false},
+
+ {"Mix of bidirectional text. With more paragraphs. Update first paragraph.",
+ "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
+ 0u,
+ 17u,
+ directions05,
+ false},
+
+ {"Mix of bidirectional text. With more paragraphs. Update from character 29",
+ "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
+ 29u,
+ 134u,
+ directions05,
+ false},
+
+ {"Mix of bidirectional text. With more paragraphs. Update from character 163",
+ "Hello world demo\nhello world\nhello world مرحبا بالعالم שלום עולם\nשלום مرحبا بالعالم עולם hello مرحبا بالعالم world"
+ " مرحبا بالعالم שלום עולם hello world hello world\nبالعالم שלום hello world demo עולם\nשלום مرحبا بالعالم עולם hello",
+ 163u,
+ 35u,
+ directions05,
+ false},
+
+ {"Mix of bidirectional text. With brackets and LRM",
+ "שלום עולם ‎(hello)[world]‎",
+ 0u,
+ 26u,
+ directions06,
+ true}};
+
const unsigned int numberOfTests = 9u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetCharactersDirectionTest( data[index] ) )
+ if(!GetCharactersDirectionTest(data[index]))
{
tet_result(TET_FAIL);
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
#include <stdlib.h>
#include <unistd.h>
+#include <iostream>
#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/internal/text/text-run-container.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/internal/text/text-run-container.h>
#include <toolkit-text-utils.h>
-
using namespace Dali;
using namespace Toolkit;
using namespace Text;
namespace
{
-const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+const std::string DEFAULT_FONT_DIR("/resources/fonts");
struct CreateParagraphData
{
struct GetLogicalCharacterIndexData
{
- std::string description; ///< Description of the test.
- std::string text; ///< Input text.
- Size textArea; ///< The text area.
- unsigned int numberOfIndices; ///< The number of characters to set.
- unsigned int* visualToLogical; ///< The expected visual to logical conversion table.
- unsigned int* cachedBidiLine; ///< The cached bidi line index for each character.
+ std::string description; ///< Description of the test.
+ std::string text; ///< Input text.
+ Size textArea; ///< The text area.
+ unsigned int numberOfIndices; ///< The number of characters to set.
+ unsigned int* visualToLogical; ///< The expected visual to logical conversion table.
+ unsigned int* cachedBidiLine; ///< The cached bidi line index for each character.
};
struct GetLogicalCursorIndexData
unsigned int* cachedBidiLine; ///< The cached bidi line index for each character.
};
-bool CreateParagraphTest( const CreateParagraphData& data )
+bool CreateParagraphTest(const CreateParagraphData& data)
{
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(100.f, 60.f);
- Size layoutSize;
+ Size textArea(100.f, 60.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
// 2) Clear the paragraphs.
Vector<ParagraphRun>& paragraphs = logicalModel->mParagraphInfo;
- ClearCharacterRuns( data.index,
- data.index + data.numberOfCharacters - 1u,
- paragraphs );
+ ClearCharacterRuns(data.index,
+ data.index + data.numberOfCharacters - 1u,
+ paragraphs);
// 3) Call the LogicalModel::CreateParagraphInfo() method
- logicalModel->CreateParagraphInfo( data.index,
- data.numberOfCharacters );
+ logicalModel->CreateParagraphInfo(data.index,
+ data.numberOfCharacters);
// 4) Compare the results.
- if( data.numberOfParagraphs != paragraphs.Count() )
+ if(data.numberOfParagraphs != paragraphs.Count())
{
std::cout << " Different number of paragraphs : " << paragraphs.Count() << ", expected : " << data.numberOfParagraphs << std::endl;
return false;
}
unsigned int index = 0u;
- for( Vector<ParagraphRun>::ConstIterator it = paragraphs.Begin(),
- endIt = paragraphs.End();
- it != endIt;
- ++it, ++index )
+ for(Vector<ParagraphRun>::ConstIterator it = paragraphs.Begin(),
+ endIt = paragraphs.End();
+ it != endIt;
+ ++it, ++index)
{
- const ParagraphRun& paragraph( *it );
+ const ParagraphRun& paragraph(*it);
- if( data.indices[index] != paragraph.characterRun.characterIndex )
+ if(data.indices[index] != paragraph.characterRun.characterIndex)
{
std::cout << " Different character index for paragraph : " << index << ", " << paragraph.characterRun.characterIndex << ", expected : " << data.indices[index] << std::endl;
return false;
}
- if( data.numberOfCharactersPerParagraph[index] != paragraph.characterRun.numberOfCharacters )
+ if(data.numberOfCharactersPerParagraph[index] != paragraph.characterRun.numberOfCharacters)
{
std::cout << " Different number of characters for paragraph : " << index << ", " << paragraph.characterRun.numberOfCharacters << ", expected : " << data.numberOfCharactersPerParagraph[index] << std::endl;
return false;
return true;
}
-bool FindParagraphTest( const FindParagraphData& data )
+bool FindParagraphTest(const FindParagraphData& data)
{
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(100.f, 60.f);
- Size layoutSize;
+ Size textArea(100.f, 60.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
// 2) Find the paragraphs.
Vector<ParagraphRunIndex> paragraphs;
- logicalModel->FindParagraphs( data.index, data.numberOfCharacters, paragraphs );
+ logicalModel->FindParagraphs(data.index, data.numberOfCharacters, paragraphs);
// 3) compare the results.
- if( data.numberOfParagraphs != paragraphs.Count() )
+ if(data.numberOfParagraphs != paragraphs.Count())
{
return false;
}
unsigned int index = 0u;
- for( Vector<ParagraphRunIndex>::ConstIterator it = paragraphs.Begin(),
- endIt = paragraphs.End();
- it != endIt;
- ++it, ++index )
+ for(Vector<ParagraphRunIndex>::ConstIterator it = paragraphs.Begin(),
+ endIt = paragraphs.End();
+ it != endIt;
+ ++it, ++index)
{
const ParagraphRunIndex paragraphIndex = *it;
- if( paragraphIndex != data.paragraphs[index] )
+ if(paragraphIndex != data.paragraphs[index])
{
return false;
}
return true;
}
-bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data )
+bool FetchBidirectionalLineInfoTest(const FetchBidirectionalLineInfoData& data)
{
std::cout << " testing : " << data.description << std::endl;
// Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea( 100.f, 300.f );
- Size layoutSize;
+ Size textArea(100.f, 300.f);
+ Size layoutSize;
// Create the model with the whole text.
const Vector<FontDescriptionRun> fontDescriptions;
- const LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptions,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ const LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptions,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
- for( unsigned int index = 0; index < data.numberOfTests; ++index )
+ for(unsigned int index = 0; index < data.numberOfTests; ++index)
{
- const bool fetched = logicalModel->FetchBidirectionalLineInfo( data.characterIndex[index] );
+ const bool fetched = logicalModel->FetchBidirectionalLineInfo(data.characterIndex[index]);
- if( fetched != data.fetched[index] )
+ if(fetched != data.fetched[index])
{
std::cout << " Different fetched result : " << fetched << ", expected : " << data.fetched[index] << std::endl;
return false;
}
- if( fetched )
+ if(fetched)
{
- if( logicalModel->mBidirectionalLineIndex != data.bidiLineIndex[index] )
+ if(logicalModel->mBidirectionalLineIndex != data.bidiLineIndex[index])
{
std::cout << " Different bidi line index : " << logicalModel->mBidirectionalLineIndex << ", expected : " << data.bidiLineIndex << std::endl;
return false;
return true;
}
-bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
+bool GetLogicalCharacterIndexTest(const GetLogicalCharacterIndexData& data)
{
std::cout << " testing : " << data.description << std::endl;
// Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size layoutSize;
+ Size layoutSize;
// Create the model with the whole text.
const Vector<FontDescriptionRun> fontDescriptions;
- const LayoutOptions options;
- CreateTextModel( data.text,
- data.textArea,
- fontDescriptions,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ const LayoutOptions options;
+ CreateTextModel(data.text,
+ data.textArea,
+ fontDescriptions,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
- for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
+ for(unsigned int index = 0u; index < data.numberOfIndices; ++index)
{
// Check the current cached bidi line index. (Check it before call the GetLogicalCharacterIndex() method )
- if( data.cachedBidiLine[index] != logicalModel->mBidirectionalLineIndex )
+ if(data.cachedBidiLine[index] != logicalModel->mBidirectionalLineIndex)
{
std::cout << " index : " << index << ", different cached bidi index : " << logicalModel->mBidirectionalLineIndex << ", expected : " << data.cachedBidiLine[index] << std::endl;
return false;
}
- const bool fetched = logicalModel->FetchBidirectionalLineInfo( index );
- const Character logicalIndex = fetched ? logicalModel->GetLogicalCharacterIndex( index ) : index;
+ const bool fetched = logicalModel->FetchBidirectionalLineInfo(index);
+ const Character logicalIndex = fetched ? logicalModel->GetLogicalCharacterIndex(index) : index;
- if( data.visualToLogical[index] != logicalIndex )
+ if(data.visualToLogical[index] != logicalIndex)
{
std::cout << " visual index : " << index << ", different logical index : " << logicalIndex << ", expected : " << data.visualToLogical[index] << std::endl;
return false;
return true;
}
-bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
+bool GetLogicalCursorIndexTest(const GetLogicalCursorIndexData& data)
{
- tet_printf( " testing : %s\n", data.description.c_str() );
+ tet_printf(" testing : %s\n", data.description.c_str());
// Load some fonts.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- fontClient.SetDpi( 96u, 96u );
+ fontClient.SetDpi(96u, 96u);
- char* pathNamePtr = get_current_dir_name();
- const std::string pathName( pathNamePtr );
- free( pathNamePtr );
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf");
// Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size layoutSize;
+ Size layoutSize;
// Create the model with the whole text.
Vector<FontDescriptionRun> fontDescriptionRuns;
- if( 0u != data.numberOfFonts )
+ if(0u != data.numberOfFonts)
{
- fontDescriptionRuns.Insert( fontDescriptionRuns.End(),
- data.fontDescriptions,
- data.fontDescriptions + data.numberOfFonts );
+ fontDescriptionRuns.Insert(fontDescriptionRuns.End(),
+ data.fontDescriptions,
+ data.fontDescriptions + data.numberOfFonts);
}
const LayoutOptions options;
- CreateTextModel( data.text,
- data.textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ CreateTextModel(data.text,
+ data.textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
- for( unsigned int index = 0u; index < data.numberOfIndices; ++index )
+ for(unsigned int index = 0u; index < data.numberOfIndices; ++index)
{
- const bool fetched = logicalModel->FetchBidirectionalLineInfo( data.characterIndex[index] );
- tet_printf(" fetched %d, line index %d, expected line index %d\n", fetched, logicalModel->mBidirectionalLineIndex, data.cachedBidiLine[index] );
+ const bool fetched = logicalModel->FetchBidirectionalLineInfo(data.characterIndex[index]);
+ tet_printf(" fetched %d, line index %d, expected line index %d\n", fetched, logicalModel->mBidirectionalLineIndex, data.cachedBidiLine[index]);
- if( logicalModel->mBidirectionalLineIndex != data.cachedBidiLine[index] )
+ if(logicalModel->mBidirectionalLineIndex != data.cachedBidiLine[index])
{
- tet_printf( " test : %d, different cached line index : %d, expected : %d\n", index, logicalModel->mBidirectionalLineIndex, data.cachedBidiLine[index] );
+ tet_printf(" test : %d, different cached line index : %d, expected : %d\n", index, logicalModel->mBidirectionalLineIndex, data.cachedBidiLine[index]);
return false;
}
const CharacterIndex visualCharacterIndex = data.visualCursorIndex[index];
- const CharacterIndex logicalCursorIndex = fetched ? logicalModel->GetLogicalCursorIndex( visualCharacterIndex ) : visualCharacterIndex;
+ const CharacterIndex logicalCursorIndex = fetched ? logicalModel->GetLogicalCursorIndex(visualCharacterIndex) : visualCharacterIndex;
tet_printf(" visual index %d, logical index %d\n", visualCharacterIndex, logicalCursorIndex);
- if( logicalCursorIndex != data.logicalCursorIndex[index] )
+ if(logicalCursorIndex != data.logicalCursorIndex[index])
{
- tet_printf( " test : %d, visual index : %d, different logical cursor index :%d, expected : %d\n", index, visualCharacterIndex, logicalCursorIndex, data.logicalCursorIndex[index] );
+ tet_printf(" test : %d, visual index : %d, different logical cursor index :%d, expected : %d\n", index, visualCharacterIndex, logicalCursorIndex, data.logicalCursorIndex[index]);
return false;
}
}
{
tet_infoline(" UtcDaliCreateParagraph");
- unsigned int paragraphsIndices01[] = { 0u };
- unsigned int paragraphsNumberOfCharacters01[] = { 0u };
- unsigned int paragraphsIndices02[] = { 0u, 12u, 17u };
- unsigned int paragraphsNumberOfCharacters02[] = { 12u, 5u, 1u };
- unsigned int paragraphsIndices03[] = { 0u, 12u, 17u, 34u };
- unsigned int paragraphsNumberOfCharacters03[] = { 12u, 5u, 17u ,1u };
+ unsigned int paragraphsIndices01[] = {0u};
+ unsigned int paragraphsNumberOfCharacters01[] = {0u};
+ unsigned int paragraphsIndices02[] = {0u, 12u, 17u};
+ unsigned int paragraphsNumberOfCharacters02[] = {12u, 5u, 1u};
+ unsigned int paragraphsIndices03[] = {0u, 12u, 17u, 34u};
+ unsigned int paragraphsNumberOfCharacters03[] = {12u, 5u, 17u, 1u};
struct CreateParagraphData data[] =
- {
- {
- "Zero characters",
- "",
- 0u,
- 0u,
- 0u,
- paragraphsIndices01,
- paragraphsNumberOfCharacters01,
- },
{
- "Some paragraphs",
- "Hello world\ndemo\n\n",
- 0u,
- 18u,
- 3u,
- paragraphsIndices02,
- paragraphsNumberOfCharacters02,
- },
- {
- "Some paragraphs. Update the initial paragraphs.",
- "Hello world\ndemo\nhello world demo\n\n",
- 0u,
- 17u,
- 4u,
- paragraphsIndices03,
- paragraphsNumberOfCharacters03,
- },
- {
- "Some paragraphs. Update the mid paragraphs.",
- "Hello world\ndemo\nhello world demo\n\n",
- 12u,
- 5u,
- 4u,
- paragraphsIndices03,
- paragraphsNumberOfCharacters03,
- },
- {
- "Some paragraphs. Update the final paragraphs.",
- "Hello world\ndemo\nhello world demo\n\n",
- 17u,
- 18u,
- 4u,
- paragraphsIndices03,
- paragraphsNumberOfCharacters03,
- },
- };
+ {
+ "Zero characters",
+ "",
+ 0u,
+ 0u,
+ 0u,
+ paragraphsIndices01,
+ paragraphsNumberOfCharacters01,
+ },
+ {
+ "Some paragraphs",
+ "Hello world\ndemo\n\n",
+ 0u,
+ 18u,
+ 3u,
+ paragraphsIndices02,
+ paragraphsNumberOfCharacters02,
+ },
+ {
+ "Some paragraphs. Update the initial paragraphs.",
+ "Hello world\ndemo\nhello world demo\n\n",
+ 0u,
+ 17u,
+ 4u,
+ paragraphsIndices03,
+ paragraphsNumberOfCharacters03,
+ },
+ {
+ "Some paragraphs. Update the mid paragraphs.",
+ "Hello world\ndemo\nhello world demo\n\n",
+ 12u,
+ 5u,
+ 4u,
+ paragraphsIndices03,
+ paragraphsNumberOfCharacters03,
+ },
+ {
+ "Some paragraphs. Update the final paragraphs.",
+ "Hello world\ndemo\nhello world demo\n\n",
+ 17u,
+ 18u,
+ 4u,
+ paragraphsIndices03,
+ paragraphsNumberOfCharacters03,
+ },
+ };
const unsigned int numberOfTests = 5u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !CreateParagraphTest( data[index] ) )
+ if(!CreateParagraphTest(data[index]))
{
tet_result(TET_FAIL);
}
tet_infoline(" UtcDaliFindParagraph");
unsigned int paragraphs01[] = {};
- unsigned int paragraphs02[] = { 0u, 1u, 2u };
- unsigned int paragraphs03[] = { 0u };
- unsigned int paragraphs04[] = { 1u };
- unsigned int paragraphs05[] = { 0u, 1u, 2u };
+ unsigned int paragraphs02[] = {0u, 1u, 2u};
+ unsigned int paragraphs03[] = {0u};
+ unsigned int paragraphs04[] = {1u};
+ unsigned int paragraphs05[] = {0u, 1u, 2u};
struct FindParagraphData data[] =
- {
- {
- "Zero characters",
- "",
- 0u,
- 100u,
- 0u,
- paragraphs01,
- },
- {
- "Some paragraphs",
- "Hello world\ndemo\n\n",
- 0u,
- 18u,
- 3u,
- paragraphs02
- },
{
- "Some paragraphs",
- "Hello world\ndemo\n\n",
- 0u,
- 12u,
- 1u,
- paragraphs03
- },
- {
- "Some paragraphs",
- "Hello world\ndemo\n\n",
- 12u,
- 5u,
- 1u,
- paragraphs04
- },
- {
- "Some paragraphs",
- "Hello world\ndemo\n\n",
- 3u,
- 15u,
- 3u,
- paragraphs05
- },
- };
+ {
+ "Zero characters",
+ "",
+ 0u,
+ 100u,
+ 0u,
+ paragraphs01,
+ },
+ {"Some paragraphs",
+ "Hello world\ndemo\n\n",
+ 0u,
+ 18u,
+ 3u,
+ paragraphs02},
+ {"Some paragraphs",
+ "Hello world\ndemo\n\n",
+ 0u,
+ 12u,
+ 1u,
+ paragraphs03},
+ {"Some paragraphs",
+ "Hello world\ndemo\n\n",
+ 12u,
+ 5u,
+ 1u,
+ paragraphs04},
+ {"Some paragraphs",
+ "Hello world\ndemo\n\n",
+ 3u,
+ 15u,
+ 3u,
+ paragraphs05},
+ };
const unsigned int numberOfTests = 5u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !FindParagraphTest( data[index] ) )
+ if(!FindParagraphTest(data[index]))
{
tet_result(TET_FAIL);
}
{
tet_infoline(" UtcDaliFetchBidirectionalLineInfo");
- unsigned int logicalIndex01[] = { 0u };
- bool fetched01[] = { false };
- unsigned int bidiLine01[] = { 0u };
+ unsigned int logicalIndex01[] = {0u};
+ bool fetched01[] = {false};
+ unsigned int bidiLine01[] = {0u};
- unsigned int logicalIndex02[] = { 3u };
- bool fetched02[] = { false };
- unsigned int bidiLine02[] = { 0u };
+ unsigned int logicalIndex02[] = {3u};
+ bool fetched02[] = {false};
+ unsigned int bidiLine02[] = {0u};
- unsigned int logicalIndex03[] = { 0u, 11u, 12u, 21u, 22u, 33u, 34u, 43u, 44u, 54u};
- bool fetched03[] = { false, false, true, true, false, false, true, true, false, false };
- unsigned int bidiLine03[] = { 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 0u, 0u };
+ unsigned int logicalIndex03[] = {0u, 11u, 12u, 21u, 22u, 33u, 34u, 43u, 44u, 54u};
+ bool fetched03[] = {false, false, true, true, false, false, true, true, false, false};
+ unsigned int bidiLine03[] = {0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 0u, 0u};
struct FetchBidirectionalLineInfoData data[] =
- {
- {
- "Void text",
- "",
- 1u,
- logicalIndex01,
- fetched01,
- bidiLine01
- },
{
- "LTR text",
- "Hello world",
- 1u,
- logicalIndex02,
- fetched02,
- bidiLine02
- },
- {
- "Bidi text",
- "Hello world\nשלום עולם\nhello world\nשלום עולם\nhello world",
- 10u,
- logicalIndex03,
- fetched03,
- bidiLine03
- }
- };
+ {"Void text",
+ "",
+ 1u,
+ logicalIndex01,
+ fetched01,
+ bidiLine01},
+ {"LTR text",
+ "Hello world",
+ 1u,
+ logicalIndex02,
+ fetched02,
+ bidiLine02},
+ {"Bidi text",
+ "Hello world\nשלום עולם\nhello world\nשלום עולם\nhello world",
+ 10u,
+ logicalIndex03,
+ fetched03,
+ bidiLine03}};
const unsigned int numberOfTests = 3u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !FetchBidirectionalLineInfoTest( data[index] ) )
+ if(!FetchBidirectionalLineInfoTest(data[index]))
{
tet_result(TET_FAIL);
}
tet_infoline(" UtcDaliSetVisualToLogicalMap");
unsigned int visualToLogical01[] = {};
- unsigned int cachedBidiLine01[] = {};
- unsigned int visualToLogical02[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u };
- unsigned int cachedBidiLine02[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u };
- unsigned int visualToLogical03[] = { 12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u };
- unsigned int cachedBidiLine03[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u };
-
- unsigned int visualToLogical04[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 25u, 24u, 23u, 22u, 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 81u, 80u, 79u, 78u, 77u, 76u, 75u, 74u, 73u, 72u, 71u, 70u, 69u, 68u, 67u, 66u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u, 43u, 42u, 41u, 40u, 95u, 94u, 93u, 92u, 91u, 90u, 89u, 88u, 87u, 86u, 85u, 84u, 83u, 82u, 96u, 97u, 98u, 99u, 100u, 101u, 102u, 103u, 104u, 105u, 106u };
- unsigned int cachedBidiLine04[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 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, 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, 2u, 2u };
-
-// size 300, 300
-// LO H e l l o _ w o r l d , _ م ر ح ب ا _ ب ا ل ع ا ل م , _ h e l l o _ w o r l d \n
-// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
-// VO H e l l o _ w o r l d , _ م ل ا ع ل ا ب _ ا ب ح ر م , _ h e l l o _ w o r l d \n
-// 0 1 2 3 4 5 6 7 8 9 10 11 12 25 24 23 22 21 20 19 18 17 16 15 14 13 26 27 28 29 30 31 32 33 34 35 36 37 38 39
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م , _ h e l l o _ w o r l d , _ م ر ح ب ا _ ب ا ل ع ا ل م \n
-// 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
-// VO \n م ل ا ع ل ا ب _ ا ب ح ر م _ , h e l l o _ w o r l d _ , م ل ا ع ل ا ب _ ا ب ح ر م
-// 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 55 56 57 58 59 60 61 62 63 64 65 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م \n
-// 82 83 84 85 86 87 88 89 90 91 92 93 94 95
-// VO \n م ل ا ع ل ا ب _ ا ب ح ر م
-// 95 94 93 92 91 90 89 88 87 86 85 84 83 82
-
-
-// LO h e l l o _ w o r l d
-// 96 97 98 99 100 101 102 103 104 105 106
-// VO h e l l o _ w o r l d
-// 96 97 98 99 100 101 102 103 104 105 106
-
- unsigned int visualToLogical05[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 25u, 24u, 23u, 22u, 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 67u, 66u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u, 43u, 42u, 41u, 40u, 81u, 80u, 79u, 78u, 77u, 76u, 75u, 74u, 73u, 72u, 71u, 70u, 69u, 68u, 95u, 94u, 93u, 92u, 91u, 90u, 89u, 88u, 87u, 86u, 85u, 84u, 83u, 82u, 96u, 97u, 98u, 99u, 100u, 101u, 102u, 103u, 104u, 105u, 106u };
- unsigned int cachedBidiLine05[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 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, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u };
-
-// size 300, 300
-// LO H e l l o _ w o r l d , _ م ر ح ب ا _ ب ا ل ع ا ل م , _
-// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
-// VO H e l l o _ w o r l d , _ م ل ا ع ل ا ب _ ا ب ح ر م , _
-// 0 1 2 3 4 5 6 7 8 9 10 11 12 25 24 23 22 21 20 19 18 17 16 15 14 13 26 27
-
-// LO h e l l o _ w o r l d \n
-// 28 29 30 31 32 33 34 35 36 37 38 39
-// VO h e l l o _ w o r l d \n
-// 28 29 30 31 32 33 34 35 36 37 38 39
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م , _ h e l l o _ w o r l d , _
-// 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
-// VO _ , h e l l o _ w o r l d _ , م ل ا ع ل ا ب _ ا ب ح ر م
-// 67 66 55 56 57 58 59 60 61 62 63 64 65 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م \n
-// 68 69 70 71 72 73 74 75 76 77 78 79 80 81
-// VO \n م ل ا ع ل ا ب _ ا ب ح ر م
-// 81 80 79 78 77 76 75 74 73 72 71 70 69 68
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م \n
-// 82 83 84 85 86 87 88 89 90 91 92 93 94 95
-// VO \n م ل ا ع ل ا ب _ ا ب ح ر م
-// 95 94 93 92 91 90 89 88 87 86 85 84 83 82
-
-
-// LO h e l l o _ w o r l d
-// 96 97 98 99 100 101 102 103 104 105 106
-// VO h e l l o _ w o r l d
-// 96 97 98 99 100 101 102 103 104 105 106
-
- unsigned int visualToLogical06[] = { 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 25u, 24u, 23u, 22u, 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u, 43u, 42u, 41u, 40u, 67u, 66u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 81u, 80u, 79u, 78u, 77u, 76u, 75u, 74u, 73u, 72u, 71u, 70u, 69u, 68u, 95u, 94u, 93u, 92u, 91u, 90u, 89u, 88u, 87u, 86u, 85u, 84u, 83u, 82u, 96u, 97u, 98u, 99u, 100u, 101u, 102u, 103u, 104u, 105u, 106u };
- unsigned int cachedBidiLine06[] = { 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, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u,
- 2u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u,
- 3u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u,
- 4u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u,
- 5u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u,
- 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u };
-
-// size 100, 600
-// LO H e l l o _ w o r l d , _
-// 0 1 2 3 4 5 6 7 8 9 10 11 12
-// VO H e l l o _ w o r l d , _
-// 0 1 2 3 4 5 6 7 8 9 10 11 12
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م , _
-// 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
-// VO م ل ا ع ل ا ب _ ا ب ح ر م , _
-// 25 24 23 22 21 20 19 18 17 16 15 14 13 26 27
-
-// LO h e l l o _ w o r l d \n
-// 28 29 30 31 32 33 34 35 36 37 38 39
-// VO h e l l o _ w o r l d \n
-// 28 29 30 31 32 33 34 35 36 37 38 39
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م , _
-// 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
-// VO _ , م ل ا ع ل ا ب _ ا ب ح ر م
-// 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
-
-// LO h e l l o _ w o r l d , _
-// 55 56 57 58 59 60 61 62 63 64 65 66 67
-// VO _ , h e l l o _ w o r l d
-// 67 66 55 56 57 58 59 60 61 62 63 64 65
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م \n
-// 68 69 70 71 72 73 74 75 76 77 78 79 80 81
-// VO \n م ل ا ع ل ا ب _ ا ب ح ر م
-// 81 80 79 78 77 76 75 74 73 72 71 70 69 68
-
-// LO م ر ح ب ا _ ب ا ل ع ا ل م \n
-// 82 83 84 85 86 87 88 89 90 91 92 93 94 95
-// VO \n م ل ا ع ل ا ب _ ا ب ح ر م
-// 95 94 93 92 91 90 89 88 87 86 85 84 83 82
-
-
-// LO h e l l o _ w o r l d
-// 96 97 98 99 100 101 102 103 104 105 106
-// VO h e l l o _ w o r l d
-// 96 97 98 99 100 101 102 103 104 105 106
+ unsigned int cachedBidiLine01[] = {};
+ unsigned int visualToLogical02[] = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u};
+ unsigned int cachedBidiLine02[] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u};
+ unsigned int visualToLogical03[] = {12u, 11u, 10u, 9u, 8u, 7u, 6u, 5u, 4u, 3u, 2u, 1u, 0u};
+ unsigned int cachedBidiLine03[] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u};
+
+ unsigned int visualToLogical04[] = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 25u, 24u, 23u, 22u, 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 81u, 80u, 79u, 78u, 77u, 76u, 75u, 74u, 73u, 72u, 71u, 70u, 69u, 68u, 67u, 66u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u, 43u, 42u, 41u, 40u, 95u, 94u, 93u, 92u, 91u, 90u, 89u, 88u, 87u, 86u, 85u, 84u, 83u, 82u, 96u, 97u, 98u, 99u, 100u, 101u, 102u, 103u, 104u, 105u, 106u};
+ unsigned int cachedBidiLine04[] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 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, 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, 2u, 2u};
+
+ // size 300, 300
+ // LO H e l l o _ w o r l d , _ م ر ح ب ا _ ب ا ل ع ا ل م , _ h e l l o _ w o r l d \n
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
+ // VO H e l l o _ w o r l d , _ م ل ا ع ل ا ب _ ا ب ح ر م , _ h e l l o _ w o r l d \n
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 25 24 23 22 21 20 19 18 17 16 15 14 13 26 27 28 29 30 31 32 33 34 35 36 37 38 39
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م , _ h e l l o _ w o r l d , _ م ر ح ب ا _ ب ا ل ع ا ل م \n
+ // 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
+ // VO \n م ل ا ع ل ا ب _ ا ب ح ر م _ , h e l l o _ w o r l d _ , م ل ا ع ل ا ب _ ا ب ح ر م
+ // 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 55 56 57 58 59 60 61 62 63 64 65 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م \n
+ // 82 83 84 85 86 87 88 89 90 91 92 93 94 95
+ // VO \n م ل ا ع ل ا ب _ ا ب ح ر م
+ // 95 94 93 92 91 90 89 88 87 86 85 84 83 82
+
+ // LO h e l l o _ w o r l d
+ // 96 97 98 99 100 101 102 103 104 105 106
+ // VO h e l l o _ w o r l d
+ // 96 97 98 99 100 101 102 103 104 105 106
+
+ unsigned int visualToLogical05[] = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 25u, 24u, 23u, 22u, 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 67u, 66u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u, 43u, 42u, 41u, 40u, 81u, 80u, 79u, 78u, 77u, 76u, 75u, 74u, 73u, 72u, 71u, 70u, 69u, 68u, 95u, 94u, 93u, 92u, 91u, 90u, 89u, 88u, 87u, 86u, 85u, 84u, 83u, 82u, 96u, 97u, 98u, 99u, 100u, 101u, 102u, 103u, 104u, 105u, 106u};
+ unsigned int cachedBidiLine05[] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 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, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u};
+
+ // size 300, 300
+ // LO H e l l o _ w o r l d , _ م ر ح ب ا _ ب ا ل ع ا ل م , _
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
+ // VO H e l l o _ w o r l d , _ م ل ا ع ل ا ب _ ا ب ح ر م , _
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 25 24 23 22 21 20 19 18 17 16 15 14 13 26 27
+
+ // LO h e l l o _ w o r l d \n
+ // 28 29 30 31 32 33 34 35 36 37 38 39
+ // VO h e l l o _ w o r l d \n
+ // 28 29 30 31 32 33 34 35 36 37 38 39
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م , _ h e l l o _ w o r l d , _
+ // 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
+ // VO _ , h e l l o _ w o r l d _ , م ل ا ع ل ا ب _ ا ب ح ر م
+ // 67 66 55 56 57 58 59 60 61 62 63 64 65 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م \n
+ // 68 69 70 71 72 73 74 75 76 77 78 79 80 81
+ // VO \n م ل ا ع ل ا ب _ ا ب ح ر م
+ // 81 80 79 78 77 76 75 74 73 72 71 70 69 68
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م \n
+ // 82 83 84 85 86 87 88 89 90 91 92 93 94 95
+ // VO \n م ل ا ع ل ا ب _ ا ب ح ر م
+ // 95 94 93 92 91 90 89 88 87 86 85 84 83 82
+
+ // LO h e l l o _ w o r l d
+ // 96 97 98 99 100 101 102 103 104 105 106
+ // VO h e l l o _ w o r l d
+ // 96 97 98 99 100 101 102 103 104 105 106
+
+ unsigned int visualToLogical06[] = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 25u, 24u, 23u, 22u, 21u, 20u, 19u, 18u, 17u, 16u, 15u, 14u, 13u, 26u, 27u, 28u, 29u, 30u, 31u, 32u, 33u, 34u, 35u, 36u, 37u, 38u, 39u, 54u, 53u, 52u, 51u, 50u, 49u, 48u, 47u, 46u, 45u, 44u, 43u, 42u, 41u, 40u, 67u, 66u, 55u, 56u, 57u, 58u, 59u, 60u, 61u, 62u, 63u, 64u, 65u, 81u, 80u, 79u, 78u, 77u, 76u, 75u, 74u, 73u, 72u, 71u, 70u, 69u, 68u, 95u, 94u, 93u, 92u, 91u, 90u, 89u, 88u, 87u, 86u, 85u, 84u, 83u, 82u, 96u, 97u, 98u, 99u, 100u, 101u, 102u, 103u, 104u, 105u, 106u};
+ unsigned int cachedBidiLine06[] = {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, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 2u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 3u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 4u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 5u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u, 6u};
+
+ // size 100, 600
+ // LO H e l l o _ w o r l d , _
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ // VO H e l l o _ w o r l d , _
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م , _
+ // 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
+ // VO م ل ا ع ل ا ب _ ا ب ح ر م , _
+ // 25 24 23 22 21 20 19 18 17 16 15 14 13 26 27
+
+ // LO h e l l o _ w o r l d \n
+ // 28 29 30 31 32 33 34 35 36 37 38 39
+ // VO h e l l o _ w o r l d \n
+ // 28 29 30 31 32 33 34 35 36 37 38 39
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م , _
+ // 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
+ // VO _ , م ل ا ع ل ا ب _ ا ب ح ر م
+ // 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40
+
+ // LO h e l l o _ w o r l d , _
+ // 55 56 57 58 59 60 61 62 63 64 65 66 67
+ // VO _ , h e l l o _ w o r l d
+ // 67 66 55 56 57 58 59 60 61 62 63 64 65
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م \n
+ // 68 69 70 71 72 73 74 75 76 77 78 79 80 81
+ // VO \n م ل ا ع ل ا ب _ ا ب ح ر م
+ // 81 80 79 78 77 76 75 74 73 72 71 70 69 68
+
+ // LO م ر ح ب ا _ ب ا ل ع ا ل م \n
+ // 82 83 84 85 86 87 88 89 90 91 92 93 94 95
+ // VO \n م ل ا ع ل ا ب _ ا ب ح ر م
+ // 95 94 93 92 91 90 89 88 87 86 85 84 83 82
+
+ // LO h e l l o _ w o r l d
+ // 96 97 98 99 100 101 102 103 104 105 106
+ // VO h e l l o _ w o r l d
+ // 96 97 98 99 100 101 102 103 104 105 106
struct GetLogicalCharacterIndexData data[] =
- {
- {
- "Zero characters text",
- "",
- Size( 300.f, 300.f ),
- 0u,
- visualToLogical01,
- cachedBidiLine01
- },
- {
- "Left to right text only",
- "Hello world",
- Size( 300.f, 300.f ),
- 11u,
- visualToLogical02,
- cachedBidiLine02
- },
{
- "Right to left text only",
- "مرحبا بالعالم",
- Size( 300.f, 300.f ),
- 13u,
- visualToLogical03,
- cachedBidiLine03
- },
- {
- "Mix of left to right and right to left text.",
- "Hello world, مرحبا بالعالم, hello world\nمرحبا بالعالم, hello world, مرحبا بالعالم\nمرحبا بالعالم\nhello world",
- Size( 300.f, 300.f ),
- 107u,
- visualToLogical04,
- cachedBidiLine04
- },
- {
- "Mix of left to right and right to left text.",
- "Hello world, مرحبا بالعالم, hello world\nمرحبا بالعالم, hello world, مرحبا بالعالم\nمرحبا بالعالم\nhello world",
- Size( 200.f, 400.f ),
- 107u,
- visualToLogical05,
- cachedBidiLine05
- },
- {
- "Mix of left to right and right to left text.",
- "Hello world, مرحبا بالعالم, hello world\nمرحبا بالعالم, hello world, مرحبا بالعالم\nمرحبا بالعالم\nhello world",
- Size( 100.f, 600.f ),
- 107u,
- visualToLogical06,
- cachedBidiLine06
- },
- };
+ {"Zero characters text",
+ "",
+ Size(300.f, 300.f),
+ 0u,
+ visualToLogical01,
+ cachedBidiLine01},
+ {"Left to right text only",
+ "Hello world",
+ Size(300.f, 300.f),
+ 11u,
+ visualToLogical02,
+ cachedBidiLine02},
+ {"Right to left text only",
+ "مرحبا بالعالم",
+ Size(300.f, 300.f),
+ 13u,
+ visualToLogical03,
+ cachedBidiLine03},
+ {"Mix of left to right and right to left text.",
+ "Hello world, مرحبا بالعالم, hello world\nمرحبا بالعالم, hello world, مرحبا بالعالم\nمرحبا بالعالم\nhello world",
+ Size(300.f, 300.f),
+ 107u,
+ visualToLogical04,
+ cachedBidiLine04},
+ {"Mix of left to right and right to left text.",
+ "Hello world, مرحبا بالعالم, hello world\nمرحبا بالعالم, hello world, مرحبا بالعالم\nمرحبا بالعالم\nhello world",
+ Size(200.f, 400.f),
+ 107u,
+ visualToLogical05,
+ cachedBidiLine05},
+ {"Mix of left to right and right to left text.",
+ "Hello world, مرحبا بالعالم, hello world\nمرحبا بالعالم, hello world, مرحبا بالعالم\nمرحبا بالعالم\nhello world",
+ Size(100.f, 600.f),
+ 107u,
+ visualToLogical06,
+ cachedBidiLine06},
+ };
const unsigned int numberOfTests = 6u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetLogicalCharacterIndexTest( data[index] ) )
+ if(!GetLogicalCharacterIndexTest(data[index]))
{
tet_result(TET_FAIL);
}
{
tet_infoline(" UtcDaliGetLogicalCursorIndex");
- const std::string fontFamily( "TizenSans" );
- const std::string fontFamilyHebrew( "TizenSansHebrew" );
+ 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 };
+ unsigned int visualIndex01[] = {10u};
+ unsigned int characterIndex01[] = {0u};
+ unsigned int logicalIndex01[] = {10u};
+ unsigned int bidirectionalLineIndex01[] = {0u};
// 0 11
// Hello world \n
// Set a known font description
FontDescriptionRun fontDescriptionRun02;
- fontDescriptionRun02.characterRun.characterIndex = 0u;
+ 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.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;
+ fontDescriptionRun02.widthDefined = false;
+ fontDescriptionRun02.slantDefined = false;
+ fontDescriptionRun02.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns02;
- fontDescriptionRuns02.PushBack( fontDescriptionRun02 );
+ 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 };
+ 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 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 ש ל ו ם _ ע ו ל ם \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 _ ם ל ו ע _ ם ו ל ש
+ // 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.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.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;
+ fontDescriptionRun0301.widthDefined = false;
+ fontDescriptionRun0301.slantDefined = false;
+ fontDescriptionRun0301.sizeDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun0302;
- fontDescriptionRun0302.characterRun.characterIndex = 12u;
+ 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.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;
+ fontDescriptionRun0302.widthDefined = false;
+ fontDescriptionRun0302.slantDefined = false;
+ fontDescriptionRun0302.sizeDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun0303;
- fontDescriptionRun0303.characterRun.characterIndex = 22u;
+ 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.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;
+ fontDescriptionRun0303.widthDefined = false;
+ fontDescriptionRun0303.slantDefined = false;
+ fontDescriptionRun0303.sizeDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun0304;
- fontDescriptionRun0304.characterRun.characterIndex = 34u;
+ 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.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;
+ fontDescriptionRun0304.widthDefined = false;
+ fontDescriptionRun0304.slantDefined = false;
+ fontDescriptionRun0304.sizeDefined = false;
// Set a known font description
FontDescriptionRun fontDescriptionRun0305;
- fontDescriptionRun0305.characterRun.characterIndex = 54u;
+ 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.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;
+ 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 };
+ fontDescriptionRuns03.PushBack(fontDescriptionRun0301);
+ fontDescriptionRuns03.PushBack(fontDescriptionRun0302);
+ fontDescriptionRuns03.PushBack(fontDescriptionRun0303);
+ fontDescriptionRuns03.PushBack(fontDescriptionRun0304);
+ fontDescriptionRuns03.PushBack(fontDescriptionRun0305);
- 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 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 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 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 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 };
+ 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 ם ל ו ע _ ם ו ל ש
+ // 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 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 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
+ // 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.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.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;
+ fontDescriptionRun0401.widthDefined = false;
+ fontDescriptionRun0401.slantDefined = false;
+ fontDescriptionRun0401.sizeDefined = false;
FontDescriptionRun fontDescriptionRun0402;
- fontDescriptionRun0402.characterRun.characterIndex = 10u;
+ 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.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;
+ fontDescriptionRun0402.widthDefined = false;
+ fontDescriptionRun0402.slantDefined = false;
+ fontDescriptionRun0402.sizeDefined = false;
FontDescriptionRun fontDescriptionRun0403;
- fontDescriptionRun0403.characterRun.characterIndex = 22u;
+ 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.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;
+ fontDescriptionRun0403.widthDefined = false;
+ fontDescriptionRun0403.slantDefined = false;
+ fontDescriptionRun0403.sizeDefined = false;
FontDescriptionRun fontDescriptionRun0404;
- fontDescriptionRun0404.characterRun.characterIndex = 32u;
+ 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.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;
+ fontDescriptionRun0404.widthDefined = false;
+ fontDescriptionRun0404.slantDefined = false;
+ fontDescriptionRun0404.sizeDefined = false;
FontDescriptionRun fontDescriptionRun0405;
- fontDescriptionRun0405.characterRun.characterIndex = 56u;
+ 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.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;
+ 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
+ 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.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.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;
+ 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 };
+ fontDescriptionRuns05.PushBack(fontDescriptionRun0501);
- unsigned int characterIndex05[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
- 11u, 11u, 11u, 11u };
+ unsigned int visualIndex05[] = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 13u, 14u};
- unsigned int logicalIndex05[] = { 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 bidirectionalLineIndex05[] = { 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u,
- 0u, 0u, 0u, 0u };
+ unsigned int logicalIndex05[] = {0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u, 8u, 9u, 10u, 11u, 12u, 13u, 14u};
-// LO ק ר א ט ו ן ם פ ש ד ג כ
-// 0 1 2 3 4 5 6 7 8 9 10 11 12
-// VO כ ג ד ש פ ם ן ו ט א ר ק
+ unsigned int bidirectionalLineIndex05[] = {0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u};
-// LO ע י ח ל
-// 12 13 14 15 16
-// VO ל ח י ע
+ // 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.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.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;
+ 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, };
+ 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",
- Size( 100.f, 300.f ),
- 1u,
- fontDescriptionRuns05.Begin(),
- 13u,
- visualIndex05,
- characterIndex05,
- logicalIndex05,
- bidirectionalLineIndex05,
- },
- {
- "bidirectional text 03.",
- "קראטוןםפשדגכעיחל",
- Size( 100.f, 300.f ),
- 1u,
- fontDescriptionRuns06.Begin(),
- 18u,
- visualIndex06,
- characterIndex06,
- logicalIndex06,
- bidirectionalLineIndex06,
- },
- };
+ {
+ "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",
+ Size(100.f, 300.f),
+ 1u,
+ fontDescriptionRuns05.Begin(),
+ 13u,
+ visualIndex05,
+ characterIndex05,
+ logicalIndex05,
+ bidirectionalLineIndex05,
+ },
+ {
+ "bidirectional text 03.",
+ "קראטוןםפשדגכעיחל",
+ Size(100.f, 300.f),
+ 1u,
+ fontDescriptionRuns06.Begin(),
+ 18u,
+ visualIndex06,
+ characterIndex06,
+ logicalIndex06,
+ bidirectionalLineIndex06,
+ },
+ };
const unsigned int numberOfTests = 6u;
- for( unsigned int index = 0u; index < numberOfTests; ++index )
+ for(unsigned int index = 0u; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetLogicalCursorIndexTest( data[index] ) )
+ if(!GetLogicalCursorIndexTest(data[index]))
{
tet_printf("Test %d failed : [%s]\n", index, data[index].description.c_str());
tet_result(TET_FAIL);
--- /dev/null
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <iostream>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/internal/text/layouts/layout-engine.h>
+#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
+#include <dali-toolkit/internal/text/text-run-container.h>
+#include <toolkit-text-utils.h>
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+// Tests the LayoutEngine methods.
+
+//////////////////////////////////////////////////////////
+
+namespace
+{
+const std::string DEFAULT_FONT_DIR("/resources/fonts");
+
+struct LayoutTextData
+{
+ std::string description;
+ std::string text;
+ Size textArea;
+ unsigned int numberOfFonts;
+ FontDescriptionRun* fontDescriptions;
+ Size layoutSize;
+ unsigned int totalNumberOfGlyphs;
+ float* positions;
+ unsigned int numberOfLines;
+ LineRun* lines;
+ Layout::Engine::Type layout;
+ unsigned int startIndex;
+ unsigned int numberOfGlyphs;
+ bool ellipsis : 1;
+ bool updated : 1;
+ float characterSpacing;
+};
+
+void Print(const LineRun& line)
+{
+ std::cout << " glyph run, index : " << line.glyphRun.glyphIndex << ", num glyphs : " << line.glyphRun.numberOfGlyphs << std::endl;
+ std::cout << " character run, index : " << line.characterRun.characterIndex << ", num chars : " << line.characterRun.numberOfCharacters << std::endl;
+ std::cout << " width : " << floor(line.width) << std::endl;
+ std::cout << " ascender : " << line.ascender << std::endl;
+ std::cout << " descender : " << line.descender << std::endl;
+ std::cout << " extraLength : " << line.extraLength << std::endl;
+ std::cout << " alignmentOffset : " << line.alignmentOffset << std::endl;
+ std::cout << " direction : " << line.direction << std::endl;
+ std::cout << " ellipsis : " << line.ellipsis << std::endl;
+}
+
+bool LayoutTextTest(const LayoutTextData& data)
+{
+ // Load some fonts.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi(96u, 96u);
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
+
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHindiRegular.ttf");
+
+ // 1) Create the model.
+ ModelPtr textModel;
+ MetricsPtr metrics;
+ Size layoutSize;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ if(0u != data.numberOfFonts)
+ {
+ fontDescriptionRuns.Insert(fontDescriptionRuns.End(),
+ data.fontDescriptions,
+ data.fontDescriptions + data.numberOfFonts);
+ }
+
+ LayoutOptions options;
+ options.align = false;
+ CreateTextModel(data.text,
+ data.textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ data.characterSpacing);
+
+ LogicalModelPtr logicalModel = textModel->mLogicalModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
+
+ // 2) Clear the layout.
+ Vector<LineRun>& lines = visualModel->mLines;
+
+ const Length numberOfCharacters = logicalModel->mText.Count();
+ const bool isLastNewParagraph = (0u == numberOfCharacters) ? false : TextAbstraction::IsNewParagraph(*(logicalModel->mText.Begin() + (numberOfCharacters - 1u)));
+ const GlyphIndex lastGlyphIndex = data.startIndex + data.numberOfGlyphs - 1u;
+ const bool removeLastLine = isLastNewParagraph && (lastGlyphIndex + 1u == visualModel->mGlyphs.Count());
+
+ LineIndex startRemoveIndex = 0u;
+
+ if(0u != lines.Count())
+ {
+ startRemoveIndex = lines.Count();
+ LineIndex endRemoveIndex = startRemoveIndex;
+ ClearGlyphRuns(data.startIndex,
+ lastGlyphIndex + (removeLastLine ? 1u : 0u),
+ lines,
+ startRemoveIndex,
+ endRemoveIndex);
+
+ // Update the character runs of the lines.
+ const CharacterIndex* const glyphsToCharactersBuffer = visualModel->mGlyphsToCharacters.Begin();
+ const Length* const charactersPerGlyph = visualModel->mCharactersPerGlyph.Begin();
+ const CharacterIndex startCharacterIndex = *(glyphsToCharactersBuffer + data.startIndex);
+ const CharacterIndex lastCharacterIndex = *(glyphsToCharactersBuffer + lastGlyphIndex) + *(charactersPerGlyph + lastGlyphIndex) - 1u;
+ ClearCharacterRuns(startCharacterIndex,
+ lastCharacterIndex + (removeLastLine ? 1u : 0u),
+ lines,
+ startRemoveIndex,
+ endRemoveIndex);
+
+ lines.Erase(lines.Begin() + startRemoveIndex,
+ lines.Begin() + endRemoveIndex);
+ }
+
+ Vector<Vector2>& glyphPositions = visualModel->mGlyphPositions;
+
+ glyphPositions.Erase(glyphPositions.Begin() + data.startIndex,
+ glyphPositions.Begin() + data.startIndex + data.numberOfGlyphs);
+
+ // 3) Layout
+ Layout::Engine engine;
+ engine.SetMetrics(metrics);
+ engine.SetLayout(data.layout);
+
+ textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
+ textModel->mLineWrapMode = LineWrap::WORD;
+ textModel->mIgnoreSpacesAfterText = true;
+ //textModel->mMatchSystemLanguageDirection = false;
+ Layout::Parameters layoutParameters(data.textArea,
+ textModel);
+
+ layoutParameters.isLastNewParagraph = isLastNewParagraph;
+
+ // The initial glyph and the number of glyphs to layout.
+ layoutParameters.startGlyphIndex = data.startIndex;
+ layoutParameters.numberOfGlyphs = data.numberOfGlyphs;
+ layoutParameters.startLineIndex = startRemoveIndex;
+ layoutParameters.estimatedNumberOfLines = logicalModel->mParagraphInfo.Count();
+
+ layoutSize = Vector2::ZERO;
+
+ bool isAutoScroll = false;
+ const bool updated = engine.LayoutText(layoutParameters,
+ layoutSize,
+ data.ellipsis,
+ isAutoScroll,
+ DevelText::EllipsisPosition::END);
+
+ // 4) Compare the results.
+
+ if(updated != data.updated)
+ {
+ std::cout << " Different updated bool : " << updated << ", expected : " << data.updated << std::endl;
+ return false;
+ }
+
+ if(layoutSize != data.layoutSize)
+ {
+ std::cout << " Different layout size : " << layoutSize << ", expected : " << data.layoutSize << std::endl;
+ return false;
+ }
+
+ for(unsigned int index = 0u; index < data.totalNumberOfGlyphs; ++index)
+ {
+ const Vector2& position = *(glyphPositions.Begin() + index);
+
+ if(fabsf(std::round(position.x) - std::round(*(data.positions + 2u * index))) > Math::MACHINE_EPSILON_1000)
+ {
+ std::cout << " Different position for glyph " << index << " x : " << position.x << ", expected : " << *(data.positions + 2u * index) << std::endl;
+ return false;
+ }
+ if(fabsf(position.y - *(data.positions + 2u * index + 1u)) > Math::MACHINE_EPSILON_1000)
+ {
+ std::cout << " Different position for glyph " << index << " y : " << position.y << ", expected : " << *(data.positions + 2u * index + 1u) << std::endl;
+ return false;
+ }
+ }
+
+ if(lines.Count() != data.numberOfLines)
+ {
+ std::cout << " Different number of lines : " << lines.Count() << ", expected : " << data.numberOfLines << std::endl;
+ return false;
+ }
+
+ for(unsigned int index = 0u; index < data.numberOfLines; ++index)
+ {
+ const LineRun& line = *(lines.Begin() + index);
+ const LineRun& expectedLine = *(data.lines + index);
+
+ if(line.glyphRun.glyphIndex != expectedLine.glyphRun.glyphIndex)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+ if(line.glyphRun.numberOfGlyphs != expectedLine.glyphRun.numberOfGlyphs)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ if(line.characterRun.characterIndex != expectedLine.characterRun.characterIndex)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+ if(line.characterRun.numberOfCharacters != expectedLine.characterRun.numberOfCharacters)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ if(fabsf(floor(line.width) - expectedLine.width) > Math::MACHINE_EPSILON_1)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ if(fabsf(line.ascender - expectedLine.ascender) > Math::MACHINE_EPSILON_1)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ if(fabsf(line.descender - expectedLine.descender) > Math::MACHINE_EPSILON_1)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ if(fabsf(line.extraLength - expectedLine.extraLength) > Math::MACHINE_EPSILON_1)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ if(line.ellipsis != expectedLine.ellipsis)
+ {
+ std::cout << " Different line info for line : " << index << std::endl;
+ Print(line);
+ std::cout << " expected" << std::endl;
+ Print(expectedLine);
+ return false;
+ }
+
+ // Do not compare the alignment offset as it's not calculated in the layout.
+ // Do not compare the line direction as it's not set in the layout.
+ }
+
+ return true;
+}
+
+////////////////////////////////////////////////////////
+
+} // namespace
+
+//////////////////////////////////////////////////////////
+//
+// UtcDaliTextCharacterSpacingSingleLineTextArea1
+// UtcDaliTextCharacterSpacingSingleLineTextArea2
+// UtcDaliTextCharacterSpacingSingleLineTextArea3
+// UtcDaliTextCharacterSpacingMultilineText1
+// UtcDaliTextCharacterSpacingMultilineText2
+//
+//////////////////////////////////////////////////////////
+
+int UtcDaliTextCharacterSpacingSingleLineTextArea1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextCharacterSpacingSingleLineTextArea1");
+
+ // Will layout the text in single line as it can be scrolled.
+
+ const std::string fontFamily("TizenSans");
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
+ fontDescriptionRun.familyDefined = true;
+ fontDescriptionRun.weightDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(1.f, 1.f);
+
+ //******* characterSpacing = 0.0f *******//
+ float positions[] = {
+ 0.f, -12.f, 10.f, -9.f, 19.875f, -13.f, 23.8906f, -13.f, 26.9062f, -9.f, 36.1875f, -0.f, 40.1875f, -9.f, 52.1562f, -9.f, 62.4375f, -9.f, 68.5f, -13.f, 71.5156f, -13.f};
+ Size layoutSize(81.f, 20.f);
+ //************************************//
+
+ struct LineRun line =
+ {
+ {0u, 11u},
+ {0u, 11u},
+ 81.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ Vector<LineRun> lines;
+ lines.PushBack(line);
+
+ LayoutTextData data =
+ {
+ "Layout text in a small area",
+ "Hello world",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 11u,
+ positions,
+ 1u,
+ lines.Begin(),
+ Layout::Engine::SINGLE_LINE_BOX,
+ 0u,
+ 11u,
+ false,
+ true,
+ 0.0f};
+
+ if(!LayoutTextTest(data))
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextCharacterSpacingSingleLineTextArea2(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextCharacterSpacingSingleLineTextArea2");
+
+ // Will layout the text in single line as it can be scrolled.
+
+ const std::string fontFamily("TizenSans");
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
+ fontDescriptionRun.familyDefined = true;
+ fontDescriptionRun.weightDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(1.f, 1.f);
+
+ //******* characterSpacing = 2.0f *******//
+ float positions[] = {
+ 0.f, -12.f, 12.f, -9.f, 23.875f, -13.f, 29.8906f, -13.f, 34.9062f, -9.f, 46.1875f, -0.f, 52.1875f, -9.f, 66.1562f, -9.f, 78.4375f, -9.f, 86.5f, -13.f, 91.5156f, -13.f};
+ Size layoutSize(101.f, 20.f);
+ //************************************//
+
+ struct LineRun line =
+ {
+ {0u, 11u},
+ {0u, 11u},
+ 101.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ Vector<LineRun> lines;
+ lines.PushBack(line);
+
+ LayoutTextData data =
+ {
+ "Layout text in a small area",
+ "Hello world",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 11u,
+ positions,
+ 1u,
+ lines.Begin(),
+ Layout::Engine::SINGLE_LINE_BOX,
+ 0u,
+ 11u,
+ false,
+ true,
+ 2.0f};
+
+ if(!LayoutTextTest(data))
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextCharacterSpacingSingleLineTextArea3(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextCharacterSpacingSingleLineTextArea3");
+
+ // Will layout the text in single line as it can be scrolled.
+
+ const std::string fontFamily("TizenSans");
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.numberOfCharacters = 11u;
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
+ fontDescriptionRun.familyDefined = true;
+ fontDescriptionRun.weightDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(1.f, 1.f);
+
+ //******* characterSpacing = 4.0f *******//
+ float positions[] = {
+ 0.f, -12.f, 14.f, -9.f, 27.875f, -13.f, 35.8906f, -13.f, 42.9062f, -9.f, 56.1875f, -0.f, 64.1875f, -9.f, 80.1562f, -9.f, 94.4375f, -9.f, 104.5f, -13.f, 111.5156f, -13.f};
+ Size layoutSize(121.f, 20.f);
+ //************************************//
+
+ struct LineRun line =
+ {
+ {0u, 11u},
+ {0u, 11u},
+ 121.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ Vector<LineRun> lines;
+ lines.PushBack(line);
+
+ LayoutTextData data =
+ {
+ "Layout text in a small area",
+ "Hello world",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 11u,
+ positions,
+ 1u,
+ lines.Begin(),
+ Layout::Engine::SINGLE_LINE_BOX,
+ 0u,
+ 11u,
+ false,
+ true,
+ 4.0f};
+
+ if(!LayoutTextTest(data))
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextCharacterSpacingMultilineText1(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextCharacterSpacingMultilineText1");
+
+ // Layout some lines of left to right text.
+
+ const std::string fontFamily("TizenSans");
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun1;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.numberOfCharacters = 18u;
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
+ fontDescriptionRun1.familyDefined = true;
+ fontDescriptionRun1.weightDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
+
+ FontDescriptionRun fontDescriptionRun2;
+ fontDescriptionRun2.characterRun.characterIndex = 18u;
+ fontDescriptionRun2.characterRun.numberOfCharacters = 31u;
+ fontDescriptionRun2.familyLength = fontFamily.size();
+ fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
+ memcpy(fontDescriptionRun2.familyName, fontFamily.c_str(), fontDescriptionRun2.familyLength);
+ fontDescriptionRun2.familyDefined = true;
+ fontDescriptionRun2.weightDefined = false;
+ fontDescriptionRun2.widthDefined = false;
+ fontDescriptionRun2.slantDefined = false;
+ fontDescriptionRun2.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
+ fontDescriptionRuns.PushBack(fontDescriptionRun2);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(98.f, 97.f);
+ float positions[] =
+ {
+ 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f, 45.f, -12.f, 0.f, -12.f, 7.92188f, -9.f, 18.f, -9.f, 27.2031f, -9.f, 38.f, -9.f, 47.f, -11.f, 53.f, -0.f, 0.f, -12.f, 11.1562f, -12.f, 15.f, -12.f, 26.f, -9.f, 36.4844f, -9.f, 42.f, -9.f, 52.5469f, -9.f, 61.6875f, -11.f, 67.9688f, -0.f, 0.f, -12.f, 4.f, -12.f, 9.f, -9.f, 18.0469f, -9.f, 27.8906f, -9.f, 36.f, -0.f, 41.3281f, -9.f, 51.125f, -12.f, 57.f, -0.f, 62.f, -11.f, 68.1406f, -9.f, 77.7031f, -9.f, 87.f, -11.f, 94.4531f, -2.f};
+ struct LineRun line0 =
+ {
+ {0u, 12u},
+ {0u, 12u},
+ 81.f,
+ 15.f,
+ -5.f,
+ 4.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line1 =
+ {
+ {12u, 6u},
+ {12u, 6u},
+ 44.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line2 =
+ {
+ {18u, 7u},
+ {18u, 7u},
+ 54.f,
+ 15.f,
+ -4.f,
+ 6.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line3 =
+ {
+ {25u, 9u},
+ {25u, 10u},
+ 68.f,
+ 15.f,
+ -4.f,
+ 6.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line4 =
+ {
+ {34u, 14u},
+ {35u, 14u},
+ 98.f,
+ 15.f,
+ -4.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ Vector<LineRun> lines;
+ lines.PushBack(line0);
+ lines.PushBack(line1);
+ lines.PushBack(line2);
+ lines.PushBack(line3);
+ lines.PushBack(line4);
+
+ LayoutTextData data =
+ {
+ "Layout simple multiline text",
+ "Hello world demo.\n"
+ "Layout different lines of text.",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 48u,
+ positions,
+ 5u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 48u,
+ false,
+ true,
+ 0.0f};
+
+ if(!LayoutTextTest(data))
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextCharacterSpacingMultilineText2(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextCharacterSpacingMultilineText2");
+
+ // Layout some lines of left to right text.
+
+ const std::string fontFamily("TizenSans");
+
+ // Set a known font description
+ FontDescriptionRun fontDescriptionRun1;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.numberOfCharacters = 18u;
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
+ fontDescriptionRun1.familyDefined = true;
+ fontDescriptionRun1.weightDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
+
+ FontDescriptionRun fontDescriptionRun2;
+ fontDescriptionRun2.characterRun.characterIndex = 18u;
+ fontDescriptionRun2.characterRun.numberOfCharacters = 31u;
+ fontDescriptionRun2.familyLength = fontFamily.size();
+ fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
+ memcpy(fontDescriptionRun2.familyName, fontFamily.c_str(), fontDescriptionRun2.familyLength);
+ fontDescriptionRun2.familyDefined = true;
+ fontDescriptionRun2.weightDefined = false;
+ fontDescriptionRun2.widthDefined = false;
+ fontDescriptionRun2.slantDefined = false;
+ fontDescriptionRun2.sizeDefined = false;
+
+ Vector<FontDescriptionRun> fontDescriptionRuns;
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
+ fontDescriptionRuns.PushBack(fontDescriptionRun2);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(82.f, 136.f);
+ float positions[] =
+ {
+ 0.f, -12.f, 12.f, -9.f, 24.f, -13.f, 30.f, -13.f, 35.f, -9.f, 46.f, -0.f, 0.f, -9.f, 13.9688f, -9.f, 26.25f, -9.f, 34.3125f, -13.f, 39.3281f, -13.f, 50.6406f, -0.f, 0.f, -13.f, 11.3125f, -9.f, 22.7031f, -9.f, 37.5625, -9.f, 48.8438f, -2.f, 54.8125, -12.f, 0.f, -12.f, 9.92188f, -9.f, 21.7344, -9.f, 33.2031f, -9.f, 46.f, -9.f, 57.1406f, -11.f, 65.4219f, -0.f, 0.f, -12.f, 13.1562f, -12.f, 18.6094f, -12.f, 31.6406f, -9.f, 44.4844f, -9.f, 51.7031f, -9.f, 64.5469f, -9.f, 75.6875f, -11.f, 83.9688, -0.f, 0.f, -12.f, 6.45312f, -12.f, 12.9062f, -9.f, 24.0469f, -9.f, 35.8906f, -9.f, 46.2344f, -0.f, 53.3281f, -9.f, 65.125f, -12.f, 72.7656f, -0.f, 0.f, -11.f, 8.28125f, -9.f, 19.8438f, -9.f, 31.3125f, -11.f, 40.5938f, -2.f};
+ struct LineRun line0 =
+ {
+ {0u, 6u},
+ {0u, 6u},
+ 44.f,
+ 15.f,
+ -5.f,
+ 6.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line1 =
+ {
+ {6u, 6u},
+ {6u, 6u},
+ 49.f,
+ 15.f,
+ -5.f,
+ 6.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line2 =
+ {
+ {12u, 6u},
+ {12u, 6u},
+ 52.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line3 =
+ {
+ {18u, 7u},
+ {18u, 7u},
+ 64.f,
+ 15.f,
+ -4.f,
+ 8.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line4 =
+ {
+ {25u, 9u},
+ {25u, 10u},
+ 82.f,
+ 15.f,
+ -4.f,
+ 8.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line5 =
+ {
+ {34u, 9u},
+ {35u, 9u},
+ 72.f,
+ 15.f,
+ -4.f,
+ 8.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ struct LineRun line6 =
+ {
+ {43u, 5u},
+ {44u, 5u},
+ 44.f,
+ 15.f,
+ -4.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
+ Vector<LineRun> lines;
+ lines.PushBack(line0);
+ lines.PushBack(line1);
+ lines.PushBack(line2);
+ lines.PushBack(line3);
+ lines.PushBack(line4);
+ lines.PushBack(line5);
+ lines.PushBack(line6);
+
+ LayoutTextData data =
+ {
+ "Layout simple multiline text",
+ "Hello world demo.\n"
+ "Layout different lines of text.",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 48u,
+ positions,
+ 7u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 48u,
+ false,
+ true,
+ 2.0f};
+
+ if(!LayoutTextTest(data))
+ {
+ tet_result(TET_FAIL);
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
#include <stdlib.h>
#include <unistd.h>
+#include <iostream>
#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <toolkit-text-utils.h>
-
using namespace Dali;
using namespace Toolkit;
using namespace Text;
namespace
{
- const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
- const unsigned int DEFAULT_FONT_SIZE = 1152u;
+const std::string DEFAULT_FONT_DIR("/resources/fonts");
+const unsigned int DEFAULT_FONT_SIZE = 1152u;
struct GetClosestLineData
{
- std::string description; ///< Description of the test.
- std::string text; ///< Input text.
- unsigned int numberOfTests; ///< The number of tests.
- float* visualY; ///< The visual 'y' position for each test.
- LineIndex* lineIndex; ///< The expected line index for each test.
- bool* isLineHit; ///< The expected line hit value for each test.
+ std::string description; ///< Description of the test.
+ std::string text; ///< Input text.
+ unsigned int numberOfTests; ///< The number of tests.
+ float* visualY; ///< The visual 'y' position for each test.
+ LineIndex* lineIndex; ///< The expected line index for each test.
+ bool* isLineHit; ///< The expected line hit value for each test.
};
struct GetClosestCursorIndexData
{
- std::string description; ///< Description of the test.
- std::string text; ///< Input text.
- unsigned int numberOfTests; ///< The number of tests.
- float* visualX; ///< The visual 'x' position for each test.
- float* visualY; ///< The visual 'y' position for each test.
- CharacterHitTest::Mode* mode; ///< The type of hit test.
- CharacterIndex* logicalIndex; ///< The expected logical cursor index for each test.
- bool* isCharacterHit; ///< The expected character hit value for each test.
+ std::string description; ///< Description of the test.
+ std::string text; ///< Input text.
+ unsigned int numberOfTests; ///< The number of tests.
+ float* visualX; ///< The visual 'x' position for each test.
+ float* visualY; ///< The visual 'y' position for each test.
+ CharacterHitTest::Mode* mode; ///< The type of hit test.
+ CharacterIndex* logicalIndex; ///< The expected logical cursor index for each test.
+ bool* isCharacterHit; ///< The expected character hit value for each test.
};
struct GetCursorPositionData
{
- std::string description; ///< Description of the test.
- std::string text; ///< Input text.
- unsigned int numberOfTests; ///< The number of tests.
- CharacterIndex* logicalIndex; ///< The logical cursor index for each test.
- float* visualX; ///< The expected visual 'x' position for each test.
- float* visualY; ///< The expected visual 'y' position for each test.
+ std::string description; ///< Description of the test.
+ std::string text; ///< Input text.
+ unsigned int numberOfTests; ///< The number of tests.
+ CharacterIndex* logicalIndex; ///< The logical cursor index for each test.
+ float* visualX; ///< The expected visual 'x' position for each test.
+ float* visualY; ///< The expected visual 'y' position for each test.
};
struct FindSelectionIndicesData
{
- std::string description; ///< Description of the test.
- std::string text; ///< Input text.
- unsigned int numberOfTests; ///< The number of tests.
- float* visualX; ///< The visual 'x' position for each test.
- float* visualY; ///< The visual 'y' position for each test.
- bool* found; ///< Whether selection indices are found.
- CharacterIndex* startIndex; ///< The expected start cursor index for each test.
- CharacterIndex* endIndex; ///< The expected end cursor index for each test.
- CharacterIndex* noTextHitIndex; ///< The expected character index when there is no hit.
+ std::string description; ///< Description of the test.
+ std::string text; ///< Input text.
+ unsigned int numberOfTests; ///< The number of tests.
+ float* visualX; ///< The visual 'x' position for each test.
+ float* visualY; ///< The visual 'y' position for each test.
+ bool* found; ///< Whether selection indices are found.
+ CharacterIndex* startIndex; ///< The expected start cursor index for each test.
+ CharacterIndex* endIndex; ///< The expected end cursor index for each test.
+ CharacterIndex* noTextHitIndex; ///< The expected character index when there is no hit.
};
struct PrimaryCursorHeightData
{
- std::string description; ///< Description of the test.
- std::string text; ///< Input text.
- unsigned int numberOfTests; ///< The number of tests.
- CharacterIndex* logicalIndex; ///< The logical cursor index for each test.
- float* heights; ///< The expected primary cursor height for each test.
+ std::string description; ///< Description of the test.
+ std::string text; ///< Input text.
+ unsigned int numberOfTests; ///< The number of tests.
+ CharacterIndex* logicalIndex; ///< The logical cursor index for each test.
+ float* heights; ///< The expected primary cursor height for each test.
};
-bool GetClosestLineTest( const GetClosestLineData& data )
+bool GetClosestLineTest(const GetClosestLineData& data)
{
std::cout << " testing : " << data.description << std::endl;
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(400.f, 600.f);
- Size layoutSize;
+ Size textArea(400.f, 600.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
- for( unsigned int index = 0; index < data.numberOfTests; ++index )
+ for(unsigned int index = 0; index < data.numberOfTests; ++index)
{
- bool isLineHit = false;
- const LineIndex lineIndex = GetClosestLine( visualModel,
- data.visualY[index],
- isLineHit );
+ bool isLineHit = false;
+ const LineIndex lineIndex = GetClosestLine(visualModel,
+ data.visualY[index],
+ isLineHit);
- if( lineIndex != data.lineIndex[index] )
+ if(lineIndex != data.lineIndex[index])
{
std::cout << " test " << index << " failed. Different line index : " << lineIndex << ", expected : " << data.lineIndex[index] << std::endl;
return false;
}
- if( isLineHit != data.isLineHit[index] )
+ if(isLineHit != data.isLineHit[index])
{
std::cout << " test " << index << " failed. Different line hit value : " << isLineHit << ", expected : " << data.isLineHit[index] << std::endl;
return false;
return true;
}
-bool GetClosestCursorIndexTest( const GetClosestCursorIndexData& data )
+bool GetClosestCursorIndexTest(const GetClosestCursorIndexData& data)
{
std::cout << " testing : " << data.description << std::endl;
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(400.f, 600.f);
- Size layoutSize;
+ Size textArea(400.f, 600.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
- for( unsigned int index = 0; index < data.numberOfTests; ++index )
+ for(unsigned int index = 0; index < data.numberOfTests; ++index)
{
- bool isCharacterHit = false;
- const CharacterIndex logicalCursorIndex = GetClosestCursorIndex( visualModel,
- logicalModel,
- metrics,
- data.visualX[index],
- data.visualY[index],
- data.mode[index],
- isCharacterHit );
-
- if( logicalCursorIndex != data.logicalIndex[index] )
+ bool isCharacterHit = false;
+ const CharacterIndex logicalCursorIndex = GetClosestCursorIndex(visualModel,
+ logicalModel,
+ metrics,
+ data.visualX[index],
+ data.visualY[index],
+ data.mode[index],
+ isCharacterHit);
+
+ if(logicalCursorIndex != data.logicalIndex[index])
{
std::cout << " test " << index << " failed. Different logical cursor index : " << logicalCursorIndex << ", expected : " << data.logicalIndex[index] << std::endl;
return false;
}
- if( isCharacterHit != data.isCharacterHit[index] )
+ if(isCharacterHit != data.isCharacterHit[index])
{
std::cout << " test " << index << " failed. Different character hit value : " << isCharacterHit << ", expected : " << data.isCharacterHit[index] << std::endl;
return false;
return true;
}
-bool GetCursorPositionTest( const GetCursorPositionData& data )
+bool GetCursorPositionTest(const GetCursorPositionData& data)
{
std::cout << " testing : " << data.description << std::endl;
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(400.f, 600.f);
- Size layoutSize;
+ Size textArea(400.f, 600.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
GetCursorPositionParameters parameters;
- parameters.visualModel = visualModel;
+ parameters.visualModel = visualModel;
parameters.logicalModel = logicalModel;
- parameters.metrics = metrics;
- parameters.isMultiline = true;
+ parameters.metrics = metrics;
+ parameters.isMultiline = true;
- for( unsigned int index = 0; index < data.numberOfTests; ++index )
+ for(unsigned int index = 0; index < data.numberOfTests; ++index)
{
CursorInfo cursorInfo;
parameters.logical = data.logicalIndex[index];
- GetCursorPosition( parameters,
- 0.f,// Since this test case is not testing the primary cursor height, the default font line height can be set to 0.f.
- cursorInfo );
+ GetCursorPosition(parameters,
+ 0.f, // Since this test case is not testing the primary cursor height, the default font line height can be set to 0.f.
+ cursorInfo);
- if( floor(cursorInfo.primaryPosition.x) != data.visualX[index] )
+ if(floor(cursorInfo.primaryPosition.x) != data.visualX[index])
{
std::cout << " test " << index << " failed. Different 'x' cursor position : " << cursorInfo.primaryPosition.x << ", expected : " << data.visualX[index] << std::endl;
return false;
}
- if( floor(cursorInfo.primaryPosition.y) != data.visualY[index] )
+ if(floor(cursorInfo.primaryPosition.y) != data.visualY[index])
{
std::cout << " test " << index << " failed. Different 'y' cursor position : " << cursorInfo.primaryPosition.y << ", expected : " << data.visualY[index] << std::endl;
return false;
return true;
}
-bool FindSelectionIndicesTest( const FindSelectionIndicesData& data )
+bool FindSelectionIndicesTest(const FindSelectionIndicesData& data)
{
std::cout << " testing : " << data.description << std::endl;
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(400.f, 600.f);
- Size layoutSize;
+ Size textArea(400.f, 600.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ LayoutOptions options;
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
- for( unsigned int index = 0; index < data.numberOfTests; ++index )
+ for(unsigned int index = 0; index < data.numberOfTests; ++index)
{
- CharacterIndex startIndex = 0;
- CharacterIndex endIndex = 0;
+ CharacterIndex startIndex = 0;
+ CharacterIndex endIndex = 0;
CharacterIndex noTextHitIndex = 0;
- const bool found = FindSelectionIndices( visualModel,
- logicalModel,
- metrics,
- data.visualX[index],
- data.visualY[index],
- startIndex,
- endIndex,
- noTextHitIndex );
-
- if( found != data.found[index] )
- {
- std::cout << " test " << index << " failed. Different found value : " << found << ", expected : " << data.found[index] << std::endl;
+ const bool found = FindSelectionIndices(visualModel,
+ logicalModel,
+ metrics,
+ data.visualX[index],
+ data.visualY[index],
+ startIndex,
+ endIndex,
+ noTextHitIndex);
+
+ if(found != data.found[index])
+ {
+ std::cout << " test " << index << " failed. Different found value : " << found << ", expected : " << data.found[index] << std::endl;
return false;
}
- if( startIndex != data.startIndex[index] )
+ if(startIndex != data.startIndex[index])
{
std::cout << " test " << index << " failed. Different start index : " << startIndex << ", expected : " << data.startIndex[index] << std::endl;
return false;
}
- if( endIndex != data.endIndex[index] )
+ if(endIndex != data.endIndex[index])
{
std::cout << " test " << index << " failed. Different end index : " << endIndex << ", expected : " << data.endIndex[index] << std::endl;
return false;
}
- if( noTextHitIndex != data.noTextHitIndex[index] )
+ if(noTextHitIndex != data.noTextHitIndex[index])
{
std::cout << " test " << index << " failed. Different no text hit index : " << noTextHitIndex << ", expected : " << data.noTextHitIndex[index] << std::endl;
return false;
return true;
}
-bool PrimaryCursorHeightTest( const PrimaryCursorHeightData& data )
+bool PrimaryCursorHeightTest(const PrimaryCursorHeightData& data)
{
std::cout << " testing : " << data.description << std::endl;
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size textArea(400.f, 600.f);
- Size layoutSize;
+ Size textArea(400.f, 600.f);
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- const std::string fontFamily( "DejaVuSans" );
+ const std::string fontFamily("DejaVuSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun1;
- fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
fontDescriptionRun1.characterRun.numberOfCharacters = 13u;
- fontDescriptionRun1.familyLength = fontFamily.size();
- fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
- memcpy( fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength );
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
fontDescriptionRun1.familyDefined = true;
fontDescriptionRun1.weightDefined = false;
- fontDescriptionRun1.widthDefined = false;
- fontDescriptionRun1.slantDefined = false;
- fontDescriptionRun1.sizeDefined = true;
- fontDescriptionRun1.size = 768u;//Font size = 12.0f (768/64 = 12)
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = true;
+ fontDescriptionRun1.size = 768u; //Font size = 12.0f (768/64 = 12)
- fontDescriptionRuns.PushBack( fontDescriptionRun1 );
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
LayoutOptions options;
- CreateTextModel( data.text,
- textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 50.f );
+ CreateTextModel(data.text,
+ textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 50.0f, // lineSpacing
+ 50.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
GetCursorPositionParameters parameters;
- parameters.visualModel = visualModel;
+ parameters.visualModel = visualModel;
parameters.logicalModel = logicalModel;
- parameters.metrics = metrics;
- parameters.isMultiline = true;
+ parameters.metrics = metrics;
+ parameters.isMultiline = true;
- for( unsigned int index = 0; index < data.numberOfTests; ++index )
+ for(unsigned int index = 0; index < data.numberOfTests; ++index)
{
CursorInfo cursorInfo;
parameters.logical = data.logicalIndex[index];
// Load some fonts.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- fontClient.SetDpi( 93u, 93u );
+ fontClient.SetDpi(93u, 93u);
- char* pathNamePtr = get_current_dir_name();
- const std::string pathName( pathNamePtr );
- free( pathNamePtr );
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
- FontId fontID = fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSans.ttf" );
+ FontId fontID = fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSans.ttf");
Text::FontMetrics fontMetrics;
- MetricsPtr mMetrics = Metrics::New(fontClient);
+ MetricsPtr mMetrics = Metrics::New(fontClient);
mMetrics->GetFontMetrics(fontID, fontMetrics);
float defaultFontLineHeight = (fontMetrics.ascender - fontMetrics.descender);
- GetCursorPosition( parameters,
- defaultFontLineHeight,
- cursorInfo );
+ GetCursorPosition(parameters,
+ defaultFontLineHeight,
+ cursorInfo);
- if( floor(cursorInfo.primaryCursorHeight) != data.heights[index] )
+ if(floor(cursorInfo.primaryCursorHeight) != data.heights[index])
{
std::cout << " test " << index << " failed. Different primaryCursorHeight : " << cursorInfo.primaryCursorHeight << ", expected : " << data.heights[index] << std::endl;
return false;
{
tet_infoline(" UtcDaliGetClosestLine");
- float visualY01[] = { -4.f, 3.f, 1000.f };
- LineIndex lineIndices01[] = { 0, 0, 0 };
- bool isLineHit01[] = { false, false, false };
+ float visualY01[] = {-4.f, 3.f, 1000.f};
+ LineIndex lineIndices01[] = {0, 0, 0};
+ bool isLineHit01[] = {false, false, false};
- float visualY02[] = { -4.f, 3.f, 1000.f };
- LineIndex lineIndices02[] = { 0, 0, 0 };
- bool isLineHit02[] = { false, true, false };
+ float visualY02[] = {-4.f, 3.f, 1000.f};
+ LineIndex lineIndices02[] = {0, 0, 0};
+ bool isLineHit02[] = {false, true, false};
- float visualY03[] = { -4.f, 11.f, 30.f, 51.f, 68.f, 87.f, 109.f, 130.f };
- LineIndex lineIndices03[] = { 0, 0, 1u, 2u, 3u, 4u, 5u, 5u };
- bool isLineHit03[] = { false, true, true, true, true, true, true, false };
+ float visualY03[] = {-4.f, 11.f, 30.f, 51.f, 68.f, 87.f, 109.f, 130.f};
+ LineIndex lineIndices03[] = {0, 0, 1u, 2u, 3u, 4u, 5u, 5u};
+ bool isLineHit03[] = {false, true, true, true, true, true, true, false};
struct GetClosestLineData data[] =
- {
- {
- "void text.",
- "",
- 3u,
- visualY01,
- lineIndices01,
- isLineHit01
- },
- {
- "Single line text.",
- "hello world",
- 3u,
- visualY02,
- lineIndices02,
- isLineHit02
- },
{
- "Multi-line text.",
- "abcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuדאוvwxה"
- "סתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuד"
- "אוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqr"
- "פרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmno"
- "צמםpqrפרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjkl"
- "חלךmnoצמםpqrפרףstuדאוvwxהסתyzטזץ",
- 8u,
- visualY03,
- lineIndices03,
- isLineHit03
- }
- };
+ {"void text.",
+ "",
+ 3u,
+ visualY01,
+ lineIndices01,
+ isLineHit01},
+ {"Single line text.",
+ "hello world",
+ 3u,
+ visualY02,
+ lineIndices02,
+ isLineHit02},
+ {"Multi-line text.",
+ "abcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuדאוvwxה"
+ "סתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuד"
+ "אוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqr"
+ "פרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmno"
+ "צמםpqrפרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjkl"
+ "חלךmnoצמםpqrפרףstuדאוvwxהסתyzטזץ",
+ 8u,
+ visualY03,
+ lineIndices03,
+ isLineHit03}};
const unsigned int numberOfTests = 3u;
- for( unsigned int index = 0; index < numberOfTests; ++index )
+ for(unsigned int index = 0; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetClosestLineTest( data[index] ) )
+ if(!GetClosestLineTest(data[index]))
{
tet_result(TET_FAIL);
}
{
tet_infoline(" UtcDaliGetClosestCursorIndex");
- float visualX01[] = { -100.f };
- float visualY01[] = { -100.f };
- CharacterHitTest::Mode mode01[] = { CharacterHitTest::TAP };
- CharacterIndex logicalIndex01[] = { 0 };
- bool isCharacterHit01[] = { false };
+ float visualX01[] = {-100.f};
+ float visualY01[] = {-100.f};
+ CharacterHitTest::Mode mode01[] = {CharacterHitTest::TAP};
+ CharacterIndex logicalIndex01[] = {0};
+ bool isCharacterHit01[] = {false};
- float visualX02[] = { -100.f, 1000.f, 60.f, 79.f, 83.f, 148.f, 99.f };
- float visualY02[] = { -100.f, 1000.f, 12.f, 12.f, 12.f, 12.f, 12.f };
- CharacterHitTest::Mode mode02[] = { CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP };
- CharacterIndex logicalIndex02[] = { 0, 21u, 7u, 10u, 10u, 14u, 12u };
- bool isCharacterHit02[] = { false, false, true, true, true, true, true };
+ float visualX02[] = {-100.f, 1000.f, 60.f, 79.f, 83.f, 148.f, 99.f};
+ float visualY02[] = {-100.f, 1000.f, 12.f, 12.f, 12.f, 12.f, 12.f};
+ CharacterHitTest::Mode mode02[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
+ CharacterIndex logicalIndex02[] = {0, 21u, 7u, 10u, 10u, 14u, 12u};
+ bool isCharacterHit02[] = {false, false, true, true, true, true, true};
- float visualX03[] = { 19.f, 104.f, -2.f, 127.f };
- float visualY03[] = { 12.f, 12.f, 12.f, 12.f };
- CharacterHitTest::Mode mode03[] = { CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP };
- CharacterIndex logicalIndex03[] = { 3u, 13u, 0, 18u };
- bool isCharacterHit03[] = { true, true, false, false };
+ float visualX03[] = {19.f, 104.f, -2.f, 127.f};
+ float visualY03[] = {12.f, 12.f, 12.f, 12.f};
+ CharacterHitTest::Mode mode03[] = {CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP, CharacterHitTest::TAP};
+ CharacterIndex logicalIndex03[] = {3u, 13u, 0, 18u};
+ bool isCharacterHit03[] = {true, true, false, false};
// 0 5 _ 6 11 12
// Hello world \n
// שלום עולם \n
// 22 31_32 40 41
// different الأربعاء \n
- 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};
- 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 };
- 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 };
- CharacterIndex logicalIndex04[] = { 0, 5u, 6u, 11u, 11u,
- 12u, 16u, 17u, 21u, 21u,
- 22u, 25u, 30u, 32u, 35u, 34u, 40u,
- 41u };
- bool isCharacterHit04[] = { false, true, true, true, false,
- false, true, true, true, false,
- false, true, true, true, true, true, false };
+ 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};
+ 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};
+ 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};
+ CharacterIndex logicalIndex04[] = {0, 5u, 6u, 11u, 11u, 12u, 16u, 17u, 21u, 21u, 22u, 25u, 30u, 32u, 35u, 34u, 40u, 41u};
+ bool isCharacterHit04[] = {false, true, true, true, false, false, true, true, true, false, false, true, true, true, true, true, false};
// 0 10 20 30 40 46
// abcשנבdefג קכghiעיןjk lחלךmnoצמם pqrפרףstuד אוvwxה
// 233 240 250 260 265
// חלךmnoצ מםpqrפרףst uדאוvwxהסת yzטזץ
- 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 };
- 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 };
- 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 };
- 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 };
- 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 };
+ 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};
+ 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};
+ 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};
+ 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};
+ 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};
// 0 10 20 30 40 46
// שנבabcגקכd efעיןghiחל ךjklצמםmno פרףpqrדאוs tuהסתv
// 232 240 250 260 265
// ךjklצמםm noפרףpqrדא וstuהסתvwx טזץyz
- 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 };
- 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 };
- 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 };
- 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 };
- 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 };
-
- float visualX07[] = { 395.f };
- float visualY07[] = { 12.f };
- CharacterHitTest::Mode mode07[] = { CharacterHitTest::TAP };
- CharacterIndex logicalIndex07[] = { 1u };
- bool isCharacterHit07[] = { true };
-
- float visualX08[] = { 7.f };
- float visualY08[] = { 12.f };
- CharacterHitTest::Mode mode08[] = { CharacterHitTest::TAP };
- CharacterIndex logicalIndex08[] = { 1u };
- bool isCharacterHit08[] = { true };
+ 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};
+ 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};
+ 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};
+ 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};
+ 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};
+
+ float visualX07[] = {395.f};
+ float visualY07[] = {12.f};
+ CharacterHitTest::Mode mode07[] = {CharacterHitTest::TAP};
+ CharacterIndex logicalIndex07[] = {1u};
+ bool isCharacterHit07[] = {true};
+
+ float visualX08[] = {7.f};
+ float visualY08[] = {12.f};
+ CharacterHitTest::Mode mode08[] = {CharacterHitTest::TAP};
+ CharacterIndex logicalIndex08[] = {1u};
+ bool isCharacterHit08[] = {true};
struct GetClosestCursorIndexData data[] =
- {
{
- "Void text.",
- "",
- 1u,
- visualX01,
- visualY01,
- mode01,
- logicalIndex01,
- isCharacterHit01
- },
- {
- "Single line text.",
- "Hello world שלום עולם",
- 7u,
- visualX02,
- visualY02,
- mode02,
- logicalIndex02,
- isCharacterHit02
- },
- {
- "Single line with ligatures",
- "different الأربعاء",
- 4u,
- visualX03,
- visualY03,
- mode03,
- logicalIndex03,
- isCharacterHit03
- },
- {
- "Multiline. Single line paragraphs",
- "Hello world\n"
- "שלום עולם\n"
- "different الأربعاء\n",
- 17u,
- visualX04,
- visualY04,
- mode04,
- logicalIndex04,
- isCharacterHit04
- },
- {
- "Multiline. Single bidirectional paragraph, starts LTR, wrapped lines",
- "abcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuדאוvwxה"
- "סתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuד"
- "אוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqr"
- "פרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmno"
- "צמםpqrפרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjkl"
- "חלךmnoצמםpqrפרףstuדאוvwxהסתyzטזץ",
- 35u,
- visualX05,
- visualY05,
- mode05,
- logicalIndex05,
- isCharacterHit05
- },
- {
- "Multiline. Single bidirectional paragraph, starts RTL, wrapped lines",
- "שנבabcגקכdefעיןghiחלךjklצמםmnoפרףpqrדאוstuהסתv"
- "wxטזץyzשנבabcגקכdefעיןghiחלךjklצמםmnoפרףpqrדאוs"
- "tuהסתvwxטזץyzשנבabcגקכdefעיןghiחלךjklצמםmnoפרף"
- "pqrדאוstuהסתvwxטזץyzשנבabcגקכdefעיןghiחלךjklצמם"
- "mnoפרףpqrדאוstuהסתvwxטזץyzשנבabcגקכdefעיןghiחל"
- "ךjklצמםmnoפרףpqrדאוstuהסתvwxטזץyz",
- 35u,
- visualX06,
- visualY06,
- mode06,
- logicalIndex06,
- isCharacterHit06
- },
- {
- "Testing complex characters. Arabic ligatures",
- "الأَبْجَدِيَّة العَرَبِيَّة",
- 1u,
- visualX07,
- visualY07,
- mode07,
- logicalIndex07,
- isCharacterHit07
- },
- {
- "Testing complex characters. Latin ligatures",
- "fi ligature",
- 1u,
- visualX08,
- visualY08,
- mode08,
- logicalIndex08,
- isCharacterHit08
- }
- };
+ {"Void text.",
+ "",
+ 1u,
+ visualX01,
+ visualY01,
+ mode01,
+ logicalIndex01,
+ isCharacterHit01},
+ {"Single line text.",
+ "Hello world שלום עולם",
+ 7u,
+ visualX02,
+ visualY02,
+ mode02,
+ logicalIndex02,
+ isCharacterHit02},
+ {"Single line with ligatures",
+ "different الأربعاء",
+ 4u,
+ visualX03,
+ visualY03,
+ mode03,
+ logicalIndex03,
+ isCharacterHit03},
+ {"Multiline. Single line paragraphs",
+ "Hello world\n"
+ "שלום עולם\n"
+ "different الأربعاء\n",
+ 17u,
+ visualX04,
+ visualY04,
+ mode04,
+ logicalIndex04,
+ isCharacterHit04},
+ {"Multiline. Single bidirectional paragraph, starts LTR, wrapped lines",
+ "abcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuדאוvwxה"
+ "סתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqrפרףstuד"
+ "אוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmnoצמםpqr"
+ "פרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjklחלךmno"
+ "צמםpqrפרףstuדאוvwxהסתyzטזץabcשנבdefגקכghiעיןjkl"
+ "חלךmnoצמםpqrפרףstuדאוvwxהסתyzטזץ",
+ 35u,
+ visualX05,
+ visualY05,
+ mode05,
+ logicalIndex05,
+ isCharacterHit05},
+ {"Multiline. Single bidirectional paragraph, starts RTL, wrapped lines",
+ "שנבabcגקכdefעיןghiחלךjklצמםmnoפרףpqrדאוstuהסתv"
+ "wxטזץyzשנבabcגקכdefעיןghiחלךjklצמםmnoפרףpqrדאוs"
+ "tuהסתvwxטזץyzשנבabcגקכdefעיןghiחלךjklצמםmnoפרף"
+ "pqrדאוstuהסתvwxטזץyzשנבabcגקכdefעיןghiחלךjklצמם"
+ "mnoפרףpqrדאוstuהסתvwxטזץyzשנבabcגקכdefעיןghiחל"
+ "ךjklצמםmnoפרףpqrדאוstuהסתvwxטזץyz",
+ 35u,
+ visualX06,
+ visualY06,
+ mode06,
+ logicalIndex06,
+ isCharacterHit06},
+ {"Testing complex characters. Arabic ligatures",
+ "الأَبْجَدِيَّة العَرَبِيَّة",
+ 1u,
+ visualX07,
+ visualY07,
+ mode07,
+ logicalIndex07,
+ isCharacterHit07},
+ {"Testing complex characters. Latin ligatures",
+ "fi ligature",
+ 1u,
+ visualX08,
+ visualY08,
+ mode08,
+ logicalIndex08,
+ isCharacterHit08}};
const unsigned int numberOfTests = 8u;
- for( unsigned int index = 0; index < numberOfTests; ++index )
+ for(unsigned int index = 0; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetClosestCursorIndexTest( data[index] ) )
+ if(!GetClosestCursorIndexTest(data[index]))
{
tet_result(TET_FAIL);
}
{
tet_infoline(" UtcDaliGetCursorPosition");
- float visualX08[] = { 5.f };
- float visualY08[] = { 0.f };
- CharacterIndex logicalIndex08[] = { 1u };
+ float visualX08[] = {5.f};
+ float visualY08[] = {0.f};
+ CharacterIndex logicalIndex08[] = {1u};
struct GetCursorPositionData data[] =
- {
{
- "Testing complex characters. Latin ligatures",
- "fi ligature",
- 1u,
- logicalIndex08,
- visualX08,
- visualY08,
- }
- };
+ {
+ "Testing complex characters. Latin ligatures",
+ "fi ligature",
+ 1u,
+ logicalIndex08,
+ visualX08,
+ visualY08,
+ }};
const unsigned int numberOfTests = 1u;
- for( unsigned int index = 0; index < numberOfTests; ++index )
+ for(unsigned int index = 0; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !GetCursorPositionTest( data[index] ) )
+ if(!GetCursorPositionTest(data[index]))
{
tet_result(TET_FAIL);
}
{
tet_infoline(" UtcDaliFindSelectionIndices");
- float visualX01[] = { -100.f };
- float visualY01[] = { -100.f };
- bool found01[] = { false };
- CharacterIndex startIndex01[] = { 0 };
- CharacterIndex endIndex01[] = { 0 };
- CharacterIndex noHitText01[] = { 0 };
-
- float visualX02[] = { -100.f, 1000.f, 1000.f };
- float visualY02[] = { -100.f, 12.f, 1000.f };
- bool found02[] = { false, false, false };
- CharacterIndex startIndex02[] = { 0, 6u, 6u };
- CharacterIndex endIndex02[] = { 5u, 11u, 11u };
- CharacterIndex noHitText02[] = { 0, 11u, 11u };
-
- float visualX03[] = { 70.f };
- float visualY03[] = { 12.f };
- bool found03[] = { true };
- CharacterIndex startIndex03[] = { 6u };
- CharacterIndex endIndex03[] = { 11u };
- CharacterIndex noHitText03[] = { 0u };
-
- float visualX04[] = { 131.f };
- float visualY04[] = { 12.f };
- bool found04[] = { true };
- CharacterIndex startIndex04[] = { 12u };
- CharacterIndex endIndex04[] = { 16u };
- CharacterIndex noHitText04[] = { 0u };
-
- float visualX05[] = { 0.f };
- float visualY05[] = { 12.f };
- bool found05[] = { true };
- CharacterIndex startIndex05[] = { 0 };
- CharacterIndex endIndex05[] = { 1u };
- CharacterIndex noHitText05[] = { 0 };
-
- float visualX06[] = { 10.f };
- float visualY06[] = { 12.f };
- bool found06[] = { true };
- CharacterIndex startIndex06[] = { 0 };
- CharacterIndex endIndex06[] = { 1u };
- CharacterIndex noHitText06[] = { 0u };
+ float visualX01[] = {-100.f};
+ float visualY01[] = {-100.f};
+ bool found01[] = {false};
+ CharacterIndex startIndex01[] = {0};
+ CharacterIndex endIndex01[] = {0};
+ CharacterIndex noHitText01[] = {0};
+
+ float visualX02[] = {-100.f, 1000.f, 1000.f};
+ float visualY02[] = {-100.f, 12.f, 1000.f};
+ bool found02[] = {false, false, false};
+ CharacterIndex startIndex02[] = {0, 6u, 6u};
+ CharacterIndex endIndex02[] = {5u, 11u, 11u};
+ CharacterIndex noHitText02[] = {0, 11u, 11u};
+
+ float visualX03[] = {70.f};
+ float visualY03[] = {12.f};
+ bool found03[] = {true};
+ CharacterIndex startIndex03[] = {6u};
+ CharacterIndex endIndex03[] = {11u};
+ CharacterIndex noHitText03[] = {0u};
+
+ float visualX04[] = {131.f};
+ float visualY04[] = {12.f};
+ bool found04[] = {true};
+ CharacterIndex startIndex04[] = {12u};
+ CharacterIndex endIndex04[] = {16u};
+ CharacterIndex noHitText04[] = {0u};
+
+ float visualX05[] = {0.f};
+ float visualY05[] = {12.f};
+ bool found05[] = {true};
+ CharacterIndex startIndex05[] = {0};
+ CharacterIndex endIndex05[] = {1u};
+ CharacterIndex noHitText05[] = {0};
+
+ float visualX06[] = {10.f};
+ float visualY06[] = {12.f};
+ bool found06[] = {true};
+ CharacterIndex startIndex06[] = {0};
+ CharacterIndex endIndex06[] = {1u};
+ CharacterIndex noHitText06[] = {0u};
struct FindSelectionIndicesData data[] =
- {
- {
- "void text",
- "",
- 1u,
- visualX01,
- visualY01,
- found01,
- startIndex01,
- endIndex01,
- noHitText01
- },
- {
- "touch out of text's boundaries",
- "Hello world",
- 3u,
- visualX02,
- visualY02,
- found02,
- startIndex02,
- endIndex02,
- noHitText02
- },
- {
- "touch on the text",
- "Hello world demo",
- 1u,
- visualX03,
- visualY03,
- found03,
- startIndex03,
- endIndex03,
- noHitText03
- },
{
- "touch on the new paragraph character at the end of line",
- "Hello world demo\n",
- 1u,
- visualX04,
- visualY04,
- found04,
- startIndex04,
- endIndex04,
- noHitText04
- },
- {
- "touch on a white space character. is the unique character of the line",
- " ",
- 1u,
- visualX05,
- visualY05,
- found05,
- startIndex05,
- endIndex05,
- noHitText05
- },
- {
- "touch on a white space character. is between two words",
- "h ello",
- 1u,
- visualX06,
- visualY06,
- found06,
- startIndex06,
- endIndex06,
- noHitText06
- },
- };
+ {"void text",
+ "",
+ 1u,
+ visualX01,
+ visualY01,
+ found01,
+ startIndex01,
+ endIndex01,
+ noHitText01},
+ {"touch out of text's boundaries",
+ "Hello world",
+ 3u,
+ visualX02,
+ visualY02,
+ found02,
+ startIndex02,
+ endIndex02,
+ noHitText02},
+ {"touch on the text",
+ "Hello world demo",
+ 1u,
+ visualX03,
+ visualY03,
+ found03,
+ startIndex03,
+ endIndex03,
+ noHitText03},
+ {"touch on the new paragraph character at the end of line",
+ "Hello world demo\n",
+ 1u,
+ visualX04,
+ visualY04,
+ found04,
+ startIndex04,
+ endIndex04,
+ noHitText04},
+ {"touch on a white space character. is the unique character of the line",
+ " ",
+ 1u,
+ visualX05,
+ visualY05,
+ found05,
+ startIndex05,
+ endIndex05,
+ noHitText05},
+ {"touch on a white space character. is between two words",
+ "h ello",
+ 1u,
+ visualX06,
+ visualY06,
+ found06,
+ startIndex06,
+ endIndex06,
+ noHitText06},
+ };
const unsigned int numberOfTests = 6u;
- for( unsigned int index = 0; index < numberOfTests; ++index )
+ for(unsigned int index = 0; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !FindSelectionIndicesTest( data[index] ) )
+ if(!FindSelectionIndicesTest(data[index]))
{
tet_result(TET_FAIL);
}
{
tet_infoline(" UtcDaliPrimaryCursorHeight");
- float heights[] = { 19.f };
- CharacterIndex logicalIndex[] = { 1u };
+ float heights[] = {19.f};
+ CharacterIndex logicalIndex[] = {1u};
struct PrimaryCursorHeightData data[] =
- {
{
- "Testing primary cursor height when line spacing is used.",
- "Hello World",
- 1u,
- logicalIndex,
- heights,
- }
- };
+ {
+ "Testing primary cursor height when line spacing is used.",
+ "Hello World",
+ 1u,
+ logicalIndex,
+ heights,
+ }};
const unsigned int numberOfTests = 1u;
- for( unsigned int index = 0; index < numberOfTests; ++index )
+ for(unsigned int index = 0; index < numberOfTests; ++index)
{
ToolkitTestApplication application;
- if( !PrimaryCursorHeightTest( data[index] ) )
+ if(!PrimaryCursorHeightTest(data[index]))
{
tet_result(TET_FAIL);
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
#include <stdlib.h>
#include <unistd.h>
+#include <iostream>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
#include <dali-toolkit/internal/text/text-run-container.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
#include <toolkit-text-utils.h>
using namespace Dali;
using namespace Toolkit;
using namespace Text;
-
namespace
{
-
-const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+const std::string DEFAULT_FONT_DIR("/resources/fonts");
struct LayoutTextData
{
std::string text;
Size textArea;
unsigned int numberOfFonts;
- FontDescriptionRun *fontDescriptions;
+ FontDescriptionRun* fontDescriptions;
unsigned int numberOfLines;
LineRun* lines;
Layout::Engine::Type layout;
Text::LineWrap::Mode wrapMode;
};
-void Print( const LineRun& line )
+void Print(const LineRun& line)
{
std::cout << " glyph run, index : " << line.glyphRun.glyphIndex << ", num glyphs : " << line.glyphRun.numberOfGlyphs << std::endl;
std::cout << " character run, index : " << line.characterRun.characterIndex << ", num chars : " << line.characterRun.numberOfCharacters << std::endl;
}
-bool LayoutTextTest( const LayoutTextData& data )
+bool LayoutTextTest(const LayoutTextData& data)
{
// Load some fonts.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- fontClient.SetDpi( 96u, 96u );
+ fontClient.SetDpi(96u, 96u);
- char* pathNamePtr = get_current_dir_name();
- const std::string pathName( pathNamePtr );
- free( pathNamePtr );
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size layoutSize;
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- if( 0u != data.numberOfFonts )
+ if(0u != data.numberOfFonts)
{
- fontDescriptionRuns.Insert( fontDescriptionRuns.End(),
- data.fontDescriptions,
- data.fontDescriptions + data.numberOfFonts );
+ fontDescriptionRuns.Insert(fontDescriptionRuns.End(),
+ data.fontDescriptions,
+ data.fontDescriptions + data.numberOfFonts);
}
LayoutOptions options;
options.align = false;
- CreateTextModel( data.text,
- data.textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- data.wrapMode,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ CreateTextModel(data.text,
+ data.textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ data.wrapMode,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
Vector<LineRun>& lines = textModel->mVisualModel->mLines;
// 4) Compare the results.
- if( lines.Count() != data.numberOfLines )
+ if(lines.Count() != data.numberOfLines)
{
std::cout << " Different number of lines : " << lines.Count() << ", expected : " << data.numberOfLines << std::endl;
return false;
}
- for( unsigned int index = 0u; index < data.numberOfLines; ++index )
+ for(unsigned int index = 0u; index < data.numberOfLines; ++index)
{
- const LineRun& line = *( lines.Begin() + index );
- const LineRun& expectedLine = *( data.lines + index );
+ const LineRun& line = *(lines.Begin() + index);
+ const LineRun& expectedLine = *(data.lines + index);
- if( line.characterRun.characterIndex != expectedLine.characterRun.characterIndex )
+ if(line.characterRun.characterIndex != expectedLine.characterRun.characterIndex)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( line.characterRun.numberOfCharacters != expectedLine.characterRun.numberOfCharacters )
+ if(line.characterRun.numberOfCharacters != expectedLine.characterRun.numberOfCharacters)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
}
} // namespace
-
int UtcDaliTextHyphenWrapping(void)
{
ToolkitTestApplication application;
// Layout some lines of left to right text.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun1;
- fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
fontDescriptionRun1.characterRun.numberOfCharacters = 13u;
- fontDescriptionRun1.familyLength = fontFamily.size();
- fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
- memcpy( fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength );
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
fontDescriptionRun1.familyDefined = true;
fontDescriptionRun1.weightDefined = false;
- fontDescriptionRun1.widthDefined = false;
- fontDescriptionRun1.slantDefined = false;
- fontDescriptionRun1.sizeDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun1 );
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
Size textArea(65.0f, 200.f);
LineRun line1 =
- {
- { 0u, 5u },
- { 0u, 5u },
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 5u},
+ {0u, 5u},
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
LineRun line2 =
- {
- { 5u, 8u },
- { 5u, 8u },
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {5u, 8u},
+ {5u, 8u},
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line1 );
- lines.PushBack( line2 );
+ lines.PushBack(line1);
+ lines.PushBack(line2);
LayoutTextData data =
- {
- "Hi Experiment",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- 2u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 13u,
- (Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION
- };
-
- if( !LayoutTextTest( data ) )
+ {
+ "Hi Experiment",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ 2u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 13u,
+ (Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION};
+
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Layout some lines of left to right text.
- const std::string fontFamily( "DejaVuSans" );
+ const std::string fontFamily("DejaVuSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun1;
- fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
fontDescriptionRun1.characterRun.numberOfCharacters = 13u;
- fontDescriptionRun1.familyLength = fontFamily.size();
- fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
- memcpy( fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength );
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
fontDescriptionRun1.familyDefined = true;
fontDescriptionRun1.weightDefined = false;
- fontDescriptionRun1.widthDefined = false;
- fontDescriptionRun1.slantDefined = false;
- fontDescriptionRun1.sizeDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun1 );
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
Size textArea(72.0f, 200.f);
LineRun line1 =
- {
- { 0u, 3u },
- { 0u, 3u },
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 3u},
+ {0u, 3u},
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
LineRun line2 =
- {
- { 3u, 6u },
- { 3u, 6u },
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {3u, 6u},
+ {3u, 6u},
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
LineRun line3 =
- {
- { 9u, 4u },
- { 9u, 4u },
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {9u, 4u},
+ {9u, 4u},
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line1 );
- lines.PushBack( line2 );
- lines.PushBack( line3 );
+ lines.PushBack(line1);
+ lines.PushBack(line2);
+ lines.PushBack(line3);
LayoutTextData data =
- {
- "Hi Experiment",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- 3u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 13u,
- (Text::LineWrap::Mode)DevelText::LineWrap::MIXED
- };
-
- if( !LayoutTextTest( data ) )
+ {
+ "Hi Experiment",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ 3u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 13u,
+ (Text::LineWrap::Mode)DevelText::LineWrap::MIXED};
+
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
#include <stdlib.h>
#include <unistd.h>
+#include <iostream>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
#include <dali-toolkit/internal/text/text-run-container.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/dali-toolkit.h>
#include <toolkit-text-utils.h>
using namespace Dali;
namespace
{
-
-const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+const std::string DEFAULT_FONT_DIR("/resources/fonts");
struct LayoutTextData
{
- std::string description;
- std::string text;
- Size textArea;
- unsigned int numberOfFonts;
- FontDescriptionRun* fontDescriptions;
- Size layoutSize;
- unsigned int totalNumberOfGlyphs;
- float* positions;
- unsigned int numberOfLines;
- LineRun* lines;
- Layout::Engine::Type layout;
- unsigned int startIndex;
- unsigned int numberOfGlyphs;
- bool ellipsis:1;
- DevelText::EllipsisPosition::Type ellipsisPosition;
- bool updated:1;
+ std::string description;
+ std::string text;
+ Size textArea;
+ unsigned int numberOfFonts;
+ FontDescriptionRun* fontDescriptions;
+ Size layoutSize;
+ unsigned int totalNumberOfGlyphs;
+ float* positions;
+ unsigned int numberOfLines;
+ LineRun* lines;
+ Layout::Engine::Type layout;
+ unsigned int startIndex;
+ unsigned int numberOfGlyphs;
+ bool ellipsis : 1;
+ DevelText::EllipsisPosition::Type ellipsisPosition;
+ bool updated : 1;
};
-void Print( const LineRun& line )
+void Print(const LineRun& line)
{
std::cout << " glyph run, index : " << line.glyphRun.glyphIndex << ", num glyphs : " << line.glyphRun.numberOfGlyphs << std::endl;
std::cout << " character run, index : " << line.characterRun.characterIndex << ", num chars : " << line.characterRun.numberOfCharacters << std::endl;
std::cout << " ellipsis : " << line.ellipsis << std::endl;
}
-bool LayoutTextTest( const LayoutTextData& data )
+bool LayoutTextTest(const LayoutTextData& data)
{
// Load some fonts.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- fontClient.SetDpi( 96u, 96u );
+ fontClient.SetDpi(96u, 96u);
- char* pathNamePtr = get_current_dir_name();
- const std::string pathName( pathNamePtr );
- free( pathNamePtr );
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHindiRegular.ttf" );
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHindiRegular.ttf");
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size layoutSize;
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- if( 0u != data.numberOfFonts )
+ if(0u != data.numberOfFonts)
{
- fontDescriptionRuns.Insert( fontDescriptionRuns.End(),
- data.fontDescriptions,
- data.fontDescriptions + data.numberOfFonts );
+ fontDescriptionRuns.Insert(fontDescriptionRuns.End(),
+ data.fontDescriptions,
+ data.fontDescriptions + data.numberOfFonts);
}
LayoutOptions options;
options.align = false;
- CreateTextModel( data.text,
- data.textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ CreateTextModel(data.text,
+ data.textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
// 2) Clear the layout.
Vector<LineRun>& lines = visualModel->mLines;
- const Length numberOfCharacters = logicalModel->mText.Count();
- const bool isLastNewParagraph = ( 0u == numberOfCharacters ) ? false : TextAbstraction::IsNewParagraph( *( logicalModel->mText.Begin() + ( numberOfCharacters - 1u ) ) );
- const GlyphIndex lastGlyphIndex = data.startIndex + data.numberOfGlyphs - 1u;
- const bool removeLastLine = isLastNewParagraph && ( lastGlyphIndex + 1u == visualModel->mGlyphs.Count() );
+ const Length numberOfCharacters = logicalModel->mText.Count();
+ const bool isLastNewParagraph = (0u == numberOfCharacters) ? false : TextAbstraction::IsNewParagraph(*(logicalModel->mText.Begin() + (numberOfCharacters - 1u)));
+ const GlyphIndex lastGlyphIndex = data.startIndex + data.numberOfGlyphs - 1u;
+ const bool removeLastLine = isLastNewParagraph && (lastGlyphIndex + 1u == visualModel->mGlyphs.Count());
LineIndex startRemoveIndex = 0u;
- if( 0u != lines.Count() )
+ if(0u != lines.Count())
{
- startRemoveIndex = lines.Count();
+ startRemoveIndex = lines.Count();
LineIndex endRemoveIndex = startRemoveIndex;
- ClearGlyphRuns( data.startIndex,
- lastGlyphIndex + ( removeLastLine ? 1u : 0u ),
- lines,
- startRemoveIndex,
- endRemoveIndex );
+ ClearGlyphRuns(data.startIndex,
+ lastGlyphIndex + (removeLastLine ? 1u : 0u),
+ lines,
+ startRemoveIndex,
+ endRemoveIndex);
// Update the character runs of the lines.
const CharacterIndex* const glyphsToCharactersBuffer = visualModel->mGlyphsToCharacters.Begin();
- const Length* const charactersPerGlyph = visualModel->mCharactersPerGlyph.Begin();
- const CharacterIndex startCharacterIndex = *( glyphsToCharactersBuffer + data.startIndex );
- const CharacterIndex lastCharacterIndex = *( glyphsToCharactersBuffer + lastGlyphIndex ) + *( charactersPerGlyph + lastGlyphIndex ) - 1u;
- ClearCharacterRuns( startCharacterIndex,
- lastCharacterIndex + ( removeLastLine ? 1u : 0u ),
- lines,
- startRemoveIndex,
- endRemoveIndex );
-
- lines.Erase( lines.Begin() + startRemoveIndex,
- lines.Begin() + endRemoveIndex );
+ const Length* const charactersPerGlyph = visualModel->mCharactersPerGlyph.Begin();
+ const CharacterIndex startCharacterIndex = *(glyphsToCharactersBuffer + data.startIndex);
+ const CharacterIndex lastCharacterIndex = *(glyphsToCharactersBuffer + lastGlyphIndex) + *(charactersPerGlyph + lastGlyphIndex) - 1u;
+ ClearCharacterRuns(startCharacterIndex,
+ lastCharacterIndex + (removeLastLine ? 1u : 0u),
+ lines,
+ startRemoveIndex,
+ endRemoveIndex);
+
+ lines.Erase(lines.Begin() + startRemoveIndex,
+ lines.Begin() + endRemoveIndex);
}
Vector<Vector2>& glyphPositions = visualModel->mGlyphPositions;
- glyphPositions.Erase( glyphPositions.Begin() + data.startIndex,
- glyphPositions.Begin() + data.startIndex + data.numberOfGlyphs );
+ glyphPositions.Erase(glyphPositions.Begin() + data.startIndex,
+ glyphPositions.Begin() + data.startIndex + data.numberOfGlyphs);
// 3) Layout
Layout::Engine engine;
- engine.SetMetrics( metrics );
- engine.SetLayout( data.layout );
+ engine.SetMetrics(metrics);
+ engine.SetLayout(data.layout);
- textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
- textModel->mLineWrapMode = LineWrap::WORD;
+ textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
+ textModel->mLineWrapMode = LineWrap::WORD;
textModel->mIgnoreSpacesAfterText = true;
- Layout::Parameters layoutParameters( data.textArea,
- textModel );
+ Layout::Parameters layoutParameters(data.textArea,
+ textModel);
layoutParameters.isLastNewParagraph = isLastNewParagraph;
// The initial glyph and the number of glyphs to layout.
- layoutParameters.startGlyphIndex = data.startIndex;
- layoutParameters.numberOfGlyphs = data.numberOfGlyphs;
- layoutParameters.startLineIndex = startRemoveIndex;
+ layoutParameters.startGlyphIndex = data.startIndex;
+ layoutParameters.numberOfGlyphs = data.numberOfGlyphs;
+ layoutParameters.startLineIndex = startRemoveIndex;
layoutParameters.estimatedNumberOfLines = logicalModel->mParagraphInfo.Count();
layoutSize = Vector2::ZERO;
- bool isAutoScroll = false;
- const bool updated = engine.LayoutText( layoutParameters,
- layoutSize,
- data.ellipsis,
- isAutoScroll,
- data.ellipsisPosition );
+ bool isAutoScroll = false;
+ const bool updated = engine.LayoutText(layoutParameters,
+ layoutSize,
+ data.ellipsis,
+ isAutoScroll,
+ data.ellipsisPosition);
// 4) Compare the results.
- if( updated != data.updated )
+ if(updated != data.updated)
{
std::cout << " Different updated bool : " << updated << ", expected : " << data.updated << std::endl;
return false;
}
- if( layoutSize != data.layoutSize )
+ if(layoutSize != data.layoutSize)
{
std::cout << " Different layout size : " << layoutSize << ", expected : " << data.layoutSize << std::endl;
return false;
}
- for( unsigned int index = 0u; index < data.totalNumberOfGlyphs; ++index )
+ for(unsigned int index = 0u; index < data.totalNumberOfGlyphs; ++index)
{
- const Vector2& position = *( glyphPositions.Begin() + index );
+ const Vector2& position = *(glyphPositions.Begin() + index);
- if( fabsf( std::round( position.x ) - *( data.positions + 2u * index ) ) > Math::MACHINE_EPSILON_1000 )
+ if(fabsf(std::round(position.x) - *(data.positions + 2u * index)) > Math::MACHINE_EPSILON_1000)
{
- std::cout << " Different position for glyph " << index << " x : " << position.x << ", expected : " << *( data.positions + 2u * index ) << std::endl;
+ std::cout << " Different position for glyph " << index << " x : " << position.x << ", expected : " << *(data.positions + 2u * index) << std::endl;
return false;
}
- if( fabsf( position.y - *( data.positions + 2u * index + 1u ) ) > Math::MACHINE_EPSILON_1000 )
+ if(fabsf(position.y - *(data.positions + 2u * index + 1u)) > Math::MACHINE_EPSILON_1000)
{
- std::cout << " Different position for glyph " << index << " y : " << position.y << ", expected : " << *( data.positions + 2u * index + 1u ) << std::endl;
+ std::cout << " Different position for glyph " << index << " y : " << position.y << ", expected : " << *(data.positions + 2u * index + 1u) << std::endl;
return false;
}
}
- if( lines.Count() != data.numberOfLines )
+ if(lines.Count() != data.numberOfLines)
{
std::cout << " Different number of lines : " << lines.Count() << ", expected : " << data.numberOfLines << std::endl;
return false;
}
- for( unsigned int index = 0u; index < data.numberOfLines; ++index )
+ for(unsigned int index = 0u; index < data.numberOfLines; ++index)
{
- const LineRun& line = *( lines.Begin() + index );
- const LineRun& expectedLine = *( data.lines + index );
+ const LineRun& line = *(lines.Begin() + index);
+ const LineRun& expectedLine = *(data.lines + index);
- if( line.glyphRun.glyphIndex != expectedLine.glyphRun.glyphIndex )
+ if(line.glyphRun.glyphIndex != expectedLine.glyphRun.glyphIndex)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( line.glyphRun.numberOfGlyphs != expectedLine.glyphRun.numberOfGlyphs )
+ if(line.glyphRun.numberOfGlyphs != expectedLine.glyphRun.numberOfGlyphs)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( line.characterRun.characterIndex != expectedLine.characterRun.characterIndex )
+ if(line.characterRun.characterIndex != expectedLine.characterRun.characterIndex)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( line.characterRun.numberOfCharacters != expectedLine.characterRun.numberOfCharacters )
+ if(line.characterRun.numberOfCharacters != expectedLine.characterRun.numberOfCharacters)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( fabsf( floor( line.width ) - expectedLine.width ) > Math::MACHINE_EPSILON_1 )
+ if(fabsf(floor(line.width) - expectedLine.width) > Math::MACHINE_EPSILON_1)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( fabsf( line.ascender - expectedLine.ascender ) > Math::MACHINE_EPSILON_1 )
+ if(fabsf(line.ascender - expectedLine.ascender) > Math::MACHINE_EPSILON_1)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( fabsf( line.descender - expectedLine.descender ) > Math::MACHINE_EPSILON_1 )
+ if(fabsf(line.descender - expectedLine.descender) > Math::MACHINE_EPSILON_1)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( fabsf( line.extraLength - expectedLine.extraLength ) > Math::MACHINE_EPSILON_1 )
+ if(fabsf(line.extraLength - expectedLine.extraLength) > Math::MACHINE_EPSILON_1)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
- if( line.ellipsis != expectedLine.ellipsis )
+ if(line.ellipsis != expectedLine.ellipsis)
{
std::cout << " Different line info for line : " << index << std::endl;
- Print( line );
+ Print(line);
std::cout << " expected" << std::endl;
- Print( expectedLine );
+ Print(expectedLine);
return false;
}
struct AlignData
{
- std::string description;
- std::string text;
- Size textArea;
- unsigned int numberOfFonts;
- FontDescriptionRun* fontDescriptions;
- Text::HorizontalAlignment::Type horizontalAlignment;
- Text::VerticalAlignment::Type verticalAlignment;
- unsigned int startIndex;
- unsigned int numberOfCharacters;
- unsigned int numberOfLines;
- float* lineOffsets;
- Dali::LayoutDirection::Type layoutDirection;
- bool matchSystemLanguageDirection;
+ std::string description;
+ std::string text;
+ Size textArea;
+ unsigned int numberOfFonts;
+ FontDescriptionRun* fontDescriptions;
+ Text::HorizontalAlignment::Type horizontalAlignment;
+ Text::VerticalAlignment::Type verticalAlignment;
+ unsigned int startIndex;
+ unsigned int numberOfCharacters;
+ unsigned int numberOfLines;
+ float* lineOffsets;
+ Dali::LayoutDirection::Type layoutDirection;
+ bool matchSystemLanguageDirection;
};
-bool AlignTest( const AlignData& data )
+bool AlignTest(const AlignData& data)
{
// Load some fonts.
TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- fontClient.SetDpi( 96u, 96u );
+ fontClient.SetDpi(96u, 96u);
- char* pathNamePtr = get_current_dir_name();
- const std::string pathName( pathNamePtr );
- free( pathNamePtr );
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName(pathNamePtr);
+ free(pathNamePtr);
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
- fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf");
+ fontClient.GetFontId(pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf");
// 1) Create the model.
- ModelPtr textModel;
+ ModelPtr textModel;
MetricsPtr metrics;
- Size layoutSize;
+ Size layoutSize;
Vector<FontDescriptionRun> fontDescriptionRuns;
- if( 0u != data.numberOfFonts )
+ if(0u != data.numberOfFonts)
{
- fontDescriptionRuns.Insert( fontDescriptionRuns.End(),
- data.fontDescriptions,
- data.fontDescriptions + data.numberOfFonts );
+ fontDescriptionRuns.Insert(fontDescriptionRuns.End(),
+ data.fontDescriptions,
+ data.fontDescriptions + data.numberOfFonts);
}
LayoutOptions options;
options.align = false;
- CreateTextModel( data.text,
- data.textArea,
- fontDescriptionRuns,
- options,
- layoutSize,
- textModel,
- metrics,
- false,
- LineWrap::WORD,
- false,
- Toolkit::DevelText::EllipsisPosition::END,
- 0.f );
+ CreateTextModel(data.text,
+ data.textArea,
+ fontDescriptionRuns,
+ options,
+ layoutSize,
+ textModel,
+ metrics,
+ false,
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END,
+ 0.0f, // lineSpacing
+ 0.0f // characterSpacing
+ );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
- VisualModelPtr visualModel = textModel->mVisualModel;
+ VisualModelPtr visualModel = textModel->mVisualModel;
// Call the Align method.
Layout::Engine engine;
- engine.SetMetrics( metrics );
+ engine.SetMetrics(metrics);
float alignmentOffset = 0.f;
- engine.Align( data.textArea,
- data.startIndex,
- data.numberOfCharacters,
- data.horizontalAlignment,
- visualModel->mLines,
- alignmentOffset,
- data.layoutDirection,
- data.matchSystemLanguageDirection );
+ engine.Align(data.textArea,
+ data.startIndex,
+ data.numberOfCharacters,
+ data.horizontalAlignment,
+ visualModel->mLines,
+ alignmentOffset,
+ data.layoutDirection,
+ data.matchSystemLanguageDirection);
// Compare results.
- if( data.numberOfLines != visualModel->mLines.Count() )
+ if(data.numberOfLines != visualModel->mLines.Count())
{
std::cout << " Different number of lines : " << visualModel->mLines.Count() << ", expected : " << data.numberOfLines << std::endl;
return false;
}
const LineRun* const linesBuffer = visualModel->mLines.Begin();
- for( unsigned int index = 0u; index < data.numberOfLines; ++index )
+ for(unsigned int index = 0u; index < data.numberOfLines; ++index)
{
- const LineRun& line = *( linesBuffer + index );
+ const LineRun& line = *(linesBuffer + index);
- if( line.alignmentOffset != *( data.lineOffsets + index ) )
+ if(line.alignmentOffset != *(data.lineOffsets + index))
{
- std::cout << " different line offset for index " << index << " : " << line.alignmentOffset << ", expected : " << *( data.lineOffsets + index ) << std::endl;
+ std::cout << " different line offset for index " << index << " : " << line.alignmentOffset << ", expected : " << *(data.lineOffsets + index) << std::endl;
return false;
}
}
Layout::Engine engine;
- DALI_TEST_CHECK( Layout::Engine::SINGLE_LINE_BOX == engine.GetLayout() );
+ DALI_TEST_CHECK(Layout::Engine::SINGLE_LINE_BOX == engine.GetLayout());
- engine.SetLayout( Layout::Engine::MULTI_LINE_BOX );
- DALI_TEST_CHECK( Layout::Engine::MULTI_LINE_BOX == engine.GetLayout() );
+ engine.SetLayout(Layout::Engine::MULTI_LINE_BOX);
+ DALI_TEST_CHECK(Layout::Engine::MULTI_LINE_BOX == engine.GetLayout());
tet_result(TET_PASS);
END_TEST;
Layout::Engine engine;
- DALI_TEST_EQUALS( 0, engine.GetCursorWidth(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, engine.GetCursorWidth(), TEST_LOCATION);
- engine.SetCursorWidth( 2 );
- DALI_TEST_EQUALS( 2, engine.GetCursorWidth(), TEST_LOCATION );
+ engine.SetCursorWidth(2);
+ DALI_TEST_EQUALS(2, engine.GetCursorWidth(), TEST_LOCATION);
tet_result(TET_PASS);
END_TEST;
ToolkitTestApplication application;
tet_infoline(" UtcDaliTextLayoutNoText");
- Size textArea(100.f, 60.f);
- Size layoutSize = Vector2::ZERO;
+ Size textArea(100.f, 60.f);
+ Size layoutSize = Vector2::ZERO;
LayoutTextData data =
- {
- "No text",
- "",
- textArea,
- 0u,
- NULL,
- layoutSize,
- 0u,
- NULL,
- 0u,
- NULL,
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 0u,
- false,
- DevelText::EllipsisPosition::END,
- false
- };
+ {
+ "No text",
+ "",
+ textArea,
+ 0u,
+ NULL,
+ layoutSize,
+ 0u,
+ NULL,
+ 0u,
+ NULL,
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 0u,
+ false,
+ DevelText::EllipsisPosition::END,
+ false};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Won't layout the text in multi-line if the width is too small.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun;
- fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
fontDescriptionRun.characterRun.numberOfCharacters = 11u;
- fontDescriptionRun.familyLength = fontFamily.size();
- fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
- memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
fontDescriptionRun.familyDefined = true;
fontDescriptionRun.weightDefined = false;
- fontDescriptionRun.widthDefined = false;
- fontDescriptionRun.slantDefined = false;
- fontDescriptionRun.sizeDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun );
- Size textArea(1.f, 1.f);
- Size layoutSize = Vector2::ZERO;
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(1.f, 1.f);
+ Size layoutSize = Vector2::ZERO;
LayoutTextData data =
- {
- "Layout text in a small area",
- "Hello world",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 0u,
- NULL,
- 0u,
- NULL,
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 11u,
- false,
- DevelText::EllipsisPosition::END,
- false
- };
+ {
+ "Layout text in a small area",
+ "Hello world",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 0u,
+ NULL,
+ 0u,
+ NULL,
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 11u,
+ false,
+ DevelText::EllipsisPosition::END,
+ false};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Will layout the text in single line as it can be scrolled.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun;
- fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
fontDescriptionRun.characterRun.numberOfCharacters = 11u;
- fontDescriptionRun.familyLength = fontFamily.size();
- fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
- memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
fontDescriptionRun.familyDefined = true;
fontDescriptionRun.weightDefined = false;
- fontDescriptionRun.widthDefined = false;
- fontDescriptionRun.slantDefined = false;
- fontDescriptionRun.sizeDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun );
- Size textArea(1.f, 1.f);
- Size layoutSize(81.f, 20.f);
- float positions[] = { 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f };
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(1.f, 1.f);
+ Size layoutSize(81.f, 20.f);
+ float positions[] = {0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f};
struct LineRun line =
- {
- { 0u, 11u },
- { 0u, 11u },
- 81.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 11u},
+ {0u, 11u},
+ 81.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line );
+ lines.PushBack(line);
LayoutTextData data =
- {
- "Layout text in a small area",
- "Hello world",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 11u,
- positions,
- 1u,
- lines.Begin(),
- Layout::Engine::SINGLE_LINE_BOX,
- 0u,
- 11u,
- false,
- DevelText::EllipsisPosition::END,
- true
- };
+ {
+ "Layout text in a small area",
+ "Hello world",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 11u,
+ positions,
+ 1u,
+ lines.Begin(),
+ Layout::Engine::SINGLE_LINE_BOX,
+ 0u,
+ 11u,
+ false,
+ DevelText::EllipsisPosition::END,
+ true};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Layout some lines of left to right text.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun1;
- fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
fontDescriptionRun1.characterRun.numberOfCharacters = 18u;
- fontDescriptionRun1.familyLength = fontFamily.size();
- fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
- memcpy( fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength );
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
fontDescriptionRun1.familyDefined = true;
fontDescriptionRun1.weightDefined = false;
- fontDescriptionRun1.widthDefined = false;
- fontDescriptionRun1.slantDefined = false;
- fontDescriptionRun1.sizeDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
FontDescriptionRun fontDescriptionRun2;
- fontDescriptionRun2.characterRun.characterIndex = 18u;
+ fontDescriptionRun2.characterRun.characterIndex = 18u;
fontDescriptionRun2.characterRun.numberOfCharacters = 31u;
- fontDescriptionRun2.familyLength = fontFamily.size();
- fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
- memcpy( fontDescriptionRun2.familyName, fontFamily.c_str(), fontDescriptionRun2.familyLength );
+ fontDescriptionRun2.familyLength = fontFamily.size();
+ fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
+ memcpy(fontDescriptionRun2.familyName, fontFamily.c_str(), fontDescriptionRun2.familyLength);
fontDescriptionRun2.familyDefined = true;
fontDescriptionRun2.weightDefined = false;
- fontDescriptionRun2.widthDefined = false;
- fontDescriptionRun2.slantDefined = false;
- fontDescriptionRun2.sizeDefined = false;
+ fontDescriptionRun2.widthDefined = false;
+ fontDescriptionRun2.slantDefined = false;
+ fontDescriptionRun2.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun1 );
- fontDescriptionRuns.PushBack( fontDescriptionRun2 );
- Size textArea(100.f, 300.f);
- Size layoutSize(98.f, 97.f);
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
+ fontDescriptionRuns.PushBack(fontDescriptionRun2);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(98.f, 97.f);
float positions[] =
- {
- 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f,
- 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f, 45.f, -12.f,
- 0.f, -12.f, 8.f, -9.f, 18.f, -9.f, 27.f, -9.f, 38.f, -9.f, 47.f, -11.f, 53.f, -0.f,
- 0.f, -12.f, 11.f, -12.f, 15.f, -12.f, 26.f, -9.f, 36.f, -9.f, 42.f, -9.f, 53.f, -9.f, 62.f, -11.f, 68.f, -0.f,
- 0.f, -12.f, 4.f, -12.f, 9.f, -9.f, 18.f, -9.f, 28.f, -9.f, 36.f, -0.f, 41.f, -9.f, 51.f, -12.f, 57.f, -0.f, 62.f, -11.f, 68.f, -9.f, 78.f, -9.f, 87.f, -11.f, 94.f, -2.f
- };
+ {
+ 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f, 45.f, -12.f, 0.f, -12.f, 8.f, -9.f, 18.f, -9.f, 27.f, -9.f, 38.f, -9.f, 47.f, -11.f, 53.f, -0.f, 0.f, -12.f, 11.f, -12.f, 15.f, -12.f, 26.f, -9.f, 36.f, -9.f, 42.f, -9.f, 53.f, -9.f, 62.f, -11.f, 68.f, -0.f, 0.f, -12.f, 4.f, -12.f, 9.f, -9.f, 18.f, -9.f, 28.f, -9.f, 36.f, -0.f, 41.f, -9.f, 51.f, -12.f, 57.f, -0.f, 62.f, -11.f, 68.f, -9.f, 78.f, -9.f, 87.f, -11.f, 94.f, -2.f};
struct LineRun line0 =
- {
- { 0u, 12u },
- { 0u, 12u },
- 81.f,
- 15.f,
- -5.f,
- 4.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 12u},
+ {0u, 12u},
+ 81.f,
+ 15.f,
+ -5.f,
+ 4.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line1 =
- {
- { 12u, 6u },
- { 12u, 6u },
- 44.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {12u, 6u},
+ {12u, 6u},
+ 44.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line2 =
- {
- { 18u, 7u },
- { 18u, 7u },
- 54.f,
- 15.f,
- -4.f,
- 6.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {18u, 7u},
+ {18u, 7u},
+ 54.f,
+ 15.f,
+ -4.f,
+ 6.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line3 =
- {
- { 25u, 9u },
- { 25u, 10u },
- 68.f,
- 15.f,
- -4.f,
- 6.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {25u, 9u},
+ {25u, 10u},
+ 68.f,
+ 15.f,
+ -4.f,
+ 6.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line4 =
- {
- { 34u, 14u },
- { 35u, 14u },
- 98.f,
- 15.f,
- -4.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {34u, 14u},
+ {35u, 14u},
+ 98.f,
+ 15.f,
+ -4.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line0 );
- lines.PushBack( line1 );
- lines.PushBack( line2 );
- lines.PushBack( line3 );
- lines.PushBack( line4 );
+ lines.PushBack(line0);
+ lines.PushBack(line1);
+ lines.PushBack(line2);
+ lines.PushBack(line3);
+ lines.PushBack(line4);
LayoutTextData data =
- {
- "Layout simple multi-line text",
- "Hello world demo.\n"
- "Layout different lines of text.",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 48u,
- positions,
- 5u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 48u,
- false,
- DevelText::EllipsisPosition::END,
- true
- };
+ {
+ "Layout simple multi-line text",
+ "Hello world demo.\n"
+ "Layout different lines of text.",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 48u,
+ positions,
+ 5u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 48u,
+ false,
+ DevelText::EllipsisPosition::END,
+ true};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Layout some lines of bidirectional text.
- const std::string fontFamily1( "TizenSans" );
+ const std::string fontFamily1("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun1;
- fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
fontDescriptionRun1.characterRun.numberOfCharacters = 17u;
- fontDescriptionRun1.familyLength = fontFamily1.size();
- fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
- memcpy( fontDescriptionRun1.familyName, fontFamily1.c_str(), fontDescriptionRun1.familyLength );
+ fontDescriptionRun1.familyLength = fontFamily1.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily1.c_str(), fontDescriptionRun1.familyLength);
fontDescriptionRun1.familyDefined = true;
fontDescriptionRun1.weightDefined = false;
- fontDescriptionRun1.widthDefined = false;
- fontDescriptionRun1.slantDefined = false;
- fontDescriptionRun1.sizeDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
- const std::string fontFamily2( "TizenSansHebrew" );
+ const std::string fontFamily2("TizenSansHebrew");
// Set a known font description
FontDescriptionRun fontDescriptionRun2;
- fontDescriptionRun2.characterRun.characterIndex = 17u;
+ fontDescriptionRun2.characterRun.characterIndex = 17u;
fontDescriptionRun2.characterRun.numberOfCharacters = 9u;
- fontDescriptionRun2.familyLength = fontFamily2.size();
- fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
- memcpy( fontDescriptionRun2.familyName, fontFamily2.c_str(), fontDescriptionRun2.familyLength );
+ fontDescriptionRun2.familyLength = fontFamily2.size();
+ fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
+ memcpy(fontDescriptionRun2.familyName, fontFamily2.c_str(), fontDescriptionRun2.familyLength);
fontDescriptionRun2.familyDefined = true;
fontDescriptionRun2.weightDefined = false;
- fontDescriptionRun2.widthDefined = false;
- fontDescriptionRun2.slantDefined = false;
- fontDescriptionRun2.sizeDefined = false;
+ fontDescriptionRun2.widthDefined = false;
+ fontDescriptionRun2.slantDefined = false;
+ fontDescriptionRun2.sizeDefined = false;
- const std::string fontFamily3( "TizenSans" );
+ const std::string fontFamily3("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun3;
- fontDescriptionRun3.characterRun.characterIndex = 26u;
+ fontDescriptionRun3.characterRun.characterIndex = 26u;
fontDescriptionRun3.characterRun.numberOfCharacters = 2u;
- fontDescriptionRun3.familyLength = fontFamily3.size();
- fontDescriptionRun3.familyName = new char[fontDescriptionRun3.familyLength];
- memcpy( fontDescriptionRun3.familyName, fontFamily3.c_str(), fontDescriptionRun3.familyLength );
+ fontDescriptionRun3.familyLength = fontFamily3.size();
+ fontDescriptionRun3.familyName = new char[fontDescriptionRun3.familyLength];
+ memcpy(fontDescriptionRun3.familyName, fontFamily3.c_str(), fontDescriptionRun3.familyLength);
fontDescriptionRun3.familyDefined = true;
fontDescriptionRun3.weightDefined = false;
- fontDescriptionRun3.widthDefined = false;
- fontDescriptionRun3.slantDefined = false;
- fontDescriptionRun3.sizeDefined = false;
+ fontDescriptionRun3.widthDefined = false;
+ fontDescriptionRun3.slantDefined = false;
+ fontDescriptionRun3.sizeDefined = false;
- const std::string fontFamily4( "TizenSansHebrew" );
+ const std::string fontFamily4("TizenSansHebrew");
// Set a known font description
FontDescriptionRun fontDescriptionRun4;
- fontDescriptionRun4.characterRun.characterIndex = 28u;
+ fontDescriptionRun4.characterRun.characterIndex = 28u;
fontDescriptionRun4.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun4.familyLength = fontFamily4.size();
- fontDescriptionRun4.familyName = new char[fontDescriptionRun4.familyLength];
- memcpy( fontDescriptionRun4.familyName, fontFamily4.c_str(), fontDescriptionRun4.familyLength );
+ fontDescriptionRun4.familyLength = fontFamily4.size();
+ fontDescriptionRun4.familyName = new char[fontDescriptionRun4.familyLength];
+ memcpy(fontDescriptionRun4.familyName, fontFamily4.c_str(), fontDescriptionRun4.familyLength);
fontDescriptionRun4.familyDefined = true;
fontDescriptionRun4.weightDefined = false;
- fontDescriptionRun4.widthDefined = false;
- fontDescriptionRun4.slantDefined = false;
- fontDescriptionRun4.sizeDefined = false;
+ fontDescriptionRun4.widthDefined = false;
+ fontDescriptionRun4.slantDefined = false;
+ fontDescriptionRun4.sizeDefined = false;
- const std::string fontFamily5( "TizenSans" );
+ const std::string fontFamily5("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun5;
- fontDescriptionRun5.characterRun.characterIndex = 38u;
+ fontDescriptionRun5.characterRun.characterIndex = 38u;
fontDescriptionRun5.characterRun.numberOfCharacters = 17u;
- fontDescriptionRun5.familyLength = fontFamily5.size();
- fontDescriptionRun5.familyName = new char[fontDescriptionRun5.familyLength];
- memcpy( fontDescriptionRun5.familyName, fontFamily5.c_str(), fontDescriptionRun5.familyLength );
+ fontDescriptionRun5.familyLength = fontFamily5.size();
+ fontDescriptionRun5.familyName = new char[fontDescriptionRun5.familyLength];
+ memcpy(fontDescriptionRun5.familyName, fontFamily5.c_str(), fontDescriptionRun5.familyLength);
fontDescriptionRun5.familyDefined = true;
fontDescriptionRun5.weightDefined = false;
- fontDescriptionRun5.widthDefined = false;
- fontDescriptionRun5.slantDefined = false;
- fontDescriptionRun5.sizeDefined = false;
+ fontDescriptionRun5.widthDefined = false;
+ fontDescriptionRun5.slantDefined = false;
+ fontDescriptionRun5.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun1 );
- fontDescriptionRuns.PushBack( fontDescriptionRun2 );
- fontDescriptionRuns.PushBack( fontDescriptionRun3 );
- fontDescriptionRuns.PushBack( fontDescriptionRun4 );
- fontDescriptionRuns.PushBack( fontDescriptionRun5 );
- Size textArea(100.f, 300.f);
- Size layoutSize(81.f, 120.f);
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
+ fontDescriptionRuns.PushBack(fontDescriptionRun2);
+ fontDescriptionRuns.PushBack(fontDescriptionRun3);
+ fontDescriptionRuns.PushBack(fontDescriptionRun4);
+ fontDescriptionRuns.PushBack(fontDescriptionRun5);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(81.f, 120.f);
float positions[] =
- {
- 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 0 .. 11
- 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -0.f, 68.f, -10.f, 59.f, -13.f, 54.f, -10.f, 45.f, -10.f, 79.f, -0.f, // 12 .. 21
- 23.f, -10.f, 19.f, -10.f, 10.f, -13.f, 0.f, -10.f, 32.f, -2.f, 36.f, -12.f, // 22 .. 27
- 63.f, -10.f, 54.f, -13.f, 50.f, -10.f, 41.f, -10.f, 36.f, -0.f, 27.f, -10.f, 23.f, -10.f, 14.f, -13.f, 4.f, -10.f, 0.f, -0.f, // 28 .. 37
- 4.f, -13.f, 12.f, -9.f, 22.f, -13.f, 26.f, -13.f, 29.f, -9.f, 38.f, -0.f, 42.f, -9.f, 54.f, -9.f, 64.f, -9.f, 70.f, -13.f, 73.f, -13.f, 0.f, -0.f, // 38 .. 49
- 4.f, -13.f, 13.f, -9.f, 23.f, -9.f, 36.f, -9.f, 0.f, -2.f, // 50 .. 54
- };
+ {
+ 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -0.f, // 0 .. 11
+ 0.f,
+ -13.f,
+ 9.f,
+ -9.f,
+ 19.f,
+ -9.f,
+ 32.f,
+ -9.f,
+ 41.f,
+ -0.f,
+ 68.f,
+ -10.f,
+ 59.f,
+ -13.f,
+ 54.f,
+ -10.f,
+ 45.f,
+ -10.f,
+ 79.f,
+ -0.f, // 12 .. 21
+ 23.f,
+ -10.f,
+ 19.f,
+ -10.f,
+ 10.f,
+ -13.f,
+ 0.f,
+ -10.f,
+ 32.f,
+ -2.f,
+ 36.f,
+ -12.f, // 22 .. 27
+ 63.f,
+ -10.f,
+ 54.f,
+ -13.f,
+ 50.f,
+ -10.f,
+ 41.f,
+ -10.f,
+ 36.f,
+ -0.f,
+ 27.f,
+ -10.f,
+ 23.f,
+ -10.f,
+ 14.f,
+ -13.f,
+ 4.f,
+ -10.f,
+ 0.f,
+ -0.f, // 28 .. 37
+ 4.f,
+ -13.f,
+ 12.f,
+ -9.f,
+ 22.f,
+ -13.f,
+ 26.f,
+ -13.f,
+ 29.f,
+ -9.f,
+ 38.f,
+ -0.f,
+ 42.f,
+ -9.f,
+ 54.f,
+ -9.f,
+ 64.f,
+ -9.f,
+ 70.f,
+ -13.f,
+ 73.f,
+ -13.f,
+ 0.f,
+ -0.f, // 38 .. 49
+ 4.f,
+ -13.f,
+ 13.f,
+ -9.f,
+ 23.f,
+ -9.f,
+ 36.f,
+ -9.f,
+ 0.f,
+ -2.f, // 50 .. 54
+ };
struct LineRun line0 =
- {
- { 0u, 12u },
- { 0u, 12u },
- 81.f,
- 15.f,
- -5.f,
- 4.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 12u},
+ {0u, 12u},
+ 81.f,
+ 15.f,
+ -5.f,
+ 4.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line1 =
- {
- { 12u, 10u },
- { 12u, 10u },
- 79.f,
- 15.f,
- -5.f,
- 5.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {12u, 10u},
+ {12u, 10u},
+ 79.f,
+ 15.f,
+ -5.f,
+ 5.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line2 =
- {
- { 22u, 6u },
- { 22u, 6u },
- 35.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {22u, 6u},
+ {22u, 6u},
+ 35.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line3 =
- {
- { 28u, 10u },
- { 28u, 10u },
- 70.f,
- 15.f,
- -5.f,
- 5.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {28u, 10u},
+ {28u, 10u},
+ 70.f,
+ 15.f,
+ -5.f,
+ 5.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line4 =
- {
- { 38u, 12u },
- { 38u, 12u },
- 79.f,
- 15.f,
- -5.f,
- 4.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {38u, 12u},
+ {38u, 12u},
+ 79.f,
+ 15.f,
+ -5.f,
+ 4.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line5 =
- {
- { 50u, 5u },
- { 50u, 5u },
- 45.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {50u, 5u},
+ {50u, 5u},
+ 45.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line0 );
- lines.PushBack( line1 );
- lines.PushBack( line2 );
- lines.PushBack( line3 );
- lines.PushBack( line4 );
- lines.PushBack( line5 );
+ lines.PushBack(line0);
+ lines.PushBack(line1);
+ lines.PushBack(line2);
+ lines.PushBack(line3);
+ lines.PushBack(line4);
+ lines.PushBack(line5);
LayoutTextData data =
- {
- "Layout bidirectional text.",
- "Hello world demo שלום עולם.\n"
- "שלום עולם hello world demo.",
- textArea,
- 5u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 55u,
- positions,
- 6u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 55u,
- false,
- DevelText::EllipsisPosition::END,
- true
- };
+ {
+ "Layout bidirectional text.",
+ "Hello world demo שלום עולם.\n"
+ "שלום עולם hello world demo.",
+ textArea,
+ 5u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 55u,
+ positions,
+ 6u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 55u,
+ false,
+ DevelText::EllipsisPosition::END,
+ true};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Layout a long word which doesn't fit in the width of the text area.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun;
- fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
fontDescriptionRun.characterRun.numberOfCharacters = 29u;
- fontDescriptionRun.familyLength = fontFamily.size();
- fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
- memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
fontDescriptionRun.familyDefined = true;
fontDescriptionRun.weightDefined = false;
- fontDescriptionRun.widthDefined = false;
- fontDescriptionRun.slantDefined = false;
- fontDescriptionRun.sizeDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun );
- Size textArea(100.f, 300.f);
- Size layoutSize(98.f, 60.f);
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(98.f, 60.f);
float positions[] =
- {
- 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -9.f, 48.f, -9.f, 58.f, -9.f, 65.f, -13.f, 68.f, -13.f, 77.f, -13.f, 86.f, -9.f,
- 0.f, -9.f, 13.f, -9.f, 23.f, -13.f, 31.f, -9.f, 41.f, -13.f, 45.f, -13.f, 48.f, -9.f, 57.f, -9.f, 69.f, -9.f, 79.f, -9.f, 85.f, -13.f, 88.f, -13.f,
- 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f,
- };
+ {
+ 0.f,
+ -12.f,
+ 10.f,
+ -9.f,
+ 20.f,
+ -13.f,
+ 24.f,
+ -13.f,
+ 27.f,
+ -9.f,
+ 36.f,
+ -9.f,
+ 48.f,
+ -9.f,
+ 58.f,
+ -9.f,
+ 65.f,
+ -13.f,
+ 68.f,
+ -13.f,
+ 77.f,
+ -13.f,
+ 86.f,
+ -9.f,
+ 0.f,
+ -9.f,
+ 13.f,
+ -9.f,
+ 23.f,
+ -13.f,
+ 31.f,
+ -9.f,
+ 41.f,
+ -13.f,
+ 45.f,
+ -13.f,
+ 48.f,
+ -9.f,
+ 57.f,
+ -9.f,
+ 69.f,
+ -9.f,
+ 79.f,
+ -9.f,
+ 85.f,
+ -13.f,
+ 88.f,
+ -13.f,
+ 0.f,
+ -13.f,
+ 9.f,
+ -9.f,
+ 19.f,
+ -9.f,
+ 32.f,
+ -9.f,
+ 41.f,
+ -2.f,
+ };
struct LineRun line0 =
- {
- { 0u, 12u },
- { 0u, 12u },
- 95.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 12u},
+ {0u, 12u},
+ 95.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line1 =
- {
- { 12u, 12u },
- { 12u, 12u },
- 98.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {12u, 12u},
+ {12u, 12u},
+ 98.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line2 =
- {
- { 24u, 5u },
- { 24u, 5u },
- 44.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {24u, 5u},
+ {24u, 5u},
+ 44.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line0 );
- lines.PushBack( line1 );
- lines.PushBack( line2 );
+ lines.PushBack(line0);
+ lines.PushBack(line1);
+ lines.PushBack(line2);
LayoutTextData data =
- {
- "Layout a long word which doesn't fit in the width of the text area.",
- "Helloworlddemohelloworlddemo.",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 29u,
- positions,
- 3u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 29u,
- false,
- DevelText::EllipsisPosition::END,
- true
- };
+ {
+ "Layout a long word which doesn't fit in the width of the text area.",
+ "Helloworlddemohelloworlddemo.",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 29u,
+ positions,
+ 3u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 29u,
+ false,
+ DevelText::EllipsisPosition::END,
+ true};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Layout simple text ending with a \n. It has to add a void line at the end.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun;
- fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
fontDescriptionRun.characterRun.numberOfCharacters = 13u;
- fontDescriptionRun.familyLength = fontFamily.size();
- fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
- memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
fontDescriptionRun.familyDefined = true;
fontDescriptionRun.weightDefined = false;
- fontDescriptionRun.widthDefined = false;
- fontDescriptionRun.slantDefined = false;
- fontDescriptionRun.sizeDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun );
- Size textArea(100.f, 300.f);
- Size layoutSize(84.f, 40.f);
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(84.f, 40.f);
float positions[] =
- {
- 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -2.f, 85.f, -12.f
- };
+ {
+ 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 52.f, -9.f, 62.f, -9.f, 69.f, -13.f, 72.f, -13.f, 81.f, -2.f, 85.f, -12.f};
struct LineRun line0 =
- {
- { 0u, 13u },
- { 0u, 13u },
- 84.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 13u},
+ {0u, 13u},
+ 84.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line1 =
- {
- { 13u, 0u },
- { 13u, 0u },
- 0.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {13u, 0u},
+ {13u, 0u},
+ 0.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line0 );
- lines.PushBack( line1 );
+ lines.PushBack(line0);
+ lines.PushBack(line1);
LayoutTextData data =
- {
- "Layout simple text ending with a \n.",
- "Hello world.\n",
- textArea,
- 1u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 13u,
- positions,
- 2u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 13u,
- false,
- DevelText::EllipsisPosition::END,
- true
- };
+ {
+ "Layout simple text ending with a \n.",
+ "Hello world.\n",
+ textArea,
+ 1u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 13u,
+ positions,
+ 2u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 13u,
+ false,
+ DevelText::EllipsisPosition::END,
+ true};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
// Layout simple text with one character with a different font size.
- const std::string fontFamily( "TizenSans" );
+ const std::string fontFamily("TizenSans");
// Set a known font description
FontDescriptionRun fontDescriptionRun1;
- fontDescriptionRun1.characterRun.characterIndex = 0u;
+ fontDescriptionRun1.characterRun.characterIndex = 0u;
fontDescriptionRun1.characterRun.numberOfCharacters = 6u;
- fontDescriptionRun1.familyLength = fontFamily.size();
- fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
- memcpy( fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength );
+ fontDescriptionRun1.familyLength = fontFamily.size();
+ fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+ memcpy(fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength);
fontDescriptionRun1.familyDefined = true;
fontDescriptionRun1.weightDefined = false;
- fontDescriptionRun1.widthDefined = false;
- fontDescriptionRun1.slantDefined = false;
- fontDescriptionRun1.sizeDefined = false;
+ fontDescriptionRun1.widthDefined = false;
+ fontDescriptionRun1.slantDefined = false;
+ fontDescriptionRun1.sizeDefined = false;
FontDescriptionRun fontDescriptionRun2;
- fontDescriptionRun2.characterRun.characterIndex = 6u;
+ fontDescriptionRun2.characterRun.characterIndex = 6u;
fontDescriptionRun2.characterRun.numberOfCharacters = 1u;
- fontDescriptionRun2.familyLength = fontFamily.size();
- fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
- memcpy( fontDescriptionRun2.familyName, fontFamily.c_str(), fontDescriptionRun2.familyLength );
- fontDescriptionRun2.size = 1280u;
+ fontDescriptionRun2.familyLength = fontFamily.size();
+ fontDescriptionRun2.familyName = new char[fontDescriptionRun2.familyLength];
+ memcpy(fontDescriptionRun2.familyName, fontFamily.c_str(), fontDescriptionRun2.familyLength);
+ fontDescriptionRun2.size = 1280u;
fontDescriptionRun2.familyDefined = true;
fontDescriptionRun2.weightDefined = false;
- fontDescriptionRun2.widthDefined = false;
- fontDescriptionRun2.slantDefined = false;
- fontDescriptionRun2.sizeDefined = true;
+ fontDescriptionRun2.widthDefined = false;
+ fontDescriptionRun2.slantDefined = false;
+ fontDescriptionRun2.sizeDefined = true;
FontDescriptionRun fontDescriptionRun3;
- fontDescriptionRun3.characterRun.characterIndex = 7u;
+ fontDescriptionRun3.characterRun.characterIndex = 7u;
fontDescriptionRun3.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun3.familyLength = fontFamily.size();
- fontDescriptionRun3.familyName = new char[fontDescriptionRun3.familyLength];
- memcpy( fontDescriptionRun3.familyName, fontFamily.c_str(), fontDescriptionRun3.familyLength );
+ fontDescriptionRun3.familyLength = fontFamily.size();
+ fontDescriptionRun3.familyName = new char[fontDescriptionRun3.familyLength];
+ memcpy(fontDescriptionRun3.familyName, fontFamily.c_str(), fontDescriptionRun3.familyLength);
fontDescriptionRun3.familyDefined = true;
fontDescriptionRun3.weightDefined = false;
- fontDescriptionRun3.widthDefined = false;
- fontDescriptionRun3.slantDefined = false;
- fontDescriptionRun3.sizeDefined = false;
+ fontDescriptionRun3.widthDefined = false;
+ fontDescriptionRun3.slantDefined = false;
+ fontDescriptionRun3.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun1 );
- fontDescriptionRuns.PushBack( fontDescriptionRun2 );
- fontDescriptionRuns.PushBack( fontDescriptionRun3 );
- Size textArea(100.f, 300.f);
- Size layoutSize(89.f, 53.f);
+ fontDescriptionRuns.PushBack(fontDescriptionRun1);
+ fontDescriptionRuns.PushBack(fontDescriptionRun2);
+ fontDescriptionRuns.PushBack(fontDescriptionRun3);
+ Size textArea(100.f, 300.f);
+ Size layoutSize(89.f, 53.f);
float positions[] =
- {
- 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 60.f, -9.f, 70.f, -9.f, 76.f, -13.f, 80.f, -13.f, 89.f, -0.f,
- 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f
- };
+ {
+ 0.f, -12.f, 10.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 60.f, -9.f, 70.f, -9.f, 76.f, -13.f, 80.f, -13.f, 89.f, -0.f, 0.f, -13.f, 9.f, -9.f, 19.f, -9.f, 32.f, -9.f, 41.f, -2.f};
struct LineRun line0 =
- {
- { 0u, 12u },
- { 0u, 12u },
- 89.f,
- 25.f,
- -8.f,
- 4.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {0u, 12u},
+ {0u, 12u},
+ 89.f,
+ 25.f,
+ -8.f,
+ 4.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
struct LineRun line1 =
- {
- { 12u, 5u },
- { 12u, 5u },
- 44.f,
- 15.f,
- -5.f,
- 0.f,
- 0.f,
- 0.f,
- false,
- false
- };
+ {
+ {12u, 5u},
+ {12u, 5u},
+ 44.f,
+ 15.f,
+ -5.f,
+ 0.f,
+ 0.f,
+ 0.f,
+ false,
+ false};
Vector<LineRun> lines;
- lines.PushBack( line0 );
- lines.PushBack( line1 );
+ lines.PushBack(line0);
+ lines.PushBack(line1);
LayoutTextData data =
- {
- "Layout simple text with one character with a different font size.",
- "Hello world demo.",
- textArea,
- 3u,
- fontDescriptionRuns.Begin(),
- layoutSize,
- 17u,
- positions,
- 2u,
- lines.Begin(),
- Layout::Engine::MULTI_LINE_BOX,
- 0u,
- 17u,
- false,
- DevelText::EllipsisPosition::END,
- true
- };
+ {
+ "Layout simple text with one character with a different font size.",
+ "Hello world demo.",
+ textArea,
+ 3u,
+ fontDescriptionRuns.Begin(),
+ layoutSize,
+ 17u,
+ positions,
+ 2u,
+ lines.Begin(),
+ Layout::Engine::MULTI_LINE_BOX,
+ 0u,
+ 17u,
+ false,
+ DevelText::EllipsisPosition::END,
+ true};
- if( !LayoutTextTest( data ) )
+ if(!LayoutTextTest(data))
{
tet_result(TET_FAIL);
}
ToolkitTestApplication application;
tet_infoline(" UtcDaliTextLayoutMultilineText06");
- const std::string fontFamily( "TizenSansHebrew" );
+ const std::string fontFamily("TizenSansHebrew");
// Set a known font description
FontDescriptionRun fontDescriptionRun;
- fontDescriptionRun.characterRun.characterIndex = 0u;
+ fontDescriptionRun.characterRun.characterIndex = 0u;
fontDescriptionRun.characterRun.numberOfCharacters = 10u;
- fontDescriptionRun.familyLength = fontFamily.size();
- fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
- memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy(fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength);
fontDescriptionRun.familyDefined = true;
fontDescriptionRun.weightDefined = false;
- fontDescriptionRun.widthDefined = false;
- fontDescriptionRun.slantDefined = false;
- fontDescriptionRun.sizeDefined = false;
+ fontDescriptionRun.widthDefined = false;
+ fontDescriptionRun.slantDefined = false;
+ fontDescriptionRun.sizeDefined = false;
Vector<FontDescriptionRun> fontDescriptionRuns;
- fontDescriptionRuns.PushBack( fontDescriptionRun );
+ fontDescriptionRuns.PushBack(fontDescriptionRun);
- Size textArea(64.f, 100.f);
- Size layoutSize(34.f, 40.f);
+ Size textArea(64.f, 100.f);
+ Size layoutSize(34.f, 40.f);
float positions[] =
- {
- 27.f, -13.f, 18.f, -10.f, 9.f, -10.f, 4.f, -10.f, 0.f, -0.f,
- 22.f, -10.f, 17.f, -10.f, 12.f, -10.f, 4.f, -10.f, 0.f, -10.f
- };
+ {
+ 27.f, -13.f, 18.f, -10.f, 9.f, -10.f, 4.f, -10.f, 0.f, -0.f, 22.f, -10.f, 17.f, -10.f, 12.f, -10.f, 4.f, -10.f, 0.f, -10.f};
struct LineRun line0 =
- {
- { 0u, 5u },
- { 0u, 5u },
- 32.f,
- 15.f,
- -5.f,
- 5.f,
- 0.f,
- 0.f,
- true,
- false
- };
+ {
+ {0u, 5u},
+ {0u, 5u},
+ 32.f,
+ 15.f,
+ -5.f,
+ 5.f,
+ 0.f,
+ 0.f,
+