utc-Dali-VisualModel.cpp
utc-Dali-VisualUrl.cpp
utc-Dali-Text-Hyphen-Wrapping.cpp
+ utc-Dali-Text-Ellipsis.cpp
)
IF(ELDBUS_AVAILABLE)
ModelPtr& textModel,
MetricsPtr& metrics,
bool markupProcessorEnabled,
- LineWrap::Mode wrapMode )
+ LineWrap::Mode wrapMode,
+ bool ellipsisEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition)
{
textModel = Model::New(); ///< Pointer to the text's model.
LogicalModelPtr logicalModel = textModel->mLogicalModel;
utf8 = reinterpret_cast<const uint8_t*>( text.c_str() );
}
+ //Ellipsis
+ textModel-> mElideEnabled = ellipsisEnabled;
+ textModel-> mVisualModel->SetTextElideEnabled(ellipsisEnabled);
+ textModel-> mEllipsisPosition = ellipsisPosition;
+ textModel-> mVisualModel->SetEllipsisPosition(ellipsisPosition);
+
// 1) Convert to utf32
Vector<Character>& utf32Characters = logicalModel->mText;
utf32Characters.Resize( textSize );
layoutEngine.LayoutText( layoutParameters,
layoutSize,
false,
- isAutoScroll );
+ isAutoScroll,
+ ellipsisPosition);
if( options.align )
{
* @param[out] textModel Pointer to a text model instance.
* @param[out] metrics Pointer to a wrapper around FontClient used to get metrics.
* @param[in] markupProcessorEnabled Enable markup processor to use markup text.
+ * @param[in] wrapMode Line wrap mode.
+ * @param[in] ellipsisEnabled Whether the ellipsis layout option is enabled.
+ * @param[in] ellipsisPosition Where is the location the text elide.
*/
void CreateTextModel( const std::string& text,
const Size& textArea,
ModelPtr& textModel,
MetricsPtr& metrics,
bool markupProcessorEnabled,
- LineWrap::Mode wrapMode );
+ LineWrap::Mode wrapMode,
+ bool ellipsisEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition);
/**
* @brief Configures the text @p controller similarly to the one configured by the text-label.
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
data.markupProcessorEnabled,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
--- /dev/null
+/*
+ * Copyright (c) 2021 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 <iostream>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <toolkit-text-utils.h>
+#include <dali-toolkit/internal/text/font-description-run.h>
+#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
+#include <dali-toolkit/internal/text/rendering/view-model.h>
+#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-view.h>
+
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+
+namespace
+{
+
+ const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
+ struct ElideData
+ {
+ std::string description;
+ std::string text;
+ bool isMultiLines;
+ DevelText::LineWrap::Mode lineWrapMode;
+ DevelText::EllipsisPosition::Type ellipsisPosition;
+ bool isMarkup;
+ Vector2 size;
+ unsigned int numberOfLines;
+ unsigned int numberOfGlyphs;
+ float* positions;
+ };
+
+
+ bool ElideTestViewModel( const ElideData& data )
+ {
+ std::cout << " testing : " << data.description << std::endl;
+
+ // Load some fonts.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ 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" );
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK(typesetter);
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK(model);
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Sets a text and relais-out.
+ controller->SetMarkupProcessorEnabled( data.isMarkup );
+
+ controller->SetMultiLineEnabled( data.isMultiLines );
+ controller->SetLineWrapMode( (Text::LineWrap::Mode)(data.lineWrapMode) );
+ controller->SetEllipsisPosition( data.ellipsisPosition );
+
+ controller->SetText( data.text );
+ controller->Relayout( data.size );
+
+ // Elide the glyphs.
+ model->ElideGlyphs();
+
+ if( data.numberOfLines != model->GetNumberOfLines() )
+ {
+ std::cout << " different number of lines : " << model->GetNumberOfLines() << ", expected : " << data.numberOfLines << std::endl;
+ return false;
+ }
+
+ Length numberOfGlyphs = model->GetNumberOfGlyphs();
+
+ if( data.numberOfGlyphs != numberOfGlyphs )
+ {
+ std::cout << " different number of glyphs : " << numberOfGlyphs << ", expected : " << data.numberOfGlyphs << std::endl;
+ return false;
+ }
+
+ const Vector2* const layoutBuffer = model->GetLayout();
+ const Length numberOfLines = model->GetNumberOfLines();
+ const GlyphIndex startIndexOfGlyphs = model->GetStartIndexOfElidedGlyphs();
+ const GlyphIndex endIndexOfGlyphs = model->GetEndIndexOfElidedGlyphs();
+ const GlyphIndex firstMiddleIndexOfGlyphs = model->GetFirstMiddleIndexOfElidedGlyphs();
+
+
+ if( numberOfLines != 0u )
+ {
+ Length elidedLineIndex = 0u;
+ for(Length lineIndex=0u; lineIndex < numberOfLines; lineIndex++)
+ {
+ const LineRun& tempLine = *( model->GetLines() + elidedLineIndex);
+ if(tempLine.ellipsis)
+ {
+ elidedLineIndex = lineIndex;
+ break;
+ }
+ }
+ const LineRun& elidedLine = *( model->GetLines() + elidedLineIndex);
+ Length numberOfLineGlyphs = 0u;
+ Length numberOfLineGlyphsSecondHalf = 0u;
+
+ switch(data.ellipsisPosition)
+ {
+ case DevelText::EllipsisPosition::START:
+ {
+ numberOfLineGlyphs = elidedLine.glyphRun.numberOfGlyphs - ( startIndexOfGlyphs - elidedLine.glyphRun.glyphIndex);
+ break;
+ }
+ case DevelText::EllipsisPosition::MIDDLE:
+ {
+ numberOfLineGlyphs = firstMiddleIndexOfGlyphs - elidedLine.glyphRun.glyphIndex +1u ;
+ break;
+ }
+ case DevelText::EllipsisPosition::END:
+ default:
+ {
+ numberOfLineGlyphs = endIndexOfGlyphs - elidedLine.glyphRun.glyphIndex + 1u;
+ break;
+ }
+ }
+
+ unsigned int index = 0u;
+ for( ; index < numberOfLineGlyphs; ++index )
+ {
+ if( *( data.positions + index ) != floor(elidedLine.alignmentOffset + ( *( layoutBuffer + index ) ).x ) )
+ {
+ std::cout << " different layout :";
+ for( unsigned int i = 0; i < numberOfLineGlyphs; ++i )
+ {
+ std::cout << " " << floor( elidedLine.alignmentOffset + ( *( layoutBuffer + i ) ).x );
+ }
+ std::cout << std::endl;
+ std::cout << " expected :";
+ for( unsigned int i = 0; i < numberOfLineGlyphs; ++i )
+ {
+ std::cout << " " << *( data.positions + i );
+ }
+ std::cout << std::endl;
+ return false;
+ }
+ }
+
+
+ for( ; index < numberOfLineGlyphsSecondHalf; ++index )
+ {
+ if( *( data.positions + index ) != floor(elidedLine.alignmentOffset + ( *( layoutBuffer + index ) ).x ) )
+ {
+ std::cout << " different layout :";
+ for( unsigned int i = 0; i < numberOfLineGlyphsSecondHalf; ++i )
+ {
+ std::cout << " " << floor( elidedLine.alignmentOffset + ( *( layoutBuffer + i ) ).x );
+ }
+ std::cout << std::endl;
+ std::cout << " expected :";
+ for( unsigned int i = 0; i < numberOfLineGlyphsSecondHalf; ++i )
+ {
+ std::cout << " " << *( data.positions + i );
+ }
+ std::cout << std::endl;
+ return false;
+ }
+ }
+
+ }
+
+ return true;
+ }
+
+ bool ElideTestTextView( const ElideData& data )
+ {
+ std::cout << " testing : " << data.description << std::endl;
+
+ // Load some fonts.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ 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" );
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ if(data.isMultiLines)
+ {
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+ controller->SetVerticalScrollEnabled( false );
+ }
+ else
+ {
+ // Configures the text controller similarly to the text-field.
+ ConfigureTextField( controller );
+ }
+
+ controller->SetDefaultFontFamily("TizenSansRegular");
+ controller->SetDefaultFontSize(12.0f, Text::Controller::POINT_SIZE);
+
+ controller->SetMultiLineEnabled( data.isMultiLines );
+ controller->SetLineWrapMode( (Text::LineWrap::Mode)(data.lineWrapMode) );
+
+ // Sets a text and relais-out.
+ controller->SetMarkupProcessorEnabled( data.isMarkup );
+
+ controller->SetTextElideEnabled( true );
+ controller->SetEllipsisPosition( data.ellipsisPosition );
+
+ controller->SetText( data.text );
+ controller->Relayout( data.size );
+
+ // Get view to elide the glyphs.
+ Text::ViewInterface& view = controller->GetView();
+
+ Length numberOfGlyphs = view.GetNumberOfGlyphs();
+
+ if(numberOfGlyphs == 0u)
+ {
+ return data.numberOfGlyphs == 0u;
+ }
+
+ Vector<GlyphInfo> glyphs;
+ glyphs.Resize(numberOfGlyphs);
+
+ Vector<Vector2> positions;
+ positions.Resize(numberOfGlyphs);
+
+ float alignmentOffset = 0u;
+ numberOfGlyphs = view.GetGlyphs(glyphs.Begin(),
+ positions.Begin(),
+ alignmentOffset,
+ 0u,
+ numberOfGlyphs);
+
+ glyphs.Resize(numberOfGlyphs);
+ positions.Resize(numberOfGlyphs);
+
+
+ if( data.numberOfGlyphs != numberOfGlyphs )
+ {
+ std::cout << " different number of glyphs : " << numberOfGlyphs << ", expected : " << data.numberOfGlyphs << std::endl;
+ return false;
+ }
+
+ // Tests the text model has been created.
+ const ModelInterface* textModel = controller->GetTextModel();
+ DALI_TEST_CHECK(textModel);
+
+ if( data.numberOfLines != textModel->GetNumberOfLines() )
+ {
+ std::cout << " different number of lines : " << textModel->GetNumberOfLines() << ", expected : " << data.numberOfLines << std::endl;
+ return false;
+ }
+
+ const Length numberOfLines = textModel->GetNumberOfLines();
+ const GlyphIndex startIndexOfGlyphs = textModel->GetStartIndexOfElidedGlyphs();
+ const GlyphIndex endIndexOfGlyphs = textModel->GetEndIndexOfElidedGlyphs();
+ const GlyphIndex firstMiddleIndexOfGlyphs = textModel->GetFirstMiddleIndexOfElidedGlyphs();
+ const GlyphIndex secondMiddleIndexOfGlyphs = textModel->GetSecondMiddleIndexOfElidedGlyphs();
+
+ if( numberOfLines != 0u )
+ {
+ Length elidedLineIndex = 0u;
+ for(Length lineIndex=0u; lineIndex < numberOfLines; lineIndex++)
+ {
+ const LineRun& tempLine = *( textModel->GetLines() + lineIndex);
+ if(tempLine.ellipsis)
+ {
+ elidedLineIndex = lineIndex;
+ break;
+ }
+ }
+ const LineRun& elidedLine = *( textModel->GetLines() + elidedLineIndex);
+
+ Length numberOfLineGlyphs = 0u;
+ Length numberOfLineGlyphsSecondHalf = 0u;
+
+ switch(data.ellipsisPosition)
+ {
+ case DevelText::EllipsisPosition::START:
+ {
+ numberOfLineGlyphs = elidedLine.glyphRun.numberOfGlyphs - ( startIndexOfGlyphs - elidedLine.glyphRun.glyphIndex);
+ break;
+ }
+ case DevelText::EllipsisPosition::MIDDLE:
+ {
+ numberOfLineGlyphs = firstMiddleIndexOfGlyphs == elidedLine.glyphRun.glyphIndex ? 0u : (firstMiddleIndexOfGlyphs - elidedLine.glyphRun.glyphIndex +1u);
+
+ if(elidedLine.isSplitToTwoHalves)
+ {
+ numberOfLineGlyphsSecondHalf = (elidedLine.glyphRunSecondHalf.glyphIndex + elidedLine.glyphRunSecondHalf.numberOfGlyphs) - secondMiddleIndexOfGlyphs ;
+
+ }
+ break;
+ }
+ case DevelText::EllipsisPosition::END:
+ default:
+ {
+ numberOfLineGlyphs = endIndexOfGlyphs - elidedLine.glyphRun.glyphIndex + 1u;
+ break;
+ }
+ }
+
+
+ unsigned int index = 0u;
+ for( ; index < numberOfLineGlyphs; ++index )
+ {
+
+ if( *( data.positions + index ) != floor( elidedLine.alignmentOffset + positions[index].x ))
+ {
+ std::cout << " different layout :";
+ for( unsigned int i = 0; i < numberOfLineGlyphs; ++i )
+ {
+ std::cout << " " << floor( elidedLine.alignmentOffset + positions[i].x );
+ }
+ std::cout << std::endl;
+ std::cout << " expected :";
+ for( unsigned int i = 0; i < numberOfLineGlyphs; ++i )
+ {
+ std::cout << " " << *( data.positions + i );
+ }
+ std::cout << std::endl;
+ return false;
+ }
+ }
+
+ for( ; index < numberOfLineGlyphsSecondHalf; ++index )
+ {
+ if( *( data.positions + index ) != floor( elidedLine.alignmentOffset + positions[index].x ))
+ {
+ std::cout << " different layout :";
+ for( unsigned int i = 0; i < numberOfLineGlyphsSecondHalf; ++i )
+ {
+ std::cout << " " << floor( elidedLine.alignmentOffset + positions[i].x );
+ }
+ std::cout << std::endl;
+ std::cout << " expected :";
+ for( unsigned int i = 0; i < numberOfLineGlyphsSecondHalf; ++i )
+ {
+ std::cout << " " << *( data.positions + i );
+ }
+ std::cout << std::endl;
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+}
+
+int UtcDaliTextLabelElideTextLocation(void)
+{
+ tet_infoline(" UtcDaliTextLabelElideTextLocation ");
+
+ Size textSize00( 100.f, 100.f );
+
+ Size textSize01( 120.0f, 50.0f );
+ float positions01[] = { 0.f, 11.f, 23.f, 32.f, 42.f, 52.f, 62.f, 73.f, 83.f, 95.f };
+
+ Size textSize02( 120.0f, 50.0f );
+ float positions02[] = { 0.f, 11.f, 23.f, 32.f, 42.f, 52.f, 62.f, 73.f, 83.f, 93.f, 103.f, 112.f, 0.f, 10.f, 22.f, 31.f, 41.f, 51.f, 61.f, 72.f, 82.f, 94.f };
+
+ Size textSize03( 120.0f, 60.0f );
+ float positions03[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 0.f, 10.f, 19.f, 29.f, 39.f, 46.f, 50.f, 66.f, 76.f, 85.f, 0.f, 15.f, 25.f, 30.f, 38.f, 48.f, 64.f, 73.f, 79.f, 93.f };
+
+ Size textSize04( 120.0f, 60.0f );
+ float positions04[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 67.f, 77.f, 86.f, 96.f, 106.f, 113.f, 0.f, 15.f, 25.f, 34.f, 39.f, 55.f, 65.f, 69.f, 78.f, 88.f, 104.f, 112.f, 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 67.f, 77.f, 86.f, 98.f };
+
+ Size textSize05( 110.0f, 60.0f );
+ float positions05[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 67.f, 77.f, 0.f, 10.f, 20.f, 26.f, 31.f, 46.f, 56.f, 65.f, 70.f, 86.f, 96.f, 0.f, 8.f, 18.f, 34.f, 43.f, 49.f, 61.f, 71.f, 75.f, 81.f };
+
+ Size textSize06( 110.0f, 60.0f );
+ float positions06[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 0.f, 10.f, 19.f, 29.f, 39.f, 46.f, 50.f, 66.f, 76.f, 85.f, 0.f, 15.f, 25.f, 30.f, 38.f, 48.f, 64.f, 73.f, 81.f };
+
+ Size textSize07( 120.0f, 50.0f );
+ float positions07[] = { 6.0f, 23.0f, 32.0f, 42.0f, 53.0f, 63.0f, 73.0f, 83.0f, 93.0f, 104.0f, 113.0f } ;
+
+ Size textSize08( 120.0f, 50.0f );
+ float positions08[] = { 5.0f, 22.0f, 31.0f, 41.0f, 51.0f, 62.0f, 72.0f, 82.0f, 92.0f, 102.0f, 112.0f };
+
+ Size textSize09( 120.0f, 60.0f );
+ float positions09[] = { 9.0f, 25.0f, 30.0f, 38.0f, 48.0f, 64.0f, 73.0f, 79.0f, 91.0f, 101.0f, 105.0f, 110.0f, 118.0f };
+
+ Size textSize10( 120.0f, 60.0f );
+ float positions10[] = { 8.0f, 25.0f, 34.0f, 39.0f, 55.0f, 65.0f, 69.0f, 78.0f, 88.0f, 104.0f, 112.0f };
+
+ Size textSize11( 100.0f, 60.0f );
+ float positions11[] = { 5.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f };
+
+ Size textSize12( 100.0f, 60.0f );
+ float positions12[] = { 5.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f };
+
+ Size textSize13( 120.0f, 60.0f );
+ float positions13[] = { 118.0f, 111.0f, 96.0f, 88.0f, 79.0f, 73.0f, 62.0f, 57.0f, 52.0f, 43.0f, 35.0f, 29.0f, 19.0f, 6.0f };
+
+ Size textSize14( 120.0f, 60.0f );
+ float positions14[] = { 114.0f, 108.0f, 93.0f, 85.0f, 76.0f, 70.0f, 59.0f, 54.0f, 49.0f, 40.0f, 32.0f, 27.0f, 112.0f, 103.0f, 93.0f, 88.0f, 86.0f, 79.0f, 76.0f, 66.0f, 57.0f, 52.0f, 42.0f, 35.0f, 32.0f, 27.0f, 140.0f, 128.0f, 123.0f, 119.0f, 116.0f, 106.0f, 102.0f, 87.0f, 79.0f, 70.0f, 67.0f, 61.0f, 55.0f, 50.0f, 38.0f };
+
+ Size textSize15( 110.0f, 60.0f );
+ float positions15[] = { 107.0f, 100.0f, 86.0f, 77.0f, 68.0f, 62.0f, 52.0f, 46.0f, 42.0f, 33.0f, 24.0f, 18.0f, 8.0f, 0.0f, 95.0f, 90.0f, 87.0f, 81.0f, 78.0f, 67.0f, 59.0f, 54.0f, 44.0f, 37.0f, 33.0f, 27.0f, 24.0f, 12.0f, 7.0f, 2.0f, 0.0f, 93.0f, 89.0f, 75.0f, 66.0f, 57.0f, 55.0f, 49.0f, 43.0f, 37.0f, 28.0f, 15.0f };
+
+ Size textSize16( 110.0f, 60.0f );
+ float positions16[] = { 104.0f, 98.0f, 83.0f, 75.0f, 66.0f, 60.0f, 49.0f, 44.0f, 39.0f, 30.0f, 22.0f, 17.0f, 102.0f, 93.0f, 83.0f, 78.0f, 76.0f, 69.0f, 66.0f, 56.0f, 47.0f, 42.0f, 32.0f, 25.0f, 22.0f, 17.0f, 116.0f, 104.0f, 99.0f, 94.0f, 91.0f, 82.0f, 78.0f, 63.0f, 54.0f, 45.0f, 43.0f, 37.0f, 23.0f };
+
+ Size textSize17( 110.0f, 60.0f );
+ float positions17[] = { 104.0f, 98.0f, 83.0f, 75.0f, 66.0f, 60.0f, 49.0f, 44.0f, 39.0f, 30.0f, 22.0f, 17.0f, 102.0f, 93.0f, 83.0f, 78.0f, 76.0f, 69.0f, 66.0f, 56.0f, 47.0f, 42.0f, 32.0f, 25.0f, 22.0f, 17.0f, 116.0f, 104.0f, 99.0f, 94.0f, 91.0f, 82.0f, 78.0f, 63.0f, 54.0f, 45.0f, 43.0f, 37.0f, 23.0f };
+
+ Size textSize18( 120.0f, 60.0f );
+ float positions18[] = { 96.0f, 84.0f, 75.0f, 73.0f, 66.0f, 61.0f, 55.0f, 46.0f, 32.0f, 29.0f, 17.0f, 10.0f, 3.0f };
+
+ Size textSize19( 120.0f, 60.0f );
+ float positions19[] = { 102.0f, 89.0f, 84.0f, 82.0f, 75.0f, 72.0f, 62.0f, 53.0f, 48.0f, 38.0f, 31.0f, 28.0f, 23.0f, };
+
+ Size textSize20( 110.0f, 60.0f );
+ float positions20[] = { 89.0f, 81.0f, 78.0f, 67.0f, 59.0f, 54.0f, 44.0f, 37.0f, 33.0f, 27.0f, 24.0f, 12.0f, 7.0f, 2.0f, 0.0f };
+
+ Size textSize21( 110.0f, 60.0f );
+ float positions21[] = { 92.0f, 79.0f, 74.0f, 72.0f, 65.0f, 62.0f, 52.0f, 43.0f, 38.0f, 28.0f, 21.0f, 18.0f, 13.0f };
+
+ Size textSize22( 110.0f, 60.0f );
+ float positions22[] = { 92.0f, 79.0f, 74.0f, 72.0f, 65.0f, 62.0f, 52.0f, 43.0f, 38.0f, 28.0f, 21.0f, 18.0f, 13.0f };
+
+ Size textSize23( 120.0f, 50.0f );
+ float positions23[] = { 0.0f, 11.0f, 22.0f, 33.0f, 46.0f };
+
+ Size textSize24( 120.0f, 50.0f );
+ float positions24[] = { 0.0f, 11.0f, 23.0f, 32.0f, 42.0f, 52.0f, 62.0f, 73.0f, 83.0f, 95.0f };
+
+ Size textSize25( 120.0f, 60.0f );
+ float positions25[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 0.0f, 10.0f, 19.0f, 29.0f, 39.0f, 46.0f, 50.0f, 68.0f };
+
+ Size textSize26( 120.0f, 60.0f );
+ float positions26[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 96.0f, 106.0f, 113.0f, 0.0f, 15.0f, 25.0f, 34.0f, 39.0f, 55.0f, 65.0f, 69.0f, 78.0f, 90.0f };
+
+ Size textSize27( 110.0f, 60.0f );
+ float positions27[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 0.0f, 10.0f, 20.0f, 26.0f, 31.0f, 46.0f, 56.0f, 65.0f, 72.0f };
+
+ Size textSize28( 110.0f, 60.0f );
+ float positions28[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 0.0f, 10.0f, 19.0f, 29.0f, 39.0f, 46.0f, 50.0f, 68.0f };
+
+ Size textSize29( 120.0f, 60.0f );
+ float positions29[] = { 116.0f, 109.0f, 94.0f, 86.0f, 77.0f, 71.0f, 60.0f };
+
+ Size textSize30( 120.0f, 60.0f );
+ float positions30[] = { 114.0f, 108.0f, 93.0f, 85.0f, 76.0f, 70.0f, 59.0f, 54.0f, 49.0f, 40.0f, 32.0f, 27.0f, 112.0f, 103.0f, 93.0f, 88.0f, 86.0f, 79.0f, 76.0f, 66.0f, 57.0f, 52.0f, 33.0f };
+
+ Size textSize31( 110.0f, 60.0f );
+ float positions31[] = { 107.0f, 100.0f, 86.0f, 77.0f, 68.0f, 62.0f, 52.0f, 46.0f, 42.0f, 33.0f, 24.0f, 18.0f, 8.0f, 0.0f, 95.0f, 90.0f, 87.0f, 81.0f, 78.0f, 67.0f, 59.0f, 54.0f, 44.0f, 37.0f, 33.0f, 27.0f, 24.0f, 9.0f};
+
+ Size textSize32( 110.0f, 60.0f );
+ float positions32[] = { 104.0f, 98.0f, 83.0f, 75.0f, 66.0f, 60.0f, 49.0f, 44.0f, 39.0f, 30.0f, 22.0f, 17.0f, 102.0f, 93.0f, 83.0f, 78.0f, 76.0f, 69.0f, 66.0f, 56.0f, 47.0f, 42.0f, 23.0f };
+
+ Size textSize33( 110.0f, 60.0f );
+ float positions33[] = { 104.0f, 98.0f, 83.0f, 75.0f, 66.0f, 60.0f, 49.0f, 44.0f, 39.0f, 30.0f, 22.0f, 17.0f, 102.0f, 93.0f, 83.0f, 78.0f, 76.0f, 69.0f, 66.0f, 56.0f, 47.0f, 42.0f, 23.0f };
+
+ Size textSize34( 120.0f, 30.0f );
+ float positions34[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 98.0f };
+
+ Size textSize35( 120.0f, 30.0f );
+ float positions35[] = { 2.0f, 20.0f, 29.0f, 39.0f, 44.0f, 60.0f, 69.0f, 74.0f, 83.0f, 92.0f, 108.0f };
+
+ Size textSize36( 120.0f, 30.0f );
+ float positions36[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f };
+
+ struct ElideData data[] =
+ {
+ {
+ "void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ //END LTR cases
+ {
+ "EllipsisPosition: TextLabel: Basic case SingleLine LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize01,
+ 1u,
+ 10u,
+ positions01
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize02,
+ 2u,
+ 22u,
+ positions02
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize03,
+ 3u,
+ 29u,
+ positions03
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize04,
+ 3u,
+ 40u,
+ positions04
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize05,
+ 3u,
+ 32u,
+ positions05
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize06,
+ 3u,
+ 28u,
+ positions06
+ },
+
+ //START LTR cases
+ {
+ "EllipsisPosition: TextLabel: Basic case SingleLine LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize07,
+ 1u,
+ 11u,
+ positions07
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize08,
+ 2u,
+ 23u,
+ positions08
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize09,
+ 3u,
+ 33u,
+ positions09
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize10,
+ 3u,
+ 37u,
+ positions10
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize11,
+ 3u,
+ 25u,
+ positions11
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize12,
+ 3u,
+ 25u,
+ positions12
+ },
+
+ //END RTL cases
+ {
+ "EllipsisPosition: TextLabel: SingleLine RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize13,
+ 1u,
+ 14u,
+ positions13
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize14,
+ 3u,
+ 41u,
+ positions14
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize15,
+ 3u,
+ 42u,
+ positions15
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize16,
+ 3u,
+ 39u,
+ positions16
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize17,
+ 3u,
+ 39u,
+ positions17
+ },
+
+ //START RTL cases
+ {
+ "EllipsisPosition: TextLabel: SingleLine RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize18,
+ 1u,
+ 13u,
+ positions18
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize19,
+ 3u,
+ 33u,
+ positions19
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize20,
+ 3u,
+ 30u,
+ positions20
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize21,
+ 3u,
+ 33u,
+ positions21
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize22,
+ 3u,
+ 33u,
+ positions22
+ },
+
+ //MIDDLE LTR cases
+ {
+ "EllipsisPosition: TextLabel: Basic case SingleLine LTR MIDDLE",
+ "ABCDEFGHIJKLMNPQRSTUVWXYZ abcdefghijklmnpqrstuvwxyz",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize23,
+ 1u,
+ 10u,
+ positions23
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR MIDDLE",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize24,
+ 2u,
+ 22u,
+ positions24
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize25,
+ 3u,
+ 24u,
+ positions25
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize26,
+ 3u,
+ 36u,
+ positions26
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize27,
+ 3u,
+ 27u,
+ positions27
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize28,
+ 3u,
+ 24u,
+ positions28
+ },
+
+//MIDDLE RTL cases
+ {
+ "EllipsisPosition: TextLabel: SingleLine RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize29,
+ 1u,
+ 12u,
+ positions29
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize30,
+ 3u,
+ 31u,
+ positions30
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize31,
+ 3u,
+ 30u,
+ positions31
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize32,
+ 3u,
+ 31u,
+ positions32
+ },
+
+ {
+ "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize33,
+ 3u,
+ 31u,
+ positions33
+ },
+
+ {
+ "EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize34,
+ 1u,
+ 13u,
+ positions34
+ },
+
+ {
+ "EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize35,
+ 1u,
+ 11u,
+ positions35
+ },
+
+ {
+ "EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize36,
+ 1u,
+ 12u,
+ positions36
+ },
+
+ };
+ const unsigned int numberOfTests = 39u;
+
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !ElideTestViewModel( data[index] ) )
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+
+int UtcDaliTextFieldlElideTextLocation(void)
+{
+ tet_infoline(" UtcDaliTextFieldlElideTextLocation ");
+
+ Size textSize00( 100.f, 100.f );
+
+ Size textSize01( 120.0f, 50.0f );
+ float positions01[] = { 0.0f, 11.0f, 23.0f, 32.0f, 42.0f, 52.0f, 62.0f, 73.0f, 83.0f, 95.0f };
+
+ Size textSize02( 120.0f, 50.0f );
+ float positions02[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 98.0f };
+
+ Size textSize03( 120.0f, 50.0f );
+ float positions03[] = { 118.0f, 111.0f, 97.0f, 89.0f, 80.0f, 74.0f, 63.0f, 58.0f, 53.0f, 44.0f, 35.0f, 29.0f, 20.0f, 7.0f };
+
+ Size textSize04( 120.0f, 50.0f );
+ float positions04[] = { 6.0f, 23.0f, 32.0f, 42.0f, 53.0f, 63.0f, 73.0f, 83.0f, 93.0f, 104.0f, 113.0f };
+
+ Size textSize05( 120.0f, 50.0f );
+ float positions05[] = { 2.0f, 20.0f, 29.0f, 39.0f, 44.0f, 60.0f, 69.0f, 74.0f, 83.0f, 92.0f, 108.0f };
+
+ Size textSize06( 120.0f, 50.0f );
+ float positions06[] = { 99.0f, 87.0f, 78.0f, 76.0f, 69.0f, 64.0f, 58.0f, 49.0f, 35.0f, 32.0f, 20.0f, 13.0f, 6.0f };
+
+ Size textSize07( 120.0f, 50.0f );
+ float positions07[] = { 0.0f, 11.0f, 23.0f, 32.0f, 42.0f, 57.0f, 73.0f };
+
+ Size textSize08( 120.0f, 50.0f );
+ float positions08[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 98.0f };
+
+ Size textSize09( 120.0f, 50.0f );
+ float positions09[] = { 118.0f, 111.0f, 97.0f, 89.0f, 80.0f, 74.0f, 63.0f, 58.0f, 53.0f, 44.0f, 35.0f, 29.0f, 20.0f, 7.0f };
+
+ Size textSize10( 120.0f, 50.0f );
+ float positions10[] = { 118.0f, 113.0f, 107.0f, 102.0f, 97.0f, 92.0f, 87.0f, 82.0f, 79.0f, 72.0f, 57.0f, 49.0f, 40.0f, 34.0f, 23.0f, 11.0f };
+
+ Size textSize11( 120.0f, 50.0f );
+ float positions11[] = { 95.0f, 78.0f, 75.0f, 64.0f, 56.0f, 49.0f, 44.0f, 39.0f, 34.0f, 29.0f, 23.0f, 18.0f, 13.0f, 8.0f, 3.0f };
+
+ Size textSize12( 120.0f, 50.0f );
+ float positions12[] = { 113.0f, 108.0f, 103.0f, 98.0f, 93.0f, 88.0f, 83.0f, 78.0f, 74.0f, 67.0f };
+
+ struct ElideData data[] =
+ {
+ {
+ "void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "EllipsisPosition: TextField: Basic case SingleLine LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize01,
+ 1u,
+ 10u,
+ positions01
+ },
+
+ {
+ "EllipsisPosition: TextField: SingleLine LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize02,
+ 1u,
+ 13u,
+ positions02
+ },
+
+ {
+ "EllipsisPosition: TextField: SingleLine RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize03,
+ 1u,
+ 14u,
+ positions03
+ },
+
+ {
+ "EllipsisPosition: TextField: Basic case SingleLine LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize04,
+ 1u,
+ 11u,
+ positions04
+ },
+
+ {
+ "EllipsisPosition: TextField: SingleLine LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize05,
+ 1u,
+ 11u,
+ positions05
+ },
+
+ {
+ "EllipsisPosition: TextField: SingleLine RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize06,
+ 1u,
+ 13u,
+ positions06
+ },
+
+ {
+ "EllipsisPosition: TextField: Basic case SingleLine LTR MIDDLE",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize07,
+ 1u,
+ 11u,
+ positions07
+ },
+
+ {
+ "EllipsisPosition: TextField: SingleLine LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize08,
+ 1u,
+ 13u,
+ positions08
+ },
+
+ {
+ "EllipsisPosition: TextField: SingleLine RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize09,
+ 1u,
+ 12u,
+ positions09
+ },
+
+ {
+ "EllipsisPosition: TextField: Head and Tail whitespaces RTL END",
+ " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize10,
+ 1u,
+ 16u,
+ positions10
+ },
+
+ {
+ "EllipsisPosition: TextField: Head and Tail whitespaces RTL START",
+ " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize11,
+ 1u,
+ 15u,
+ positions11
+ },
+
+ {
+ "EllipsisPosition: TextField: Head and Tail whitespaces RTL MIDDLE",
+ " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize12,
+ 1u,
+ 20u,
+ positions12
+ },
+
+ };
+
+ const unsigned int numberOfTests = 15u;
+
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !ElideTestTextView( data[index] ) )
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+ tet_result(TET_PASS);
+ END_TEST;
+
+}
+
+
+int UtcDaliTextEditorElideTextLocation(void)
+{
+ tet_infoline(" UtcDaliTextEditorElideTextLocation ");
+
+ Size textSize00( 100.f, 100.f );
+
+ Size textSize01( 120.0f, 50.0f );
+ float positions01[] = { 0.0f, 11.0f, 23.0f, 32.0f, 42.0f, 52.0f, 62.0f, 73.0f, 83.0f, 93.0f, 103.0f, 112.0f, 0.0f, 10.0f, 22.0f, 31.0f, 41.0f, 51.0f, 61.0f, 72.0f, 82.0f, 94.0f };
+
+ Size textSize02( 120.0f, 60.0f );
+ float positions02[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 0.0f, 10.0f, 19.0f, 29.0f, 39.0f, 46.0f, 50.0f, 66.0f, 76.0f, 85.0f, 0.0f, 15.0f, 25.0f, 30.0f, 38.0f, 48.0f, 64.0f, 73.0f, 79.0f, 93.0f };
+
+ Size textSize03( 120.0f, 60.0f );
+ float positions03[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 96.0f, 106.0f, 113.0f, 0.0f, 15.0f, 25.0f, 34.0f, 39.0f, 55.0f, 65.0f, 69.0f, 78.0f, 88.0f, 104.0f, 112.0f, 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 98.0f };
+
+ Size textSize04( 110.0f, 60.0f );
+ float positions04[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 0.0f, 10.0f, 20.0f, 26.0f, 31.0f, 46.0f, 56.0f, 65.0f, 70.0f, 86.0f, 96.0f, 0.0f, 8.0f, 18.0f, 34.0f, 43.0f, 49.0f, 61.0f, 71.0f, 75.0f, 81.0f };
+
+ Size textSize05( 110.0f, 60.0f );
+ float positions05[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 0.0f, 10.0f, 19.0f, 29.0f, 39.0f, 46.0f, 50.0f, 66.0f, 76.0f, 85.0f, 0.0f, 15.0f, 25.0f, 30.0f, 38.0f, 48.0f, 64.0f, 73.0f, 81.0f };
+
+ Size textSize06( 120.0f, 50.0f );
+ float positions06[] = { 5.0f, 22.0f, 31.0f, 41.0f, 51.0f, 62.0f, 72.0f, 82.0f, 92.0f, 102.0f, 112.0f };
+
+ Size textSize07( 120.0f, 60.0f );
+ float positions07[] = { 9.f, 25.f, 30.f, 38.f, 48.f, 64.f, 73.f, 79.f, 91.f, 101.f, 105.f, 110.f, 118.f };
+
+ Size textSize08( 120.0f, 60.0f );
+ float positions08[] = { 8.f, 25.f, 34.f, 39.f, 55.f, 65.f, 69.f, 78.f, 88.f, 104.f, 112.f };
+
+ Size textSize09( 100.0f, 60.0f );
+ float positions09[] = { 5.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 67.f, 77.f };
+
+ Size textSize10( 100.0f, 60.0f );
+ float positions10[] = { 5.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f };
+
+ Size textSize11( 120.0f, 60.0f );
+ float positions11[] = { 119.0f, 112.0f, 98.0f, 89.0f, 80.0f, 74.0f, 63.0f, 58.0f, 53.0f, 45.0f, 36.0f, 31.0f, 112.0f, 103.0f, 93.0f };
+
+ Size textSize12( 110.0f, 60.0f );
+ float positions12[] = { 115.0f, 108.0f, 94.0f, 85.0f, 76.0f, 70.0f, 60.0f, 54.0f, 50.0f, 41.0f, 32.0f };
+
+ Size textSize13( 110.0f, 60.0f );
+ float positions13[] = { 113.0f, 106.0f, 92.0f, 83.0f, 74.0f, 68.0f, 58.0f, 52.0f, 48.0f, 39.0f, 30.0f, 25.0f, 106.0f };
+
+ Size textSize14( 110.0f, 60.0f );
+ float positions14[] = { 113.0f, 106.0f, 92.0f, 83.0f, 74.0f, 68.0f, 58.0f, 52.0f, 48.0f, 39.0f, 30.0f, 25.0f, 106.0f };
+
+ Size textSize15( 120.0f, 60.0f );
+ float positions15[] = { 125.f, 112.f, 107.f, 105.f, 98.f, 95.f, 85.f, 76.f, 71.f, 61.f, 54.f, 51.f, 46.f };
+
+ Size textSize16( 110.0f, 60.0f );
+ float positions16[] = { 89.f, 81.f, 78.f, 67.f, 59.f, 54.f, 44.f, 37.f, 33.f, 27.f, 24.f, 12.f, 7.f, 2.f, 0.f };
+
+ Size textSize17( 110.0f, 60.0f );
+ float positions17[] = { 105.f, 92.f, 87.f, 85.f, 78.f, 75.f, 65.f, 56.f, 51.f, 41.f, 34.f, 31.f, 26.f };
+
+ Size textSize18( 110.0f, 60.0f );
+ float positions18[] = { 105.f, 92.f, 87.f, 85.f, 78.f, 75.f, 65.f, 56.f, 51.f, 41.f, 34.f, 31.f, 26.f };
+
+ Size textSize19( 120.0f, 50.0f );
+ float positions19[] = { 0.f, 11.f, 23.f, 32.f, 42.f, 52.f, 62.f, 73.f, 83.f, 95.f };
+
+ Size textSize20( 120.0f, 60.0f );
+ float positions20[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 0.f, 10.f, 19.f, 29.f, 39.f, 46.f, 50.f, 68.f };
+
+ Size textSize21( 120.0f, 60.0f );
+ float positions21[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 67.f, 77.f, 86.f, 96.f, 106.f, 113.f, 0.f, 15.f, 25.f, 34.f, 39.f, 55.f, 65.f, 69.f, 78.f, 90.f };
+
+ Size textSize22( 110.0f, 60.0f );
+ float positions22[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 67.f, 77.f, 0.f, 10.f, 20.f, 26.f, 31.f, 46.f, 56.f, 65.f, 72.f };
+
+ Size textSize23( 110.0f, 60.0f );
+ float positions23[] = { 0.f, 12.f, 21.f, 26.f, 30.f, 39.f, 45.f, 57.f, 61.f, 0.f, 10.f, 19.f, 29.f, 39.f, 46.f, 50.f, 68.f };
+
+ Size textSize24( 120.0f, 60.0f );
+ float positions24[] = { 137.0f, 131.0f, 116.0f, 108.0f, 99.0f, 93.0f, 82.0f, 77.0f, 72.0f, 63.0f, 55.0f };
+
+ Size textSize25( 110.0f, 60.0f );
+ float positions25[] = { 107.f, 100.f, 86.f, 77.f, 68.f, 62.f, 52.f, 46.f, 42.f, 33.f, 24.f, 18.f, 8.f, 0.f, 95.f, 90.f, 87.f, 81.f, 78.f, 67.f, 59.f, 54.f, 44.f, 37.f, 33.f, 27.f, 24.f, 9.f };
+
+ Size textSize26( 110.0f, 60.0f );
+ float positions26[] = { 117.0f, 111.0f, 96.0f, 88.0f, 79.0f, 73.0f, 62.0f, 57.0f, 52.0f, 43.0f, 35.0f };
+
+ Size textSize27( 110.0f, 60.0f );
+ float positions27[] = { 117.0f, 111.0f, 96.0f, 88.0f, 79.0f, 73.0f, 62.0f, 57.0f, 52.0f, 43.0f, 35.0f };
+
+ Size textSize28( 120.0f, 30.0f );
+ float positions28[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f, 61.0f, 67.0f, 77.0f, 86.0f, 98.0f };
+
+ Size textSize29( 120.0f, 30.0f );
+ float positions29[] = { 2.0f, 20.0f, 29.0f, 39.0f, 44.0f, 60.0f, 69.0f, 74.0f, 83.0f, 92.0f, 108.0f };
+
+ Size textSize30( 120.0f, 30.0f );
+ float positions30[] = { 0.0f, 12.0f, 21.0f, 26.0f, 30.0f, 39.0f, 45.0f, 57.0f };
+
+
+ struct ElideData data[] =
+ {
+ {
+ "void text",
+ "",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "void text",
+ "",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ {
+ "void text",
+ "",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr
+ },
+
+ //END LTR cases
+
+ {
+ "EllipsisPosition: TextEditor: Basic case Mulitlines LineWrap-WORD LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize01,
+ 2u,
+ 22u,
+ positions01
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-WORD LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize02,
+ 3u,
+ 29u,
+ positions02
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-CHARACTER LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize03,
+ 3u,
+ 40u,
+ positions03
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-HYPHAN LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize04,
+ 3u,
+ 32u,
+ positions04
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-MIXED LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize05,
+ 3u,
+ 28u,
+ positions05
+ },
+
+ //START LTR cases
+
+ {
+ "EllipsisPosition: TextEditor: Basic case Mulitlines LineWrap-WORD LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize06,
+ 2u,
+ 23u,
+ positions06
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-WORD LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize07,
+ 3u,
+ 33u,
+ positions07
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-CHARACTER LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize08,
+ 3u,
+ 37u,
+ positions08
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-HYPHAN LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize09,
+ 3u,
+ 25u,
+ positions09
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-MIXED LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize10,
+ 3u,
+ 25u,
+ positions10
+ },
+
+ //END RTL cases
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-WORD RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize11,
+ 3u,
+ 41u,
+ positions11
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-CHARACTER RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize12,
+ 3u,
+ 42u,
+ positions12
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-HYPHENATION RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize13,
+ 3u,
+ 39u,
+ positions13
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-MIXED RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize14,
+ 3u,
+ 39u,
+ positions14
+ },
+
+ //START RTL cases
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-WORD RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize15,
+ 3u,
+ 33u,
+ positions15
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-CHARACTER RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize16,
+ 3u,
+ 30u,
+ positions16
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-HYPHENATION RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize17,
+ 3u,
+ 33u,
+ positions17
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-MIXED RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize18,
+ 3u,
+ 33u,
+ positions18
+ },
+
+//MIDDLE LTR cases
+
+ {
+ "EllipsisPosition: TextEditor: Basic case Mulitlines LineWrap-WORD LTR MIDDLE",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize19,
+ 2u,
+ 22u,
+ positions19
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-WORD LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize20,
+ 3u,
+ 24u,
+ positions20
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-CHARACTER LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize21,
+ 3u,
+ 36u,
+ positions21
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-HYPHAN LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize22,
+ 3u,
+ 27u,
+ positions22
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-MIXED LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize23,
+ 3u,
+ 24u,
+ positions23
+ },
+
+//MIDDLE RTL cases
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-WORD RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize24,
+ 3u,
+ 31u,
+ positions24
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-CHARACTER RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize25,
+ 3u,
+ 30u,
+ positions25
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-HYPHENATION RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize26,
+ 3u,
+ 31u,
+ positions26
+ },
+
+ {
+ "EllipsisPosition: TextEditor: Mulitlines LineWrap-MIXED RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize27,
+ 3u,
+ 31u,
+ positions27
+ },
+
+ {
+ "EllipsisPosition: TextEditor: One-Line for Mulitlines LineWrap-WORD LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize28,
+ 1u,
+ 13u,
+ positions28
+ },
+
+ {
+ "EllipsisPosition: TextEditor: One-Line for Mulitlines LineWrap-WORD LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize29,
+ 1u,
+ 11u,
+ positions29
+ },
+
+ {
+ "EllipsisPosition: TextEditor: One-Line for Mulitlines LineWrap-WORD LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize30,
+ 1u,
+ 12u,
+ positions30
+ },
+
+ };
+ const unsigned int numberOfTests = 33u;
+
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !ElideTestTextView( data[index] ) )
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
textModel,
metrics,
false,
- data.wrapMode );
+ data.wrapMode,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
Vector<LineRun>& lines = textModel->mVisualModel->mLines;
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun1 );
Size textArea(65.0f, 200.f);
-
+
LineRun line1 =
{
{ 0u, 5u },
false,
false
};
-
+
Vector<LineRun> lines;
lines.PushBack( line1 );
lines.PushBack( line2 );
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun1 );
Size textArea(72.0f, 200.f);
-
+
LineRun line1 =
{
{ 0u, 3u },
false,
false
};
-
+
Vector<LineRun> lines;
lines.PushBack( line1 );
lines.PushBack( line2 );
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;
+ 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 )
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
const bool updated = engine.LayoutText( layoutParameters,
layoutSize,
data.ellipsis,
- isAutoScroll );
+ isAutoScroll,
+ data.ellipsisPosition );
// 4) Compare the results.
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
0u,
0u,
false,
+ DevelText::EllipsisPosition::END,
false
};
0u,
11u,
false,
+ DevelText::EllipsisPosition::END,
false
};
0u,
11u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
48u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
55u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
29u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
13u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
17u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
10u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
9u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
64u,
false,
+ DevelText::EllipsisPosition::END,
true
};
64u,
64u,
false,
+ DevelText::EllipsisPosition::END,
true
};
128u,
64u,
false,
+ DevelText::EllipsisPosition::END,
true
};
0u,
51u,
true,
+ DevelText::EllipsisPosition::END,
true
};
0u,
51u,
true,
+ DevelText::EllipsisPosition::END,
true
};
0u,
72u,
true,
+ DevelText::EllipsisPosition::END,
true
};
0u,
72u,
true,
+ DevelText::EllipsisPosition::END,
true
};
0u,
11u,
true,
+ DevelText::EllipsisPosition::END,
true
};
0u,
1u,
false,
+ DevelText::EllipsisPosition::END,
true
},
{
0u,
2u,
false,
+ DevelText::EllipsisPosition::END,
true
},
{
0u,
2u,
false,
+ DevelText::EllipsisPosition::END,
true
}
};
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
float positions01[] = { 0.f, 8.f, 16.f, 26.f, 34.f, 43.f, 47.f, 58.f, 64.0f };
Size textSize02( 80.f, 100.f );
- float positions02[] = { 69.f, 63.f, 58.f, 50.f, 45.f, 41.f, 32.f, 23.f, 9.f };
+ float positions02[] = { 69.f, 63.f, 58.f, 50.f, 45.f, 41.f, 32.f, 23.f, 5.f };
Size textSize03( 80.f, 100.f );
- float positions03[] = { 54.f, 47.f, 44.f, 41.f, 36.f, 29.f, 25.f, 20.f, 13.f, 8.f, 4.f, 6.f };
+ float positions03[] = { 72.f, 65.f, 61.f, 59.f, 53.f, 47.f, 43.f, 38.f, 30.f, 25.f, 21.f, 7.f };
Size textSize04( 80.f, 10.f );
float positions04[] = { 2.f };
END_TEST;
}
+int UtcDaliToolkitTextFieldEllipsisInternalAPIs(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs ");
+ TextField textField = TextField::New();
+
+ Toolkit::Internal::TextField& textFieldImpl = GetImpl( textField );
+ Text::ViewInterface& view = textFieldImpl.GetTextController()->GetView();
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs - ELLIPSIS Disabled");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS, false);
+ DALI_TEST_EQUALS( textField.GetProperty< bool >( DevelTextField::Property::ELLIPSIS ), false, TEST_LOCATION );
+ DALI_TEST_CHECK(!(view.IsTextElideEnabled()));
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs - ELLIPSIS Enabled");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS, true);
+ DALI_TEST_EQUALS( textField.GetProperty< bool >( DevelTextField::Property::ELLIPSIS ), true, TEST_LOCATION );
+ DALI_TEST_CHECK(view.IsTextElideEnabled());
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( view.GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( view.GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( view.GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( view.GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+
+ END_TEST;
+}
int UtcDaliTextFieldTextWithSpan(void)
{
ToolkitTestApplication application;
#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-controller-impl.h>
+#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
+#include <dali-toolkit/internal/text/rendering/view-model.h>
using namespace Dali;
using namespace Toolkit;
END_TEST;
}
+int UtcDaliToolkitTextlabelEllipsisInternalAPIs(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs ");
+ TextLabel textLabel = TextLabel::New();
+
+ Toolkit::Internal::TextLabel& textLabelImpl = GetImpl( textLabel );
+ const ModelInterface* const textModel = textLabelImpl.GetTextController()->GetTextModel();
+
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - ELLIPSIS Disabled");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS, false);
+ DALI_TEST_EQUALS( textLabel.GetProperty< bool >( DevelTextLabel::Property::ELLIPSIS ), false, TEST_LOCATION );
+ DALI_TEST_CHECK(!(textModel->IsTextElideEnabled()));
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - ELLIPSIS Enabled");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS, true);
+ DALI_TEST_EQUALS( textLabel.GetProperty< bool >( DevelTextLabel::Property::ELLIPSIS ), true, TEST_LOCATION );
+ DALI_TEST_CHECK(textModel->IsTextElideEnabled());
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( textModel->GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( textModel->GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( textModel->GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs Default");
+ DALI_TEST_EQUALS( textModel->GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( textModel );
+ DALI_TEST_CHECK(typesetter);
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - IsTextElideEnabled ViewModel");
+ DALI_TEST_CHECK(model->IsTextElideEnabled());
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetStartIndexOfElidedGlyphs ViewModel");
+ DALI_TEST_EQUALS( model->GetStartIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetEndIndexOfElidedGlyphs ViewModel");
+ DALI_TEST_EQUALS( model->GetEndIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetFirstMiddleIndexOfElidedGlyphs ViewModel");
+ DALI_TEST_EQUALS( model->GetFirstMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisInternalAPIs - GetSecondMiddleIndexOfElidedGlyphs ViewModel");
+ DALI_TEST_EQUALS( model->GetSecondMiddleIndexOfElidedGlyphs(), 0u, TEST_LOCATION );
+
+ END_TEST;
+}
int UtcDaliTextLabelTextWithSpan(void)
{
ToolkitTestApplication application;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
textModel,
metrics,
false,
- LineWrap::WORD );
+ LineWrap::WORD,
+ false,
+ Toolkit::DevelText::EllipsisPosition::END );
LogicalModelPtr logicalModel = textModel->mLogicalModel;
VisualModelPtr visualModel = textModel->mVisualModel;
DALI_TEST_EQUALS( true, visualUrl3.IsValid(), TEST_LOCATION );
DALI_TEST_EQUALS( visualUrl3.GetType(), VisualUrl::GIF, TEST_LOCATION );
DALI_TEST_EQUALS( visualUrl3.GetProtocolType(), VisualUrl::LOCAL, TEST_LOCATION );
+
+ VisualUrl visualUrl4("dali://0");
+ visualUrl4 = visualUrl;
+ DALI_TEST_EQUALS( true, visualUrl4.IsValid(), TEST_LOCATION );
+ DALI_TEST_EQUALS( visualUrl4.GetType(), VisualUrl::GIF, TEST_LOCATION );
+ DALI_TEST_EQUALS( visualUrl4.GetProtocolType(), VisualUrl::LOCAL, TEST_LOCATION );
+
+ VisualUrl visualUrl5("dali://1");
+ visualUrl4 = visualUrl5;
+ DALI_TEST_EQUALS( true, visualUrl4.IsValid(), TEST_LOCATION );
+ DALI_TEST_EQUALS( visualUrl4.GetType(), VisualUrl::REGULAR_IMAGE, TEST_LOCATION );
+ DALI_TEST_EQUALS( visualUrl4.GetProtocolType(), VisualUrl::TEXTURE, TEST_LOCATION );
END_TEST;
}
utc-Dali-Image.cpp
utc-Dali-ImageView.cpp
utc-Dali-ImageVisual.cpp
+ utc-Dali-ImageUrl.cpp
utc-Dali-JsonParser.cpp
utc-Dali-KeyInputFocusManager.cpp
utc-Dali-PageTurnView.cpp
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
application.ProcessEvent(GenerateSingleTouch(PointState::UP, pos, time));
}
+void TestTriggerTap(TestApplication& application)
+{
+ application.GetPlatform().TriggerTimer();
+}
+
void TestGenerateTap(TestApplication& application, float x, float y, uint32_t time_down)
{
application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time_down));
application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time_down + 20));
+ TestTriggerTap(application);
}
void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down)
{
application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(x1, y1), PointState::DOWN, Vector2(x2, y2), time_down));
application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(x1, y1), PointState::UP, Vector2(x2, y2), time_down + 20));
+ TestTriggerTap(application);
}
void TestGenerateRotation(TestApplication& application)
#define DALI_TEST_GESTURE_GENERATOR_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time = 500);
/**
+ * Triggers the timer to begin a tap gesture
+ */
+void TestTriggerTap(TestApplication& application);
+
+/**
* Produces a single point tap gesture with a 20ms interval
*/
void TestGenerateTap(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100);
mCallStack.PushCall("GetCustomFragmentPrefix", "");
return "#extension GL_OES_EGL_image_external:require\n";
};
+ inline virtual bool ApplyNativeFragmentShader(std::string& shader)
+ {
+ mCallStack.PushCall("ApplyNativeFragmentShader", "");
+ shader = "#extension GL_OES_EGL_image_external:require\n" + shader;
+
+ //Get custom sampler type name
+ const char* customSamplerTypename = GetCustomSamplerTypename();
+ if(customSamplerTypename)
+ {
+ size_t samplerPosition = shader.find("sampler2D");
+ if(samplerPosition != std::string::npos)
+ {
+ shader.replace(samplerPosition, strlen("sampler2D"), customSamplerTypename);
+ }
+ }
+ return true;
+ };
inline const char* GetCustomSamplerTypename() const override
{
mCallStack.PushCall("GetCustomSamplerTypename", "");
return "";
}
+bool NativeImageSource::ApplyNativeFragmentShader(std::string& shader)
+{
+ return true;
+}
+
const char* NativeImageSource::GetCustomSamplerTypename() const
{
return "";
{
public:
- using JavaScriptEvaluatedResultCallback = std::function<void(const std::string&)>;
-
WebEngine()
: mUrl()
, mCurrentPlusOnePos( 0 )
}
}
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal()
+ Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal()
{
- return mPageLoadStartedSignal;
+ return mFrameRenderedSignal;
}
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadInProgressSignal()
+ void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return mPageLoadInProgressSignal;
+ mPageLoadStartedCallback = callback;
}
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal()
+ void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return mPageLoadFinishedSignal;
+ mPageLoadInProgressCallback = callback;
}
- Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal()
+ void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return mPageLoadErrorSignal;
+ mPageLoadFinishedCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& ScrollEdgeReachedSignal()
+ void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback)
{
- return mScrollEdgeReachedSignal;
+ mPageLoadErrorCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& UrlChangedSignal()
+ void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback)
{
- return mUrlChangedSignal;
+ mScrollEdgeReachedCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& FormRepostDecisionSignal()
+ void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback)
{
- return mFormRepostDecisionSignal;
+ mUrlChangedCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& FrameRenderedSignal()
+ void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback)
{
- return mFrameRenderedSignal;
+ mFormRepostDecidedCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& RequestInterceptorSignal()
+ void RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback)
{
- return mRequestInterceptorSignal;
+ mRequestInterceptorCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& ConsoleMessageSignal()
+ void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback)
{
- return mConsoleMessageSignal;
+ mConsoleMessageCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineResponsePolicyDecisionSignalType& ResponsePolicyDecisionSignal()
+ void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback)
{
- return mResponsePolicyDecisionSignal;
+ mResponsePolicyDecisionCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineCertificateSignalType& CertificateConfirmSignal()
+ void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- return mCertificateConfirmSignal;
+ mCertificateConfirmCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineCertificateSignalType& SslCertificateChangedSignal()
+ void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- return mSslCertificateChangedSignal;
+ mSslCertificateChangedCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& HttpAuthHandlerSignal()
+ void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback)
{
- return mHttpAuthHandlerSignal;
+ mHttpAuthHandlerCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineContextMenuShownSignalType& ContextMenuShownSignal()
+ void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback)
{
- return mContextMenuShownSignal;
+ mContextMenuShownCallback = callback;
}
- Dali::WebEnginePlugin::WebEngineContextMenuHiddenSignalType& ContextMenuHiddenSignal()
+ void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback)
{
- return mContextMenuHiddenSignal;
+ mContextMenuHiddenCallback = callback;
}
std::string mUrl;
size_t mCurrentPlusOnePos;
std::string mUserAgent;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadStartedSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadInProgressSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadSignalType mPageLoadFinishedSignal;
- Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType mPageLoadErrorSignal;
- Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- Dali::WebEnginePlugin::WebEngineUrlChangedSignalType mUrlChangedSignal;
- Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
- Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType mRequestInterceptorSignal;
- Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType mConsoleMessageSignal;
- Dali::WebEnginePlugin::WebEngineResponsePolicyDecisionSignalType mResponsePolicyDecisionSignal;
- Dali::WebEnginePlugin::WebEngineCertificateSignalType mCertificateConfirmSignal;
- Dali::WebEnginePlugin::WebEngineCertificateSignalType mSslCertificateChangedSignal;
- Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
- Dali::WebEnginePlugin::WebEngineContextMenuShownSignalType mContextMenuShownSignal;
- Dali::WebEnginePlugin::WebEngineContextMenuHiddenSignalType mContextMenuHiddenSignal;
+ Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType mFrameRenderedSignal;
bool mEvaluating;
float mPageZoomFactor;
WebEngineCookieManager* mockWebEngineCookieManager;
WebEngineSettings* mockWebEngineSettings;
- std::vector<JavaScriptEvaluatedResultCallback> mResultCallbacks;
- Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
- Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
- Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
- Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
- Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
- Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
- Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback mHitTestCreatedCallback;
+ std::vector<Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback> mResultCallbacks;
+
+ Dali::WebEnginePlugin::WebEnginePageLoadCallback mPageLoadStartedCallback;
+ Dali::WebEnginePlugin::WebEnginePageLoadCallback mPageLoadInProgressCallback;
+ Dali::WebEnginePlugin::WebEnginePageLoadCallback mPageLoadFinishedCallback;
+ Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback mPageLoadErrorCallback;
+ Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback mScrollEdgeReachedCallback;
+ Dali::WebEnginePlugin::WebEngineUrlChangedCallback mUrlChangedCallback;
+ Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback mFormRepostDecidedCallback;
+ Dali::WebEnginePlugin::WebEngineFrameRenderedCallback mFrameRenderedCallback;
+ Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback mRequestInterceptorCallback;
+ Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback mConsoleMessageCallback;
+ Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback mResponsePolicyDecisionCallback;
+ Dali::WebEnginePlugin::WebEngineCertificateCallback mCertificateConfirmCallback;
+ Dali::WebEnginePlugin::WebEngineCertificateCallback mSslCertificateChangedCallback;
+ Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback mHttpAuthHandlerCallback;
+ Dali::WebEnginePlugin::WebEngineContextMenuShownCallback mContextMenuShownCallback;
+ Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback mContextMenuHiddenCallback;
+ Dali::WebEnginePlugin::JavaScriptAlertCallback mJavaScriptAlertCallback;
+ Dali::WebEnginePlugin::JavaScriptConfirmCallback mJavaScriptConfirmCallback;
+ Dali::WebEnginePlugin::JavaScriptPromptCallback mJavaScriptPromptCallback;
+ Dali::WebEnginePlugin::ScreenshotCapturedCallback mScreenshotCapturedCallback;
+ Dali::WebEnginePlugin::VideoPlayingCallback mVideoPlayingCallback;
+ Dali::WebEnginePlugin::GeolocationPermissionCallback mGeolocationPermissionCallback;
+ Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback mHitTestCreatedCallback;
};
}
gInstance->mHistory.push_back( gInstance->mUrl );
gInstance->mCurrentPlusOnePos++;
- gInstance->mPageLoadStartedSignal.Emit( gInstance->mUrl );
- gInstance->mPageLoadInProgressSignal.Emit( gInstance->mUrl );
- gInstance->mPageLoadFinishedSignal.Emit( gInstance->mUrl );
- gInstance->mUrlChangedSignal.Emit( "http://new-test" );
-
- std::shared_ptr<Dali::WebEngineFormRepostDecision> repostDecision(new MockWebEngineFormRepostDecision());
- gInstance->mFormRepostDecisionSignal.Emit(std::move(repostDecision));
+ if (gInstance->mPageLoadStartedCallback)
+ {
+ gInstance->mPageLoadStartedCallback( gInstance->mUrl );
+ }
+ if (gInstance->mPageLoadInProgressCallback)
+ {
+ gInstance->mPageLoadInProgressCallback( gInstance->mUrl );
+ }
+ if (gInstance->mPageLoadFinishedCallback)
+ {
+ gInstance->mPageLoadFinishedCallback( gInstance->mUrl );
+ }
+ if (gInstance->mPageLoadErrorCallback)
+ {
+ std::unique_ptr<Dali::WebEngineLoadError> error(new MockWebEngineLoadError(gInstance->mUrl));
+ gInstance->mPageLoadErrorCallback(std::move(error));
+ }
+ if (gInstance->mUrlChangedCallback)
+ {
+ gInstance->mUrlChangedCallback( "http://new-test" );
+ }
+ if (gInstance->mFormRepostDecidedCallback)
+ {
+ std::unique_ptr<Dali::WebEngineFormRepostDecision> repostDecision(new MockWebEngineFormRepostDecision());
+ gInstance->mFormRepostDecidedCallback(std::move(repostDecision));
+ }
gInstance->mFrameRenderedSignal.Emit();
- std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
- gInstance->mRequestInterceptorSignal.Emit(std::move(interceptor));
-
- std::shared_ptr<Dali::WebEngineLoadError> error(new MockWebEngineLoadError(gInstance->mUrl));
- gInstance->mPageLoadErrorSignal.Emit(std::move(error));
- std::shared_ptr<Dali::WebEngineConsoleMessage> message(new MockWebEngineConsoleMessage());
- gInstance->mConsoleMessageSignal.Emit(std::move(message));
- std::shared_ptr<Dali::WebEnginePolicyDecision> policyDecision(new MockWebEnginePolicyDecision());
- gInstance->mResponsePolicyDecisionSignal.Emit(std::move(policyDecision));
-
- std::shared_ptr<Dali::WebEngineCertificate> certificate(new MockWebEngineCertificate());
- gInstance->mCertificateConfirmSignal.Emit(std::move(certificate));
- std::shared_ptr<Dali::WebEngineCertificate> sslCertificate(new MockWebEngineCertificate());
- gInstance->mSslCertificateChangedSignal.Emit(std::move(sslCertificate));
- std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler(new MockWebEngineHttpAuthHandler());
- gInstance->mHttpAuthHandlerSignal.Emit(std::move(handler));
-
- std::shared_ptr<Dali::WebEngineContextMenu> menu(new MockWebEngineContextMenu());
- gInstance->mContextMenuShownSignal.Emit(std::move(menu));
- std::shared_ptr<Dali::WebEngineContextMenu> hiddenMenu(new MockWebEngineContextMenu());
- gInstance->mContextMenuHiddenSignal.Emit(std::move(hiddenMenu));
+ if (gInstance->mFrameRenderedCallback)
+ {
+ gInstance->mFrameRenderedCallback();
+ }
+ if (gInstance->mRequestInterceptorCallback)
+ {
+ std::unique_ptr<Dali::WebEngineRequestInterceptor> interceptor(new MockWebEngineRequestInterceptor());
+ gInstance->mRequestInterceptorCallback(std::move(interceptor));
+ }
+ if (gInstance->mConsoleMessageCallback)
+ {
+ std::unique_ptr<Dali::WebEngineConsoleMessage> message(new MockWebEngineConsoleMessage());
+ gInstance->mConsoleMessageCallback(std::move(message));
+ }
+ if (gInstance->mResponsePolicyDecisionCallback)
+ {
+ std::unique_ptr<Dali::WebEnginePolicyDecision> policyDecision(new MockWebEnginePolicyDecision());
+ gInstance->mResponsePolicyDecisionCallback(std::move(policyDecision));
+ }
+ if (gInstance->mCertificateConfirmCallback)
+ {
+ std::unique_ptr<Dali::WebEngineCertificate> certificate(new MockWebEngineCertificate());
+ gInstance->mCertificateConfirmCallback(std::move(certificate));
+ }
+ if (gInstance->mSslCertificateChangedCallback)
+ {
+ std::unique_ptr<Dali::WebEngineCertificate> sslCertificate(new MockWebEngineCertificate());
+ gInstance->mSslCertificateChangedCallback(std::move(sslCertificate));
+ }
+ if (gInstance->mHttpAuthHandlerCallback)
+ {
+ std::unique_ptr<Dali::WebEngineHttpAuthHandler> handler(new MockWebEngineHttpAuthHandler());
+ gInstance->mHttpAuthHandlerCallback(std::move(handler));
+ }
+ if (gInstance->mContextMenuShownCallback)
+ {
+ std::unique_ptr<Dali::WebEngineContextMenu> menu(new MockWebEngineContextMenu());
+ gInstance->mContextMenuShownCallback(std::move(menu));
+ }
+ if (gInstance->mContextMenuHiddenCallback)
+ {
+ std::unique_ptr<Dali::WebEngineContextMenu> hiddenMenu(new MockWebEngineContextMenu());
+ gInstance->mContextMenuHiddenCallback(std::move(hiddenMenu));
+ }
}
return false;
}
{
DisconnectFromGlobalSignal( &OnScrollEdge );
- if( gInstance )
+ if( gInstance && gInstance->mScrollEdgeReachedCallback )
{
- gInstance->mScrollEdgeReachedSignal.Emit( Dali::WebEnginePlugin::ScrollEdge::BOTTOM );
+ gInstance->mScrollEdgeReachedCallback( Dali::WebEnginePlugin::ScrollEdge::BOTTOM );
}
return false;
{
}
-Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadStartedSignal()
+Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal()
{
- return Internal::Adaptor::GetImplementation( *this ).PageLoadStartedSignal();
+ return Internal::Adaptor::GetImplementation(*this).FrameRenderedSignal();
}
-Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadInProgressSignal()
+void WebEngine::RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).PageLoadInProgressSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadStartedCallback(callback);
}
-Dali::WebEnginePlugin::WebEnginePageLoadSignalType& WebEngine::PageLoadFinishedSignal()
+void WebEngine::RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).PageLoadFinishedSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadInProgressCallback(callback);
}
-Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& WebEngine::PageLoadErrorSignal()
+void WebEngine::RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).PageLoadErrorSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadFinishedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineScrollEdgeReachedSignalType& WebEngine::ScrollEdgeReachedSignal()
+void WebEngine::RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).ScrollEdgeReachedSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterPageLoadErrorCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineUrlChangedSignalType& WebEngine::UrlChangedSignal()
+void WebEngine::RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).UrlChangedSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterScrollEdgeReachedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineFormRepostDecisionSignalType& WebEngine::FormRepostDecisionSignal()
+void WebEngine::RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).FormRepostDecisionSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterUrlChangedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineFrameRenderedSignalType& WebEngine::FrameRenderedSignal()
+void WebEngine::RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).FrameRenderedSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterFormRepostDecidedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineRequestInterceptorSignalType& WebEngine::RequestInterceptorSignal()
+void WebEngine::RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).RequestInterceptorSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterRequestInterceptorCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineConsoleMessageSignalType& WebEngine::ConsoleMessageSignal()
+void WebEngine::RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).ConsoleMessageSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterConsoleMessageReceivedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineResponsePolicyDecisionSignalType& WebEngine::ResponsePolicyDecisionSignal()
+void WebEngine::RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).ResponsePolicyDecisionSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterResponsePolicyDecidedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::CertificateConfirmSignal()
+void WebEngine::RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).CertificateConfirmSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterCertificateConfirmedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineCertificateSignalType& WebEngine::SslCertificateChangedSignal()
+void WebEngine::RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).SslCertificateChangedSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterSslCertificateChangedCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineHttpAuthHandlerSignalType& WebEngine::HttpAuthHandlerSignal()
+void WebEngine::RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback)
{
- return Internal::Adaptor::GetImplementation(*this).HttpAuthHandlerSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterHttpAuthHandlerCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineContextMenuShownSignalType& WebEngine::ContextMenuShownSignal()
+void WebEngine::RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).ContextMenuShownSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterContextMenuShownCallback(callback);
}
-Dali::WebEnginePlugin::WebEngineContextMenuHiddenSignalType& WebEngine::ContextMenuHiddenSignal()
+void WebEngine::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback)
{
- return Internal::Adaptor::GetImplementation( *this ).ContextMenuHiddenSignal();
+ Internal::Adaptor::GetImplementation( *this ).RegisterContextMenuHiddenCallback(callback);
}
} // namespace Dali;
application.SendNotification();
application.Render();
+ // Trigger count is 1 - render the first frame
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
Property::Map attributes;
DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
application.SendNotification();
application.Render();
- // Trigger count is 1 - render the first frame
- DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
-
// Wait for calculating frame drops
DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
// Check dropped frame
uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames();
- DALI_TEST_CHECK(frames >= 9);
+ DALI_TEST_CHECK(frames > 0);
END_TEST;
}
#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
#include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
using namespace Dali;
using namespace Dali::Toolkit;
FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
DALI_TEST_CHECK( frameBuffer );
- std::string url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
+ ImageUrl url = Dali::Toolkit::Image::GenerateUrl( frameBuffer, Pixel::Format::RGBA8888, width, height );
- DALI_TEST_CHECK( url.size() > 0u );
+ DALI_TEST_CHECK( url.GetUrl().size() > 0u );
END_TEST;
}
Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
frameBuffer.AttachColorTexture( texture );
- DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).size() > 0u );
+ DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( frameBuffer, 0 ).GetUrl().size() > 0u );
END_TEST;
}
unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
- DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).size() > 0u );
+ DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( pixelData ).GetUrl().size() > 0u );
END_TEST;
}
{
NativeImageSourcePtr nativeImageSource = NativeImageSource::New(width, height, NativeImageSource::COLOR_DEPTH_DEFAULT );
- DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).size() > 0u );
+ DALI_TEST_CHECK( Dali::Toolkit::Image::GenerateUrl( nativeImageSource ).GetUrl().size() > 0u );
}
catch(Dali::DaliException& e)
{
--- /dev/null
+/*
+ * Copyright (c) 2021 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 <iostream>
+#include <stdlib.h>
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+int UtcImageUrlConstructor(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcImageUrlValid ");
+
+ // Test default constructor.
+ ImageUrl imageUrl;
+ DALI_TEST_CHECK( !imageUrl );
+
+ // Test object creation
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); // test texture
+ imageUrl = ImageUrl::New(image);
+ DALI_TEST_CHECK( imageUrl );
+
+ // Test copy constructor
+ ImageUrl ImageUrlCopy( imageUrl );
+ DALI_TEST_CHECK( ImageUrlCopy );
+
+ // Test down cast
+ BaseHandle baseUrl;
+ baseUrl = imageUrl;
+ ImageUrl downcastUrl = ImageUrl::DownCast( baseUrl );
+ DALI_TEST_CHECK( downcastUrl );
+ END_TEST;
+}
\ No newline at end of file
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/public-api/image-loader/image.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
#include <dali-toolkit/dali-toolkit.h>
#include "dummy-control.h"
tet_infoline( "Use Native Image as url" );
NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
- std::string url = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+ ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+ std::string url = imageUrl.GetUrl();
VisualFactory factory = VisualFactory::Get();
DALI_TEST_CHECK( factory );
END_TEST;
}
+int UtcDaliImageVisualWithNativeImageRemoved(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Use Native Image as url" );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable(true);
+
+ NativeImageSourcePtr nativeImageSource = NativeImageSource::New(500, 500, NativeImageSource::COLOR_DEPTH_DEFAULT);
+ ImageUrl imageUrl = Dali::Toolkit::Image::GenerateUrl(nativeImageSource);
+ std::string url = imageUrl.GetUrl();
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ Property::Map propertyMap;
+ propertyMap.Insert( Toolkit::Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, url );
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ DummyControl actor = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast<DummyControlImpl&>(actor.GetImplementation());
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+
+ application.GetScene().Add( actor );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+
+ tet_infoline( "No delete texture because reference count is not zero" );
+ imageUrl.Reset();
+ application.GetScene().Remove( actor );
+ dummyImpl.UnregisterVisual( DummyControl::Property::TEST_VISUAL );
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 0, TEST_LOCATION );
+
+ tet_infoline( "Delete texture because reference count is zero" );
+ visual.Reset();
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( textureTrace.CountMethod("DeleteTextures"), 1, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliImageVisualTextureReuse1(void)
{
ToolkitTestApplication application;
focusChangedCallback.Reset();
// without set the navigation properties, but we can focus move
+ // enable the default algorithm
+ Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, true);
+ DALI_TEST_CHECK( Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
// Move the focus towards right
// button1 -- [button2]
DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliKeyboardFocusManagerEnableDefaultAlgorithm(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerEnableDefaultAlgorithm");
+
+ // Register Type
+ TypeInfo type;
+ type = TypeRegistry::Get().GetTypeInfo( "KeyboardFocusManager" );
+ DALI_TEST_CHECK( type );
+ BaseHandle handle = type.CreateInstance();
+ DALI_TEST_CHECK( handle );
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ bool focusChangedSignalVerified = false;
+ FocusChangedCallback focusChangedCallback(focusChangedSignalVerified);
+ manager.FocusChangedSignal().Connect( &focusChangedCallback, &FocusChangedCallback::Callback );
+
+ PushButton button1 = PushButton::New();
+ PushButton button2 = PushButton::New();
+
+ button1.SetProperty(Actor::Property::SIZE, Vector2(50, 50));
+ button2.SetProperty(Actor::Property::SIZE, Vector2(50, 50));
+
+ button1.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE,true);
+ button2.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE,true);
+
+ application.GetScene().Add(button1);
+ application.GetScene().Add(button2);
+
+ // set position
+ // button1 -- button2
+ button1.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+ button2.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 0.0f));
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Set the focus to the button1
+ // [button1] -- button2
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(button1) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == button1);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == Actor());
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button1);
+ focusChangedCallback.Reset();
+
+ // without set the navigation properties, but we can focus move
+ // enable the default algorithm
+ Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, true);
+ DALI_TEST_CHECK( Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
+
+ // Move the focus towards right
+ // button1 -- [button2]
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::RIGHT) == true);
+
+ // Confirm whether focus is moved to button2
+ DALI_TEST_EQUALS(button2.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == button1);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button2);
+ focusChangedCallback.Reset();
+
+ // disable the default algorithm
+ Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, false);
+ DALI_TEST_CHECK( !Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
+
+ // Move the focus towards left, The focus move will fail because the default algorithm is disabled.
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == false);
+
+ // enable the default algorithm
+ Dali::Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm(manager, true);
+ DALI_TEST_CHECK( Dali::Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled(manager) );
+
+ // Move the focus towards left, The focus move will success because the default algorithm is enabled.
+ // [button1] -- button2
+ DALI_TEST_CHECK(manager.MoveFocus(Control::KeyboardFocus::LEFT) == true);
+ // Confirm whether focus is moved to button2
+ DALI_TEST_EQUALS(button1.GetProperty<int>(DevelControl::Property::STATE), (int)DevelControl::FOCUSED, TEST_LOCATION);
+ DALI_TEST_CHECK(focusChangedCallback.mSignalVerified);
+ DALI_TEST_CHECK(focusChangedCallback.mOriginalFocusedActor == button2);
+ DALI_TEST_CHECK(focusChangedCallback.mCurrentFocusedActor == button1);
+ focusChangedCallback.Reset();
+
+
+ END_TEST;
+}
DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
END_TEST;
+}
+
+int UtcDaliToolkitTextEditorEllipsisPositionProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty ");
+ TextEditor textEditor = TextEditor::New();
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Default is END");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to START using integer");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 1);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to MIDDLE using integer");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 2);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextEditorEllipsisPositionProperty - Change to END using integer");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, 0);
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "START");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "MIDDLE");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "END");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "start");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "middle");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
+ textEditor.SetProperty(DevelTextEditor::Property::ELLIPSIS_POSITION, "end");
+ DALI_TEST_EQUALS( textEditor.GetProperty< int >( DevelTextEditor::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ END_TEST;
}
\ No newline at end of file
#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
#include <dali-toolkit/devel-api/text/rendering-backend.h>
#include "toolkit-clipboard.h"
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
using namespace Dali;
using namespace Toolkit;
}
END_TEST;
+}
+
+int UtcDaliToolkitTextFieldEllipsisPositionProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty ");
+ TextField textField = TextField::New();
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Default is END");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Change to START");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Change to MIDDLE");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Change to END");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Change to START using integer");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, 1);
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Change to MIDDLE using integer");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, 2);
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextFieldEllipsisPositionProperty - Change to END using integer");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, 0);
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, "START");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, "MIDDLE");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, "END");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, "start");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, "middle");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
+ textField.SetProperty(DevelTextField::Property::ELLIPSIS_POSITION, "end");
+ DALI_TEST_EQUALS( textField.GetProperty< int >( DevelTextField::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ END_TEST;
}
\ No newline at end of file
const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
+
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
END_TEST;
}
END_TEST;
+}
+
+int UtcDaliToolkitTextlabelEllipsisPositionProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty ");
+ TextLabel textLabel = TextLabel::New();
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Default is END");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::START);
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::MIDDLE);
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, DevelText::EllipsisPosition::END);
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using integer");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 1);
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using integer");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 2);
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using integer");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, 0);
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - uppercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "START");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - uppercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "MIDDLE");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - uppercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "END");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to START using string - lowercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "start");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::START ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to MIDDLE using string - lowercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "middle");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::MIDDLE ), TEST_LOCATION );
+
+ tet_infoline(" UtcDaliToolkitTextlabelEllipsisPositionProperty - Change to END using string - lowercase");
+ textLabel.SetProperty(DevelTextLabel::Property::ELLIPSIS_POSITION, "end");
+ DALI_TEST_EQUALS( textLabel.GetProperty< int >( DevelTextLabel::Property::ELLIPSIS_POSITION ), static_cast< int >( Toolkit::DevelText::EllipsisPosition::END ), TEST_LOCATION );
+
+
+ END_TEST;
}
\ No newline at end of file
controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
Control control2 = Control::New();
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
application.GetScene().Add(control1);
controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(50.0f, 30.0f, 40.0f, 20.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
Control control2 = Control::New();
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, Vector4(32.f, 54.0f, 24.0f, 42.0f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
application.GetScene().Add(control1);
Vector4 destinationColor(1.0f, 0.5f, 1.0f, 0.8f);
float destinationOpacity(0.8f);
float destinationRadius(50.f);
+ float destinationBorderlineWidth(80.0f);
+ Vector4 destinationBorderlineColor(0.5f, 1.0f, 0.5f, 0.3f);
+ float destinationBorderlineOffset(-1.0f);
Vector4 destinationRadiusV4 = Vector4(destinationRadius, destinationRadius, destinationRadius, destinationRadius);
Control control1 = Control::New();
controlProperty1.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty1.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 60.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty1);
Control control2 = Control::New();
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
+ float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
application.GetScene().Add(control1);
application.GetScene().Add(control2);
Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+ borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+ borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
application.SendNotification();
application.Render(700);
index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
+ borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
+ borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
END_TEST;
}
tet_infoline(" UtcDaliTransitionBetweenControlPair");
Vector4 destinationRadius(50.f, 30.f, 40.f, 0.f);
+ float destinationBorderlineWidth(40.f);
+ Vector4 destinationBorderlineColor(1.0f, 0.5f, 0.2f, 0.8f);
+ float destinationBorderlineOffset(1.f);
Control control1 = Control::New();
control1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
controlProperty2.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
controlProperty2.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.0f, 0.5f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, destinationRadius);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, destinationBorderlineWidth);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, destinationBorderlineColor);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, destinationBorderlineOffset);
control2.SetProperty(Toolkit::Control::Property::BACKGROUND, controlProperty2);
Property::Map backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
Vector4 cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
+ float borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ Vector4 borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ float borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
application.GetScene().Add(control1);
application.GetScene().Add(control2);
backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
+ borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
application.SendNotification();
application.Render(700);
backgroundMap = control2.GetProperty<Property::Map>(Toolkit::Control::Property::BACKGROUND);
cornerRadius = backgroundMap.Find(Toolkit::DevelVisual::Property::CORNER_RADIUS)->Get<Vector4>();
DALI_TEST_EQUALS(destinationRadius, cornerRadius, TEST_LOCATION);
+ borderlineWidth = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
+ borderlineColor = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_COLOR)->Get<Vector4>();
+ DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
+ borderlineOffset = backgroundMap.Find(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET)->Get<float>();
+ DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
END_TEST;
}
controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
ImageView control2 = ImageView::New();
controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
controlProperty1.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty1.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 0.5f, 0.5f));
controlProperty1.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 50.f);
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(1.0f, 0.0f, 0.0f, 1.0f));
+ controlProperty1.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, 1.f);
control1.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty1);
ImageView control2 = ImageView::New();
controlProperty2.Insert(Toolkit::ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME);
controlProperty2.Insert(Toolkit::Visual::Property::MIX_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
controlProperty2.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, 30.f);
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, Vector4(0.0f, 1.0f, 1.0f, 0.5f));
+ controlProperty2.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, -1.f);
control2.SetProperty(Toolkit::ImageView::Property::IMAGE, controlProperty2);
DALI_TEST_EQUALS(destinationPosition, control2.GetProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
static int gPageLoadInProgressCallbackCalled = 0;
static int gPageLoadFinishedCallbackCalled = 0;
static int gPageLoadErrorCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
static int gScrollEdgeReachedCallbackCalled = 0;
static int gUrlChangedCallbackCalled = 0;
static int gEvaluateJavaScriptCallbackCalled = 0;
static bool gTouched = false;
static bool gHovered = false;
static bool gWheelEventHandled = false;
-static int gFormRepostDecisionCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineFormRepostDecision> gFormRepostDecisionInstance = nullptr;
+static int gFormRepostDecidedCallbackCalled = 0;
+static std::unique_ptr<Dali::WebEngineFormRepostDecision> gFormRepostDecidedInstance = nullptr;
static int gFrameRenderedCallbackCalled = 0;
static int gRequestInterceptorCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
static int gConsoleMessageCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
static int gResponsePolicyDecidedCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEnginePolicyDecision> gResponsePolicyDecisionInstance = nullptr;
+static std::unique_ptr<Dali::WebEnginePolicyDecision> gResponsePolicyDecisionInstance = nullptr;
static int gCertificateConfirmCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
static int gSslCertificateChangedCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
static int gHttpAuthHandlerCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
static int gSecurityOriginsAcquiredCallbackCalled = 0;
static int gStorageUsageAcquiredCallbackCalled = 0;
static int gFormPasswordsAcquiredCallbackCalled = 0;
static std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> gSecurityOriginList;
static std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> gPasswordDataList;
static int gContextMenuShownCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineContextMenu> gContextMenuShownInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineContextMenu> gContextMenuShownInstance = nullptr;
static int gContextMenuHiddenCallbackCalled = 0;
-static std::shared_ptr<Dali::WebEngineContextMenu> gContextMenuHiddenInstance = nullptr;
+static std::unique_ptr<Dali::WebEngineContextMenu> gContextMenuHiddenInstance = nullptr;
static int gHitTestCreatedCallbackCalled = 0;
static int gCookieManagerChangsWatchCallbackCalled = 0;
bool* mCallbackFlag;
};
-static void OnPageLoadStarted( WebView view, const std::string& url )
+static void OnPageLoadStarted(const std::string& url)
{
gPageLoadStartedCallbackCalled++;
}
-static void OnPageLoadInProgress( WebView view, const std::string& url )
+static void OnPageLoadInProgress(const std::string& url)
{
gPageLoadInProgressCallbackCalled++;
}
-static void OnPageLoadFinished( WebView view, const std::string& url )
+static void OnPageLoadFinished(const std::string& url)
{
gPageLoadFinishedCallbackCalled++;
}
-static void OnScrollEdgeReached( WebView view, Dali::WebEnginePlugin::ScrollEdge edge )
+static void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge)
{
gScrollEdgeReachedCallbackCalled++;
}
-static void OnResponsePolicyDecided(WebView view, std::shared_ptr<Dali::WebEnginePolicyDecision> decision)
+static void OnResponsePolicyDecided(std::unique_ptr<Dali::WebEnginePolicyDecision> decision)
{
gResponsePolicyDecidedCallbackCalled++;
gResponsePolicyDecisionInstance = std::move(decision);
}
-static void OnUrlChanged( WebView view, const std::string& url )
+static void OnUrlChanged(const std::string& url)
{
gUrlChangedCallbackCalled++;
}
return true;
}
-static void OnPageLoadError(WebView view, std::shared_ptr<Dali::WebEngineLoadError> error)
+static void OnPageLoadError(std::unique_ptr<Dali::WebEngineLoadError> error)
{
gPageLoadErrorCallbackCalled++;
gPageLoadErrorInstance = std::move(error);
}
-static void OnEvaluateJavaScript( const std::string& result )
+static void OnEvaluateJavaScript(const std::string& result)
{
gEvaluateJavaScriptCallbackCalled++;
}
-static bool OnJavaScriptAlert( const std::string& result )
+static bool OnJavaScriptAlert(const std::string& result)
{
gJavaScriptAlertCallbackCalled++;
return true;
}
-static bool OnJavaScriptConfirm( const std::string& result )
+static bool OnJavaScriptConfirm(const std::string& result)
{
gJavaScriptConfirmCallbackCalled++;
return true;
}
-static bool OnJavaScriptPrompt( const std::string& meesage1, const std::string& message2 )
+static bool OnJavaScriptPrompt(const std::string& meesage1, const std::string& message2)
{
gJavaScriptPromptCallbackCalled++;
return true;
gCookieManagerChangsWatchCallbackCalled++;
}
-static bool OnHovered( Actor actor, const Dali::HoverEvent& hover )
+static bool OnHovered(Actor actor, const Dali::HoverEvent& hover)
{
gHovered = true;
return true;
}
-static bool OnWheelEvent( Actor actor, const Dali::WheelEvent& wheel )
+static bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
{
gWheelEventHandled = true;
return true;
}
-static void OnFormRepostDecision(WebView, std::shared_ptr<Dali::WebEngineFormRepostDecision> decision)
+static void OnFormRepostDecided(std::unique_ptr<Dali::WebEngineFormRepostDecision> decision)
{
- gFormRepostDecisionCallbackCalled++;
- gFormRepostDecisionInstance = std::move(decision);
+ gFormRepostDecidedCallbackCalled++;
+ gFormRepostDecidedInstance = std::move(decision);
}
-static void OnFrameRendered(WebView)
+static void OnFrameRendered()
{
gFrameRenderedCallbackCalled++;
}
-static void OnRequestInterceptor(WebView view, std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
+static void OnRequestInterceptor(std::unique_ptr<Dali::WebEngineRequestInterceptor> interceptor)
{
gRequestInterceptorCallbackCalled++;
gRequestInterceptorInstance = std::move(interceptor);
}
-static void OnConsoleMessage(WebView view, std::shared_ptr<Dali::WebEngineConsoleMessage> message)
+static void OnConsoleMessage(std::unique_ptr<Dali::WebEngineConsoleMessage> message)
{
gConsoleMessageCallbackCalled++;
gConsoleMessageInstance = std::move(message);
}
-static void OnCertificateConfirm(WebView view, std::shared_ptr<Dali::WebEngineCertificate> certificate )
+static void OnCertificateConfirm(std::unique_ptr<Dali::WebEngineCertificate> certificate)
{
gCertificateConfirmCallbackCalled++;
gCertificateConfirmInstance = std::move(certificate);
}
-static void OnSslCertificateChanged(WebView view, std::shared_ptr<Dali::WebEngineCertificate> certificate )
+static void OnSslCertificateChanged(std::unique_ptr<Dali::WebEngineCertificate> certificate)
{
gSslCertificateChangedCallbackCalled++;
gSslCertificateInstance = std::move(certificate);
}
-static void OnHttpAuthHandler( WebView view, std::shared_ptr<Dali::WebEngineHttpAuthHandler> hander )
+static void OnHttpAuthHandler(std::unique_ptr<Dali::WebEngineHttpAuthHandler> hander)
{
gHttpAuthHandlerCallbackCalled++;
gHttpAuthInstance = std::move(hander);
return false;
}
-static void OnContextMenuShown(WebView view, std::shared_ptr<Dali::WebEngineContextMenu> menu)
+static void OnContextMenuShown(std::unique_ptr<Dali::WebEngineContextMenu> menu)
{
gContextMenuShownCallbackCalled++;
gContextMenuShownInstance = std::move(menu);
}
-static void OnContextMenuHidden(WebView view, std::shared_ptr<Dali::WebEngineContextMenu> menu)
+static void OnContextMenuHidden(std::unique_ptr<Dali::WebEngineContextMenu> menu)
{
gContextMenuHiddenCallbackCalled++;
gContextMenuHiddenInstance = std::move(menu);
application.Render();
DALI_TEST_CHECK( view );
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
- view.PageLoadInProgressSignal().Connect( &OnPageLoadInProgress );
- view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
- view.UrlChangedSignal().Connect( &OnUrlChanged );
- bool signal1 = false;
- bool signal2 = false;
- bool signal3 = false;
- bool signal4 = false;
- bool signal5 = false;
- view.ConnectSignal( testTracker, "pageLoadStarted", CallbackFunctor(&signal1) );
- view.ConnectSignal( testTracker, "pageLoadInProgress", CallbackFunctor(&signal2) );
- view.ConnectSignal( testTracker, "pageLoadFinished", CallbackFunctor(&signal3) );
- view.ConnectSignal( testTracker, "urlChanged", CallbackFunctor(&signal4) );
- view.ConnectSignal( testTracker, "invalidname", CallbackFunctor(&signal5) );
+ view.RegisterPageLoadStartedCallback( &OnPageLoadStarted );
+ view.RegisterPageLoadInProgressCallback( &OnPageLoadInProgress );
+ view.RegisterPageLoadFinishedCallback( &OnPageLoadFinished );
+ view.RegisterUrlChangedCallback( &OnUrlChanged );
DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 & signal2 & signal3 & signal4 );
- DALI_TEST_CHECK( !signal5 );
view.LoadUrl( TEST_URL2 );
view.Suspend();
application.Render();
DALI_TEST_CHECK( view );
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.PageLoadErrorSignal().Connect( &OnPageLoadError );
- view.ConsoleMessageSignal().Connect( &OnConsoleMessage );
- bool signal1 = false;
- bool signal2 = false;
- view.ConnectSignal( testTracker, "pageLoadError", CallbackFunctor(&signal1) );
- view.ConnectSignal( testTracker, "consoleMessage", CallbackFunctor(&signal2) );
+ view.RegisterPageLoadErrorCallback( &OnPageLoadError );
+ view.RegisterConsoleMessageReceivedCallback( &OnConsoleMessage );
DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 0, TEST_LOCATION );
Test::EmitGlobalTimerSignal();
DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 & signal2);
// error code.
DALI_TEST_CHECK(gPageLoadErrorInstance);
WebView view = WebView::New();
DALI_TEST_CHECK( view );
- const bool kDefaultValue = true;
- const bool kTestValue = false;
+ const bool kDefaultValue = false;
+ const bool kTestValue = true;
// Check default value
bool output;
END_TEST;
}
-int UtcDaliWebViewFormRepostDecisionFrameRendering(void)
+int UtcDaliWebViewFormRepostDecidedFrameRendering(void)
{
ToolkitTestApplication application;
application.Render();
DALI_TEST_CHECK( view );
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.FormRepostDecisionSignal().Connect(&OnFormRepostDecision);
- view.FrameRenderedSignal().Connect(&OnFrameRendered);
- bool signal1 = false;
- bool signal2 = false;
- view.ConnectSignal( testTracker, "formRepostDecision", CallbackFunctor(&signal1) );
- view.ConnectSignal( testTracker, "frameRendered", CallbackFunctor(&signal2) );
- DALI_TEST_EQUALS( gFormRepostDecisionCallbackCalled, 0, TEST_LOCATION );
+ view.RegisterFormRepostDecidedCallback(&OnFormRepostDecided);
+ view.RegisterFrameRenderedCallback(&OnFrameRendered);
+ DALI_TEST_EQUALS( gFormRepostDecidedCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gFrameRenderedCallbackCalled, 0, TEST_LOCATION );
view.LoadUrl( TEST_URL1 );
Test::EmitGlobalTimerSignal();
- DALI_TEST_EQUALS( gFormRepostDecisionCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gFormRepostDecidedCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gFrameRenderedCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 & signal2);
// form repost decision.
- DALI_TEST_CHECK(gFormRepostDecisionInstance);
- gFormRepostDecisionInstance->Reply(true);
+ DALI_TEST_CHECK(gFormRepostDecidedInstance);
+ gFormRepostDecidedInstance->Reply(true);
// reset
- gFormRepostDecisionInstance = nullptr;
+ gFormRepostDecidedInstance = nullptr;
END_TEST;
}
application.Render();
DALI_TEST_CHECK( view );
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.CertificateConfirmSignal().Connect(&OnCertificateConfirm);
- view.SslCertificateChangedSignal().Connect(&OnSslCertificateChanged);
- view.HttpAuthHandlerSignal().Connect(&OnHttpAuthHandler);
- bool signal1 = false;
- bool signal2 = false;
- bool signal3 = false;
- view.ConnectSignal( testTracker, "certificateConfirm", CallbackFunctor(&signal1) );
- view.ConnectSignal( testTracker, "sslCertificateChanged", CallbackFunctor(&signal2) );
- view.ConnectSignal( testTracker, "httpAuthRequest", CallbackFunctor(&signal3) );
+ view.RegisterCertificateConfirmedCallback(&OnCertificateConfirm);
+ view.RegisterSslCertificateChangedCallback(&OnSslCertificateChanged);
+ view.RegisterHttpAuthHandlerCallback(&OnHttpAuthHandler);
DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 & signal2 & signal3);
// certificate.
DALI_TEST_CHECK(gCertificateConfirmInstance);
DALI_TEST_CHECK( view );
// load url.
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.ContextMenuShownSignal().Connect( &OnContextMenuShown );
- view.ContextMenuHiddenSignal().Connect( &OnContextMenuHidden );
- bool signal1 = false;
- bool signal2 = false;
- view.ConnectSignal( testTracker, "contextMenuShown", CallbackFunctor(&signal1) );
- view.ConnectSignal( testTracker, "contextMenuHidden", CallbackFunctor(&signal2) );
+ view.RegisterContextMenuShownCallback( &OnContextMenuShown );
+ view.RegisterContextMenuHiddenCallback( &OnContextMenuHidden );
DALI_TEST_EQUALS( gContextMenuShownCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_EQUALS( gContextMenuHiddenCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_CHECK(gContextMenuShownInstance == 0);
Test::EmitGlobalTimerSignal();
DALI_TEST_EQUALS( gContextMenuShownCallbackCalled, 1, TEST_LOCATION );
DALI_TEST_EQUALS( gContextMenuHiddenCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 );
- DALI_TEST_CHECK( signal2 );
// check context meun & its items.
DALI_TEST_CHECK(gContextMenuShownInstance != 0);
DALI_TEST_CHECK( view );
// load url.
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.ScrollEdgeReachedSignal().Connect( &OnScrollEdgeReached );
- bool signal1 = false;
- view.ConnectSignal( testTracker, "scrollEdgeReached", CallbackFunctor(&signal1) );
+ view.RegisterScrollEdgeReachedCallback( &OnScrollEdgeReached );
DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 0, TEST_LOCATION );
view.LoadUrl( TEST_URL1 );
view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
DALI_TEST_CHECK( output.x == 150 && output.y == 150 );
DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 );
// scroll by and trigger scrollEdgeReached event.
bool result = view.ScrollEdgeBy( 50, 50 );
view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
DALI_TEST_CHECK( output.x == 200 && output.y == 200 );
DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 2, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 );
END_TEST;
}
DALI_TEST_CHECK( view );
// load url.
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.RequestInterceptorSignal().Connect( &OnRequestInterceptor );
- bool signal1 = false;
- view.ConnectSignal( testTracker, "requestInterceptor", CallbackFunctor(&signal1) );
+ view.RegisterRequestInterceptorCallback( &OnRequestInterceptor );
DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_CHECK(gRequestInterceptorInstance == 0);
view.LoadUrl( TEST_URL1 );
Test::EmitGlobalTimerSignal();
DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 );
// check request interceptor.
DALI_TEST_CHECK(gRequestInterceptorInstance != 0);
DALI_TEST_CHECK( view );
// load url.
- ConnectionTracker* testTracker = new ConnectionTracker();
- view.ResponsePolicyDecisionSignal().Connect( &OnResponsePolicyDecided );
- bool signal1 = false;
- view.ConnectSignal( testTracker, "responsePolicyDecided", CallbackFunctor(&signal1) );
+ view.RegisterResponsePolicyDecidedCallback( &OnResponsePolicyDecided );
DALI_TEST_EQUALS( gResponsePolicyDecidedCallbackCalled, 0, TEST_LOCATION );
DALI_TEST_CHECK(gResponsePolicyDecisionInstance == 0);
view.LoadUrl( TEST_URL1 );
Test::EmitGlobalTimerSignal();
DALI_TEST_EQUALS( gResponsePolicyDecidedCallbackCalled, 1, TEST_LOCATION );
- DALI_TEST_CHECK( signal1 );
// check response policy decision & its frame.
DALI_TEST_CHECK(gResponsePolicyDecisionInstance != 0);
[]( const std::string& arg ) {
}
);
+ view.SetTtsFocus(true);
DALI_TEST_CHECK( view );
* @endcode
*/
INPUT_FILTER,
+
+ /**
+ * @brief Whether we should show the ellipsis if required.
+ * @details Name "ellipsis", type Property::BOOLEAN.
+ */
+ ELLIPSIS,
+
+ /**
+ * @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
+ * @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
+ * @note Default is EllipsisPosition::END.
+ * @see DevelText::EllipsisPosition
+ */
+ ELLIPSIS_POSITION,
};
} // namespace Property
* @endcode
*/
INPUT_FILTER,
+
+ /**
+ * @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
+ * @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
+ * @note Default is EllipsisPosition::END.
+ * @see DevelText::EllipsisPosition
+ */
+ ELLIPSIS_POSITION,
};
} // namespace Property
*/
FONT_SIZE_SCALE,
+ /**
+ * @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
+ * @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
+ * @note Default is EllipsisPosition::END.
+ * @see DevelText::EllipsisPosition
+ */
+ ELLIPSIS_POSITION,
};
} // namespace Property
Dali::Toolkit::GetImpl(*this).GoBack();
}
-void WebView::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
+void WebView::EvaluateJavaScript(const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler)
{
Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, resultHandler);
}
Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, nullptr);
}
-void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
+void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler)
{
Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
}
Dali::Toolkit::GetImpl(*this).RegisterGeolocationPermissionCallback(callback);
}
-WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
+void WebView::SetTtsFocus(bool focused)
{
- return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
+ Dali::Toolkit::GetImpl(*this).SetTtsFocus(focused);
}
-WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
+void WebView::RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).PageLoadInProgressSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterPageLoadStartedCallback(callback);
}
-WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
+void WebView::RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).PageLoadFinishedSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterPageLoadInProgressCallback(callback);
}
-WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
+void WebView::RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).PageLoadErrorSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterPageLoadFinishedCallback(callback);
}
-WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
+void WebView::RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).ScrollEdgeReachedSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterPageLoadErrorCallback(callback);
}
-WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
+void WebView::RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).UrlChangedSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterScrollEdgeReachedCallback(callback);
}
-WebView::WebViewFormRepostDecisionSignalType& WebView::FormRepostDecisionSignal()
+void WebView::RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).FormRepostDecisionSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterUrlChangedCallback(callback);
}
-WebView::WebViewFrameRenderedSignalType& WebView::FrameRenderedSignal()
+void WebView::RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).FrameRenderedSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterFormRepostDecidedCallback(callback);
}
-WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
+void WebView::RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).RequestInterceptorSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterFrameRenderedCallback(callback);
}
-WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
+void WebView::RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).ConsoleMessageSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterRequestInterceptorCallback(callback);
}
-WebView::WebViewResponsePolicyDecisionSignalType& WebView::ResponsePolicyDecisionSignal()
+void WebView::RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).ResponsePolicyDecisionSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterConsoleMessageReceivedCallback(callback);
}
-WebView::WebViewCertificateSignalType& WebView::CertificateConfirmSignal()
+void WebView::RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).CertificateConfirmSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterResponsePolicyDecidedCallback(callback);
}
-WebView::WebViewCertificateSignalType& WebView::SslCertificateChangedSignal()
+void WebView::RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).SslCertificateChangedSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterCertificateConfirmedCallback(callback);
}
-WebView::WebViewHttpAuthHandlerSignalType& WebView::HttpAuthHandlerSignal()
+void WebView::RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).HttpAuthHandlerSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterSslCertificateChangedCallback(callback);
}
-WebView::WebViewContextMenuShownSignalType& WebView::ContextMenuShownSignal()
+void WebView::RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).ContextMenuShownSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterHttpAuthHandlerCallback(callback);
}
-WebView::WebViewContextMenuHiddenSignalType& WebView::ContextMenuHiddenSignal()
+void WebView::RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback)
{
- return Dali::Toolkit::GetImpl(*this).ContextMenuHiddenSignal();
+ Dali::Toolkit::GetImpl(*this).RegisterContextMenuShownCallback(callback);
+}
+
+void WebView::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback)
+{
+ Dali::Toolkit::GetImpl(*this).RegisterContextMenuHiddenCallback(callback);
}
WebView::WebView(Internal::WebView& implementation)
class ImageView;
class WebBackForwardList;
class WebContext;
-class WebContextMenu;
class WebCookieManager;
-class WebFormRepostDecision;
class WebSettings;
namespace Internal DALI_INTERNAL
/**
* @brief Whether video hole is enabled or not.
* @details name "videoHoleEnabled", type Property::BOOLEAN.
- * @note The value is read-only.
+ * @note False by default.
*/
VIDEO_HOLE_ENABLED,
*/
using WebViewScreenshotCapturedCallback = std::function<void(Dali::Toolkit::ImageView)>;
- /**
- * @brief WebView signal type related with page loading.
- */
- using WebViewPageLoadSignalType = Signal<void(WebView, const std::string&)>;
-
- /**
- * @brief WebView signal type related with page loading error.
- */
- using WebViewPageLoadErrorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineLoadError>)>;
-
- /**
- * @brief WebView signal type related with scroll edge reached.
- */
- using WebViewScrollEdgeReachedSignalType = Signal<void(WebView, Dali::WebEnginePlugin::ScrollEdge)>;
-
- /**
- * @brief WebView signal type related with url changed.
- */
- using WebViewUrlChangedSignalType = Signal<void(WebView, const std::string&)>;
-
- /**
- * @brief WebView signal type related with form repost decision.
- */
- using WebViewFormRepostDecisionSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineFormRepostDecision>)>;
-
- /**
- * @brief WebView signal type related with frame rendered.
- */
- using WebViewFrameRenderedSignalType = Signal<void(WebView)>;
-
- /**
- * @brief WebView signal type related with http request interceptor.
- */
- using WebViewRequestInterceptorSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineRequestInterceptor>)>;
-
- /**
- * @brief WebView signal type related with console message.
- */
- using WebViewConsoleMessageSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineConsoleMessage>)>;
-
- /**
- * @brief WebView signal type related with response policy decision.
- */
- using WebViewResponsePolicyDecisionSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEnginePolicyDecision>)>;
-
- /**
- * @brief WebView signal type related with certificate changed.
- */
- using WebViewCertificateSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineCertificate>)>;
-
- /**
- * @brief WebView signal type related with http authentication.
- */
- using WebViewHttpAuthHandlerSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineHttpAuthHandler>)>;
-
- /**
- * @brief WebView signal type related with context menu shown.
- */
- using WebViewContextMenuShownSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineContextMenu>)>;
-
- /**
- * @brief WebView signal type related with context menu hidden.
- */
- using WebViewContextMenuHiddenSignalType = Signal<void(WebView, std::shared_ptr<Dali::WebEngineContextMenu>)>;
-
public:
/**
* @brief Create an initialized WebView.
* @brief Evaluate JavaScript code represented as a string.
*
* @param[in] script The JavaScript code
- * @param[in] resultHandler The callback function to be called by the JavaScript runtime. This carries evaluation result
+ * @param[in] resultHandler The callback to be called by the JavaScript runtime. This carries evaluation result
*/
- void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
+ void EvaluateJavaScript(const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler);
/**
* @brief Evaluate JavaScript code represented as a string.
* @param[in] exposedObjectName The name of exposed object
* @param[in] handler The callback function
*/
- void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
+ void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler);
/**
* @brief Register alert callback for javascript.
void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
/**
- * @brief Connect to this signal to be notified when page loading is started.
+ * @brief Set or unset TTS focus of the webview.
+ * @param[in] focused True if it is gained, false lost.
+ * @note It only works when the webview does not have keyinput focus. If it has keyinput focus, the TTS focus is set automatically.
+ */
+ void SetTtsFocus(bool focused);
+
+ /**
+ * @brief Callback to be called when page loading is started.
*
- * @return A signal object to connect with
+ * @param[in] callback
*/
- WebViewPageLoadSignalType& PageLoadStartedSignal();
+ void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
/**
- * @brief Connect to this signal to be notified when page loading is in progress.
+ * @brief Callback to be called when page loading is in progress.
*
- * @return A signal object to connect with
+ * @param[in] callback
*/
- WebViewPageLoadSignalType& PageLoadInProgressSignal();
+ void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
/**
- * @brief Connect to this signal to be notified when page loading is finished.
+ * @brief Callback to be called when page loading is finished.
*
- * @return A signal object to connect with
+ * @param[in] callback
*/
- WebViewPageLoadSignalType& PageLoadFinishedSignal();
+ void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
/**
- * @brief Connect to this signal to be notified when an error occurs in page loading.
+ * @brief Callback to be called when an error occurs in page loading.
*
- * @return A signal object to connect with
+ * @param[in] callback
*/
- WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
+ void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback);
/**
- * @brief Connect to this signal to be notified when scroll edge is reached.
+ * @brief Callback to be called when scroll edge is reached.
*
- * @return A signal object to connect with
+ * @param[in] callback
*/
- WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+ void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback);
/**
- * @brief Connect to this signal to be notified when url is changed.
+ * @brief Callback to be called when url is changed.
*
- * @return A signal object to connect with
+ * @param[in] callback
*/
- WebViewUrlChangedSignalType& UrlChangedSignal();
+ void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback);
/**
- * @brief Connect to this signal to be notified when form repost decision is requested.
+ * @brief Callback to be called when form repost decision is requested.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewFormRepostDecisionSignalType& FormRepostDecisionSignal();
+ void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback);
/**
- * @brief Connect to this signal to be notified when frame is rendered.
+ * @brief Callback to be called when frame is rendered.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewFrameRenderedSignalType& FrameRenderedSignal();
+ void RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback);
/**
- * @brief Connect to this signal to be notified when http request need be intercepted.
+ * @brief Callback to be called when http request need be intercepted.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
+ void RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback);
/**
- * @brief Connect to this signal to be notified when console message will be logged.
+ * @brief Callback to be called when console message will be logged.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewConsoleMessageSignalType& ConsoleMessageSignal();
+ void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback);
/**
- * @brief Connect to this signal to be notified when response policy would be decided.
+ * @brief Callback to be called when response policy would be decided.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewResponsePolicyDecisionSignalType& ResponsePolicyDecisionSignal();
+ void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback);
/**
- * @brief Connect to this signal to be notified when certificate need be confirmed.
+ * @brief Callback to be called when certificate need be confirmed.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewCertificateSignalType& CertificateConfirmSignal();
+ void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
/**
- * @brief Connect to this signal to be notified when ssl certificate is changed.
+ * @brief Callback to be called when ssl certificate is changed.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewCertificateSignalType& SslCertificateChangedSignal();
+ void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
/**
- * @brief Connect to this signal to be notified when http authentication need be confirmed.
+ * @brief Callback to be called when http authentication need be confirmed.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+ void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback);
/**
- * @brief Connect to this signal to be notified when context menu would be shown.
+ * @brief Callback to be called when context menu would be shown.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewContextMenuShownSignalType& ContextMenuShownSignal();
+ void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback);
/**
- * @brief Connect to this signal to be notified when context menu would be hidden.
+ * @brief Callback to be called when context menu would be hidden.
*
- * @return A signal object to connect with.
+ * @param[in] callback
*/
- WebViewContextMenuHiddenSignalType& ContextMenuHiddenSignal();
+ void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
public: // Not intended for application developers
/// @cond internal
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
return GetImpl(keyboardFocusManager).IsFocusIndicatorEnabled();
}
+void EnableDefaultAlgorithm(KeyboardFocusManager keyboardFocusManager, bool enable)
+{
+ GetImpl(keyboardFocusManager).EnableDefaultAlgorithm(enable);
+}
+
+bool IsDefaultAlgorithmEnabled(KeyboardFocusManager keyboardFocusManager)
+{
+ return GetImpl(keyboardFocusManager).IsDefaultAlgorithmEnabled();
+}
+
} // namespace DevelKeyboardFocusManager
} // namespace Toolkit
#define DALI_TOOLKIT_KEYBOARD_FOCUS_MANAGER_DEVEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
*/
DALI_TOOLKIT_API bool IsFocusIndicatorEnabled(KeyboardFocusManager keyboardFocusManager);
+/**
+ * @brief Decide using default focus algorithm or not
+ *
+ * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
+ * @param[in] enable Whether using default focus algorithm or not
+ */
+DALI_TOOLKIT_API void EnableDefaultAlgorithm(KeyboardFocusManager keyboardFocusManager, bool enable);
+
+/**
+ * @brief Check default focus algorithm is enabled or not
+ *
+ * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
+ * @return True when default focus algorithm is enabled
+ */
+DALI_TOOLKIT_API bool IsDefaultAlgorithmEnabled(KeyboardFocusManager keyboardFocusManager);
+
} // namespace DevelKeyboardFocusManager
} // namespace Toolkit
CONTENTS // The text layout direction is determined by the text itself.
};
+/**
+ * @brief Contains types which specify where the text is truncated and replaced by Ellipsis glyph.
+ *
+ * If the text cannot fit into layout size then truncate text and replace it by Ellipsis glyph.
+ *
+ * Ellipsis works after layouting text normally according to LineWrap mode.
+ *
+ * Ellipsis glyph is three dots "...".
+ *
+ * The Ellipsis property should be enabled.
+ *
+ *
+ * Example: "Hello here is test goodbye."
+ *
+ * Assume LineWrap is CHARACTER.
+ *
+ * EllipsisPosition::END type in single line, truncate tail of line then add Ellipsis:
+ * @code
+ * +-----------+
+ * |Hello he...|
+ * +-----------+
+ * @endcode
+ *
+ * EllipsisPosition::END type in multi-lines, truncate tail of the last appeared line then add Ellipsis:
+ * @code
+ * +-----------+
+ * |Hello here |
+ * |is test ...|
+ * +-----------+
+ * @endcode
+ *
+ * EllipsisPosition::START type in single line, truncate head of line then add Ellipsis:
+ * @code
+ * +-----------+
+ * |...goodbye.|
+ * +-----------+
+ * @endcode
+ *
+ * EllipsisPosition::START type in multi-lines, truncate head of the first appeared line then add Ellipsis:
+ * @code
+ * +-----------+
+ * |...test goo|
+ * |dbye. |
+ * +-----------+
+ * @endcode
+ *
+ * EllipsisPosition::MIDDLE type in single line, truncate middle of line then add Ellipsis:
+ * @code
+ * +-----------+
+ * |Hell...bye.|
+ * +-----------+
+ * @endcode
+ *
+ * EllipsisPosition::MIDDLE type in multi-lines, truncate middle lines. In the end of the last appeared line before removed lines add Ellipsis:
+ * @code
+ * +-----------+
+ * |Hello he...|
+ * |dbye. |
+ * +-----------+
+ * @endcode
+ *
+ */
+namespace EllipsisPosition
+{
+/**
+ * @brief Enumerations specifying where to position the ellipsis glyph.
+ * @see EllipsisPosition
+ */
+enum Type
+{
+ END = 0, ///< END position will truncate tail of text that exceeds the layout size then replace it by Ellipsis glyph in the end of the last appeared line.
+ START, ///< START position will truncate head of text that exceeds the layout size then replace it by Ellipsis glyph in the start of the first appeared line. In multilines, the lines are removed from top until the text fit into layout height.
+ MIDDLE ///< MIDDLE position will truncate middle of text that exceeds the layout size then replace it by Ellipsis glyph in the middle of line. In multilines, the lines are removed from middle until the text fit into layout height then add ellipsis glyph in the end of the last line appeared before removed lines.
+};
+
+} // namespace EllipsisPosition
+
} // namespace DevelText
} // namespace Toolkit
const bool isTextMirrored = internalDataModel.isTextMirrored;
const Vector<Character>& mirroredUtf32Characters = internalDataModel.mirroredUtf32Characters;
const Length numberOfCharacters = internalDataModel.numberOfCharacters;
+ const auto ellipsisPosition = textModel->mEllipsisPosition;
Layout::Type layout = Layout::SINGLELINE;
layoutEngine.LayoutText(layoutParameters,
newLayoutSize,
textParameters.ellipsisEnabled,
- isAutoScrollEnabled);
+ isAutoScrollEnabled,
+ ellipsisPosition);
return newLayoutSize;
}
mNativeTexture = Dali::Texture::New(*nativeImageSourcePtr);
Dali::Geometry geometry = VisualFactoryCache::CreateQuadGeometry();
- Dali::Shader shader = CreateShader(nativeImageSourcePtr->GetCustomFragmentPrefix());
+ Dali::Shader shader = CreateShader(nativeImageSourcePtr);
Dali::TextureSet textureSet = Dali::TextureSet::New();
textureSet.SetTexture(0u, mNativeTexture);
mCameraPlayer.SetDisplayArea(mDisplayArea);
}
-Dali::Shader CameraView::CreateShader(const char* fragmentPrefix)
+Dali::Shader CameraView::CreateShader(Dali::NativeImageSourcePtr nativeImageSourcePtr)
{
- std::string fragmentShader = fragmentPrefix;
- std::string vertexShader;
+ std::string vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
+ std::string fragmentShader = SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
- vertexShader = SHADER_VIDEO_VIEW_TEXTURE_VERT.data();
- fragmentShader += SHADER_VIDEO_VIEW_TEXTURE_FRAG.data();
+ nativeImageSourcePtr->ApplyNativeFragmentShader(fragmentShader);
return Dali::Shader::New(vertexShader, fragmentShader);
}
/**
* @brief CreateShader for native image target
- * @param[in] fragmentPrefix prefix of fragment
+ * @param[in] nativeImageSourcePtr to apply custom fragment prefix
* @return Returns the shader for NativeImage.
*/
- Dali::Shader CreateShader(const char* fragmentPrefix);
+ Dali::Shader CreateShader(Dali::NativeImageSourcePtr nativeImageSourcePtr);
private:
Dali::CameraPlayer mCameraPlayer;
Vector4 mixColor(1.0f, 1.0f, 1.0f, 1.0f);
Vector4 cornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
+ float borderlineWidth(0.0f);
+ Vector4 borderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
+ float borderlineOffset(0.0f);
if(!destinationMap.Empty())
{
- static auto findValue = [](const Property::Map& map, Property::Index index) -> Vector4 {
+ static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
Property::Value* propertyValue = map.Find(index);
if(propertyValue)
{
return propertyValue->Get<Vector4>();
}
- return Vector4{};
+ return defaultValue;
};
- mixColor = findValue(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- cornerRadius = findValue(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
+ Property::Value* propertyValue = map.Find(index);
+ if(propertyValue)
+ {
+ return propertyValue->Get<float>();
+ }
+ return defaultValue;
+ };
+
+ mixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, mixColor);
+ cornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
+ borderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
+ borderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
+ borderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
if(sourceMap.Empty())
{
sourceMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
sourceMap.Insert(Dali::Toolkit::Visual::Property::MIX_COLOR, Color::TRANSPARENT);
sourceMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
+ sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
+ sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
+ sourceMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
}
- Vector4 sourceMixColor = findValue(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- Vector4 sourceCornerRadius = findValue(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ Vector4 sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, mixColor);
+ Vector4 sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, cornerRadius);
+ float sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, borderlineWidth);
+ Vector4 sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, borderlineColor);
+ float sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, borderlineOffset);
std::vector<Dali::Property> properties;
std::vector<std::pair<Property::Value, Property::Value>> values;
values.push_back(std::make_pair(sourceCornerRadius, cornerRadius));
}
+ if(sourceBorderlineWidth != borderlineWidth)
+ {
+ properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH));
+ values.push_back(std::make_pair(sourceBorderlineWidth, borderlineWidth));
+ }
+
+ if(sourceBorderlineColor != borderlineColor)
+ {
+ properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR));
+ values.push_back(std::make_pair(sourceBorderlineColor, borderlineColor));
+ }
+
+ if(sourceBorderlineOffset != borderlineOffset)
+ {
+ properties.push_back(GetVisualProperty(visualIndex, Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET));
+ values.push_back(std::make_pair(sourceBorderlineOffset, borderlineOffset));
+ }
+
for(uint32_t i = 0; i < properties.size(); ++i)
{
if(timePeriod.delaySeconds > 0.0f)
destinationVisual.CreatePropertyMap(destinationMap);
- static auto findValue = [](const Property::Map& map, Property::Index index) -> Vector4 {
+ static auto findValueVector4 = [](const Property::Map& map, Property::Index index, const Vector4& defaultValue = Vector4()) -> Vector4 {
Property::Value* propertyValue = map.Find(index);
if(propertyValue)
{
return propertyValue->Get<Vector4>();
}
- return Vector4{};
+ return defaultValue;
+ };
+
+ static auto findValueFloat = [](const Property::Map& map, Property::Index index, const float& defaultValue = 0.0f) -> float {
+ Property::Value* propertyValue = map.Find(index);
+ if(propertyValue)
+ {
+ return propertyValue->Get<float>();
+ }
+ return defaultValue;
};
Vector4 sourceMixColor(0.0f, 0.0f, 0.0f, 0.0f);
Vector4 sourceCornerRadius(0.0f, 0.0f, 0.0f, 0.0f);
- Vector4 destinationMixColor = findValue(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- Vector4 destinationCornerRadius = findValue(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ float sourceBorderlineWidth(0.0f);
+ Vector4 sourceBorderlineColor(0.0f, 0.0f, 0.0f, 1.0f);
+ float sourceBorderlineOffset(0.0f);
+ Vector4 destinationMixColor = findValueVector4(destinationMap, Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
+ Vector4 destinationCornerRadius = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
+ float destinationBorderlineWidth = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
+ Vector4 destinationBorderlineColor = findValueVector4(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
+ float destinationBorderlineOffset = findValueFloat(destinationMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
Dali::Toolkit::ImageView sourceHandle = Dali::Toolkit::ImageView::DownCast(source);
Toolkit::Visual::Base sourceVisual;
if(sourceVisual)
{
sourceVisual.CreatePropertyMap(sourceMap);
- sourceMixColor = findValue(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR);
- sourceCornerRadius = findValue(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS);
+ sourceMixColor = findValueVector4(sourceMap, Dali::Toolkit::Visual::Property::MIX_COLOR, sourceMixColor);
+ sourceCornerRadius = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::CORNER_RADIUS, sourceCornerRadius);
+ sourceBorderlineWidth = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, sourceBorderlineWidth);
+ sourceBorderlineColor = findValueVector4(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_COLOR, sourceBorderlineColor);
+ sourceBorderlineOffset = findValueFloat(sourceMap, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, sourceBorderlineOffset);
}
std::vector<Dali::Property> properties;
properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::CORNER_RADIUS));
values.push_back(std::make_pair(sourceCornerRadius, destinationCornerRadius));
}
+ if(sourceBorderlineWidth != destinationBorderlineWidth)
+ {
+ properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_WIDTH));
+ values.push_back(std::make_pair(sourceBorderlineWidth, destinationBorderlineWidth));
+ }
+ if(sourceBorderlineColor != destinationBorderlineColor)
+ {
+ properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_COLOR));
+ values.push_back(std::make_pair(sourceBorderlineColor, destinationBorderlineColor));
+ }
+ if(sourceBorderlineOffset != destinationBorderlineOffset)
+ {
+ properties.push_back(DevelControl::GetVisualProperty(destinationHandle, Toolkit::ImageView::Property::IMAGE, Toolkit::DevelVisual::Property::BORDERLINE_OFFSET));
+ values.push_back(std::make_pair(sourceBorderlineOffset, destinationBorderlineOffset));
+ }
for(uint32_t i = 0; i < properties.size(); ++i)
{
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputMethodSettings", MAP, INPUT_METHOD_SETTINGS )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputFilter", MAP, INPUT_FILTER )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsis", BOOLEAN, ELLIPSIS )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED)
}
break;
}
+ case Toolkit::DevelTextEditor::Property::ELLIPSIS:
+ {
+ const bool ellipsis = value.Get<bool>();
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextEditor %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis);
+
+ impl.mController->SetTextElideEnabled(ellipsis);
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::ELLIPSIS_POSITION:
+ {
+ DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
+ if(GetEllipsisPositionTypeEnumeration(value, ellipsisPositionType))
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextEditor %p EllipsisPosition::Type %d\n", impl.mController.Get(), ellipsisPositionType);
+ impl.mController->SetEllipsisPosition(ellipsisPositionType);
+ }
+ break;
+ }
} // switch
} // texteditor
}
value = map;
break;
}
+ case Toolkit::DevelTextEditor::Property::ELLIPSIS:
+ {
+ value = impl.mController->IsTextElideEnabled();
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::ELLIPSIS_POSITION:
+ {
+ value = impl.mController->GetEllipsisPosition();
+ break;
+ }
} //switch
}
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputFilter", MAP, INPUT_FILTER )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
break;
}
+ case Toolkit::DevelTextField::Property::ELLIPSIS_POSITION:
+ {
+ DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
+ if(GetEllipsisPositionTypeEnumeration(value, ellipsisPositionType))
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p EllipsisPosition::Type %d\n", impl.mController.Get(), ellipsisPositionType);
+ impl.mController->SetEllipsisPosition(ellipsisPositionType);
+ }
+ break;
+ }
} // switch
} // textfield
}
value = map;
break;
}
+ case Toolkit::DevelTextField::Property::ELLIPSIS_POSITION:
+ {
+ value = impl.mController->GetEllipsisPosition();
+ break;
+ }
} //switch
}
#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
+// DEVEL INCLUDES
#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
using namespace Dali::Toolkit::Text;
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "minLineSize", FLOAT, MIN_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT(Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION(Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0)
}
break;
}
+ case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
+ {
+ DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
+ if(GetEllipsisPositionTypeEnumeration(value, ellipsisPositionType))
+ {
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel %p EllipsisPosition::Type %d\n", impl.mController.Get(), ellipsisPositionType);
+ impl.mController->SetEllipsisPosition(ellipsisPositionType);
+ }
+ break;
+ }
}
// Request relayout when text update is needed. It's necessary to call it
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
+ {
+ value = impl.mController->GetEllipsisPosition();
+ break;
+ }
}
}
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/public-api/image-loader/image.h>
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
namespace Dali
{
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "textZoomFactor", FLOAT, TEXT_ZOOM_FACTOR )
DALI_PROPERTY_REGISTRATION(Toolkit, WebView, "loadProgressPercentage", FLOAT, LOAD_PROGRESS_PERCENTAGE )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadStarted", PAGE_LOAD_STARTED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadInProgress", PAGE_LOAD_IN_PROGRESS_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadFinished", PAGE_LOAD_FINISHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "pageLoadError", PAGE_LOAD_ERROR_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "scrollEdgeReached", SCROLL_EDGE_REACHED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "urlChanged", URL_CHANGED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "formRepostDecision", FORM_REPOST_DECISION_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "frameRendered", FRAME_RENDERED_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "requestInterceptor", REQUEST_INTERCEPTOR_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "consoleMessage", CONSOLE_MESSAGE_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "responsePolicyDecided", POLICY_DECISION )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "certificateConfirm", CERTIFICATE_CONFIRM_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "sslCertificateChanged", SSL_CERTIFICATE_CHANGED_SIGNAL)
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "httpAuthRequest", HTTP_AUTH_REQUEST_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "contextMenuShown", CONTEXT_MENU_SHOWN_SIGNAL )
-DALI_SIGNAL_REGISTRATION(Toolkit, WebView, "contextMenuHidden", CONTEXT_MENU_HIDDEN_SIGNAL )
-
DALI_TYPE_REGISTRATION_END()
// clang-format on
mVisual(),
mWebViewSize(Stage::GetCurrent().GetSize()),
mWebEngine(),
- mPageLoadStartedSignal(),
- mPageLoadFinishedSignal(),
- mPageLoadErrorSignal(),
- mUrlChangedSignal(),
mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
- mVideoHoleEnabled(true),
+ mVideoHoleEnabled(false),
mMouseEventsEnabled(true),
mKeyEventsEnabled(true),
mScreenshotCapturedCallback(nullptr)
mVisual(),
mWebViewSize(Stage::GetCurrent().GetSize()),
mWebEngine(),
- mPageLoadStartedSignal(),
- mPageLoadFinishedSignal(),
- mPageLoadErrorSignal(),
- mUrlChangedSignal(),
mWebViewArea(0, 0, mWebViewSize.width, mWebViewSize.height),
- mVideoHoleEnabled(true),
+ mVideoHoleEnabled(false),
mMouseEventsEnabled(true),
mKeyEventsEnabled(true),
mScreenshotCapturedCallback(nullptr)
{
if(mWebEngine)
{
+ mWebEngine.FrameRenderedSignal().Disconnect(this, &WebView::OnFrameRendered);
mWebEngine.Destroy();
}
}
if(mWebEngine)
{
- mWebEngine.PageLoadStartedSignal().Connect(this, &WebView::OnPageLoadStarted);
- mWebEngine.PageLoadInProgressSignal().Connect(this, &WebView::OnPageLoadInProgress);
- mWebEngine.PageLoadFinishedSignal().Connect(this, &WebView::OnPageLoadFinished);
- mWebEngine.PageLoadErrorSignal().Connect(this, &WebView::OnPageLoadError);
- mWebEngine.ScrollEdgeReachedSignal().Connect(this, &WebView::OnScrollEdgeReached);
- mWebEngine.UrlChangedSignal().Connect(this, &WebView::OnUrlChanged);
- mWebEngine.FormRepostDecisionSignal().Connect(this, &WebView::OnFormRepostDecision);
mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
- mWebEngine.RequestInterceptorSignal().Connect(this, &WebView::OnInterceptRequest);
- mWebEngine.ConsoleMessageSignal().Connect(this, &WebView::OnConsoleMessage);
- mWebEngine.ResponsePolicyDecisionSignal().Connect(this, &WebView::OnResponsePolicyDecided);
- mWebEngine.CertificateConfirmSignal().Connect(this, &WebView::OnCertificateConfirm);
- mWebEngine.SslCertificateChangedSignal().Connect(this, &WebView::OnSslCertificateChanged);
- mWebEngine.HttpAuthHandlerSignal().Connect(this, &WebView::OnHttpAuthenticationRequest);
- mWebEngine.ContextMenuShownSignal().Connect(this, &WebView::OnContextMenuShown);
- mWebEngine.ContextMenuHiddenSignal().Connect(this, &WebView::OnContextMenuHidden);
-
mWebContext = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
mWebSettings = std::unique_ptr<Dali::Toolkit::WebSettings>(new WebSettings(mWebEngine.GetSettings()));
}
}
+void WebView::SetTtsFocus(bool focused)
+{
+ if(mWebEngine && !HasKeyInputFocus())
+ {
+ mWebEngine.SetFocus(focused);
+ }
+}
+
void WebView::UpdateDisplayArea(Dali::PropertyNotification& /*source*/)
{
if(!mWebEngine)
return Dali::Toolkit::ImageView();
}
- std::string url = Dali::Toolkit::Image::GenerateUrl(pixel);
- Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url);
+ Dali::Toolkit::ImageUrl url = Dali::Toolkit::Image::GenerateUrl(pixel);
+ Dali::Toolkit::ImageView imageView = Dali::Toolkit::ImageView::New(url.GetUrl());
imageView.SetProperty(Dali::Actor::Property::SIZE, Vector2(pixel.GetWidth(), pixel.GetHeight()));
return imageView;
}
-Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
-{
- return mPageLoadStartedSignal;
-}
-
-Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadInProgressSignal()
-{
- return mPageLoadInProgressSignal;
-}
-
-Dali::Toolkit::WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
+void WebView::RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return mPageLoadFinishedSignal;
-}
-
-Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
-{
- return mPageLoadErrorSignal;
-}
-
-Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
-{
- return mScrollEdgeReachedSignal;
-}
-
-Dali::Toolkit::WebView::WebViewUrlChangedSignalType& WebView::UrlChangedSignal()
-{
- return mUrlChangedSignal;
-}
-
-Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType& WebView::FormRepostDecisionSignal()
-{
- return mFormRepostDecisionSignal;
-}
-
-Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& WebView::FrameRenderedSignal()
-{
- return mFrameRenderedSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterPageLoadStartedCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& WebView::RequestInterceptorSignal()
+void WebView::RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return mRequestInterceptorSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterPageLoadInProgressCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& WebView::ConsoleMessageSignal()
+void WebView::RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback)
{
- return mConsoleMessageSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterPageLoadFinishedCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewResponsePolicyDecisionSignalType& WebView::ResponsePolicyDecisionSignal()
+void WebView::RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback)
{
- return mResponsePolicyDecisionSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterPageLoadErrorCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewCertificateSignalType& WebView::CertificateConfirmSignal()
+void WebView::RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback)
{
- return mCertificateConfirmSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterScrollEdgeReachedCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewCertificateSignalType& WebView::SslCertificateChangedSignal()
+void WebView::RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback)
{
- return mSslCertificateChangedSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterUrlChangedCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType& WebView::HttpAuthHandlerSignal()
+void WebView::RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback)
{
- return mHttpAuthHandlerSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterFormRepostDecidedCallback(callback);
+ }
}
-Dali::Toolkit::WebView::WebViewContextMenuShownSignalType& WebView::ContextMenuShownSignal()
+void WebView::RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback)
{
- return mContextMenuShownSignal;
+ mFrameRenderedCallback = callback;
}
-Dali::Toolkit::WebView::WebViewContextMenuHiddenSignalType& WebView::ContextMenuHiddenSignal()
+void WebView::RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback)
{
- return mContextMenuHiddenSignal;
+ if(mWebEngine)
+ {
+ mWebEngine.RegisterRequestInterceptorCallback(callback);
+ }
}
-void WebView::OnPageLoadStarted(const std::string& url)
+void WebView::RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback)
{
- if(!mPageLoadStartedSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mPageLoadStartedSignal.Emit(handle, url);
+ mWebEngine.RegisterConsoleMessageReceivedCallback(callback);
}
}
-void WebView::OnPageLoadInProgress(const std::string& url)
+void WebView::RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback)
{
- if(!mPageLoadInProgressSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mPageLoadInProgressSignal.Emit(handle, url);
+ mWebEngine.RegisterResponsePolicyDecidedCallback(callback);
}
}
-void WebView::OnPageLoadFinished(const std::string& url)
+void WebView::RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- if(!mPageLoadFinishedSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mPageLoadFinishedSignal.Emit(handle, url);
+ mWebEngine.RegisterCertificateConfirmedCallback(callback);
}
}
-void WebView::OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error)
+void WebView::RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback)
{
- if(!mPageLoadErrorSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mPageLoadErrorSignal.Emit(handle, std::move(error));
+ mWebEngine.RegisterSslCertificateChangedCallback(callback);
}
}
-void WebView::OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge)
+void WebView::RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback)
{
- if(!mScrollEdgeReachedSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mScrollEdgeReachedSignal.Emit(handle, edge);
+ mWebEngine.RegisterHttpAuthHandlerCallback(callback);
}
}
-void WebView::OnUrlChanged(const std::string& url)
+void WebView::RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback)
{
- if(!mUrlChangedSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mUrlChangedSignal.Emit(handle, url);
+ mWebEngine.RegisterContextMenuShownCallback(callback);
}
}
-void WebView::OnFormRepostDecision(std::shared_ptr<Dali::WebEngineFormRepostDecision> decision)
+void WebView::RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback)
{
- if(!mFormRepostDecisionSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mFormRepostDecisionSignal.Emit(handle, std::move(decision));
+ mWebEngine.RegisterContextMenuHiddenCallback(callback);
}
}
void WebView::OnFrameRendered()
{
- if(!mFrameRenderedSignal.Empty())
+ if(mFrameRenderedCallback)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mFrameRenderedSignal.Emit(handle);
+ mFrameRenderedCallback();
}
}
}
}
-void WebView::OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
+void WebView::OnSceneConnection(int depth)
{
- if(!mRequestInterceptorSignal.Empty())
- {
- Dali::Toolkit::WebView handle(GetOwner());
- mRequestInterceptorSignal.Emit(handle, std::move(interceptor));
- }
+ Control::OnSceneConnection(depth);
+ EnableBlendMode(!mVideoHoleEnabled);
}
-void WebView::OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message)
+bool WebView::OnTouchEvent(Actor actor, const Dali::TouchEvent& touch)
{
- if(!mConsoleMessageSignal.Empty())
- {
- Dali::Toolkit::WebView handle(GetOwner());
- mConsoleMessageSignal.Emit(handle, std::move(message));
- }
-}
+ bool result = false;
-void WebView::OnResponsePolicyDecided(std::shared_ptr<Dali::WebEnginePolicyDecision> decision)
-{
- if(!mResponsePolicyDecisionSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mResponsePolicyDecisionSignal.Emit(handle, std::move(decision));
+ result = mWebEngine.SendTouchEvent(touch);
}
+ return result;
}
-void WebView::OnCertificateConfirm(std::shared_ptr<Dali::WebEngineCertificate> certificate)
+bool WebView::OnKeyEvent(const Dali::KeyEvent& event)
{
- if(!mCertificateConfirmSignal.Empty())
- {
- Dali::Toolkit::WebView handle(GetOwner());
- mCertificateConfirmSignal.Emit(handle, std::move(certificate));
- }
-}
+ bool result = false;
-void WebView::OnSslCertificateChanged(std::shared_ptr<Dali::WebEngineCertificate> certificate)
-{
- if(!mSslCertificateChangedSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mSslCertificateChangedSignal.Emit(handle, std::move(certificate));
+ result = mWebEngine.SendKeyEvent(event);
}
+ return result;
}
-void WebView::OnHttpAuthenticationRequest(std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler)
+bool WebView::OnHoverEvent(Actor actor, const Dali::HoverEvent& hover)
{
- if(!mHttpAuthHandlerSignal.Empty())
+ bool result = false;
+ if(mWebEngine && mMouseEventsEnabled)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mHttpAuthHandlerSignal.Emit(handle, std::move(handler));
+ result = mWebEngine.SendHoverEvent(hover);
}
+ return result;
}
-void WebView::OnContextMenuShown(std::shared_ptr<Dali::WebEngineContextMenu> menu)
+bool WebView::OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
{
- if(!mContextMenuShownSignal.Empty())
+ bool result = false;
+ if(mWebEngine && mMouseEventsEnabled)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mContextMenuShownSignal.Emit(handle, std::move(menu));
+ result = mWebEngine.SendWheelEvent(wheel);
}
+ return result;
}
-void WebView::OnContextMenuHidden(std::shared_ptr<Dali::WebEngineContextMenu> menu)
+void WebView::OnKeyInputFocusGained()
{
- if(!mContextMenuHiddenSignal.Empty())
+ if(mWebEngine)
{
- Dali::Toolkit::WebView handle(GetOwner());
- mContextMenuHiddenSignal.Emit(handle, std::move(menu));
+ mWebEngine.SetFocus(true);
}
+
+ EmitKeyInputFocusSignal(true); // Calls back into the Control hence done last.
}
-bool WebView::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
+void WebView::OnKeyInputFocusLost()
{
- Dali::BaseHandle handle(object);
-
- bool connected = false;
- Toolkit::WebView webView = Toolkit::WebView::DownCast(handle);
-
- if(0 == strcmp(signalName.c_str(), PAGE_LOAD_STARTED_SIGNAL))
- {
- webView.PageLoadStartedSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_IN_PROGRESS_SIGNAL))
- {
- webView.PageLoadInProgressSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_FINISHED_SIGNAL))
- {
- webView.PageLoadFinishedSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), PAGE_LOAD_ERROR_SIGNAL))
- {
- webView.PageLoadErrorSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), SCROLL_EDGE_REACHED_SIGNAL))
- {
- webView.ScrollEdgeReachedSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), URL_CHANGED_SIGNAL))
- {
- webView.UrlChangedSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), FORM_REPOST_DECISION_SIGNAL))
- {
- webView.FormRepostDecisionSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), FRAME_RENDERED_SIGNAL))
- {
- webView.FrameRenderedSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), REQUEST_INTERCEPTOR_SIGNAL))
- {
- webView.RequestInterceptorSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), CONSOLE_MESSAGE_SIGNAL))
- {
- webView.ConsoleMessageSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), POLICY_DECISION))
- {
- webView.ResponsePolicyDecisionSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), CERTIFICATE_CONFIRM_SIGNAL))
- {
- webView.CertificateConfirmSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), SSL_CERTIFICATE_CHANGED_SIGNAL))
- {
- webView.SslCertificateChangedSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), HTTP_AUTH_REQUEST_SIGNAL))
- {
- webView.HttpAuthHandlerSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), CONTEXT_MENU_SHOWN_SIGNAL))
- {
- webView.ContextMenuShownSignal().Connect(tracker, functor);
- connected = true;
- }
- else if(0 == strcmp(signalName.c_str(), CONTEXT_MENU_HIDDEN_SIGNAL))
+ if(mWebEngine)
{
- webView.ContextMenuHiddenSignal().Connect(tracker, functor);
- connected = true;
+ mWebEngine.SetFocus(false);
}
- return connected;
+ EmitKeyInputFocusSignal(false); // Calls back into the Control hence done last.
}
Vector3 WebView::GetNaturalSize()
return Vector3(mWebViewSize);
}
-void WebView::OnSceneConnection(int depth)
-{
- Control::OnSceneConnection(depth);
-
- EnableBlendMode(!mVideoHoleEnabled);
-}
-
void WebView::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value)
{
Toolkit::WebView webView = Toolkit::WebView::DownCast(Dali::BaseHandle(object));
return value;
}
-bool WebView::OnTouchEvent(Actor actor, const Dali::TouchEvent& touch)
-{
- bool result = false;
-
- if(mWebEngine)
- {
- result = mWebEngine.SendTouchEvent(touch);
- }
- return result;
-}
-
-bool WebView::OnKeyEvent(const Dali::KeyEvent& event)
-{
- bool result = false;
-
- if(mWebEngine)
- {
- result = mWebEngine.SendKeyEvent(event);
- }
- return result;
-}
-
-bool WebView::OnHoverEvent(Actor actor, const Dali::HoverEvent& hover)
-{
- bool result = false;
- if(mWebEngine && mMouseEventsEnabled)
- {
- result = mWebEngine.SendHoverEvent(hover);
- }
- return result;
-}
-
-bool WebView::OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
-{
- bool result = false;
- if(mWebEngine && mMouseEventsEnabled)
- {
- result = mWebEngine.SendWheelEvent(wheel);
- }
- return result;
-}
-
-void WebView::OnKeyInputFocusGained()
-{
- if(mWebEngine)
- {
- mWebEngine.SetFocus(true);
- }
-
- EmitKeyInputFocusSignal(true); // Calls back into the Control hence done last.
-}
-
-void WebView::OnKeyInputFocusLost()
-{
- if(mWebEngine)
- {
- mWebEngine.SetFocus(false);
- }
-
- EmitKeyInputFocusSignal(false); // Calls back into the Control hence done last.
-}
-
void WebView::SetScrollPosition(int32_t x, int32_t y)
{
if(mWebEngine)
/**
* @copydoc Dali::Toolkit::WebView::EvaluateJavaScript()
*/
- void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
+ void EvaluateJavaScript(const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler);
/**
* @copydoc Dali::Toolkit::WebView::AddJavaScriptMessageHandler()
*/
- void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
+ void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler);
/**
* @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback()
void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
+ * @copydoc Dali::Toolkit::WebView::SetTtsFocus()
*/
- Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
+ void SetTtsFocus(bool focused);
/**
- * @copydoc Dali::Toolkit::WebView::PageLoadInProgressSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterPageLoadStartedCallback()
*/
- Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadInProgressSignal();
+ void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterPageLoadInProgressCallback()
*/
- Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadFinishedSignal();
+ void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::PageLoadErrorSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterPageLoadFinishedCallback()
*/
- Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
+ void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::ScrollEdgeReachedSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterPageLoadErrorCallback()
*/
- Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
+ void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::UrlChangedSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterScrollEdgeReachedCallback()
*/
- Dali::Toolkit::WebView::WebViewUrlChangedSignalType& UrlChangedSignal();
+ void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::FormRepostDecisionSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterUrlChangedCallback()
*/
- Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType& FormRepostDecisionSignal();
+ void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::FrameRenderedSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterFormRepostDecidedCallback()
*/
- Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& FrameRenderedSignal();
+ void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::RequestInterceptorSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterFrameRenderedCallback()
*/
- Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
+ void RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::ConsoleMessageSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterRequestInterceptorCallback()
*/
- Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& ConsoleMessageSignal();
+ void RegisterRequestInterceptorCallback(Dali::WebEnginePlugin::WebEngineRequestInterceptorCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::ResponsePolicyDecisionSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterConsoleMessageReceivedCallback()
*/
- Dali::Toolkit::WebView::WebViewResponsePolicyDecisionSignalType& ResponsePolicyDecisionSignal();
+ void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::CertificateConfirmSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterResponsePolicyDecidedCallback()
*/
- Dali::Toolkit::WebView::WebViewCertificateSignalType& CertificateConfirmSignal();
+ void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::SslCertificateChangedSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterCertificateConfirmedCallback()
*/
- Dali::Toolkit::WebView::WebViewCertificateSignalType& SslCertificateChangedSignal();
+ void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::HttpAuthHandlerSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterSslCertificateChangedCallback()
*/
- Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
+ void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::ContextMenuShownSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterHttpAuthHandlerCallback()
*/
- Dali::Toolkit::WebView::WebViewContextMenuShownSignalType& ContextMenuShownSignal();
+ void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback);
/**
- * @copydoc Dali::Toolkit::WebView::ContextMenuHiddenSignal()
+ * @copydoc Dali::Toolkit::WebView::RegisterContextMenuShownCallback()
*/
- Dali::Toolkit::WebView::WebViewContextMenuHiddenSignalType& ContextMenuHiddenSignal();
+ void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback);
+
+ /**
+ * @copydoc Dali::Toolkit::WebView::RegisterContextMenuHiddenCallback()
+ */
+ void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
public: // Properties
/**
*/
static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex);
- /**
- * Connects a callback function with the object's signals.
- * @param[in] object The object providing the signal.
- * @param[in] tracker Used to disconnect the signal.
- * @param[in] signalName The signal to connect to.
- * @param[in] functor A newly allocated FunctorDelegate.
- * @return True if the signal was connected.
- * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the c
- */
- static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
-
private: // From Control
/**
* @copydoc Toolkit::Control::OnInitialize()
Dali::Toolkit::ImageView CreateImageView(Dali::PixelData pixel) const;
/**
- * @brief Callback function to be called when page load started.
- * @param[in] url The url currently being loaded
- */
- void OnPageLoadStarted(const std::string& url);
-
- /**
- * @brief Callback function to be called when page is loading in progress.
- * @param[in] url The url currently being loaded
- */
- void OnPageLoadInProgress(const std::string& url);
-
- /**
- * @brief Callback function to be called when page load finished.
- * @param[in] url The url currently being loaded
- */
- void OnPageLoadFinished(const std::string& url);
-
- /**
- * @brief Callback function to be called when there is an error in page loading.
- * @param[in] url The url currently being loaded
- * @param[in] errorCode The error code
- */
- void OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error);
-
- /**
- * @brief Callback function to be called when scroll edge is reached.
- * @param[in] edge The scroll edge reached.
- */
- void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge);
-
- /**
- * @brief Callback function to be called when url is changed.
- * @param[in] url The url currently being loaded
- */
- void OnUrlChanged(const std::string& url);
-
- /**
* @brief Signal occurs when the Web View has been touched.
* @param[in] actor The Actor Touched
* @param[in] touch The Touch Data.
bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel);
/**
- * @brief Callback function to be called when form repost decision need be checked.
- * @param[in] decision The new decision for form repost
- */
- void OnFormRepostDecision(std::shared_ptr<Dali::WebEngineFormRepostDecision> decision);
-
- /**
* @brief Callback function to be called when frame is rendered.
*/
void OnFrameRendered();
*/
void OnScreenshotCaptured(Dali::PixelData pixel);
- /**
- * @brief Callback function to be called when http request need be intercepted.
- * @param [in] request The http request interceptor.
- */
- void OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor);
-
- /**
- * @brief Callback function to be called when console message will be logged.
- * @param[in] message The message logged.
- */
- void OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message);
-
- /**
- * @brief Callback function to be called when response policy need be decided.
- * @param[in] decision The policy decided.
- */
- void OnResponsePolicyDecided(std::shared_ptr<Dali::WebEnginePolicyDecision> decision);
-
- /**
- * @brief Callback function to be called when certificate need be confirmed.
- * @param[in] certificate The certificate policy decision.
- */
- void OnCertificateConfirm(std::shared_ptr<Dali::WebEngineCertificate> certificate);
-
- /**
- * @brief Callback function to be called when ssl certificate is changed.
- * @param[in] certificate The certificate information received.
- */
- void OnSslCertificateChanged(std::shared_ptr<Dali::WebEngineCertificate> certificate);
-
- /**
- * @brief Callback function to be called when http authentication need be confirmed.
- * @param[in] handler The handler for http authentication
- */
- void OnHttpAuthenticationRequest(std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler);
-
- /**
- * @brief Callback function to be called when context menu would be shown.
- * @param[in] e The scroll edge reached.
- */
- void OnContextMenuShown(std::shared_ptr<Dali::WebEngineContextMenu> menu);
-
- /**
- * @brief Callback function to be called when context menu would be hidden.
- * @param[in] url The url currently being loaded
- */
- void OnContextMenuHidden(std::shared_ptr<Dali::WebEngineContextMenu> menu);
-
private:
Dali::Toolkit::Visual::Base mVisual;
Dali::Size mWebViewSize;
Dali::WebEngine mWebEngine;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadStartedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadInProgressSignal;
- Dali::Toolkit::WebView::WebViewPageLoadSignalType mPageLoadFinishedSignal;
- Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType mPageLoadErrorSignal;
- Dali::Toolkit::WebView::WebViewUrlChangedSignalType mUrlChangedSignal;
- Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType mScrollEdgeReachedSignal;
- Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType mFormRepostDecisionSignal;
- Dali::Toolkit::WebView::WebViewFrameRenderedSignalType mFrameRenderedSignal;
- Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType mRequestInterceptorSignal;
- Dali::Toolkit::WebView::WebViewConsoleMessageSignalType mConsoleMessageSignal;
- Dali::Toolkit::WebView::WebViewResponsePolicyDecisionSignalType mResponsePolicyDecisionSignal;
- Dali::Toolkit::WebView::WebViewCertificateSignalType mCertificateConfirmSignal;
- Dali::Toolkit::WebView::WebViewCertificateSignalType mSslCertificateChangedSignal;
- Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType mHttpAuthHandlerSignal;
- Dali::Toolkit::WebView::WebViewContextMenuShownSignalType mContextMenuShownSignal;
- Dali::Toolkit::WebView::WebViewContextMenuHiddenSignalType mContextMenuHiddenSignal;
-
std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
bool mKeyEventsEnabled;
Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
+ Dali::WebEnginePlugin::WebEngineFrameRenderedCallback mFrameRenderedCallback;
};
} // namespace Internal
${toolkit_src_dir}/image-loader/atlas-packer.cpp
${toolkit_src_dir}/image-loader/image-atlas-impl.cpp
${toolkit_src_dir}/image-loader/image-load-thread.cpp
+ ${toolkit_src_dir}/image-loader/image-url-impl.cpp
${toolkit_src_dir}/styling/style-manager-impl.cpp
${toolkit_src_dir}/text/bidirectional-support.cpp
${toolkit_src_dir}/text/character-set-conversion.cpp
mAlwaysShowIndicator(ALWAYS_SHOW),
mFocusGroupLoopEnabled(false),
mIsWaitingKeyboardFocusChangeCommit(false),
- mClearFocusOnTouch(true)
+ mClearFocusOnTouch(true),
+ mEnableDefaultAlgorithm(false)
{
// TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorShown.
nextFocusableActor = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
mIsWaitingKeyboardFocusChangeCommit = false;
}
- else
+ else if(mEnableDefaultAlgorithm)
{
// We should find it among the actors nearby.
nextFocusableActor = Toolkit::FocusFinder::GetNearestFocusableActor(currentFocusActor, direction);
{
// "Tab" key changes the focus group in the forward direction and
// "Shift-Tab" key changes it in the backward direction.
- DoMoveFocusToNextFocusGroup(!event.IsShiftModifier());
+ if(!DoMoveFocusToNextFocusGroup(!event.IsShiftModifier()))
+ {
+ // If the focus group is not changed, Move the focus towards right, "Shift-Tap" key moves the focus towards left.
+ if(!MoveFocus(event.IsShiftModifier() ? Toolkit::Control::KeyboardFocus::LEFT : Toolkit::Control::KeyboardFocus::RIGHT))
+ {
+ // If the focus is not moved, Move the focus towards down, "Shift-Tap" key moves the focus towards up.
+ MoveFocus(event.IsShiftModifier() ? Toolkit::Control::KeyboardFocus::UP : Toolkit::Control::KeyboardFocus::DOWN);
+ }
+ }
}
isFocusStartableKey = true;
return (mEnableFocusIndicator == ENABLE);
}
+void KeyboardFocusManager::EnableDefaultAlgorithm(bool enable)
+{
+ mEnableDefaultAlgorithm = enable;
+}
+
+bool KeyboardFocusManager::IsDefaultAlgorithmEnabled() const
+{
+ return mEnableDefaultAlgorithm;
+}
+
} // namespace Internal
} // namespace Toolkit
*/
bool IsFocusIndicatorEnabled() const;
+ /**
+ * @copydoc Toolkit::DevelKeyboardFocusManager::EnableDefaultAlgorithm
+ */
+ void EnableDefaultAlgorithm(bool enable);
+
+ /**
+ * @copydoc Toolkit::DevelKeyboardFocusManager::IsDefaultAlgorithmEnabled
+ */
+ bool IsDefaultAlgorithmEnabled() const;
+
public:
/**
* @copydoc Toolkit::KeyboardFocusManager::PreFocusChangeSignal()
bool mIsWaitingKeyboardFocusChangeCommit : 1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
bool mClearFocusOnTouch : 1; ///< Whether clear focus on touch.
+
+ bool mEnableDefaultAlgorithm : 1; ///< Whether use default algorithm focus
};
} // namespace Internal
--- /dev/null
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
+#include <dali-toolkit/internal/image-loader/image-url-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+ImageUrl::ImageUrl(Texture& texture)
+: mUrl("")
+{
+ mUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+}
+
+ImageUrl::~ImageUrl()
+{
+ Dali::Toolkit::TextureManager::RemoveTexture(mUrl);
+}
+
+ImageUrlPtr ImageUrl::New(Texture& texture)
+{
+ ImageUrlPtr imageUrlPtr = new ImageUrl(texture);
+ return imageUrlPtr;
+}
+
+const std::string& ImageUrl::GetUrl() const
+{
+ return mUrl;
+}
+
+} // End of namespace Internal
+
+} // End of namespace Toolkit
+
+} // End of namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
+#define DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
+
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+#include <string>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal
+{
+class ImageUrl;
+using ImageUrlPtr = IntrusivePtr<ImageUrl>;
+
+class ImageUrl : public BaseObject
+{
+public:
+ /**
+ * @brief Constructor.
+ */
+ ImageUrl(Texture& texture);
+
+ /**
+ * @copydoc Dali::Toolkit::ImageUrl::New
+ */
+ static ImageUrlPtr New(Texture& texture);
+
+ /**
+ * @copydoc Dali::Toolkit::ImageUrl::GetUrl
+ */
+ const std::string& GetUrl() const;
+
+protected:
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~ImageUrl();
+
+private:
+ // Undefined
+ ImageUrl(const ImageUrl&);
+
+ // Undefined
+ ImageUrl& operator=(const ImageUrl& rhs);
+
+private:
+ std::string mUrl;
+};
+
+} // namespace Internal
+} // namespace Toolkit
+
+// Helpers for public-api forwarding methods
+
+inline Toolkit::Internal::ImageUrl& GetImpl(Dali::Toolkit::ImageUrl& imageUrl)
+{
+ DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
+
+ BaseObject& handle = imageUrl.GetBaseObject();
+
+ return static_cast<Toolkit::Internal::ImageUrl&>(handle);
+}
+
+inline const Toolkit::Internal::ImageUrl& GetImpl(const Dali::Toolkit::ImageUrl& imageUrl)
+{
+ DALI_ASSERT_ALWAYS(imageUrl && "ImageUrl handle is empty");
+
+ const BaseObject& handle = imageUrl.GetBaseObject();
+
+ return static_cast<const Toolkit::Internal::ImageUrl&>(handle);
+}
+
+} // End of namespace Dali
+
+#endif // DALI_TOOLKIT_INTERNAL_IMAGE_URL_H
*/
struct BidirectionalLineInfoRun
{
- CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run.
- CharacterIndex* visualToLogicalMap; ///< Pointer to the visual to logical map table.
- CharacterDirection direction : 1; ///< Direction of the first character of the paragraph.
- bool isIdentity : 1; ///< Whether the map is the identity.
+ CharacterRun characterRun; ///< The initial character index within the whole text and the number of characters of the run. In case the line is splitted by MIDDLE Ellipsis, this for the first half of line.
+ CharacterIndex* visualToLogicalMap; ///< Pointer to the visual to logical map table. In case the line is splitted by MIDDLE Ellipsis, this for the first half of line.
+ CharacterRun characterRunForSecondHalfLine; ///< The initial character index within the whole text and the number of characters of the run for the second half of line.
+ CharacterIndex* visualToLogicalMapSecondHalf; ///< Pointer to the visual to logical map table for the second half of line.
+ CharacterDirection direction : 1; ///< Direction of the first character of the paragraph.
+ bool isIdentity : 1; ///< Whether the map is the identity.
};
} // namespace Text
BidirectionalLineRunIndex bidiLineIndex,
CharacterIndex startIndex,
Length numberOfCharacters,
+ CharacterIndex startIndexInSecondHalfLine,
+ Length numberOfCharactersInSecondHalfLine,
CharacterDirection direction)
{
// Handle to the bidirectional info module in text-abstraction.
lineInfoRun.direction = direction;
lineInfoRun.isIdentity = true;
+ lineInfoRun.characterRunForSecondHalfLine.characterIndex = startIndexInSecondHalfLine;
+ lineInfoRun.characterRunForSecondHalfLine.numberOfCharacters = numberOfCharactersInSecondHalfLine;
+
// Allocate space for the conversion maps.
// The memory is freed after the visual to logical to visual conversion tables are built in the logical model.
lineInfoRun.visualToLogicalMap = reinterpret_cast<CharacterIndex*>(malloc(numberOfCharacters * sizeof(CharacterIndex)));
- if(nullptr != lineInfoRun.visualToLogicalMap)
+ lineInfoRun.visualToLogicalMapSecondHalf = reinterpret_cast<CharacterIndex*>(malloc(numberOfCharactersInSecondHalfLine * sizeof(CharacterIndex)));
+
+ if(nullptr != lineInfoRun.visualToLogicalMap && nullptr != lineInfoRun.visualToLogicalMapSecondHalf)
{
// Reorders the line.
bidirectionalSupport.Reorder(bidirectionalParagraphInfo.bidirectionalInfoIndex,
lineInfoRun.characterRun.numberOfCharacters,
lineInfoRun.visualToLogicalMap);
+ bidirectionalSupport.Reorder(bidirectionalParagraphInfo.bidirectionalInfoIndex,
+ lineInfoRun.characterRunForSecondHalfLine.characterIndex - bidirectionalParagraphInfo.characterRun.characterIndex,
+ lineInfoRun.characterRunForSecondHalfLine.numberOfCharacters,
+ lineInfoRun.visualToLogicalMapSecondHalf);
+
// For those LTR lines inside a bidirectional paragraph.
// It will save to relayout the line after reordering.
for(unsigned int i = 0; i < numberOfCharacters; ++i)
break;
}
}
+
+ for(unsigned int i = 0; i < numberOfCharactersInSecondHalfLine; ++i)
+ {
+ if(i != *(lineInfoRun.visualToLogicalMapSecondHalf + i))
+ {
+ lineInfoRun.isIdentity = false;
+ break;
+ }
+ }
}
// Push the run into the vector.
* @param[in] bidiLineIndex Index to the line's bidirectional info.
* @param[in] startIndex The character from where the bidirectional info is set.
* @param[in] numberOfCharacters The number of characters.
+ * @param[in] startIndexInSecondHalfLine The character from where the bidirectional info is set for the second half of line..
+ * @param[in] numberOfCharactersInSecondHalfLine The number of characters for the second half of line..
* @param[in] direction The direction of the line.
*/
void ReorderLine(const BidirectionalParagraphInfoRun& bidirectionalParagraphInfo,
BidirectionalLineRunIndex bidiLineIndex,
CharacterIndex startIndex,
Length numberOfCharacters,
+ CharacterIndex startIndexInSecondHalfLine,
+ Length numberOfCharactersInSecondHalfLine,
CharacterDirection direction);
/**
previousAdvance{0.f},
length{0.f},
whiteSpaceLengthEndOfLine{0.f},
- direction{LTR}
+ direction{LTR},
+ isSplitToTwoHalves(false),
+ glyphIndexInSecondHalfLine{0u},
+ characterIndexInSecondHalfLine{0u},
+ numberOfGlyphsInSecondHalfLine{0u},
+ numberOfCharactersInSecondHalfLine{0u}
+
{
}
void Clear()
{
- glyphIndex = 0u;
- characterIndex = 0u;
- numberOfGlyphs = 0u;
- numberOfCharacters = 0u;
- ascender = -MAX_FLOAT;
- descender = MAX_FLOAT;
- direction = LTR;
+ glyphIndex = 0u;
+ characterIndex = 0u;
+ numberOfGlyphs = 0u;
+ numberOfCharacters = 0u;
+ ascender = -MAX_FLOAT;
+ descender = MAX_FLOAT;
+ direction = LTR;
+ isSplitToTwoHalves = false;
+ glyphIndexInSecondHalfLine = 0u;
+ characterIndexInSecondHalfLine = 0u;
+ numberOfGlyphsInSecondHalfLine = 0u;
+ numberOfCharactersInSecondHalfLine = 0u;
}
GlyphIndex glyphIndex; ///< Index of the first glyph to be laid-out.
float length; ///< The current length of the line.
float whiteSpaceLengthEndOfLine; ///< The length of the white spaces at the end of the line.
CharacterDirection direction;
+
+ bool isSplitToTwoHalves; ///< Whether the second half is defined.
+ GlyphIndex glyphIndexInSecondHalfLine; ///< Index of the first glyph to be laid-out for the second half of line.
+ CharacterIndex characterIndexInSecondHalfLine; ///< Index of the first character to be laid-out for the second half of line.
+ Length numberOfGlyphsInSecondHalfLine; ///< The number of glyph which fit in one line for the second half of line.
+ Length numberOfCharactersInSecondHalfLine; ///< The number of characters which fit in one line for the second half of line.
};
struct LayoutBidiParameters
*
* @param[in,out] lineLayout The line layout.
* @param[in] tmpLineLayout A temporary line layout.
+ * @param[in] isShifted Whether to shift first glyph and character indices.
*/
void MergeLineLayout(LineLayout& lineLayout,
- const LineLayout& tmpLineLayout)
+ const LineLayout& tmpLineLayout,
+ bool isShifted)
{
lineLayout.numberOfCharacters += tmpLineLayout.numberOfCharacters;
lineLayout.numberOfGlyphs += tmpLineLayout.numberOfGlyphs;
// Sets the minimum descender.
lineLayout.descender = std::min(lineLayout.descender, tmpLineLayout.descender);
+
+ // To handle cases START in ellipsis position when want to shift first glyph to let width fit.
+ if(isShifted)
+ {
+ lineLayout.glyphIndex = tmpLineLayout.glyphIndex;
+ lineLayout.characterIndex = tmpLineLayout.characterIndex;
+ }
+
+ lineLayout.isSplitToTwoHalves = tmpLineLayout.isSplitToTwoHalves;
+ lineLayout.glyphIndexInSecondHalfLine = tmpLineLayout.glyphIndexInSecondHalfLine;
+ lineLayout.characterIndexInSecondHalfLine = tmpLineLayout.characterIndexInSecondHalfLine;
+ lineLayout.numberOfGlyphsInSecondHalfLine = tmpLineLayout.numberOfGlyphsInSecondHalfLine;
+ lineLayout.numberOfCharactersInSecondHalfLine = tmpLineLayout.numberOfCharactersInSecondHalfLine;
}
void LayoutRightToLeft(const Parameters& parameters,
float& length,
float& whiteSpaceLengthEndOfLine)
{
+ // Travers characters in line then draw it form right to left by mapping index using visualToLogicalMap.
+ // When the line is spllited by MIDDLE ellipsis then travers the second half of line "characterRunForSecondHalfLine"
+ // then the first half of line "characterRun",
+ // Otherwise travers whole characters in"characterRun".
+
const Character* const textBuffer = parameters.textModel->mLogicalModel->mText.Begin();
const Length* const charactersPerGlyphBuffer = parameters.textModel->mVisualModel->mCharactersPerGlyph.Begin();
const GlyphInfo* const glyphsBuffer = parameters.textModel->mVisualModel->mGlyphs.Begin();
const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
CharacterIndex characterLogicalIndex = 0u;
- CharacterIndex characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *(bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex);
+ CharacterIndex characterVisualIndex = 0u;
+
+ // If there are characters in the second half of Line then the first visual index mapped from visualToLogicalMapSecondHalf
+ // Otherwise maps the first visual index from visualToLogicalMap.
+ // This is to initialize the first visual index.
+ if(bidirectionalLineInfo.characterRunForSecondHalfLine.numberOfCharacters > 0u)
+ {
+ characterVisualIndex = bidirectionalLineInfo.characterRunForSecondHalfLine.characterIndex + *(bidirectionalLineInfo.visualToLogicalMapSecondHalf + characterLogicalIndex);
+ }
+ else
+ {
+ characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *(bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex);
+ }
+
+ bool extendedToSecondHalf = false; // Whether the logical index is extended to second half
if(RTL == bidirectionalLineInfo.direction)
{
- while(TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex)))
+ // If there are characters in the second half of Line.
+ if(bidirectionalLineInfo.characterRunForSecondHalfLine.numberOfCharacters > 0u)
{
- const GlyphInfo& glyphInfo = *(glyphsBuffer + *(charactersToGlyphsBuffer + characterVisualIndex));
+ // Keep adding the WhiteSpaces to the whiteSpaceLengthEndOfLine
+ while(TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex)))
+ {
+ const GlyphInfo& glyphInfo = *(glyphsBuffer + *(charactersToGlyphsBuffer + characterVisualIndex));
- whiteSpaceLengthEndOfLine += glyphInfo.advance;
+ whiteSpaceLengthEndOfLine += glyphInfo.advance;
- ++characterLogicalIndex;
- characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *(bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex);
+ ++characterLogicalIndex;
+ characterVisualIndex = bidirectionalLineInfo.characterRunForSecondHalfLine.characterIndex + *(bidirectionalLineInfo.visualToLogicalMapSecondHalf + characterLogicalIndex);
+ }
+ }
+
+ // If all characters in the second half of Line are WhiteSpaces.
+ // then continue adding the WhiteSpaces from the first hel of Line.
+ // Also this is valid when the line was not splitted.
+ if(characterLogicalIndex == bidirectionalLineInfo.characterRunForSecondHalfLine.numberOfCharacters)
+ {
+ extendedToSecondHalf = true; // Whether the logical index is extended to second half
+ characterLogicalIndex = 0u;
+ characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *(bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex);
+
+ // Keep adding the WhiteSpaces to the whiteSpaceLengthEndOfLine
+ while(TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex)))
+ {
+ const GlyphInfo& glyphInfo = *(glyphsBuffer + *(charactersToGlyphsBuffer + characterVisualIndex));
+
+ whiteSpaceLengthEndOfLine += glyphInfo.advance;
+
+ ++characterLogicalIndex;
+ characterVisualIndex = bidirectionalLineInfo.characterRun.characterIndex + *(bidirectionalLineInfo.visualToLogicalMap + characterLogicalIndex);
+ }
}
}
+ // Here's the first index of character is not WhiteSpace
const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
// Check whether the first glyph comes from a character that is shaped in multiple glyphs.
float penX = -glyphMetrics.xBearing + mCursorWidth + outlineWidth;
// Traverses the characters of the right to left paragraph.
+ // Continue in the second half of line, because in it the first index of character that is not WhiteSpace.
+ if(!extendedToSecondHalf &&
+ bidirectionalLineInfo.characterRunForSecondHalfLine.numberOfCharacters > 0u)
+ {
+ for(; characterLogicalIndex < bidirectionalLineInfo.characterRunForSecondHalfLine.numberOfCharacters;)
+ {
+ // Convert the character in the logical order into the character in the visual order.
+ const CharacterIndex characterVisualIndex = bidirectionalLineInfo.characterRunForSecondHalfLine.characterIndex + *(bidirectionalLineInfo.visualToLogicalMapSecondHalf + characterLogicalIndex);
+ const bool isWhiteSpace = TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex));
+
+ const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
+
+ // Check whether this glyph comes from a character that is shaped in multiple glyphs.
+ const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup(glyphIndex,
+ lastGlyphOfParagraphPlusOne,
+ charactersPerGlyphBuffer);
+
+ characterLogicalIndex += *(charactersPerGlyphBuffer + glyphIndex + numberOfGLyphsInGroup - 1u);
+
+ GlyphMetrics glyphMetrics;
+ GetGlyphsMetrics(glyphIndex,
+ numberOfGLyphsInGroup,
+ glyphMetrics,
+ glyphsBuffer,
+ mMetrics);
+
+ if(isWhiteSpace)
+ {
+ // If glyph is WhiteSpace then:
+ // For RTL it is whitespace but not at endOfLine. Use "advance" to accumulate length and shift penX.
+ // the endOfLine in RTL was the headOfLine for layouting.
+ // But for LTR added it to the endOfLine and use "advance" to accumulate length.
+ if(RTL == bidirectionalLineInfo.direction)
+ {
+ length += glyphMetrics.advance;
+ }
+ else
+ {
+ whiteSpaceLengthEndOfLine += glyphMetrics.advance;
+ }
+ penX += glyphMetrics.advance;
+ }
+ else
+ {
+ // If glyph is not whiteSpace then:
+ // Reset endOfLine for LTR because there is a non-whiteSpace so the tail of line is not whiteSpaces
+ // Use "advance" and "interGlyphExtraAdvance" to shift penX.
+ // Set length to the maximum possible length, of the current glyph "xBearing" and "width" are shifted penX to length greater than current lenght.
+ // Otherwise the current length is maximum.
+ if(LTR == bidirectionalLineInfo.direction)
+ {
+ whiteSpaceLengthEndOfLine = 0.f;
+ }
+ length = std::max(length, penX + glyphMetrics.xBearing + glyphMetrics.width);
+ penX += (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
+ }
+ }
+ }
+
+ // Continue traversing in the first half of line or in the whole line.
+ // If the second half of line was extended then continue from logical index in the first half of line
+ // Also this is valid when the line was not splitted and there were WhiteSpace.
+ // Otherwise start from first logical index in line.
+ characterLogicalIndex = extendedToSecondHalf ? characterLogicalIndex : 0u;
for(; characterLogicalIndex < bidirectionalLineInfo.characterRun.numberOfCharacters;)
{
// Convert the character in the logical order into the character in the visual order.
if(isWhiteSpace)
{
+ // If glyph is WhiteSpace then:
+ // For RTL it is whitespace but not at endOfLine. Use "advance" to accumulate length and shift penX.
+ // the endOfLine in RTL was the headOfLine for layouting.
+ // But for LTR added it to the endOfLine and use "advance" to accumulate length.
if(RTL == bidirectionalLineInfo.direction)
{
length += glyphMetrics.advance;
}
else
{
+ // If glyph is not whiteSpace then:
+ // Reset endOfLine for LTR because there is a non-whiteSpace so the tail of line is not whiteSpaces
+ // Use "advance" and "interGlyphExtraAdvance" to shift penX.
+ // Set length to the maximum possible length, of the current glyph "xBearing" and "width" are shifted penX to length greater than current lenght.
+ // Otherwise the current length is maximum.
if(LTR == bidirectionalLineInfo.direction)
{
whiteSpaceLengthEndOfLine = 0.f;
LayoutBidiParameters& bidiParameters,
const LineLayout& currentLineLayout,
LineLayout& lineLayout,
- bool breakInCharacters)
+ bool breakInCharacters,
+ bool enforceEllipsisInSingleLine)
{
const Length* const charactersPerGlyphBuffer = parameters.textModel->mVisualModel->mCharactersPerGlyph.Begin();
bidiParameters.bidiLineIndex,
lineLayout.characterIndex,
lineLayout.numberOfCharacters,
+ lineLayout.characterIndexInSecondHalfLine,
+ lineLayout.numberOfCharactersInSecondHalfLine,
bidiParameters.paragraphDirection);
// Recalculate the length of the line and update the layout.
lineLayout.whiteSpaceLengthEndOfLine = whiteSpaceLengthEndOfLine;
if(!Equals(length, lineLayout.length))
{
- const bool isMultiline = mLayout == MULTI_LINE_BOX;
+ const bool isMultiline = (!enforceEllipsisInSingleLine) && (mLayout == MULTI_LINE_BOX);
if(isMultiline && (length > parameters.boundingBox.width))
{
bidiParameters.bidiLineIndex,
lineLayout.characterIndex,
lineLayout.numberOfCharacters,
+ lineLayout.characterIndexInSecondHalfLine,
+ lineLayout.numberOfCharactersInSecondHalfLine,
bidiParameters.paragraphDirection);
const BidirectionalLineInfoRun& bidirectionalLineInfo = *(bidirectionalLinesInfo.Begin() + bidiParameters.bidiLineIndex);
* @param[] bidiParameters Bidirectional info for the current line.
* @param[out] lineLayout The line layout.
* @param[in] completelyFill Whether to completely fill the line ( even if the last word exceeds the boundaries ).
+ * @param[in] ellipsisPosition Where is the location the text elide
*/
- void GetLineLayoutForBox(const Parameters& parameters,
- LayoutBidiParameters& bidiParameters,
- LineLayout& lineLayout,
- bool completelyFill)
+ void GetLineLayoutForBox(const Parameters& parameters,
+ LayoutBidiParameters& bidiParameters,
+ LineLayout& lineLayout,
+ bool completelyFill,
+ DevelText::EllipsisPosition::Type ellipsisPosition,
+ bool enforceEllipsisInSingleLine,
+ bool elideTextEnabled)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->GetLineLayoutForBox\n");
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " initial glyph index : %d\n", lineLayout.glyphIndex);
const float outlineWidth = static_cast<float>(parameters.textModel->GetOutlineWidth());
const Length totalNumberOfGlyphs = parameters.textModel->mVisualModel->mGlyphs.Count();
- const bool isMultiline = mLayout == MULTI_LINE_BOX;
+ const bool isMultiline = !enforceEllipsisInSingleLine && (mLayout == MULTI_LINE_BOX);
const bool isWordLaidOut = parameters.textModel->mLineWrapMode == Text::LineWrap::WORD ||
(parameters.textModel->mLineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) ||
(parameters.textModel->mLineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::MIXED);
const bool isHyphenMode = parameters.textModel->mLineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION;
const bool isMixedMode = parameters.textModel->mLineWrapMode == (Text::LineWrap::Mode)DevelText::LineWrap::MIXED;
+ const bool isSplitToTwoHalves = elideTextEnabled && !isMultiline && ellipsisPosition == DevelText::EllipsisPosition::MIDDLE;
+
// The last glyph to be laid-out.
const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
lastGlyphOfParagraphPlusOne,
charactersPerGlyphBuffer);
+ float targetWidth = parameters.boundingBox.width;
+ float widthFirstHalf = ((ellipsisPosition != DevelText::EllipsisPosition::MIDDLE) ? targetWidth : targetWidth - std::floor(targetWidth / 2));
+
+ bool isSecondHalf = false;
+
GlyphMetrics glyphMetrics;
GetGlyphsMetrics(lineLayout.glyphIndex,
numberOfGLyphsInGroup,
// Get the line break info for the current character.
const LineBreakInfo lineBreakInfo = hasCharacters ? *(lineBreakInfoBuffer + characterLastIndex) : TextAbstraction::LINE_NO_BREAK;
- // Increase the number of characters.
- tmpLineLayout.numberOfCharacters += charactersPerGlyph;
+ if(isSecondHalf)
+ {
+ // Increase the number of characters.
+ tmpLineLayout.numberOfCharactersInSecondHalfLine += charactersPerGlyph;
+
+ // Increase the number of glyphs.
+ tmpLineLayout.numberOfGlyphsInSecondHalfLine += numberOfGLyphsInGroup;
+ }
+ else
+ {
+ // Increase the number of characters.
+ tmpLineLayout.numberOfCharacters += charactersPerGlyph;
- // Increase the number of glyphs.
- tmpLineLayout.numberOfGlyphs += numberOfGLyphsInGroup;
+ // Increase the number of glyphs.
+ tmpLineLayout.numberOfGlyphs += numberOfGLyphsInGroup;
+ }
// Check whether is a white space.
const Character character = *(textBuffer + characterFirstIndex);
tmpLineLayout.whiteSpaceLengthEndOfLine = 0.f;
}
+ if(isSplitToTwoHalves && (!isSecondHalf) &&
+ (tmpLineLayout.length + tmpLineLayout.whiteSpaceLengthEndOfLine > widthFirstHalf))
+ {
+ tmpLineLayout.numberOfCharacters -= charactersPerGlyph;
+ tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
+
+ tmpLineLayout.numberOfCharactersInSecondHalfLine += charactersPerGlyph;
+ tmpLineLayout.numberOfGlyphsInSecondHalfLine += numberOfGLyphsInGroup;
+
+ tmpLineLayout.glyphIndexInSecondHalfLine = tmpLineLayout.glyphIndex + tmpLineLayout.numberOfGlyphs;
+ tmpLineLayout.characterIndexInSecondHalfLine = tmpLineLayout.characterIndex + tmpLineLayout.numberOfCharacters;
+
+ tmpLineLayout.isSplitToTwoHalves = isSecondHalf = true;
+ }
// Check if the accumulated length fits in the width of the box.
- if((completelyFill || isMultiline) && !isWhiteSpace &&
- (tmpLineLayout.length > parameters.boundingBox.width))
+ if((ellipsisPosition == DevelText::EllipsisPosition::START ||
+ (ellipsisPosition == DevelText::EllipsisPosition::MIDDLE && isSecondHalf)) &&
+ completelyFill && !isMultiline &&
+ (tmpLineLayout.length + tmpLineLayout.whiteSpaceLengthEndOfLine > targetWidth))
+ {
+ GlyphIndex glyphIndexToRemove = isSecondHalf ? tmpLineLayout.glyphIndexInSecondHalfLine : tmpLineLayout.glyphIndex;
+
+ while(tmpLineLayout.length + tmpLineLayout.whiteSpaceLengthEndOfLine > targetWidth && glyphIndexToRemove < glyphIndex)
+ {
+ GlyphMetrics glyphMetrics;
+ GetGlyphsMetrics(glyphIndexToRemove,
+ numberOfGLyphsInGroup,
+ glyphMetrics,
+ glyphsBuffer,
+ mMetrics);
+
+ const Length numberOfGLyphsInGroup = GetNumberOfGlyphsOfGroup(glyphIndexToRemove,
+ lastGlyphOfParagraphPlusOne,
+ charactersPerGlyphBuffer);
+
+ const Length charactersPerGlyph = *(charactersPerGlyphBuffer + glyphIndexToRemove + numberOfGLyphsInGroup - 1u);
+ const bool hasCharacters = charactersPerGlyph > 0u;
+ const CharacterIndex characterFirstIndex = *(glyphsToCharactersBuffer + glyphIndexToRemove);
+ const CharacterIndex characterLastIndex = characterFirstIndex + (hasCharacters ? charactersPerGlyph - 1u : 0u);
+
+ // Check whether is a white space.
+ const Character character = *(textBuffer + characterFirstIndex);
+ const bool isRemovedGlyphWhiteSpace = TextAbstraction::IsWhiteSpace(character);
+
+ if(isSecondHalf)
+ {
+ // Decrease the number of characters for SecondHalf.
+ tmpLineLayout.numberOfCharactersInSecondHalfLine -= charactersPerGlyph;
+
+ // Decrease the number of glyphs for SecondHalf.
+ tmpLineLayout.numberOfGlyphsInSecondHalfLine -= numberOfGLyphsInGroup;
+ }
+ else
+ {
+ // Decrease the number of characters.
+ tmpLineLayout.numberOfCharacters -= charactersPerGlyph;
+
+ // Decrease the number of glyphs.
+ tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
+ }
+
+ if(isRemovedGlyphWhiteSpace)
+ {
+ tmpLineLayout.penX -= glyphMetrics.advance;
+ tmpLineLayout.length -= glyphMetrics.advance;
+ }
+ else
+ {
+ tmpLineLayout.penX -= (glyphMetrics.advance + parameters.interGlyphExtraAdvance);
+ tmpLineLayout.length -= (std::min(glyphMetrics.advance + parameters.interGlyphExtraAdvance, glyphMetrics.xBearing + glyphMetrics.width));
+ }
+
+ if(isSecondHalf)
+ {
+ tmpLineLayout.glyphIndexInSecondHalfLine += numberOfGLyphsInGroup;
+ tmpLineLayout.characterIndexInSecondHalfLine = characterLastIndex + 1u;
+ glyphIndexToRemove = tmpLineLayout.glyphIndexInSecondHalfLine;
+ }
+ else
+ {
+ tmpLineLayout.glyphIndex += numberOfGLyphsInGroup;
+ tmpLineLayout.characterIndex = characterLastIndex + 1u;
+ glyphIndexToRemove = tmpLineLayout.glyphIndex;
+ }
+ }
+ }
+ else if((completelyFill || isMultiline) &&
+ (tmpLineLayout.length > targetWidth))
{
// Current word does not fit in the box's width.
if(((oneHyphenLaidOut && isHyphenMode) ||
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " Break the word by character\n");
// The word doesn't fit in the control's width. It needs to be split by character.
- if(tmpLineLayout.numberOfGlyphs > 0u)
+ if(tmpLineLayout.numberOfGlyphs + tmpLineLayout.numberOfGlyphsInSecondHalfLine > 0u)
{
- tmpLineLayout.numberOfCharacters -= charactersPerGlyph;
- tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
+ if(isSecondHalf)
+ {
+ tmpLineLayout.numberOfCharactersInSecondHalfLine -= charactersPerGlyph;
+ tmpLineLayout.numberOfGlyphsInSecondHalfLine -= numberOfGLyphsInGroup;
+ }
+ else
+ {
+ tmpLineLayout.numberOfCharacters -= charactersPerGlyph;
+ tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
+ }
tmpLineLayout.penX = previousTmpPenX;
tmpLineLayout.previousAdvance = previousTmpAdvance;
tmpLineLayout.whiteSpaceLengthEndOfLine = previousTmpWhiteSpaceLengthEndOfLine;
}
- // Add part of the word to the line layout.
- MergeLineLayout(lineLayout, tmpLineLayout);
+ if(ellipsisPosition == DevelText::EllipsisPosition::START && !isMultiline)
+ {
+ // Add part of the word to the line layout and shift the first glyph.
+ MergeLineLayout(lineLayout, tmpLineLayout, true);
+ }
+ else if(ellipsisPosition != DevelText::EllipsisPosition::START ||
+ (ellipsisPosition == DevelText::EllipsisPosition::START && (!completelyFill)))
+ {
+ // Add part of the word to the line layout.
+ MergeLineLayout(lineLayout, tmpLineLayout, false);
+ }
}
else
{
bidiParameters,
lineLayout,
lineLayout,
- true);
+ true,
+ enforceEllipsisInSingleLine);
}
return;
{
LineLayout currentLineLayout = lineLayout;
oneHyphenLaidOut = false;
- // Must break the line. Update the line layout and return.
- MergeLineLayout(lineLayout, tmpLineLayout);
+
+ if(ellipsisPosition == DevelText::EllipsisPosition::START && !isMultiline)
+ {
+ // Must break the line. Update the line layout, shift the first glyph and return.
+ MergeLineLayout(lineLayout, tmpLineLayout, true);
+ }
+ else
+ {
+ // Must break the line. Update the line layout and return.
+ MergeLineLayout(lineLayout, tmpLineLayout, false);
+ }
// Reorder the RTL line.
if(bidiParameters.isBidirectional)
bidiParameters,
currentLineLayout,
lineLayout,
- false);
+ false,
+ enforceEllipsisInSingleLine);
}
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " Must break\n");
// Current glyph is the last one of the current word.
// Add the temporal layout to the current one.
- MergeLineLayout(lineLayout, tmpLineLayout);
+ MergeLineLayout(lineLayout, tmpLineLayout, false);
tmpLineLayout.Clear();
}
mMetrics->GetGlyphMetrics(&hyphenGlyph, 1);
- if((tmpLineLayout.length + hyphenGlyph.width) <= parameters.boundingBox.width)
+ if((tmpLineLayout.length + hyphenGlyph.width) <= targetWidth)
{
hyphenIndex = glyphIndex;
oneHyphenLaidOut = true;
// Current glyph is the last one of the current word hyphen.
// Add the temporal layout to the current one.
- MergeLineLayout(lineLayout, tmpLineLayout);
+ MergeLineLayout(lineLayout, tmpLineLayout, false);
tmpLineLayout.Clear();
}
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--GetLineLayoutForBox\n");
}
- void SetGlyphPositions(const GlyphInfo* const glyphsBuffer,
- Length numberOfGlyphs,
- float outlineWidth,
- float interGlyphExtraAdvance,
- Vector2* glyphPositionsBuffer)
+ void SetGlyphPositions(const Parameters& layoutParameters,
+ Vector2* glyphPositionsBuffer,
+ const LineLayout& layout)
{
// Traverse the glyphs and set the positions.
+ const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
+ const float outlineWidth = static_cast<float>(layoutParameters.textModel->GetOutlineWidth());
+ const Length numberOfGlyphs = layout.numberOfGlyphs;
+ const float interGlyphExtraAdvance = layoutParameters.interGlyphExtraAdvance;
+
+ const GlyphIndex startIndexForGlyph = layout.glyphIndex;
+ const GlyphIndex startIndexForGlyphPositions = startIndexForGlyph - layoutParameters.startGlyphIndex;
+
// Check if the x bearing of the first character is negative.
// If it has a negative x bearing, it will exceed the boundaries of the actor,
// so the penX position needs to be moved to the right.
-
- const GlyphInfo& glyph = *glyphsBuffer;
- float penX = -glyph.xBearing + mCursorWidth + outlineWidth;
+ const GlyphInfo& glyph = *(glyphsBuffer + startIndexForGlyph);
+ float penX = -glyph.xBearing + mCursorWidth + outlineWidth; //
for(GlyphIndex i = 0u; i < numberOfGlyphs; ++i)
{
- const GlyphInfo& glyph = *(glyphsBuffer + i);
- Vector2& position = *(glyphPositionsBuffer + i);
+ const GlyphInfo& glyph = *(glyphsBuffer + startIndexForGlyph + i);
+ Vector2& position = *(glyphPositionsBuffer + startIndexForGlyphPositions + i);
position.x = penX + glyph.xBearing;
position.y = -glyph.yBearing;
penX += (glyph.advance + interGlyphExtraAdvance);
}
+
+ if(layout.isSplitToTwoHalves)
+ {
+ const GlyphIndex startIndexForGlyphInSecondHalf = layout.glyphIndexInSecondHalfLine;
+ const Length numberOfGlyphsInSecondHalfLine = layout.numberOfGlyphsInSecondHalfLine;
+ const GlyphIndex startIndexForGlyphPositionsnSecondHalf = layout.glyphIndexInSecondHalfLine - layoutParameters.startGlyphIndex;
+
+ for(GlyphIndex i = 0u; i < numberOfGlyphsInSecondHalfLine; ++i)
+ {
+ const GlyphInfo& glyph = *(glyphsBuffer + startIndexForGlyphInSecondHalf + i);
+ Vector2& position = *(glyphPositionsBuffer + startIndexForGlyphPositionsnSecondHalf + i);
+
+ position.x = penX + glyph.xBearing;
+ position.y = -glyph.yBearing;
+
+ penX += (glyph.advance + interGlyphExtraAdvance);
+ }
+ }
}
void SetGlyphPositions(const Parameters& layoutParameters,
const Length* const glyphsPerCharacterBuffer = layoutParameters.textModel->mVisualModel->mGlyphsPerCharacter.Begin();
CharacterIndex characterLogicalIndex = 0u;
- CharacterIndex characterVisualIndex = bidiLine.characterRun.characterIndex + *(bidiLine.visualToLogicalMap + characterLogicalIndex);
+ CharacterIndex characterVisualIndex = bidiLine.characterRunForSecondHalfLine.characterIndex + *(bidiLine.visualToLogicalMapSecondHalf + characterLogicalIndex);
+ bool extendedToSecondHalf = false; // Whether the logical index is extended to second half
float penX = 0.f;
- while(TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex)))
+
+ if(layout.isSplitToTwoHalves)
{
- const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
- const GlyphInfo& glyph = *(glyphsBuffer + glyphIndex);
+ while(TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex)))
+ {
+ const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
+ const GlyphInfo& glyph = *(glyphsBuffer + glyphIndex);
- Vector2& position = *(glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex);
- position.x = penX;
- position.y = -glyph.yBearing;
+ Vector2& position = *(glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex);
+ position.x = penX;
+ position.y = -glyph.yBearing;
- penX += glyph.advance;
+ penX += glyph.advance;
- ++characterLogicalIndex;
- characterVisualIndex = bidiLine.characterRun.characterIndex + *(bidiLine.visualToLogicalMap + characterLogicalIndex);
+ ++characterLogicalIndex;
+ characterVisualIndex = bidiLine.characterRun.characterIndex + *(bidiLine.visualToLogicalMap + characterLogicalIndex);
+ }
+ }
+
+ if(characterLogicalIndex == bidiLine.characterRunForSecondHalfLine.numberOfCharacters)
+ {
+ extendedToSecondHalf = true;
+ characterLogicalIndex = 0u;
+ characterVisualIndex = bidiLine.characterRun.characterIndex + *(bidiLine.visualToLogicalMap + characterLogicalIndex);
+
+ while(TextAbstraction::IsWhiteSpace(*(textBuffer + characterVisualIndex)))
+ {
+ const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
+ const GlyphInfo& glyph = *(glyphsBuffer + glyphIndex);
+
+ Vector2& position = *(glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex);
+ position.x = penX;
+ position.y = -glyph.yBearing;
+
+ penX += glyph.advance;
+
+ ++characterLogicalIndex;
+ characterVisualIndex = bidiLine.characterRun.characterIndex + *(bidiLine.visualToLogicalMap + characterLogicalIndex);
+ }
}
const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex);
penX += -glyph.xBearing;
// Traverses the characters of the right to left paragraph.
+ if(layout.isSplitToTwoHalves && !extendedToSecondHalf)
+ {
+ for(; characterLogicalIndex < bidiLine.characterRunForSecondHalfLine.numberOfCharacters;
+ ++characterLogicalIndex)
+ {
+ // Convert the character in the logical order into the character in the visual order.
+ const CharacterIndex characterVisualIndex = bidiLine.characterRunForSecondHalfLine.characterIndex + *(bidiLine.visualToLogicalMapSecondHalf + characterLogicalIndex);
+
+ // Get the number of glyphs of the character.
+ const Length numberOfGlyphs = *(glyphsPerCharacterBuffer + characterVisualIndex);
+
+ for(GlyphIndex index = 0u; index < numberOfGlyphs; ++index)
+ {
+ // Convert the character in the visual order into the glyph in the visual order.
+ const GlyphIndex glyphIndex = *(charactersToGlyphsBuffer + characterVisualIndex) + index;
+
+ DALI_ASSERT_DEBUG(glyphIndex < layoutParameters.textModel->mVisualModel->mGlyphs.Count());
+
+ const GlyphInfo& glyph = *(glyphsBuffer + glyphIndex);
+ Vector2& position = *(glyphPositionsBuffer + glyphIndex - layoutParameters.startGlyphIndex);
+
+ position.x = penX + glyph.xBearing;
+ position.y = -glyph.yBearing;
+
+ penX += (glyph.advance + layoutParameters.interGlyphExtraAdvance);
+ }
+ }
+ }
+
+ characterLogicalIndex = extendedToSecondHalf ? characterLogicalIndex : 0u;
for(; characterLogicalIndex < bidiLine.characterRun.numberOfCharacters;
++characterLogicalIndex)
{
* @param[in] penY The vertical layout position.
* @param[in] currentParagraphDirection The current paragraph's direction.
* @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+ * @param[in] ellipsisPosition Where is the location the text elide
*
* return Whether the line is ellipsized.
*/
- bool EllipsisLine(const Parameters& layoutParameters,
- LayoutBidiParameters& layoutBidiParameters,
- const LineLayout& layout,
- Size& layoutSize,
- LineRun* linesBuffer,
- Vector2* glyphPositionsBuffer,
- Length& numberOfLines,
- float penY,
- bool& isAutoScrollEnabled)
+ bool EllipsisLine(const Parameters& layoutParameters,
+ LayoutBidiParameters& layoutBidiParameters,
+ const LineLayout& layout,
+ Size& layoutSize,
+ LineRun* linesBuffer,
+ Vector2* glyphPositionsBuffer,
+ Length& numberOfLines,
+ float penY,
+ bool& isAutoScrollEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition,
+ bool enforceEllipsisInSingleLine)
{
- const bool ellipsis = isAutoScrollEnabled ? (penY - layout.descender > layoutParameters.boundingBox.height) : ((penY - layout.descender > layoutParameters.boundingBox.height) || ((mLayout == SINGLE_LINE_BOX) && (layout.length > layoutParameters.boundingBox.width)));
-
- if(ellipsis)
+ const bool ellipsis = enforceEllipsisInSingleLine || (isAutoScrollEnabled ? (penY - layout.descender > layoutParameters.boundingBox.height) : ((penY - layout.descender > layoutParameters.boundingBox.height) || ((mLayout == SINGLE_LINE_BOX) && (layout.length > layoutParameters.boundingBox.width))));
+ const bool isMultiline = !enforceEllipsisInSingleLine && (mLayout == MULTI_LINE_BOX);
+ if(ellipsis && (ellipsisPosition == DevelText::EllipsisPosition::END || !isMultiline))
{
isAutoScrollEnabled = false;
// Do not layout more lines if ellipsis is enabled.
{
// Get the last line and layout it again with the 'completelyFill' flag to true.
lineRun = linesBuffer + (numberOfLines - 1u);
-
penY -= layout.ascender - lineRun->descender + lineRun->lineSpacing;
ellipsisLayout.glyphIndex = lineRun->glyphRun.glyphIndex;
lineRun->glyphRun.glyphIndex = 0u;
ellipsisLayout.glyphIndex = 0u;
+ lineRun->isSplitToTwoHalves = false;
++numberOfLines;
}
GetLineLayoutForBox(layoutParameters,
layoutBidiParameters,
ellipsisLayout,
+ true,
+ ellipsisPosition,
+ enforceEllipsisInSingleLine,
true);
+ if(ellipsisPosition == DevelText::EllipsisPosition::START && !isMultiline)
+ {
+ lineRun->glyphRun.glyphIndex = ellipsisLayout.glyphIndex;
+ }
+
lineRun->glyphRun.numberOfGlyphs = ellipsisLayout.numberOfGlyphs;
lineRun->characterRun.characterIndex = ellipsisLayout.characterIndex;
lineRun->characterRun.numberOfCharacters = ellipsisLayout.numberOfCharacters;
lineRun->descender = ellipsisLayout.descender;
lineRun->ellipsis = true;
+ lineRun->isSplitToTwoHalves = ellipsisLayout.isSplitToTwoHalves;
+ lineRun->glyphRunSecondHalf.glyphIndex = ellipsisLayout.glyphIndexInSecondHalfLine;
+ lineRun->glyphRunSecondHalf.numberOfGlyphs = ellipsisLayout.numberOfGlyphsInSecondHalfLine;
+ lineRun->characterRunForSecondHalfLine.characterIndex = ellipsisLayout.characterIndexInSecondHalfLine;
+ lineRun->characterRunForSecondHalfLine.numberOfCharacters = ellipsisLayout.numberOfCharactersInSecondHalfLine;
+
layoutSize.width = layoutParameters.boundingBox.width;
if(layoutSize.height < Math::MACHINE_EPSILON_1000)
{
layoutSize.height += (lineRun->ascender + -lineRun->descender) + lineRun->lineSpacing;
}
- const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
- const float outlineWidth = static_cast<float>(layoutParameters.textModel->GetOutlineWidth());
-
const Vector<BidirectionalLineInfoRun>& bidirectionalLinesInfo = layoutParameters.textModel->mLogicalModel->mBidirectionalLineInfo;
if(layoutBidiParameters.isBidirectional)
++it, ++layoutBidiParameters.bidiLineIndex)
{
const BidirectionalLineInfoRun& run = *it;
-
- if(ellipsisLayout.characterIndex == run.characterRun.characterIndex)
+ //To handle case when the laid characters exist in next line.
+ //More than one BidirectionalLineInfoRun could start with same character.
+ //When need to check also numberOfCharacters in line.
+ //Note: This fixed the incorrect view of extra spaces of RTL as in Arabic then view ellipsis glyph
+ if(ellipsisLayout.characterIndex == run.characterRun.characterIndex &&
+ ellipsisLayout.numberOfCharacters == run.characterRun.numberOfCharacters &&
+ ellipsisLayout.characterIndexInSecondHalfLine == run.characterRunForSecondHalfLine.characterIndex &&
+ ellipsisLayout.numberOfCharactersInSecondHalfLine == run.characterRunForSecondHalfLine.numberOfCharacters)
{
// Found where to insert the bidi line info.
break;
else
{
lineRun->direction = LTR;
- SetGlyphPositions(glyphsBuffer + lineRun->glyphRun.glyphIndex,
- ellipsisLayout.numberOfGlyphs,
- outlineWidth,
- layoutParameters.interGlyphExtraAdvance,
- glyphPositionsBuffer + lineRun->glyphRun.glyphIndex - layoutParameters.startGlyphIndex);
+ SetGlyphPositions(layoutParameters,
+ glyphPositionsBuffer,
+ ellipsisLayout);
}
}
lineRun.width = layout.length;
lineRun.extraLength = std::ceil(layout.whiteSpaceLengthEndOfLine);
+ lineRun.isSplitToTwoHalves = layout.isSplitToTwoHalves;
+ lineRun.glyphRunSecondHalf.glyphIndex = layout.glyphIndexInSecondHalfLine;
+ lineRun.glyphRunSecondHalf.numberOfGlyphs = layout.numberOfGlyphsInSecondHalfLine;
+ lineRun.characterRunForSecondHalfLine.characterIndex = layout.characterIndexInSecondHalfLine;
+ lineRun.characterRunForSecondHalfLine.numberOfCharacters = layout.numberOfCharactersInSecondHalfLine;
+
// Rounds upward to avoid a non integer size.
lineRun.width = std::ceil(lineRun.width);
}
}
- bool LayoutText(Parameters& layoutParameters,
- Size& layoutSize,
- bool elideTextEnabled,
- bool& isAutoScrollEnabled)
+ bool LayoutText(Parameters& layoutParameters,
+ Size& layoutSize,
+ bool elideTextEnabled,
+ bool& isAutoScrollEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->LayoutText\n");
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " box size %f, %f\n", layoutParameters.boundingBox.width, layoutParameters.boundingBox.height);
layoutParameters.textModel->mVisualModel->mHyphen.glyph.Clear();
layoutParameters.textModel->mVisualModel->mHyphen.index.Clear();
+ //Reset indices of ElidedGlyphs
+ layoutParameters.textModel->mVisualModel->SetStartIndexOfElidedGlyphs(0u);
+ layoutParameters.textModel->mVisualModel->SetEndIndexOfElidedGlyphs(layoutParameters.textModel->GetNumberOfGlyphs() - 1u);
+ layoutParameters.textModel->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(0u);
+ layoutParameters.textModel->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(0u);
+
Vector<LineRun>& lines = layoutParameters.textModel->mVisualModel->mLines;
if(0u == layoutParameters.numberOfGlyphs)
linesBuffer = lines.Begin();
}
- float penY = CalculateLineOffset(lines,
+ float penY = CalculateLineOffset(lines,
layoutParameters.startLineIndex);
+ bool anyLineIsEliped = false;
for(GlyphIndex index = layoutParameters.startGlyphIndex; index < lastGlyphPlusOne;)
{
layoutBidiParameters.Clear();
GetLineLayoutForBox(layoutParameters,
layoutBidiParameters,
layout,
- false);
+ false,
+ ellipsisPosition,
+ false,
+ elideTextEnabled);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " glyph index %d\n", layout.glyphIndex);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " character index %d\n", layout.characterIndex);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " number of characters %d\n", layout.numberOfCharacters);
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " length %f\n", layout.length);
- if(0u == layout.numberOfGlyphs)
+ if(0u == layout.numberOfGlyphs + layout.numberOfGlyphsInSecondHalfLine)
{
// The width is too small and no characters are laid-out.
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--LayoutText width too small!\n\n");
glyphPositionsBuffer,
numberOfLines,
penY,
- isAutoScrollEnabled);
+ isAutoScrollEnabled,
+ ellipsisPosition,
+ false);
}
- if(ellipsis)
+ if(ellipsis && ((ellipsisPosition == DevelText::EllipsisPosition::END) || (numberOfLines == 1u)))
{
+ const bool isMultiline = mLayout == MULTI_LINE_BOX;
+ if(isMultiline && ellipsisPosition != DevelText::EllipsisPosition::END)
+ {
+ ellipsis = EllipsisLine(layoutParameters,
+ layoutBidiParameters,
+ layout,
+ layoutSize,
+ linesBuffer,
+ glyphPositionsBuffer,
+ numberOfLines,
+ penY,
+ isAutoScrollEnabled,
+ ellipsisPosition,
+ true);
+ }
+
//clear hyphen from ellipsis line
const Length* hyphenIndices = layoutParameters.textModel->mVisualModel->mHyphen.index.Begin();
Length hyphensCount = layoutParameters.textModel->mVisualModel->mHyphen.glyph.Size();
}
else
{
+ //In START location of ellipsis whether to shift lines or not.
+ anyLineIsEliped |= ellipsis;
+
// Whether the last line has been laid-out.
- const bool isLastLine = index + layout.numberOfGlyphs == totalNumberOfGlyphs;
+ const bool isLastLine = index + (layout.numberOfGlyphs + layout.numberOfGlyphsInSecondHalfLine) == totalNumberOfGlyphs;
if(numberOfLines == linesCapacity)
{
numberOfLines,
isLastLine);
- const GlyphIndex nextIndex = index + layout.numberOfGlyphs;
+ const GlyphIndex nextIndex = index + layout.numberOfGlyphs + layout.numberOfGlyphsInSecondHalfLine;
if((nextIndex == totalNumberOfGlyphs) &&
layoutParameters.isLastNewParagraph &&
}
UpdateTextLayout(layoutParameters,
- layout.characterIndex + layout.numberOfCharacters,
- index + layout.numberOfGlyphs,
+ layout.characterIndex + (layout.numberOfCharacters + layout.numberOfCharactersInSecondHalfLine),
+ index + (layout.numberOfGlyphs + layout.numberOfGlyphsInSecondHalfLine),
layoutSize,
linesBuffer,
numberOfLines);
} // whether to add a last line.
- const GlyphInfo* const glyphsBuffer = layoutParameters.textModel->mVisualModel->mGlyphs.Begin();
- const float outlineWidth = static_cast<float>(layoutParameters.textModel->GetOutlineWidth());
-
const BidirectionalLineInfoRun* const bidirectionalLineInfo = (layoutBidiParameters.isBidirectional && !bidirectionalLinesInfo.Empty()) ? &bidirectionalLinesInfo[layoutBidiParameters.bidiLineIndex] : nullptr;
if((nullptr != bidirectionalLineInfo) &&
else
{
// Sets the positions of the glyphs.
- SetGlyphPositions(glyphsBuffer + index,
- layout.numberOfGlyphs,
- outlineWidth,
- layoutParameters.interGlyphExtraAdvance,
- glyphPositionsBuffer + index - layoutParameters.startGlyphIndex);
+ SetGlyphPositions(layoutParameters,
+ glyphPositionsBuffer,
+ layout);
}
// Updates the vertical pen's position.
} // no ellipsis
} // end for() traversing glyphs.
+ //Shift lines to up if ellipsis and multilines and set ellipsis of first line to true
+ if(anyLineIsEliped && numberOfLines > 1u)
+ {
+ if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ Length lineIndex = 0;
+ while(lineIndex < numberOfLines && layoutParameters.boundingBox.height < layoutSize.height)
+ {
+ LineRun& delLine = linesBuffer[lineIndex];
+ delLine.ellipsis = true;
+
+ layoutSize.height -= (delLine.ascender + -delLine.descender) + delLine.lineSpacing;
+ for(Length lineIndex = 0; lineIndex < numberOfLines - 1; lineIndex++)
+ {
+ linesBuffer[lineIndex] = linesBuffer[lineIndex + 1];
+ linesBuffer[lineIndex].ellipsis = false;
+ }
+ numberOfLines--;
+ lineIndex++;
+ }
+ linesBuffer[0u].ellipsis = true;
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ Length middleLineIndex = (numberOfLines) / 2u;
+ Length ellipsisLineIndex = 0u;
+ while(1u < numberOfLines && 0u < middleLineIndex && layoutParameters.boundingBox.height < layoutSize.height)
+ {
+ LineRun& delLine = linesBuffer[middleLineIndex];
+ delLine.ellipsis = true;
+
+ layoutSize.height -= (delLine.ascender + -delLine.descender) + delLine.lineSpacing;
+ for(Length lineIndex = middleLineIndex; lineIndex < numberOfLines - 1; lineIndex++)
+ {
+ linesBuffer[lineIndex] = linesBuffer[lineIndex + 1];
+ linesBuffer[lineIndex].ellipsis = false;
+ }
+ numberOfLines--;
+ ellipsisLineIndex = middleLineIndex > 0u ? middleLineIndex - 1u : 0u;
+ middleLineIndex = (numberOfLines) / 2u;
+ }
+
+ linesBuffer[ellipsisLineIndex].ellipsis = true;
+ }
+ }
+
if(updateCurrentBuffer)
{
glyphPositions.Insert(glyphPositions.Begin() + layoutParameters.startGlyphIndex,
return static_cast<int>(mImpl->mCursorWidth);
}
-bool Engine::LayoutText(Parameters& layoutParameters,
- Size& layoutSize,
- bool elideTextEnabled,
- bool& isAutoScrollEnabled)
+bool Engine::LayoutText(Parameters& layoutParameters,
+ Size& layoutSize,
+ bool elideTextEnabled,
+ bool& isAutoScrollEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition)
{
return mImpl->LayoutText(layoutParameters,
layoutSize,
elideTextEnabled,
- isAutoScrollEnabled);
+ isAutoScrollEnabled,
+ ellipsisPosition);
}
void Engine::Align(const Size& size,
#include <dali-toolkit/internal/text/metrics.h>
#include <dali-toolkit/public-api/text/text-enumerations.h>
+//DEVEL INCLUDE
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+
namespace Dali
{
namespace Toolkit
* @param[out] layoutSize The size of the text after it has been laid-out.
* @param[in] elideTextEnabled Whether the text elide is enabled.
* @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+ * @param[in] ellipsisPosition The location of the text ellipsis
*
* @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
*/
- bool LayoutText(Parameters& layoutParameters,
- Size& layoutSize,
- bool elideTextEnabled,
- bool& isAutoScrollEnabled);
+ bool LayoutText(Parameters& layoutParameters,
+ Size& layoutSize,
+ bool elideTextEnabled,
+ bool& isAutoScrollEnabled,
+ DevelText::EllipsisPosition::Type ellipsisPosition);
/**
* @brief Aligns the laid out lines.
*/
struct LineRun
{
- GlyphRun glyphRun; ///< The initial glyph index and the number of glyphs of the run.
- CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
- float width; ///< The line's width.
- float ascender; ///< The line's ascender.
- float descender; ///< The line's descender.
- float extraLength; ///< The length of the white spaces at the end of the line.
- float alignmentOffset; ///< The horizontal alignment offset.
- float lineSpacing; ///< The line's spacing
- CharacterDirection direction : 1; ///< Direction of the first character of the paragraph.
- bool ellipsis : 1; ///< Wheter ellipsis is added to the line.
+ GlyphRun glyphRun; ///< The initial glyph index and the number of glyphs of the run.
+ CharacterRun characterRun; ///< The initial character index and the number of characters of the run.
+ float width; ///< The line's width.
+ float ascender; ///< The line's ascender.
+ float descender; ///< The line's descender.
+ float extraLength; ///< The length of the white spaces at the end of the line.
+ float alignmentOffset; ///< The horizontal alignment offset.
+ float lineSpacing; ///< The line's spacing
+ CharacterDirection direction : 1; ///< Direction of the first character of the paragraph.
+ bool ellipsis : 1; ///< Wheter ellipsis is added to the line.
+ bool isSplitToTwoHalves; ///< Whether the second half is defined. When split line to two halves to set Ellipsis in the MIDDLE of line. The second half is the second part of line after Ellipsis.
+ GlyphRun glyphRunSecondHalf; ///< The initial glyph index and the number of glyphs of the run for the second half of line.
+ CharacterRun characterRunForSecondHalfLine; ///< The initial character index and the number of characters of the run for the second half of line.
};
} // namespace Text
const float ZERO(0.0f);
const float HALF(0.5f);
const float ONE(1.0f);
-const uint32_t DOUBLE_PIXEL_PADDING = 4u;//Padding will be added twice to Atlas
+const uint32_t DOUBLE_PIXEL_PADDING = 4u; //Padding will be added twice to Atlas
const uint16_t NO_OUTLINE = 0u;
} // namespace
// If CheckAtlas in AtlasManager::Add can't fit the bitmap in the current atlas it will create a new atlas
// Setting the block size and size of new atlas does not mean a new one will be created. An existing atlas may still surffice.
- uint32_t default_width = defaultTextAtlasSize.width;
+ uint32_t default_width = defaultTextAtlasSize.width;
uint32_t default_height = defaultTextAtlasSize.height;
- while (
+ while(
(blockSize.mNeededBlockWidth >= (default_width - (DOUBLE_PIXEL_PADDING + 1u)) ||
- blockSize.mNeededBlockHeight >= (default_height - (DOUBLE_PIXEL_PADDING + 1u)))
- &&
+ blockSize.mNeededBlockHeight >= (default_height - (DOUBLE_PIXEL_PADDING + 1u))) &&
(default_width < maximumTextAtlasSize.width &&
default_height < maximumTextAtlasSize.height))
{
const Length* hyphenIndices = view.GetHyphenIndices();
const Length hyphensCount = view.GetHyphensCount();
+ // Elided text info. Indices according to elided text.
+ const auto startIndexOfGlyphs = view.GetStartIndexOfElidedGlyphs();
+ const auto firstMiddleIndexOfElidedGlyphs = view.GetFirstMiddleIndexOfElidedGlyphs();
+ const auto secondMiddleIndexOfElidedGlyphs = view.GetSecondMiddleIndexOfElidedGlyphs();
+
const bool useDefaultColor = (NULL == colorsBuffer);
// Get the underline runs.
uint32_t hyphenIndex = 0;
//For septated underlined chunks. (this is for Markup case)
- uint32_t underlineChunkId = 0u; // give id for each chunk.
- bool isPreUnderlined = false; // status of underlined for previous glyph.
+ uint32_t underlineChunkId = 0u; // give id for each chunk.
+ bool isPreUnderlined = false; // status of underlined for previous glyph.
+
+ //Skip hyphenIndices less than startIndexOfGlyphs or between two middle of elided text
+ if(hyphenIndices)
+ {
+ while((hyphenIndex < hyphensCount) && (hyphenIndices[hyphenIndex] < startIndexOfGlyphs ||
+ (hyphenIndices[hyphenIndex] > firstMiddleIndexOfElidedGlyphs && hyphenIndices[hyphenIndex] < secondMiddleIndexOfElidedGlyphs)))
+ {
+ ++hyphenIndex;
+ }
+ }
for(uint32_t i = 0, glyphSize = glyphs.Size(); i < glyphSize; ++i)
{
GlyphInfo glyph;
- bool addHyphen = ((hyphenIndex < hyphensCount) && hyphenIndices && (i == hyphenIndices[hyphenIndex]));
+ bool addHyphen = ((hyphenIndex < hyphensCount) && hyphenIndices && ((i + startIndexOfGlyphs) == hyphenIndices[hyphenIndex]));
if(addHyphen && hyphens)
{
glyph = hyphens[hyphenIndex];
0u);
}
-
//The new underlined chunk. Add new id if they are not consecutive indices (this is for Markup case)
// Examples: "Hello <u>World</u> Hello <u>World</u>", "<u>World</u> Hello <u>World</u>", "<u> World</u> Hello <u>World</u>"
- if( isPreUnderlined && (isPreUnderlined != isGlyphUnderlined))
+ if(isPreUnderlined && (isPreUnderlined != isGlyphUnderlined))
{
underlineChunkId++;
}
extent.mUnderlinePosition = underlinePosition;
extent.mUnderlineThickness = underlineThickness;
extent.mMeshRecordIndex = index;
- extent.mUnderlineChunkId = underlineChunkId;
+ extent.mUnderlineChunkId = underlineChunkId;
extents.PushBack(extent);
}
}
const unsigned int bufferSizeInt = bufferWidth * bufferHeight;
const unsigned int bufferSizeChar = 4u * bufferSizeInt;
- Length numberOfGlyphs = mModel->GetNumberOfGlyphs();
+ //Elided text in ellipsis at START could start on index greater than 0
+ auto startIndexOfGlyphs = mModel->GetStartIndexOfElidedGlyphs();
+ auto endIndexOfGlyphs = mModel->GetEndIndexOfElidedGlyphs();
Devel::PixelBuffer imageBuffer;
if(RENDER_MASK == behaviour)
{
// Generate the image buffer as an alpha mask for color glyphs.
- imageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_MASK, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, numberOfGlyphs - 1);
+ imageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_MASK, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
}
else if(RENDER_NO_TEXT == behaviour)
{
else
{
// Generate the image buffer for the text with no style.
- imageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_NONE, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, numberOfGlyphs - 1);
+ imageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_NONE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
}
if((RENDER_NO_STYLES != behaviour) && (RENDER_MASK != behaviour))
if(outlineWidth != 0u)
{
// Create the image buffer for outline
- Devel::PixelBuffer outlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_OUTLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, numberOfGlyphs - 1);
+ Devel::PixelBuffer outlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_OUTLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
// Combine the two buffers
imageBuffer = CombineImageBuffer(imageBuffer, outlineImageBuffer, bufferWidth, bufferHeight);
if(fabsf(shadowOffset.x) > Math::MACHINE_EPSILON_1 || fabsf(shadowOffset.y) > Math::MACHINE_EPSILON_1)
{
// Create the image buffer for shadow
- Devel::PixelBuffer shadowImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_SHADOW, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, numberOfGlyphs - 1);
+ Devel::PixelBuffer shadowImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_SHADOW, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
// Check whether it will be a soft shadow
const float& blurRadius = mModel->GetShadowBlurRadius();
if(underlineEnabled)
{
// Create the image buffer for underline
- Devel::PixelBuffer underlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_UNDERLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, numberOfGlyphs - 1);
+ Devel::PixelBuffer underlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_UNDERLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
// Combine the two buffers
imageBuffer = CombineImageBuffer(imageBuffer, underlineImageBuffer, bufferWidth, bufferHeight);
if(backgroundEnabled)
{
- backgroundImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_BACKGROUND, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, numberOfGlyphs - 1);
+ backgroundImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_BACKGROUND, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
}
else
{
// Retrieve lines, glyphs, positions and colors from the view model.
const Length modelNumberOfLines = mModel->GetNumberOfLines();
const LineRun* const modelLinesBuffer = mModel->GetLines();
- const Length numberOfGlyphs = mModel->GetNumberOfGlyphs();
const GlyphInfo* const glyphsBuffer = mModel->GetGlyphs();
const Vector2* const positionBuffer = mModel->GetLayout();
const Vector4* const colorsBuffer = mModel->GetColors();
const Length* hyphenIndices = mModel->GetHyphenIndices();
const Length hyphensCount = mModel->GetHyphensCount();
+ // Elided text info. Indices according to elided text and Ellipsis position.
+ const auto startIndexOfGlyphs = mModel->GetStartIndexOfElidedGlyphs();
+ const auto endIndexOfGlyphs = mModel->GetEndIndexOfElidedGlyphs();
+ const auto firstMiddleIndexOfElidedGlyphs = mModel->GetFirstMiddleIndexOfElidedGlyphs();
+ const auto secondMiddleIndexOfElidedGlyphs = mModel->GetSecondMiddleIndexOfElidedGlyphs();
+ const auto ellipsisPosition = mModel->GetEllipsisPosition();
+
// Whether to use the default color.
const bool useDefaultColor = (NULL == colorsBuffer);
const Vector4& defaultColor = mModel->GetDefaultColor();
bool addHyphen = false;
// Traverses the glyphs of the line.
- const GlyphIndex endGlyphIndex = std::min(numberOfGlyphs, line.glyphRun.glyphIndex + line.glyphRun.numberOfGlyphs);
- for(GlyphIndex glyphIndex = line.glyphRun.glyphIndex; glyphIndex < endGlyphIndex; ++glyphIndex)
+ const GlyphIndex startGlyphIndex = std::max(line.glyphRun.glyphIndex, startIndexOfGlyphs);
+ GlyphIndex endGlyphIndex = (line.isSplitToTwoHalves ? line.glyphRunSecondHalf.glyphIndex + line.glyphRunSecondHalf.numberOfGlyphs : line.glyphRun.glyphIndex + line.glyphRun.numberOfGlyphs) - 1u;
+ endGlyphIndex = std::min(endGlyphIndex, endIndexOfGlyphs);
+
+ for(GlyphIndex glyphIndex = startGlyphIndex; glyphIndex <= endGlyphIndex; ++glyphIndex)
{
if(glyphIndex < fromGlyphIndex || glyphIndex > toGlyphIndex)
{
continue;
}
+ //To handle START case of ellipsis, the first glyph has been shifted
+ //glyphIndex represent indices in whole glyphs but elidedGlyphIndex represents indices in elided Glyphs
+ GlyphIndex elidedGlyphIndex = glyphIndex - startIndexOfGlyphs;
+
+ //To handle MIDDLE case of ellipsis, the first glyph in the second half of line has been shifted and skip the removed glyph from middle.
+ if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ if(glyphIndex > firstMiddleIndexOfElidedGlyphs &&
+ glyphIndex < secondMiddleIndexOfElidedGlyphs)
+ {
+ // Ignore any glyph that removed for MIDDLE ellipsis
+ continue;
+ }
+ if(glyphIndex >= secondMiddleIndexOfElidedGlyphs)
+ {
+ elidedGlyphIndex -= (secondMiddleIndexOfElidedGlyphs - firstMiddleIndexOfElidedGlyphs - 1u);
+ }
+ }
+
// Retrieve the glyph's info.
const GlyphInfo* glyphInfo;
}
else
{
- glyphInfo = glyphsBuffer + glyphIndex;
+ glyphInfo = glyphsBuffer + elidedGlyphIndex;
}
if((glyphInfo->width < Math::MACHINE_EPSILON_1000) ||
} // underline
// Retrieves the glyph's position.
- Vector2 position = *(positionBuffer + glyphIndex);
+ Vector2 position = *(positionBuffer + elidedGlyphIndex);
if(addHyphen)
{
- GlyphInfo tempInfo = *(glyphsBuffer + glyphIndex);
+ GlyphInfo tempInfo = *(glyphsBuffer + elidedGlyphIndex);
position.x = position.x + tempInfo.advance - tempInfo.xBearing + glyphInfo->xBearing;
position.y = -glyphInfo->yBearing;
}
: mModel(model),
mElidedGlyphs(),
mElidedLayout(),
- mIsTextElided(false)
+ mIsTextElided(false),
+ mStartIndexOfElidedGlyphs(0u),
+ mEndIndexOfElidedGlyphs(0u),
+ mFirstMiddleIndexOfElidedGlyphs(0u),
+ mSecondMiddleIndexOfElidedGlyphs(0u)
{
}
return mModel->GetVerticalLineAlignment();
}
+DevelText::EllipsisPosition::Type ViewModel::GetEllipsisPosition() const
+{
+ return mModel->GetEllipsisPosition();
+}
+
bool ViewModel::IsTextElideEnabled() const
{
return mModel->IsTextElideEnabled();
return 0u;
}
+GlyphIndex ViewModel::GetStartIndexOfElidedGlyphs() const
+{
+ if(mIsTextElided && mModel->IsTextElideEnabled())
+ {
+ return mStartIndexOfElidedGlyphs;
+ }
+
+ return mModel->GetStartIndexOfElidedGlyphs();
+}
+
+GlyphIndex ViewModel::GetEndIndexOfElidedGlyphs() const
+{
+ if(mIsTextElided && mModel->IsTextElideEnabled())
+ {
+ return mEndIndexOfElidedGlyphs;
+ }
+
+ return mModel->GetEndIndexOfElidedGlyphs();
+}
+
+GlyphIndex ViewModel::GetFirstMiddleIndexOfElidedGlyphs() const
+{
+ if(mIsTextElided && mModel->IsTextElideEnabled())
+ {
+ return mFirstMiddleIndexOfElidedGlyphs;
+ }
+
+ return mModel->GetFirstMiddleIndexOfElidedGlyphs();
+}
+
+GlyphIndex ViewModel::GetSecondMiddleIndexOfElidedGlyphs() const
+{
+ if(mIsTextElided && mModel->IsTextElideEnabled())
+ {
+ return mSecondMiddleIndexOfElidedGlyphs;
+ }
+
+ return mModel->GetSecondMiddleIndexOfElidedGlyphs();
+}
+
const GlyphInfo* const ViewModel::GetGlyphs() const
{
if(mIsTextElided && mModel->IsTextElideEnabled())
void ViewModel::ElideGlyphs()
{
- mIsTextElided = false;
+ mIsTextElided = false;
+ mStartIndexOfElidedGlyphs = mFirstMiddleIndexOfElidedGlyphs = mSecondMiddleIndexOfElidedGlyphs = 0;
+ mEndIndexOfElidedGlyphs = mModel->GetNumberOfGlyphs() - 1u;
+
+ auto ellipsisPosition = GetEllipsisPosition();
- if(mModel->IsTextElideEnabled())
+ if(IsTextElideEnabled())
{
const Length numberOfLines = mModel->GetNumberOfLines();
if(0u != numberOfLines)
{
const LineRun* const lines = mModel->GetLines();
- const LineRun& lastLine = *(lines + (numberOfLines - 1u));
- const Length numberOfLaidOutGlyphs = lastLine.glyphRun.glyphIndex + lastLine.glyphRun.numberOfGlyphs;
+ //Get line of ellipsis
+ const LineRun* ellipsisLine = nullptr;
+ const LineRun* ellipsisNextLine = nullptr;
- if(lastLine.ellipsis && (0u != numberOfLaidOutGlyphs))
+ for(Length lineIndex = 0; lineIndex < numberOfLines; lineIndex++)
{
- mIsTextElided = true;
- TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ const LineRun* line = (lines + lineIndex);
+ if(line->ellipsis)
+ {
+ ellipsisLine = line;
+ if(lineIndex < numberOfLines - 1u)
+ {
+ ellipsisNextLine = (lines + lineIndex + 1u);
+ }
+ break;
+ }
+ }
- const GlyphInfo* const glyphs = mModel->GetGlyphs();
- const Vector2* const positions = mModel->GetLayout();
+ // Check if there is a line contains Ellipsis.
+ // Then find total number of glyphs and total number of laid out glyphs.
+ // Check where to set Ellipsis glyph in line.
+ // Determine index of Ellipsis glyph and how many glyphs should be replaced by Ellipsis glyph, according to width of Ellipsis glyph.
+ if(ellipsisLine != nullptr)
+ {
+ // Total number of glyphs.
+ const Length numberOfGlyphs = mModel->GetNumberOfGlyphs();
+ // Total number of laid out glyphs.
+ Length numberOfActualLaidOutGlyphs = 0u;
- // Copy the glyphs to be elided.
- mElidedGlyphs.Resize(numberOfLaidOutGlyphs);
- mElidedLayout.Resize(numberOfLaidOutGlyphs);
+ // Accumulate laid out glyphs for each line to find total number of laid out glyphs.
+ for(Length lineIndex = 0u; lineIndex < numberOfLines; lineIndex++)
+ {
+ numberOfActualLaidOutGlyphs += lines[lineIndex].glyphRun.numberOfGlyphs + lines[lineIndex].glyphRunSecondHalf.numberOfGlyphs;
+ }
- GlyphInfo* elidedGlyphsBuffer = mElidedGlyphs.Begin();
- Vector2* elidedPositionsBuffer = mElidedLayout.Begin();
+ // Make sure there are laid out glyphs.
+ if(0u != numberOfActualLaidOutGlyphs)
+ {
+ // There are elided glyphs.
+ mIsTextElided = true;
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
- memcpy(elidedGlyphsBuffer, glyphs, numberOfLaidOutGlyphs * sizeof(GlyphInfo));
- memcpy(elidedPositionsBuffer, positions, numberOfLaidOutGlyphs * sizeof(Vector2));
+ // Retrieve the whole glyphs and their positions.
+ const GlyphInfo* const glyphs = mModel->GetGlyphs();
+ const Vector2* const positions = mModel->GetLayout();
- const Size& controlSize = mModel->GetControlSize();
+ // Copy the glyphs to be elided.
+ mElidedGlyphs.Resize(numberOfGlyphs);
+ mElidedLayout.Resize(numberOfGlyphs);
+ GlyphInfo* elidedGlyphsBuffer = mElidedGlyphs.Begin();
+ Vector2* elidedPositionsBuffer = mElidedLayout.Begin();
- if((1u == numberOfLines) &&
- (lastLine.ascender - lastLine.descender > controlSize.height))
- {
- // Get the first glyph which is going to be replaced and the ellipsis glyph.
- GlyphInfo& glyphToRemove = *elidedGlyphsBuffer;
- const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph(fontClient.GetPointSize(glyphToRemove.fontId));
+ memcpy(elidedGlyphsBuffer, glyphs, numberOfGlyphs * sizeof(GlyphInfo));
+ memcpy(elidedPositionsBuffer, positions, numberOfGlyphs * sizeof(Vector2));
- // Change the 'x' and 'y' position of the ellipsis glyph.
- Vector2& position = *elidedPositionsBuffer;
+ const Size& controlSize = mModel->GetControlSize();
- position.x = ellipsisGlyph.xBearing;
- position.y = -lastLine.ascender + controlSize.height - ellipsisGlyph.yBearing;
+ // Set index where to set Ellipsis according to the selected position of Ellipsis.
+ // Start with this index to replace its glyph by Ellipsis, if the width is not enough, then remove more glyphs.
+ GlyphIndex startIndexOfEllipsis = 0u;
+ if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ // It's the fisrt glyph in line.
+ startIndexOfEllipsis = ellipsisLine->glyphRun.glyphIndex;
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ // It's the second middle of the line in case the line split to two halves.
+ // Otherwise it's It's the last glyph in line (line before all removed lines).
+ startIndexOfEllipsis = ellipsisLine->isSplitToTwoHalves ? (ellipsisLine->glyphRunSecondHalf.glyphIndex) : (ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u);
+ }
+ else // DevelText::EllipsisPosition::END
+ {
+ // It's the last glyph in line.
+ startIndexOfEllipsis = ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u;
+ }
- // Replace the glyph by the ellipsis glyph and resize the buffers.
- glyphToRemove = ellipsisGlyph;
+ // When the hight is not enough then show one glyph and that should be the first laid out glyph.
+ if((1u == numberOfLines) &&
+ (ellipsisLine->ascender - ellipsisLine->descender > controlSize.height))
+ {
+ // Replace the first glyph with ellipsis glyph
+ auto indexOfFirstGlyph = (ellipsisPosition == DevelText::EllipsisPosition::START) ? startIndexOfEllipsis : 0u;
- mElidedGlyphs.Resize(1u);
- mElidedLayout.Resize(1u);
+ // Regardless where the location of ellipsis,in-case the hight of line is greater than control's height
+ // then replace the first glyph with ellipsis glyph.
- return;
- }
+ // Get the first glyph which is going to be replaced and the ellipsis glyph.
+ GlyphInfo& glyphToRemove = *(elidedGlyphsBuffer + indexOfFirstGlyph);
+ const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph(fontClient.GetPointSize(glyphToRemove.fontId));
- // firstPenX, penY and firstPenSet are used to position the ellipsis glyph if needed.
- float firstPenX = 0.f; // Used if rtl text is elided.
- float penY = 0.f;
- bool firstPenSet = false;
+ // Change the 'x' and 'y' position of the ellipsis glyph.
+ Vector2& position = *(elidedPositionsBuffer + indexOfFirstGlyph);
- // Add the ellipsis glyph.
- bool inserted = false;
- float removedGlypsWidth = 0.f;
- Length numberOfRemovedGlyphs = 0u;
- GlyphIndex index = numberOfLaidOutGlyphs - 1u;
+ position.x = ellipsisGlyph.xBearing;
+ position.y = -ellipsisLine->ascender + controlSize.height - ellipsisGlyph.yBearing;
- // The ellipsis glyph has to fit in the place where the last glyph(s) is(are) removed.
- while(!inserted)
- {
- const GlyphInfo& glyphToRemove = *(elidedGlyphsBuffer + index);
+ // Replace the glyph by the ellipsis glyph and resize the buffers.
+ glyphToRemove = ellipsisGlyph;
- if(0u != glyphToRemove.fontId)
- {
- // i.e. The font id of the glyph shaped from the '\n' character is zero.
+ mElidedGlyphs.Resize(1u);
+ mElidedLayout.Resize(1u);
- // Need to reshape the glyph as the font may be different in size.
- const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph(fontClient.GetPointSize(glyphToRemove.fontId));
+ mEndIndexOfElidedGlyphs = mStartIndexOfElidedGlyphs = mFirstMiddleIndexOfElidedGlyphs = mSecondMiddleIndexOfElidedGlyphs = indexOfFirstGlyph;
+
+ return;
+ }
+
+ // firstPenX, penY and firstPenSet are used to position the ellipsis glyph if needed.
+ float firstPenX = 0.f; // Used if rtl text is elided.
+ float penY = 0.f;
+ bool firstPenSet = false;
+
+ // Add the ellipsis glyph.
+ bool inserted = false;
+ float removedGlypsWidth = 0.f;
+ Length numberOfRemovedGlyphs = 0u;
+ GlyphIndex indexOfEllipsis = startIndexOfEllipsis;
+
+ // Tail Mode: start by the end of line.
+ bool isTailMode = (ellipsisPosition == DevelText::EllipsisPosition::END) ||
+ (ellipsisPosition == DevelText::EllipsisPosition::MIDDLE && numberOfLines != 1u);
- if(!firstPenSet || EqualsZero(glyphToRemove.advance))
+ // The ellipsis glyph has to fit in the place where the last glyph(s) is(are) removed.
+ while(!inserted)
+ {
+ const GlyphInfo& glyphToRemove = *(elidedGlyphsBuffer + indexOfEllipsis);
+
+ if(0u != glyphToRemove.fontId)
{
- const Vector2& position = *(elidedPositionsBuffer + index);
+ // i.e. The font id of the glyph shaped from the '\n' character is zero.
- // Calculates the penY of the current line. It will be used to position the ellipsis glyph.
- penY = position.y + glyphToRemove.yBearing;
+ // Need to reshape the glyph as the font may be different in size.
+ const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph(fontClient.GetPointSize(glyphToRemove.fontId));
- // Calculates the first penX which will be used if rtl text is elided.
- firstPenX = position.x - glyphToRemove.xBearing;
- if(firstPenX < -ellipsisGlyph.xBearing)
+ if(!firstPenSet)
{
- // Avoids to exceed the bounding box when rtl text is elided.
- firstPenX = -ellipsisGlyph.xBearing;
- }
+ const Vector2& position = *(elidedPositionsBuffer + indexOfEllipsis);
- removedGlypsWidth = -ellipsisGlyph.xBearing;
+ // Calculates the penY of the current line. It will be used to position the ellipsis glyph.
+ penY = position.y + glyphToRemove.yBearing;
+
+ // Calculates the first penX which will be used if rtl text is elided.
+ firstPenX = position.x - glyphToRemove.xBearing;
+ if(firstPenX < -ellipsisGlyph.xBearing)
+ {
+ // Avoids to exceed the bounding box when rtl text is elided.
+ firstPenX = -ellipsisGlyph.xBearing;
+ }
+
+ removedGlypsWidth = -ellipsisGlyph.xBearing;
- if(!EqualsZero(firstPenX))
- {
firstPenSet = true;
}
- }
- removedGlypsWidth += std::min(glyphToRemove.advance, (glyphToRemove.xBearing + glyphToRemove.width));
+ removedGlypsWidth += std::min(glyphToRemove.advance, (glyphToRemove.xBearing + glyphToRemove.width));
- // Calculate the width of the ellipsis glyph and check if it fits.
- const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing;
+ // Calculate the width of the ellipsis glyph and check if it fits.
+ const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing;
- // If it is the last glyph to remove, add the ellipsis glyph without checking its width.
- if((ellipsisGlyphWidth < removedGlypsWidth) || (index == 0u))
- {
- GlyphInfo& glyphInfo = *(elidedGlyphsBuffer + index);
- Vector2& position = *(elidedPositionsBuffer + index);
- position.x -= (0.f > glyphInfo.xBearing) ? glyphInfo.xBearing : 0.f;
+ // If it is the last glyph to remove, add the ellipsis glyph without checking its width.
+ if((ellipsisGlyphWidth < removedGlypsWidth) || (isTailMode ? (indexOfEllipsis == 0u) : (indexOfEllipsis == numberOfGlyphs - 1u)))
+ {
+ GlyphInfo& glyphInfo = *(elidedGlyphsBuffer + indexOfEllipsis);
+ Vector2& position = *(elidedPositionsBuffer + indexOfEllipsis);
+ position.x -= (0.f > glyphInfo.xBearing) ? glyphInfo.xBearing : 0.f;
- // Replace the glyph by the ellipsis glyph.
- glyphInfo = ellipsisGlyph;
+ // Replace the glyph by the ellipsis glyph.
+ glyphInfo = ellipsisGlyph;
- // Change the 'x' and 'y' position of the ellipsis glyph.
- if(position.x > firstPenX)
- {
- position.x = firstPenX;
- if(ellipsisGlyphWidth < removedGlypsWidth)
+ // Change the 'x' and 'y' position of the ellipsis glyph.
+ if(position.x > firstPenX)
{
- position.x += removedGlypsWidth - ellipsisGlyphWidth;
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
}
- }
- position.x += ellipsisGlyph.xBearing;
- position.y = penY - ellipsisGlyph.yBearing;
+ position.x += ellipsisGlyph.xBearing;
+ position.y = penY - ellipsisGlyph.yBearing;
- inserted = true;
+ inserted = true;
+ }
}
- }
- if(!inserted)
+ if(!inserted)
+ {
+ if(!isTailMode && indexOfEllipsis < numberOfGlyphs - 1u)
+ {
+ // Tail Mode: remove glyphs from startIndexOfEllipsis then decrement indexOfEllipsis, until arrive to index zero.
+ ++indexOfEllipsis;
+ }
+ else if(isTailMode && indexOfEllipsis > 0u)
+ {
+ // Not Tail Mode: remove glyphs from startIndexOfEllipsis then increase indexOfEllipsis, until arrive to last index (numberOfGlyphs - 1u).
+ --indexOfEllipsis;
+ }
+ else
+ {
+ // No space for the ellipsis.
+ inserted = true;
+ }
+ ++numberOfRemovedGlyphs;
+ }
+ } // while( !inserted )
+
+ //Reduce size, shift glyphs and start from ellipsis glyph
+ Length numberOfElidedGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+ mElidedGlyphs.Resize(numberOfElidedGlyphs);
+ mElidedLayout.Resize(numberOfElidedGlyphs);
+
+ if(ellipsisPosition == DevelText::EllipsisPosition::START)
{
- if(index > 0u)
+ // 'Shifts' glyphs after ellipsis glyph and 'Removes' before ellipsis glyph
+ memcpy(elidedGlyphsBuffer, elidedGlyphsBuffer + indexOfEllipsis, numberOfElidedGlyphs * sizeof(GlyphInfo));
+ memcpy(elidedPositionsBuffer, elidedPositionsBuffer + indexOfEllipsis, numberOfElidedGlyphs * sizeof(Vector2));
+
+ mStartIndexOfElidedGlyphs = mFirstMiddleIndexOfElidedGlyphs = mSecondMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ // 'Shifts and connects' glyphs before and after ellipsis glyph and 'Removes' in-between.
+ bool isOnlySecondHalf = false;
+
+ if(isTailMode)
+ {
+ mFirstMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ if(ellipsisNextLine != nullptr)
+ {
+ mSecondMiddleIndexOfElidedGlyphs = ellipsisNextLine->glyphRun.glyphIndex;
+ }
+ else
+ {
+ mEndIndexOfElidedGlyphs = mSecondMiddleIndexOfElidedGlyphs = mFirstMiddleIndexOfElidedGlyphs;
+ }
+ }
+ else
{
- --index;
+ mFirstMiddleIndexOfElidedGlyphs = (ellipsisLine->glyphRun.numberOfGlyphs > 0u) ? (ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u) : (ellipsisLine->glyphRun.glyphIndex);
+ mSecondMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ isOnlySecondHalf = ellipsisLine->glyphRun.numberOfGlyphs == 0u && ellipsisLine->glyphRunSecondHalf.numberOfGlyphs > 0u;
+ }
+
+ if(isOnlySecondHalf)
+ {
+ Length numberOfSecondHalfGlyphs = numberOfElidedGlyphs - mFirstMiddleIndexOfElidedGlyphs;
+
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(elidedGlyphsBuffer + mFirstMiddleIndexOfElidedGlyphs, elidedGlyphsBuffer + mSecondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(GlyphInfo));
+ memcpy(elidedPositionsBuffer + mFirstMiddleIndexOfElidedGlyphs, elidedPositionsBuffer + mSecondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(Vector2));
}
else
{
- // No space for the ellipsis.
- inserted = true;
+ Length numberOfSecondHalfGlyphs = numberOfElidedGlyphs - mFirstMiddleIndexOfElidedGlyphs + 1u;
+
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(elidedGlyphsBuffer + mFirstMiddleIndexOfElidedGlyphs + 1u, elidedGlyphsBuffer + mSecondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(GlyphInfo));
+ memcpy(elidedPositionsBuffer + mFirstMiddleIndexOfElidedGlyphs + 1u, elidedPositionsBuffer + mSecondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(Vector2));
}
- ++numberOfRemovedGlyphs;
}
- } // while( !inserted )
-
- // 'Removes' all the glyphs after the ellipsis glyph.
- const Length numberOfGlyphs = numberOfLaidOutGlyphs - numberOfRemovedGlyphs;
- mElidedGlyphs.Resize(numberOfGlyphs);
- mElidedLayout.Resize(numberOfGlyphs);
+ else // DevelText::EllipsisPosition::END
+ {
+ // 'Removes' all the glyphs after the ellipsis glyph.
+ mEndIndexOfElidedGlyphs = indexOfEllipsis;
+ }
+ }
}
}
}
Text::VerticalAlignment::Type GetVerticalAlignment() const override;
/**
- * @copydoc ModelInterface::GetVerticalLineAlignment()
- */
+ * @copydoc ModelInterface::GetVerticalLineAlignment()
+ */
DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const override;
/**
+ * @copydoc ModelInterface::GetEllipsisPosition()
+ */
+ DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
+
+ /**
* @copydoc ModelInterface::IsTextElideEnabled()
*/
bool IsTextElideEnabled() const override;
Length GetNumberOfGlyphs() const override;
/**
+ * @copydoc ModelInterface::GetStartIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetStartIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc ModelInterface::GetEndIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetEndIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc ModelInterface::GetFirstMiddleIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc ModelInterface::GetSecondMiddleIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
+
+ /**
* @copydoc ModelInterface::GetGlyphs()
*/
const GlyphInfo* const GetGlyphs() const override;
Length GetHyphensCount() const override;
/**
- * @brief Does the text elide.
+ * @brief Does the text elide at the end, start or middle of text according to ellipsis position
*
* It stores a copy of the visible glyphs and removes as many glyphs as needed
- * from the last visible line to add the ellipsis glyph.
+ * from the last visible line to add the ellipsis glyph in END case,
+ * from the first visible line to add the ellipsis glyph in START case,
+ * between the first and last visible lines to add the ellipsis glyph.
*
* It stores as well a copy of the positions for each visible glyph.
*/
void ElideGlyphs();
private:
- const ModelInterface* const mModel; ///< Pointer to the text's model.
- Vector<GlyphInfo> mElidedGlyphs; ///< Stores the glyphs of the elided text.
- Vector<Vector2> mElidedLayout; ///< Stores the positions of each glyph of the elided text.
- bool mIsTextElided : 1; ///< Whether the text has been elided.
+ const ModelInterface* const mModel; ///< Pointer to the text's model.
+ Vector<GlyphInfo> mElidedGlyphs; ///< Stores the glyphs of the elided text.
+ Vector<Vector2> mElidedLayout; ///< Stores the positions of each glyph of the elided text.
+ bool mIsTextElided : 1; ///< Whether the text has been elided.
+ GlyphIndex mStartIndexOfElidedGlyphs; ///< The start index of elided glyphs.
+ GlyphIndex mEndIndexOfElidedGlyphs; ///< The end index of elided glyphs.
+ GlyphIndex mFirstMiddleIndexOfElidedGlyphs; ///< The first end index of elided glyphs, index before ellipsis of middle.
+ GlyphIndex mSecondMiddleIndexOfElidedGlyphs; ///< The second end index of elided glyphs, index of ellipsis of middle.
};
} // namespace Text
// Update the ellipsis
bool elideTextEnabled = impl.mModel->mElideEnabled;
+ auto ellipsisPosition = impl.mModel->mEllipsisPosition;
if(NULL != impl.mEventData)
{
viewUpdated = impl.mLayoutEngine.LayoutText(layoutParameters,
newLayoutSize,
elideTextEnabled,
- isAutoScrollEnabled);
+ isAutoScrollEnabled,
+ ellipsisPosition);
impl.mIsAutoScrollEnabled = isAutoScrollEnabled;
viewUpdated = viewUpdated || (newLayoutSize != layoutSize);
void Controller::SetTextElideEnabled(bool enabled)
{
mImpl->mModel->mElideEnabled = enabled;
+ mImpl->mModel->mVisualModel->SetTextElideEnabled(enabled);
}
bool Controller::IsTextElideEnabled() const
mImpl->mModel->mVerticalLineAlignment = alignment;
}
+Toolkit::DevelText::EllipsisPosition::Type Controller::GetEllipsisPosition() const
+{
+ return mImpl->mModel->GetEllipsisPosition();
+}
+
+void Controller::SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition)
+{
+ mImpl->mModel->mEllipsisPosition = ellipsisPosition;
+ mImpl->mModel->mVisualModel->SetEllipsisPosition(ellipsisPosition);
+}
+
// public : Relayout.
Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection)
void SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignment::Type alignment);
/**
+ * @brief Retrieves ellipsis position
+ * @return The ellipsis position
+ */
+ Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
+
+ /**
+ * @brief Sets ellipsis position
+ * @param[in] ellipsisPosition The ellipsis position for the text
+ */
+ void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
+
+ /**
* @brief Retrieves ignoreSpaceAfterText value from model
* @return The value of ignoreSpaceAfterText
*/
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Text::LineWrap, WORD)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::Text::LineWrap, CHARACTER)
DALI_ENUM_TO_STRING_TABLE_END(LINE_WRAP_MODE)
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN(ELLIPSIS_POSITION_TYPE)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::DevelText::EllipsisPosition, END)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::DevelText::EllipsisPosition, START)
+ DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::DevelText::EllipsisPosition, MIDDLE)
+DALI_ENUM_TO_STRING_TABLE_END(ELLIPSIS_POSITION_TYPE)
+
} // namespace
bool GetHorizontalAlignmentEnumeration(const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment)
VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT);
}
+bool GetEllipsisPositionTypeEnumeration(const Property::Value& propertyValue, Toolkit::DevelText::EllipsisPosition::Type& ellipsisPositionType)
+{
+ return Scripting::GetEnumerationProperty(propertyValue, ELLIPSIS_POSITION_TYPE_TABLE, ELLIPSIS_POSITION_TYPE_TABLE_COUNT, ellipsisPositionType);
+}
+
} // namespace Text
} // namespace Toolkit
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/text-enumerations.h>
+// DEVEL INCLUDES
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
namespace Dali
{
namespace Toolkit
*/
const char* GetVerticalAlignmentString(const Toolkit::Text::VerticalAlignment::Type& alignment);
+/**
+ * @brief Get the ellipsis-location-type from the provided property value.
+ * @param[in] propertyValue The source value (which can be a Property::INTEGER or Property::STRING type)
+ * @param[out] ellipsisPositionType The resulting ellipsisPositionType from the given source
+ * @return true if the resulting ellipsisPositionType has been updated
+ */
+bool GetEllipsisPositionTypeEnumeration(const Property::Value& propertyValue, Toolkit::DevelText::EllipsisPosition::Type& ellipsisPositionType);
+
} // namespace Text
} // namespace Toolkit
virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const = 0;
/**
+ * @brief Retrieves ellipsis position for text.
+ *
+ * @return The ellipsis position.
+ */
+ virtual DevelText::EllipsisPosition::Type GetEllipsisPosition() const = 0;
+
+ /**
* @brief Whether the text elide property is enabled.
*
* @return @e true if the text elide property is enabled, @e false otherwise.
virtual Length GetNumberOfGlyphs() const = 0;
/**
+ * @brief Retrieves the start index of laid-out glyphs.
+ *
+ * @return The start index of laid-out glyphs.
+ */
+ virtual GlyphIndex GetStartIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the end index of laid-out glyphs.
+ *
+ * @return The end index of laid-out glyphs.
+ */
+ virtual GlyphIndex GetEndIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the first middle index of elided glyphs, index before ellipsis of middle.
+ *
+ * @return The first middle index of elided glyphs, index before ellipsis of middle.
+ */
+ virtual GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the second middle index of elided glyphs, index of ellipsis of middle.
+ *
+ * @return The second middle index of elided glyphs, index of ellipsis of middle.
+ */
+ virtual GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const = 0;
+
+ /**
* @brief Retrieves the laid-out glyphs.
*
* @return A pointer to the vector with the laid-out glyphs.
return mVerticalLineAlignment;
}
+DevelText::EllipsisPosition::Type Model::GetEllipsisPosition() const
+{
+ return mEllipsisPosition;
+}
+
bool Model::IsTextElideEnabled() const
{
return mElideEnabled;
return mVisualModel->mGlyphs.Count();
}
+GlyphIndex Model::GetStartIndexOfElidedGlyphs() const
+{
+ return mVisualModel->GetStartIndexOfElidedGlyphs();
+}
+
+GlyphIndex Model::GetEndIndexOfElidedGlyphs() const
+{
+ return mVisualModel->GetEndIndexOfElidedGlyphs();
+}
+
+GlyphIndex Model::GetFirstMiddleIndexOfElidedGlyphs() const
+{
+ return mVisualModel->GetFirstMiddleIndexOfElidedGlyphs();
+}
+
+GlyphIndex Model::GetSecondMiddleIndexOfElidedGlyphs() const
+{
+ return mVisualModel->GetSecondMiddleIndexOfElidedGlyphs();
+}
+
const GlyphInfo* const Model::GetGlyphs() const
{
return mVisualModel->mGlyphs.Begin();
mAlignmentOffset(0.0f),
mElideEnabled(false),
mIgnoreSpacesAfterText(true),
- mMatchLayoutDirection(DevelText::MatchLayoutDirection::INHERIT)
+ mMatchLayoutDirection(DevelText::MatchLayoutDirection::INHERIT),
+ mEllipsisPosition(DevelText::EllipsisPosition::END)
{
mLogicalModel = LogicalModel::New();
mVisualModel = VisualModel::New();
DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const override;
/**
+ * @copydoc ModelInterface::GetEllipsisPosition()
+ */
+ DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
+
+ /**
* @copydoc ModelInterface::IsTextElideEnabled()
*/
bool IsTextElideEnabled() const override;
Length GetNumberOfGlyphs() const override;
/**
+ * @copydoc ModelInterface::GetStartIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetStartIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc ModelInterface::GetEndIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetEndIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc ModelInterface::GetFirstMiddleIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc ModelInterface::GetSecondMiddleIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
+
+ /**
* @copydoc ModelInterface::GetGlyphs()
*/
const GlyphInfo* const GetGlyphs() const override;
bool mElideEnabled : 1; ///< Whether the text's elide is enabled.
bool mIgnoreSpacesAfterText : 1; ///< Whether ignoring spaces after text or not. Default is true.
DevelText::MatchLayoutDirection mMatchLayoutDirection; ///< Whether to match text alignment with layout direction or not.
+ DevelText::EllipsisPosition::Type mEllipsisPosition; ///< Where is the location the text elide
};
} // namespace Text
*/
// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
#include <dali-toolkit/internal/text/text-definitions.h>
namespace Dali
* @return The width of the outline.
*/
virtual uint16_t GetOutlineWidth() const = 0;
+
+ /**
+ * @brief Retrieves ellipsis position for text.
+ *
+ * @return The ellipsis position.
+ */
+ virtual DevelText::EllipsisPosition::Type GetEllipsisPosition() const = 0;
+
+ /**
+ * @brief Whether the text elide property is enabled.
+ *
+ * @return @e true if the text elide property is enabled, @e false otherwise.
+ */
+ virtual bool IsTextElideEnabled() const = 0;
+
+ /**
+ * @brief Retrieves the start index of laid-out glyphs.
+ *
+ * @return The start index of laid-out glyphs.
+ */
+ virtual GlyphIndex GetStartIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the end index of laid-out glyphs.
+ *
+ * @return The end index of laid-out glyphs.
+ */
+ virtual GlyphIndex GetEndIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the first middle index of elided glyphs, index before ellipsis of middle.
+ *
+ * @return The first middle index of elided glyphs, index before ellipsis of middle.
+ */
+ virtual GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the second middle index of elided glyphs, index of ellipsis of middle.
+ *
+ * @return The second middle index of elided glyphs, index of ellipsis of middle.
+ */
+ virtual GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const = 0;
};
} // namespace Text
// EXTERNAL INCLUDES
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/public-api/math/vector2.h>
+#include <memory.h>
namespace Dali
{
GlyphIndex glyphIndex,
Length numberOfGlyphs) const
{
- Length numberOfLaidOutGlyphs = 0u;
+ Length numberOfLaidOutGlyphs = 0u;
+ Length numberOfActualLaidOutGlyphs = 0u;
if(mImpl->mVisualModel)
{
+ bool textElided = false;
+ DevelText::EllipsisPosition::Type ellipsisPosition = GetEllipsisPosition();
+
+ //Reset indices of ElidedGlyphs
+ mImpl->mVisualModel->SetStartIndexOfElidedGlyphs(0u);
+ mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(numberOfGlyphs);
+ mImpl->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(0u);
+ mImpl->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(0u);
+
// If ellipsis is enabled, the number of glyphs the layout engine has laid out may be less than 'numberOfGlyphs'.
// Check the last laid out line to know if the layout engine elided some text.
const Length numberOfLines = mImpl->mVisualModel->mLines.Count();
if(numberOfLines > 0u)
{
- const LineRun& lastLine = *(mImpl->mVisualModel->mLines.Begin() + (numberOfLines - 1u));
+ const LineRun* const lines = mImpl->mVisualModel->mLines.Begin();
+
+ //Get line of ellipsis
+ const LineRun* ellipsisLine = nullptr;
+ const LineRun* ellipsisNextLine = nullptr;
+ bool hasEllipsis = false;
+ for(Length lineIndex = 0; lineIndex < numberOfLines; lineIndex++)
+ {
+ const LineRun* line = (lines + lineIndex);
+ if(line->ellipsis)
+ {
+ ellipsisLine = line;
+ hasEllipsis = true;
+ if(lineIndex < numberOfLines - 1u)
+ {
+ ellipsisNextLine = (lines + lineIndex + 1u);
+ }
+ break;
+ }
+ }
// If ellipsis is enabled, calculate the number of laid out glyphs.
// Otherwise use the given number of glyphs.
- if(lastLine.ellipsis)
+ if(hasEllipsis)
{
- numberOfLaidOutGlyphs = lastLine.glyphRun.glyphIndex + lastLine.glyphRun.numberOfGlyphs;
+ textElided = true;
+ numberOfLaidOutGlyphs = numberOfGlyphs;
+
+ if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ numberOfActualLaidOutGlyphs = numberOfGlyphs - ellipsisLine->glyphRun.glyphIndex;
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ numberOfActualLaidOutGlyphs = 0u;
+ for(Length lineIndex = 0u; lineIndex < numberOfLines; lineIndex++)
+ {
+ numberOfActualLaidOutGlyphs += lines[lineIndex].glyphRun.numberOfGlyphs + lines[lineIndex].glyphRunSecondHalf.numberOfGlyphs;
+ }
+ }
+ else // DevelText::EllipsisPosition::END
+ {
+ numberOfActualLaidOutGlyphs = ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs;
+ }
}
else
{
- numberOfLaidOutGlyphs = numberOfGlyphs;
+ numberOfActualLaidOutGlyphs = numberOfLaidOutGlyphs = numberOfGlyphs;
}
- if(0u < numberOfLaidOutGlyphs)
+ if(0u < numberOfActualLaidOutGlyphs)
{
// Retrieve from the visual model the glyphs and positions.
mImpl->mVisualModel->GetGlyphs(glyphs,
// Get the lines for the given range of glyphs.
// The lines contain the alignment offset which needs to be added to the glyph's position.
- LineIndex firstLine = 0u;
- Length numberOfLines = 0u;
+ LineIndex firstLineIndex = 0u;
+ Length numberOfLines = 0u;
mImpl->mVisualModel->GetNumberOfLines(glyphIndex,
numberOfLaidOutGlyphs,
- firstLine,
+ firstLineIndex,
numberOfLines);
Vector<LineRun> lines;
numberOfLaidOutGlyphs);
// Get the first line for the given glyph range.
- LineIndex lineIndex = firstLine;
+ LineIndex lineIndex = firstLineIndex;
LineRun* line = lineBuffer + lineIndex;
// Index of the last glyph of the line.
- GlyphIndex lastGlyphIndexOfLine = line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs - 1u;
+ GlyphIndex lastGlyphIndexOfLine = (line->isSplitToTwoHalves ? line->glyphRunSecondHalf.glyphIndex + line->glyphRunSecondHalf.numberOfGlyphs : line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs) - 1u;
// Add the alignment offset to the glyph's position.
line = lineBuffer + lineIndex;
minLineOffset = std::min(minLineOffset, line->alignmentOffset);
- lastGlyphIndexOfLine = line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs - 1u;
+ lastGlyphIndexOfLine = (line->isSplitToTwoHalves ? line->glyphRunSecondHalf.glyphIndex + line->glyphRunSecondHalf.numberOfGlyphs : line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs) - 1u;
penY += line->ascender;
}
}
}
+ // Set index where to set Ellipsis according to the selected position of Ellipsis.
+ // Start with this index to replace its glyph by Ellipsis, if the width is not enough, then remove more glyphs.
+ GlyphIndex startIndexOfEllipsis = 0u;
+ if(hasEllipsis)
+ {
+ if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ // It's the fisrt glyph in line.
+ startIndexOfEllipsis = ellipsisLine->glyphRun.glyphIndex;
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ // It's the second middle of the line in case the line split to two halves.
+ // Otherwise it's It's the last glyph in line (line before all removed lines).
+ startIndexOfEllipsis = ellipsisLine->isSplitToTwoHalves ? (ellipsisLine->glyphRunSecondHalf.glyphIndex) : (ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u);
+ }
+ else // DevelText::EllipsisPosition::END
+ {
+ // It's the last glyph in line.
+ startIndexOfEllipsis = ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u;
+ }
+ }
+
if(1u == numberOfLaidOutGlyphs)
{
// not a point try to do ellipsis with only one laid out character.
+
return numberOfLaidOutGlyphs;
}
- if(lastLine.ellipsis)
+ if(textElided)
{
+ const LineRun& elidedLine = *ellipsisLine;
+
if((1u == numberOfLines) &&
- (lastLine.ascender - lastLine.descender > mImpl->mVisualModel->mControlSize.height))
+ (elidedLine.ascender - elidedLine.descender > mImpl->mVisualModel->mControlSize.height))
{
+ // Replace the first glyph with ellipsis glyph
+ auto indexOfFirstGlyph = (ellipsisPosition == DevelText::EllipsisPosition::START) ? startIndexOfEllipsis : 0u;
+
+ // Regardless where the location of ellipsis,in-case the hight of line is greater than control's height
+ // then replace the first glyph with ellipsis glyph.
+
// Get the first glyph which is going to be replaced and the ellipsis glyph.
- GlyphInfo& glyphInfo = *glyphs;
+ GlyphInfo& glyphInfo = *(glyphs + indexOfFirstGlyph);
const GlyphInfo& ellipsisGlyph = mImpl->mFontClient.GetEllipsisGlyph(mImpl->mFontClient.GetPointSize(glyphInfo.fontId));
// Change the 'x' and 'y' position of the ellipsis glyph.
- Vector2& position = *glyphPositions;
+ Vector2& position = *(glyphPositions + indexOfFirstGlyph);
position.x = ellipsisGlyph.xBearing;
position.y = mImpl->mVisualModel->mControlSize.height - ellipsisGlyph.yBearing;
// Replace the glyph by the ellipsis glyph.
glyphInfo = ellipsisGlyph;
- return 1u;
+ mImpl->mVisualModel->SetStartIndexOfElidedGlyphs(indexOfFirstGlyph);
+ mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(indexOfFirstGlyph);
+ mImpl->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(indexOfFirstGlyph);
+ mImpl->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(indexOfFirstGlyph);
+
+ numberOfLaidOutGlyphs = 1u;
+
+ return numberOfLaidOutGlyphs;
}
// firstPenX, penY and firstPenSet are used to position the ellipsis glyph if needed.
bool inserted = false;
float removedGlypsWidth = 0.f;
Length numberOfRemovedGlyphs = 0u;
- GlyphIndex index = numberOfLaidOutGlyphs - 1u;
+ GlyphIndex indexOfEllipsis = startIndexOfEllipsis;
+
+ // Tail Mode: start by the end of line.
+ const bool isTailMode = ellipsisPosition == DevelText::EllipsisPosition::END ||
+ (ellipsisPosition == DevelText::EllipsisPosition::MIDDLE && numberOfLines != 1u);
// The ellipsis glyph has to fit in the place where the last glyph(s) is(are) removed.
while(!inserted)
{
- const GlyphInfo& glyphToRemove = *(glyphs + index);
+ const GlyphInfo& glyphToRemove = *(glyphs + indexOfEllipsis);
if(0u != glyphToRemove.fontId)
{
if(!firstPenSet)
{
- const Vector2& position = *(glyphPositions + index);
+ const Vector2& position = *(glyphPositions + indexOfEllipsis);
// Calculates the penY of the current line. It will be used to position the ellipsis glyph.
penY = position.y + glyphToRemove.yBearing;
// Calculate the width of the ellipsis glyph and check if it fits.
const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing;
- if(ellipsisGlyphWidth < removedGlypsWidth)
+ if((ellipsisGlyphWidth < removedGlypsWidth) || (isTailMode ? (indexOfEllipsis == 0u) : (indexOfEllipsis == numberOfGlyphs - 1u)))
{
- GlyphInfo& glyphInfo = *(glyphs + index);
- Vector2& position = *(glyphPositions + index);
+ GlyphInfo& glyphInfo = *(glyphs + indexOfEllipsis);
+ Vector2& position = *(glyphPositions + indexOfEllipsis);
position.x -= (0.f > glyphInfo.xBearing) ? glyphInfo.xBearing : 0.f;
// Replace the glyph by the ellipsis glyph.
if(!inserted)
{
- if(index > 0u)
+ if(isTailMode && indexOfEllipsis > 0u)
{
- --index;
+ // Tail Mode: remove glyphs from startIndexOfEllipsis then decrement indexOfEllipsis, until arrive to index zero.
+ --indexOfEllipsis;
+ }
+ else if(!isTailMode && indexOfEllipsis < numberOfLaidOutGlyphs - 1u)
+ {
+ // Not Tail Mode: remove glyphs from startIndexOfEllipsis then increase indexOfEllipsis, until arrive to last index (numberOfGlyphs - 1u).
+ ++indexOfEllipsis;
}
else
{
}
// 'Removes' all the glyphs after the ellipsis glyph.
- numberOfLaidOutGlyphs -= numberOfRemovedGlyphs;
+ if(ellipsisPosition == DevelText::EllipsisPosition::MIDDLE)
+ {
+ //Reduce size, shift glyphs and start from ellipsis glyph
+ numberOfLaidOutGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+
+ GlyphIndex firstMiddleIndexOfElidedGlyphs = 0u;
+ GlyphIndex secondMiddleIndexOfElidedGlyphs = 0u;
+
+ bool isOnlySecondHalf = false;
+ if(isTailMode)
+ {
+ // Multi-lines case with MIDDLE
+ // In case the Ellipsis in the end of line,
+ // then this index will be the firstMiddleIndex.
+ // The secondMiddleIndex will be the fisrt index in next line.
+ // But in case there is no line after Ellipsis's line then secondMiddleIndex and endIndex equal firstMiddle
+ // Example:
+ // A: are laid out glyphs in line has Ellipsis in the end.
+ // N: are laid out glyphs in lines after removed lines.
+ // R: are removed glyphs.
+ // L: are removed glyphs when removed lines.
+ // AAAAAAAAAAAA...RRR => Here's the firstMiddleIndex (First index after last A)
+ // LLLLLLLLLLLLLLL
+ // LLLLLLLLLLLLLLL
+ // NNNNNNNNNNNNNN => Here's the secondMiddleIndex (First N)
+ // NNNNNNNNNN
+
+ firstMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ if(ellipsisNextLine != nullptr)
+ {
+ secondMiddleIndexOfElidedGlyphs = ellipsisNextLine->glyphRun.glyphIndex;
+ }
+ else
+ {
+ secondMiddleIndexOfElidedGlyphs = firstMiddleIndexOfElidedGlyphs;
+ mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(firstMiddleIndexOfElidedGlyphs);
+ }
+ }
+ else
+ {
+ // Single line case with MIDDLE
+ // In case the Ellipsis in the middle of line,
+ // Then the last index in first half will be firstMiddleIndex.
+ // And the indexOfEllipsis will be secondMiddleIndex, which is the first index in second half.
+ // Example:
+ // A: are laid out glyphs in first half of line.
+ // N: are laid out glyphs in second half of line.
+ // R: are removed glyphs.
+ // L: re removed glyphs when layouting text
+ // AAAAAAALLLLLLLLLLLRRR...NNNNN
+ // firstMiddleIndex (index of last A)
+ // secondMiddleIndex (index before first N)
+
+ firstMiddleIndexOfElidedGlyphs = (ellipsisLine->glyphRun.numberOfGlyphs > 0u) ? (ellipsisLine->glyphRun.glyphIndex + ellipsisLine->glyphRun.numberOfGlyphs - 1u) : (ellipsisLine->glyphRun.glyphIndex);
+ secondMiddleIndexOfElidedGlyphs = indexOfEllipsis;
+ isOnlySecondHalf = ellipsisLine->glyphRun.numberOfGlyphs == 0u && ellipsisLine->glyphRunSecondHalf.numberOfGlyphs > 0u;
+ }
+
+ mImpl->mVisualModel->SetFirstMiddleIndexOfElidedGlyphs(firstMiddleIndexOfElidedGlyphs);
+ mImpl->mVisualModel->SetSecondMiddleIndexOfElidedGlyphs(secondMiddleIndexOfElidedGlyphs);
+
+ // The number of shifted glyphs and shifting positions will be different according to Single-line or Multi-lines.
+ // isOnlySecondHalf will be true when MIDDLE Ellipsis glyph in single line.
+ if(isOnlySecondHalf)
+ {
+ Length numberOfSecondHalfGlyphs = numberOfLaidOutGlyphs - firstMiddleIndexOfElidedGlyphs;
+
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(glyphs + firstMiddleIndexOfElidedGlyphs, glyphs + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(GlyphInfo));
+ memcpy(glyphPositions + firstMiddleIndexOfElidedGlyphs, glyphPositions + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(Vector2));
+ }
+ else
+ {
+ Length numberOfSecondHalfGlyphs = numberOfLaidOutGlyphs - firstMiddleIndexOfElidedGlyphs + 1u;
+
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(glyphs + firstMiddleIndexOfElidedGlyphs + 1u, glyphs + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(GlyphInfo));
+ memcpy(glyphPositions + firstMiddleIndexOfElidedGlyphs + 1u, glyphPositions + secondMiddleIndexOfElidedGlyphs, numberOfSecondHalfGlyphs * sizeof(Vector2));
+ }
+ }
+ else if(ellipsisPosition == DevelText::EllipsisPosition::START)
+ {
+ numberOfLaidOutGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+ //Copy elided glyphs after the ellipsis glyph.
+ memcpy(glyphs, glyphs + startIndexOfEllipsis + numberOfRemovedGlyphs, numberOfLaidOutGlyphs * sizeof(GlyphInfo));
+ memcpy(glyphPositions, glyphPositions + startIndexOfEllipsis + numberOfRemovedGlyphs, numberOfLaidOutGlyphs * sizeof(Vector2));
+ mImpl->mVisualModel->SetStartIndexOfElidedGlyphs(indexOfEllipsis);
+ }
+ else // DevelText::EllipsisPosition::END
+ {
+ numberOfLaidOutGlyphs = numberOfActualLaidOutGlyphs - numberOfRemovedGlyphs;
+ mImpl->mVisualModel->SetEndIndexOfElidedGlyphs(indexOfEllipsis);
+ }
}
}
}
return 0u;
}
+DevelText::EllipsisPosition::Type View::GetEllipsisPosition() const
+{
+ DevelText::EllipsisPosition::Type ellipsisPosition = DevelText::EllipsisPosition::END;
+ if(mImpl->mVisualModel)
+ {
+ const VisualModel& model = *mImpl->mVisualModel;
+ ellipsisPosition = model.GetEllipsisPosition();
+ }
+
+ return ellipsisPosition;
+}
+
+bool View::IsTextElideEnabled() const
+{
+ bool isTextElideEnabled = false;
+
+ if(mImpl->mVisualModel)
+ {
+ const VisualModel& model = *mImpl->mVisualModel;
+ isTextElideEnabled = model.IsTextElideEnabled();
+ }
+
+ return isTextElideEnabled;
+}
+
+GlyphIndex View::GetStartIndexOfElidedGlyphs() const
+{
+ GlyphIndex startIndexOfElidedGlyphs = 0u;
+
+ if(mImpl->mVisualModel)
+ {
+ const VisualModel& model = *mImpl->mVisualModel;
+ startIndexOfElidedGlyphs = model.GetStartIndexOfElidedGlyphs();
+ }
+
+ return startIndexOfElidedGlyphs;
+}
+
+GlyphIndex View::GetEndIndexOfElidedGlyphs() const
+{
+ GlyphIndex endIndexOfElidedGlyphs = 0u;
+
+ if(mImpl->mVisualModel)
+ {
+ const VisualModel& model = *mImpl->mVisualModel;
+ endIndexOfElidedGlyphs = model.GetEndIndexOfElidedGlyphs();
+ }
+
+ return endIndexOfElidedGlyphs;
+}
+
+GlyphIndex View::GetFirstMiddleIndexOfElidedGlyphs() const
+{
+ GlyphIndex firstMiddleIndexOfElidedGlyphs = 0u;
+
+ if(mImpl->mVisualModel)
+ {
+ const VisualModel& model = *mImpl->mVisualModel;
+ firstMiddleIndexOfElidedGlyphs = model.GetFirstMiddleIndexOfElidedGlyphs();
+ }
+
+ return firstMiddleIndexOfElidedGlyphs;
+}
+
+GlyphIndex View::GetSecondMiddleIndexOfElidedGlyphs() const
+{
+ GlyphIndex secondMiddleIndexOfElidedGlyphs = 0u;
+
+ if(mImpl->mVisualModel)
+ {
+ const VisualModel& model = *mImpl->mVisualModel;
+ secondMiddleIndexOfElidedGlyphs = model.GetSecondMiddleIndexOfElidedGlyphs();
+ }
+
+ return secondMiddleIndexOfElidedGlyphs;
+}
+
} // namespace Text
} // namespace Toolkit
*/
uint16_t GetOutlineWidth() const override;
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetEllipsisPosition()
+ */
+ DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::IsTextElideEnabled()
+ */
+ bool IsTextElideEnabled() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetStartIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetStartIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetEndIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetEndIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetFirstMiddleIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetSecondMiddleIndexOfElidedGlyphs()
+ */
+ GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
+
private:
// Undefined
View(const View& handle);
firstLineFound = true;
++numberOfLines;
}
+ else if((line.glyphRunSecondHalf.glyphIndex + line.glyphRunSecondHalf.numberOfGlyphs > glyphIndex) &&
+ (lastGlyphIndex > line.glyphRunSecondHalf.glyphIndex))
+ {
+ firstLineFound = true;
+ ++numberOfLines;
+ }
else if(lastGlyphIndex <= line.glyphRun.glyphIndex)
{
// nothing else to do.
mMarkupProcessorEnabled = enabled;
}
+void VisualModel::SetTextElideEnabled(bool enabled)
+{
+ mTextElideEnabled = enabled;
+}
+
+void VisualModel::SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition)
+{
+ mEllipsisPosition = ellipsisPosition;
+}
+
+void VisualModel::SetStartIndexOfElidedGlyphs(GlyphIndex startIndexOfElidedGlyphs)
+{
+ mStartIndexOfElidedGlyphs = startIndexOfElidedGlyphs;
+}
+
+void VisualModel::SetEndIndexOfElidedGlyphs(GlyphIndex endIndexOfElidedGlyphs)
+{
+ mEndIndexOfElidedGlyphs = endIndexOfElidedGlyphs;
+}
+
+void VisualModel::SetFirstMiddleIndexOfElidedGlyphs(GlyphIndex firstMiddleIndexOfElidedGlyphs)
+{
+ mFirstMiddleIndexOfElidedGlyphs = firstMiddleIndexOfElidedGlyphs;
+}
+
+void VisualModel::SetSecondMiddleIndexOfElidedGlyphs(GlyphIndex secondMiddleIndexOfElidedGlyphs)
+{
+ mSecondMiddleIndexOfElidedGlyphs = secondMiddleIndexOfElidedGlyphs;
+}
+
const Vector4& VisualModel::GetTextColor() const
{
return mTextColor;
return mMarkupProcessorEnabled;
}
+bool VisualModel::IsTextElideEnabled() const
+{
+ return mTextElideEnabled;
+}
+
+Toolkit::DevelText::EllipsisPosition::Type VisualModel::GetEllipsisPosition() const
+{
+ return mEllipsisPosition;
+}
+
+GlyphIndex VisualModel::GetStartIndexOfElidedGlyphs() const
+{
+ return mStartIndexOfElidedGlyphs;
+}
+
+GlyphIndex VisualModel::GetEndIndexOfElidedGlyphs() const
+{
+ return mEndIndexOfElidedGlyphs;
+}
+
+GlyphIndex VisualModel::GetFirstMiddleIndexOfElidedGlyphs() const
+{
+ return mFirstMiddleIndexOfElidedGlyphs;
+}
+
+GlyphIndex VisualModel::GetSecondMiddleIndexOfElidedGlyphs() const
+{
+ return mSecondMiddleIndexOfElidedGlyphs;
+}
+
Length VisualModel::GetNumberOfUnderlineRuns() const
{
return mUnderlineRuns.Count();
mNaturalSize(),
mLayoutSize(),
mCachedLineIndex(0u),
+ mEllipsisPosition(DevelText::EllipsisPosition::END),
+ mStartIndexOfElidedGlyphs(0u),
+ mEndIndexOfElidedGlyphs(0u),
+ mFirstMiddleIndexOfElidedGlyphs(0u),
+ mSecondMiddleIndexOfElidedGlyphs(0u),
+ mTextElideEnabled(false),
mUnderlineEnabled(false),
mUnderlineColorSet(false),
mBackgroundEnabled(false),
mMarkupProcessorEnabled(false)
+
{
}
#include <dali-toolkit/internal/text/color-run.h>
#include <dali-toolkit/internal/text/line-run.h>
+// DEVEL INCLUDES
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
+
namespace Dali
{
namespace Toolkit
*/
bool IsMarkupProcessorEnabled() const;
+ /**
+ * @brief Sets ellipsis position
+ * @param[in] ellipsisPosition The ellipsis position for the text
+ */
+ void SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition);
+
+ /**
+ * @brief Retrieves ellipsis position for text.
+ *
+ * @return The ellipsis position.
+ */
+ Toolkit::DevelText::EllipsisPosition::Type GetEllipsisPosition() const;
+
+ /**
+ * @brief Enable or disable the text elide.
+ *
+ * @param[in] enabled Whether to enable the text elide.
+ */
+ void SetTextElideEnabled(bool enabled);
+
+ /**
+ * @brief Whether the text elide property is enabled.
+ *
+ * @return @e true if the text elide property is enabled, @e false otherwise.
+ */
+ bool IsTextElideEnabled() const;
+
+ /**
+ * @brief Sets the start index of laid-out glyphs.
+ *
+ * @param[in] startIndexOfElidedGlyphs The start index of laid-out glyphs.
+ */
+ void SetStartIndexOfElidedGlyphs(GlyphIndex startIndexOfElidedGlyphs);
+
+ /**
+ * @brief Sets the end index of elided glyphs.
+ *
+ * @param[in] endIndexOfElidedGlyphs The end index of elided glyphs.
+ */
+ void SetEndIndexOfElidedGlyphs(GlyphIndex endIndexOfElidedGlyphs);
+
+ /**
+ * @brief Sets the first middle index of elided glyphs, index before ellipsis of middle.
+ *
+ * @param[in] firstMiddleIndexOfElidedGlyphs The first middle index of elided glyphs, index before ellipsis of middle.
+ */
+ void SetFirstMiddleIndexOfElidedGlyphs(GlyphIndex firstMiddleIndexOfElidedGlyphs);
+
+ /**
+ * @brief Sets the second middle index of elided glyphs, index of ellipsis of middle.
+ *
+ * @param[in] secondMiddleIndexOfElidedGlyphs The second middle index of elided glyphs, index of ellipsis of middle.
+ */
+ void SetSecondMiddleIndexOfElidedGlyphs(GlyphIndex secondMiddleIndexOfElidedGlyphs);
+
+ /**
+ * @brief Retrieves the start index of laid-out glyphs.
+ *
+ * @return The start index of laid-out glyphs.
+ */
+ GlyphIndex GetStartIndexOfElidedGlyphs() const;
+
+ /**
+ * @brief Retrieves the end index of laid-out glyphs.
+ *
+ * @return The end index of laid-out glyphs.
+ */
+ GlyphIndex GetEndIndexOfElidedGlyphs() const;
+
+ /**
+ * @brief Retrieves the first middle index of elided glyphs, index before ellipsis of middle.
+ *
+ * @return The first middle index of elided glyphs, index before ellipsis of middle.
+ */
+ GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const;
+
+ /**
+ * @brief Retrieves the second middle index of elided glyphs, index of ellipsis of middle.
+ *
+ * @return The second middle index of elided glyphs, index of ellipsis of middle.
+ */
+ GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const;
+
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
// Caches to increase performance in some consecutive operations.
LineIndex mCachedLineIndex; ///< Used to increase performance in consecutive calls to GetLineOfGlyph() or GetLineOfCharacter() with consecutive glyphs or characters.
+ DevelText::EllipsisPosition::Type mEllipsisPosition; ///< Where is the location the text elide
+ GlyphIndex mStartIndexOfElidedGlyphs; ///< The start index of elided glyphs.
+ GlyphIndex mEndIndexOfElidedGlyphs; ///< The end index of elided glyphs.
+ GlyphIndex mFirstMiddleIndexOfElidedGlyphs; ///< The first end index of elided glyphs, index before ellipsis of middle.
+ GlyphIndex mSecondMiddleIndexOfElidedGlyphs; ///< The first end index of elided glyphs, index of ellipsis of middle.
+ bool mTextElideEnabled : 1; ///< Whether the text's elide is enabled.
+
public:
- bool mUnderlineEnabled : 1; ///< Underline enabled flag
- bool mUnderlineColorSet : 1; ///< Has the underline color been explicitly set?
- bool mBackgroundEnabled : 1; ///< Background enabled flag
- bool mMarkupProcessorEnabled : 1; ///< Markup-processor enabled flag
- HyphenInfo mHyphen; ///< Contains hyphen glyph info & the character index to draw hyphen after.
+ bool mUnderlineEnabled : 1; ///< Underline enabled flag
+ bool mUnderlineColorSet : 1; ///< Has the underline color been explicitly set?
+ bool mBackgroundEnabled : 1; ///< Background enabled flag
+ bool mMarkupProcessorEnabled : 1; ///< Markup-processor enabled flag
+ HyphenInfo mHyphen; ///< Contains hyphen glyph info & the character index to draw hyphen after.
};
} // namespace Text
void TextureManager::Remove(const TextureManager::TextureId textureId, TextureUploadObserver* observer)
{
int textureInfoIndex = GetCacheIndexFromId(textureId);
+
if(textureInfoIndex != INVALID_INDEX)
{
TextureInfo& textureInfo(mTextureInfoContainer[textureInfoIndex]);
info.textureId = GenerateUniqueTextureId();
info.textureSet = textureSet;
mExternalTextures.emplace_back(info);
+
return VisualUrl::CreateTextureUrl(std::to_string(info.textureId));
}
if(url.size() > 0u)
{
// get the location from the Url
- VisualUrl parseUrl(url);
- if(VisualUrl::TEXTURE == parseUrl.GetProtocolType())
+ if(VisualUrl::TEXTURE == VisualUrl::GetProtocolType(url))
{
- std::string location = parseUrl.GetLocation();
+ std::string location = VisualUrl::GetLocation(url);
if(location.size() > 0u)
{
TextureId id = std::stoi(location);
if(iter->textureId == id)
{
auto textureSet = iter->textureSet;
- mExternalTextures.erase(iter);
+ if(--(iter->referenceCount) <= 0)
+ {
+ mExternalTextures.erase(iter);
+ }
return textureSet;
}
}
return TextureSet();
}
+void TextureManager::UseExternalTexture(const VisualUrl& url)
+{
+ if(VisualUrl::TEXTURE == url.GetProtocolType())
+ {
+ std::string location = url.GetLocation();
+ if(location.size() > 0u)
+ {
+ TextureId id = std::stoi(location);
+ for(auto&& elem : mExternalTextures)
+ {
+ if(elem.textureId == id)
+ {
+ elem.referenceCount++;
+ return;
+ }
+ }
+ }
+ }
+}
+
void TextureManager::AddObserver(TextureManager::LifecycleObserver& observer)
{
// make sure an observer doesn't observe the same object twice
TextureSet RemoveExternalTexture(const std::string& url);
/**
+ * @brief Notify that external textures are used.
+ * @param[in] url The URL of the texture to use.
+ */
+ void UseExternalTexture(const VisualUrl& url);
+
+ /**
* Add an observer to the object.
* @param[in] observer The observer to add.
*/
{
TextureId textureId;
TextureSet textureSet;
+ int16_t referenceCount{1};
};
private:
// EXTERNAL HEADERS
#include <cstring> // for toupper()
+// INTERNAL HEADERS
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
+
namespace Dali
{
namespace Toolkit
// TEXTURE location url doesn't need type resolving, REGULAR_IMAGE is fine
mType = ResolveType(url);
}
+ else
+ {
+ Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+ if(factory)
+ {
+ GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
+ }
+ }
}
}
mType(url.mType),
mLocation(url.mLocation)
{
+ if(VisualUrl::TEXTURE == mLocation)
+ {
+ Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+ if(factory)
+ {
+ GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
+ }
+ }
+}
+
+VisualUrl::~VisualUrl()
+{
+ if(VisualUrl::TEXTURE == mLocation)
+ {
+ Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+ if(factory)
+ {
+ GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
+ }
+ }
}
VisualUrl& VisualUrl::operator=(const VisualUrl& url)
{
if(&url != this)
{
+ if(VisualUrl::TEXTURE == mLocation)
+ {
+ Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+ if(factory)
+ {
+ GetImplementation(factory).GetTextureManager().RemoveExternalTexture(mUrl);
+ }
+ }
+
mUrl = url.mUrl;
mType = url.mType;
mLocation = url.mLocation;
+
+ if(VisualUrl::TEXTURE == mLocation)
+ {
+ Toolkit::VisualFactory factory = Toolkit::VisualFactory::Get();
+ if(factory)
+ {
+ GetImplementation(factory).GetTextureManager().UseExternalTexture(*this);
+ }
+ }
}
return *this;
}
std::string VisualUrl::GetLocation() const
{
- const auto location = mUrl.find("://");
- if(std::string::npos != location)
- {
- return mUrl.substr(location + 3u); // 3 characters forwards from the start of ://
- }
- return mUrl;
+ return GetLocation(mUrl);
}
std::string VisualUrl::CreateTextureUrl(const std::string& location)
return "dali://" + location;
}
+VisualUrl::ProtocolType VisualUrl::GetProtocolType(const std::string& url)
+{
+ return ResolveLocation(url);
+}
+
+std::string VisualUrl::GetLocation(const std::string& url)
+{
+ const auto location = url.find("://");
+ if(std::string::npos != location)
+ {
+ return url.substr(location + 3u); // 3 characters forwards from the start of ://
+ }
+ return url;
+}
+
+
} // namespace Internal
} // namespace Toolkit
VisualUrl();
/**
+ * Default Destructor.
+ * Delete an external texture if if protocolType is TEXTURE.
+ */
+ ~VisualUrl();
+
+ /**
* Constructor.
* Determines type of visual and whether the url is local or remote
+ * Notify that it is using an external texture if if protocolType is TEXTURE.
+ *
* @param[in] url The URL to store and resolve
*/
VisualUrl(const std::string& url);
*/
static std::string CreateTextureUrl(const std::string& location);
+ /**
+ * Helper to get a ProtocolType from url
+ * @param url the url of the texture
+ * @return the protocol type
+ */
+ static VisualUrl::ProtocolType GetProtocolType(const std::string& url);
+
+ /**
+ * Helper to get a location from url
+ * @param url the location of the texture
+ * @return the location
+ */
+ static std::string GetLocation(const std::string& url);
private:
std::string mUrl;
Type mType;
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 34;
+const unsigned int TOOLKIT_MICRO_VERSION = 35;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
${public_api_src_dir}/controls/video-view/video-view.cpp
${public_api_src_dir}/controls/camera-view/camera-view.cpp
${public_api_src_dir}/image-loader/image.cpp
+ ${public_api_src_dir}/image-loader/image-url.cpp
${public_api_src_dir}/image-loader/async-image-loader.cpp
${public_api_src_dir}/image-loader/sync-image-loader.cpp
${public_api_src_dir}/styling/style-manager.cpp
SET( public_api_image_loader_header_files
${public_api_src_dir}/image-loader/image.h
+ ${public_api_src_dir}/image-loader/image-url.h
${public_api_src_dir}/image-loader/async-image-loader.h
${public_api_src_dir}/image-loader/sync-image-loader.h
)
--- /dev/null
+/*
+ * Copyright (c) 2021 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.
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/image-loader/image-url.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/image-loader/image-url-impl.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+ImageUrl::ImageUrl()
+{
+}
+
+ImageUrl::~ImageUrl()
+{
+}
+
+ImageUrl ImageUrl::New(Texture& texture)
+{
+ Toolkit::Internal::ImageUrlPtr internal = Toolkit::Internal::ImageUrl::New(texture);
+ return ImageUrl(internal.Get());
+}
+
+ImageUrl ImageUrl::DownCast(BaseHandle handle)
+{
+ return ImageUrl(dynamic_cast<Toolkit::Internal::ImageUrl*>(handle.GetObjectPtr()));
+}
+
+ImageUrl::ImageUrl(const ImageUrl& rhs) = default;
+
+ImageUrl& ImageUrl::operator=(const ImageUrl& url) = default;
+
+ImageUrl::ImageUrl(ImageUrl&& rhs) = default;
+
+ImageUrl& ImageUrl::operator=(ImageUrl&& rhs) = default;
+
+const std::string& ImageUrl::GetUrl() const
+{
+ return GetImpl(*this).GetUrl();
+}
+
+ImageUrl::ImageUrl(Toolkit::Internal::ImageUrl* internal)
+: BaseHandle(internal)
+{
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_IMAGE_URL_H
+#define DALI_TOOLKIT_IMAGE_URL_H
+
+/*
+ * Copyright (c) 2021 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.
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/public-api/rendering/texture.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Internal DALI_INTERNAL
+{
+class ImageUrl;
+}
+/**
+ * @brief ImageUrl can be used to wrap an external buffer.
+ *
+ * An instance of ImageUrl can be created from Image::GenerateUrl().
+ * Application can get url from ImageUrl.
+ * When application does not use this anymore, the destructor of the ImageUrl is called.
+ * At this time, the buffer is deleted from the texture manager.
+ */
+class DALI_TOOLKIT_API ImageUrl : public BaseHandle
+{
+public:
+ /**
+ * Default Constructor.
+ * Resulting URL is not valid
+ */
+ ImageUrl();
+
+ /**
+ * Destructor
+ */
+ ~ImageUrl();
+
+ /**
+ * @brief Create an initialized ImageUrl.
+ *
+ * @param[in] texture The texture url is got from external buffer.
+ * @return A handle to a newly allocated Dali resource.
+ */
+ static ImageUrl New(Texture& texture);
+
+ /**
+ * @brief Downcast an Object handle to ImageUrl handle.
+ *
+ * If handle points to a ImageUrl object the downcast produces valid
+ * handle. If not the returned handle is left uninitialized.
+ *
+ * @param[in] handle to An object.
+ * @return handle to a ImageUrl object or an uninitialized handle.
+ */
+ static ImageUrl DownCast(BaseHandle handle);
+
+ /**
+ * Copy constructor
+ * @param[in] url The url to copy
+ */
+ ImageUrl(const ImageUrl& url);
+
+ /**
+ * Assignment operator
+ * @param[in] url The url to copy
+ */
+ ImageUrl& operator=(const ImageUrl& url);
+
+ /**
+ * @brief Move constructor.
+ * @param[in] rhs A reference to the moved handle
+ */
+ ImageUrl(ImageUrl&& rhs);
+
+ /**
+ * @brief Move assignment operator.
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this handle
+ */
+ ImageUrl& operator=(ImageUrl&& rhs);
+
+ /**
+ * Get the url
+ * @return Returns url's string
+ */
+ const std::string& GetUrl() const;
+
+public: // Not intended for application developers
+ /// @cond internal
+ /**
+ * @brief This constructor is used by New() methods.
+ *
+ * @param[in] internal A pointer to a newly allocated Dali resource.
+ */
+ explicit DALI_INTERNAL ImageUrl(Toolkit::Internal::ImageUrl* internal);
+ /// @endcond
+};
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif /* DALI_TOOLKIT_IMAGE_URL_H */
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
// EXTERNAL INCLUDES
#include <dali/devel-api/rendering/frame-buffer-devel.h>
{
namespace Image
{
-std::string GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height)
+Dali::Toolkit::ImageUrl GenerateUrl(Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height)
{
Texture texture = Texture::New(Dali::TextureType::TEXTURE_2D, pixelFormat, width, height);
frameBuffer.AttachColorTexture(texture, 0u, 0u);
- return Dali::Toolkit::TextureManager::AddTexture(texture);
+ Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+ return imageUrl;
}
-std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index)
{
Texture texture = Dali::DevelFrameBuffer::GetColorTexture(frameBuffer, index);
- return Dali::Toolkit::TextureManager::AddTexture(texture);
+ Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+ return imageUrl;
}
-std::string GenerateUrl(const Dali::PixelData pixelData)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData)
{
Texture texture = Texture::New(TextureType::TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight());
texture.Upload(pixelData);
- return Dali::Toolkit::TextureManager::AddTexture(texture);
+ Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+ return imageUrl;
}
-std::string GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
+Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource)
{
Texture texture = Dali::Texture::New(*nativeImageSource);
- return Dali::Toolkit::TextureManager::AddTexture(texture);
+ Dali::Toolkit::ImageUrl imageUrl = Dali::Toolkit::ImageUrl::New(texture);
+ return imageUrl;
}
} // namespace Image
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali-toolkit/public-api/image-loader/image-url.h>
namespace Dali
{
* @param[in] pixelFormat the pixel format for this frame buffer
* @param[in] width the width for this frame buffer
* @param[in] height the height for this frame buffer
- * @return the Url string representing this frame buffer
+ * @return the ImageUrl representing this frame buffer
*/
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, Pixel::Format pixelFormat, uint32_t width, uint32_t height);
/**
* @brief Generate a Url from frame buffer.
* This method does not check for duplicates, If same frame buffer is entered multiple times, a different URL is returned each time.
* @param[in] frameBuffer the frame buffer to converted to Url
* @param[in] index the index of the attached color texture.
- * @return the Url string representing this frame buffer
+ * @return the ImageUrl representing this frame buffer
*/
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::FrameBuffer frameBuffer, uint8_t index);
/**
* @brief Generate a Url from Pixel data.
* This Url can be used in visuals to render the pixel data.
* @note This method does not check for duplicates, If same pixel data is entered multiple times, a different URL is returned each time.
* @param[in] pixelData the pixel data to converted to Url
- * @return the Url string representing this pixel data
+ * @return the ImageUrl representing this pixel data
*/
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::PixelData pixelData);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::PixelData pixelData);
/**
* @brief Generate a Url from native image source.
* This Url can be used in visuals to render the native image source.
* @note This method does not check for duplicates, If same native image source is entered multiple times, a different URL is returned each time.
* @param[in] nativeImageSource the native image source to converted to Url
- * @return the Url string representing this native image source
+ * @return the ImageUrl representing this native image source
*/
-DALI_TOOLKIT_API std::string GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
+DALI_TOOLKIT_API Dali::Toolkit::ImageUrl GenerateUrl(const Dali::NativeImageSourcePtr nativeImageSource);
} // namespace Image
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.0.34
+Version: 2.0.35
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT