From: Seoyeon Kim Date: Tue, 17 Oct 2017 08:29:55 +0000 (+0000) Subject: Merge "Add MARGIN and PADDING property in Control" into devel/master X-Git-Tag: dali_1.2.62~6 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=bc5e9a0b52e07309fd557deb212333d1798109f3;hp=3e3ba0c9a854a2a392b74baab03ae171833d3ac0 Merge "Add MARGIN and PADDING property in Control" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp index 034e416..ce17641 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.cpp @@ -87,6 +87,8 @@ std::string Application::GetResourcePath() //////////////////////////////////////////////////////////////////////////////////////////////////// +bool ToolkitApplication::DECODED_IMAGES_SUPPORTED; + ToolkitApplication::ToolkitApplication() : mApplicationStub(new Application(*this)) { diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h index 7178b68..584a38c 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-application.h @@ -85,6 +85,9 @@ private: // The Application Stub Application* mApplicationStub; friend class Application; + +public: // Test static member + static bool DECODED_IMAGES_SUPPORTED; }; } // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp index eee723b..09cc438 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.cpp @@ -15,11 +15,10 @@ * */ -// CLASS HEADER -#include "toolkit-video-player.h" - -// EXTERNAL INCLUDES +#include #include +#include +#include namespace Dali { @@ -226,5 +225,10 @@ void VideoPlayer::Backward( int millisecond ) { } +bool VideoPlayer::IsVideoTextureSupported() const +{ + return ToolkitApplication::DECODED_IMAGES_SUPPORTED; +} + } // namespace Dali; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.h deleted file mode 100644 index 199fa12..0000000 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-video-player.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef __DALI_TOOLKIT_VIDEO_PLAYER_H__ -#define __DALI_TOOLKIT_VIDEO_PLAYER_H__ - -/* - * Copyright (c) 2016 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 -#include - -#include - -namespace Dali -{ - -class Any; - -namespace Internal -{ -namespace Adaptor -{ - -class VideoPlayer; - -} -} - -/** - * @brief VideoPlayer class is used for video playback. - * @SINCE_1_1.38 - */ -class VideoPlayer: public BaseHandle -{ -public: - - VideoPlayer(); - - ~VideoPlayer(); - - static VideoPlayer New(); - - VideoPlayer( const VideoPlayer& player ); - - VideoPlayer& operator=( const VideoPlayer& player ); - - static VideoPlayer DownCast( BaseHandle handle ); - - void SetUrl( const std::string& url ); - - std::string GetUrl(); - - void SetLooping(bool looping); - - bool IsLooping(); - - void Play(); - - void Pause(); - - void Stop(); - - void SetMute( bool mute ); - - bool IsMuted(); - - void SetVolume( float left, float right ); - - void GetVolume( float& left, float& right ); - - void SetRenderingTarget( Any target ); - - void SetPlayPosition( int millisecond ); - - int GetPlayPosition(); - - void SetDisplayArea( DisplayArea area ); - - void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation ); - - Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation(); - - Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal(); - - void Forward( int millisecond ); - - void Backward( int millisecond ); - -private: - - VideoPlayer( Internal::Adaptor::VideoPlayer* internal ); - -}; - -} // namespace Dali; - -#endif diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index d93a39e..6eefd84 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -281,7 +281,17 @@ bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Ma { const KeyValuePair& valueGet = fontStyleMapGet.GetKeyValue( index ); - Property::Value* valueSet = fontStyleMapSet.Find( valueGet.first.stringKey ); + Property::Value* valueSet = NULL; + if ( valueGet.first.type == Property::Key::INDEX ) + { + valueSet = fontStyleMapSet.Find( valueGet.first.indexKey ); + } + else + { + // Get Key is a string so searching Set Map for a string key + valueSet = fontStyleMapSet.Find( valueGet.first.stringKey ); + } + if( NULL != valueSet ) { if( valueGet.second.Get() != valueSet->Get() ) @@ -292,7 +302,14 @@ bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Ma } else { - tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() ); + if ( valueGet.first.type == Property::Key::INDEX ) + { + tet_printf( " The key %d doesn't exist.", valueGet.first.indexKey ); + } + else + { + tet_printf( " The key %s doesn't exist.", valueGet.first.stringKey.c_str() ); + } return false; } } @@ -796,67 +813,87 @@ int UtcDaliTextEditorSetPropertyP(void) Property::Map placeholderPixelSizeMapSet; Property::Map placeholderPixelSizeMapGet; Property::Map placeholderFontstyleMap; - placeholderPixelSizeMapSet["placeholderText"] = "Setting Placeholder Text"; - placeholderPixelSizeMapSet["placeholderTextFocused"] = "Setting Placeholder Text Focused"; - placeholderPixelSizeMapSet["placeholderColor"] = Color::BLUE; - placeholderPixelSizeMapSet["placeholderFontFamily"] = "Arial"; - placeholderPixelSizeMapSet["placeholderPixelSize"] = 15.0f; + placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text"; + placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused"; + placeholderPixelSizeMapSet["color"] = Color::BLUE; + placeholderPixelSizeMapSet["fontFamily"] = "Arial"; + placeholderPixelSizeMapSet["pixelSize"] = 15.0f; placeholderFontstyleMap.Insert( "weight", "bold" ); - placeholderPixelSizeMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderPixelSizeMapSet["fontStyle"] = placeholderFontstyleMap; editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderPixelSizeMapSet ); placeholderPixelSizeMapGet = editor.GetProperty( TextEditor::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderPixelSizeMapSet ), true, TEST_LOCATION ); + + tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value"); + Property::Map placeholderConversionMap; + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderPixelSizeMapSet["text"]; + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderPixelSizeMapSet["textFocused"] ; + placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderPixelSizeMapSet["color"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderPixelSizeMapSet["fontFamily"]; + placeholderConversionMap[ Text::PlaceHolder::Property::PIXEL_SIZE ] = placeholderPixelSizeMapSet["pixelSize"]; + + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderConversionMap ), true, TEST_LOCATION ); // Check the placeholder property with point size Property::Map placeholderMapSet; Property::Map placeholderMapGet; - placeholderMapSet["placeholderText"] = "Setting Placeholder Text"; - placeholderMapSet["placeholderTextFocused"] = "Setting Placeholder Text Focused"; - placeholderMapSet["placeholderColor"] = Color::RED; - placeholderMapSet["placeholderFontFamily"] = "Arial"; - placeholderMapSet["placeholderPointSize"] = 12.0f; - + placeholderMapSet["text"] = "Setting Placeholder Text"; + placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused"; + placeholderMapSet["color"] = Color::RED; + placeholderMapSet["fontFamily"] = "Arial"; + placeholderMapSet["pointSize"] = 12.0f; // Check the placeholder font style property placeholderFontstyleMap.Clear(); placeholderFontstyleMap.Insert( "weight", "bold" ); placeholderFontstyleMap.Insert( "width", "condensed" ); placeholderFontstyleMap.Insert( "slant", "italic" ); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = editor.GetProperty( TextEditor::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value"); + placeholderConversionMap.Clear(); + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderMapSet["text"]; + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderMapSet["textFocused"] ; + placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderMapSet["color"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderMapSet["fontFamily"]; + placeholderConversionMap[ Text::PlaceHolder::Property::POINT_SIZE ] = placeholderMapSet["pointSize"]; + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION ); // Reset font style. placeholderFontstyleMap.Clear(); placeholderFontstyleMap.Insert( "weight", "normal" ); placeholderFontstyleMap.Insert( "slant", "oblique" ); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = editor.GetProperty( TextEditor::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"]; + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION ); placeholderFontstyleMap.Clear(); placeholderFontstyleMap.Insert( "slant", "roman" ); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = editor.GetProperty( TextEditor::Property::PLACEHOLDER ); placeholderFontstyleMap.Clear(); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; editor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = editor.GetProperty( TextEditor::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderMapSet["fontStyle"]; + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 66f1875..3e5e7b1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -877,12 +877,12 @@ int UtcDaliTextFieldSetPropertyP(void) Property::Map placeholderPixelSizeMapSet; Property::Map placeholderPixelSizeMapGet; Property::Map placeholderFontstyleMap; - placeholderPixelSizeMapSet["placeholderText"] = "Setting Placeholder Text"; - placeholderPixelSizeMapSet["placeholderTextFocused"] = "Setting Placeholder Text Focused"; - placeholderPixelSizeMapSet["placeholderColor"] = Color::BLUE; - placeholderPixelSizeMapSet["placeholderFontFamily"] = "Arial"; - placeholderPixelSizeMapSet["placeholderPixelSize"] = 15.0f; - placeholderPixelSizeMapSet["placeholderEllipsis"] = true; + placeholderPixelSizeMapSet["text"] = "Setting Placeholder Text"; + placeholderPixelSizeMapSet["textFocused"] = "Setting Placeholder Text Focused"; + placeholderPixelSizeMapSet["color"] = Color::BLUE; + placeholderPixelSizeMapSet["fontFamily"] = "Arial"; + placeholderPixelSizeMapSet["pixelSize"] = 15.0f; + placeholderPixelSizeMapSet["ellipsis"] = true; placeholderFontstyleMap.Insert( "weight", "bold" ); placeholderPixelSizeMapSet["placeholderFontStyle"] = placeholderFontstyleMap; @@ -890,17 +890,27 @@ int UtcDaliTextFieldSetPropertyP(void) placeholderPixelSizeMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderPixelSizeMapSet ), true, TEST_LOCATION ); + + tet_infoline("Test Placeholder settings set as strings is converted correctly to Property Index key and holds set value"); + Property::Map placeholderConversionMap; + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderPixelSizeMapSet["text"]; + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderPixelSizeMapSet["textFocused"] ; + placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderPixelSizeMapSet["color"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderPixelSizeMapSet["fontFamily"]; + placeholderConversionMap[ Text::PlaceHolder::Property::PIXEL_SIZE ] = placeholderPixelSizeMapSet["pixelSize"]; + + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderConversionMap ), true, TEST_LOCATION ); // Check the placeholder property with point size Property::Map placeholderMapSet; Property::Map placeholderMapGet; - placeholderMapSet["placeholderText"] = "Setting Placeholder Text"; - placeholderMapSet["placeholderTextFocused"] = "Setting Placeholder Text Focused"; - placeholderMapSet["placeholderColor"] = Color::RED; - placeholderMapSet["placeholderFontFamily"] = "Arial"; - placeholderMapSet["placeholderPointSize"] = 12.0f; - placeholderMapSet["placeholderEllipsis"] = false; + placeholderMapSet["text"] = "Setting Placeholder Text"; + placeholderMapSet["textFocused"] = "Setting Placeholder Text Focused"; + placeholderMapSet["color"] = Color::RED; + placeholderMapSet["fontFamily"] = "Arial"; + placeholderMapSet["pointSize"] = 12.0f; + placeholderMapSet["ellipsis"] = false; // Check the placeholder font style property placeholderFontstyleMap.Clear(); @@ -908,38 +918,53 @@ int UtcDaliTextFieldSetPropertyP(void) placeholderFontstyleMap.Insert( "weight", "bold" ); placeholderFontstyleMap.Insert( "width", "condensed" ); placeholderFontstyleMap.Insert( "slant", "italic" ); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + placeholderConversionMap.Clear(); + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT ] = placeholderPixelSizeMapSet["text"]; + placeholderConversionMap[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = placeholderPixelSizeMapSet["textFocused"] ; + placeholderConversionMap[ Text::PlaceHolder::Property::COLOR ] = placeholderPixelSizeMapSet["color"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = placeholderPixelSizeMapSet["fontFamily"]; + placeholderConversionMap[ Text::PlaceHolder::Property::POINT_SIZE ] = placeholderPixelSizeMapSet["pointSize"]; + + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION ); // Reset font style. placeholderFontstyleMap.Clear(); placeholderFontstyleMap.Insert( "weight", "normal" ); placeholderFontstyleMap.Insert( "slant", "oblique" ); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION ); placeholderFontstyleMap.Clear(); placeholderFontstyleMap.Insert( "slant", "roman" ); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; + field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); placeholderFontstyleMap.Clear(); - placeholderMapSet["placeholderFontStyle"] = placeholderFontstyleMap; + placeholderMapSet["fontStyle"] = placeholderFontstyleMap; + placeholderConversionMap[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderPixelSizeMapSet["fontStyle"]; field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); - DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderConversionMap ), true, TEST_LOCATION ); // Check the ellipsis property DALI_TEST_CHECK( !field.GetProperty( TextField::Property::ELLIPSIS ) ); @@ -2578,3 +2603,83 @@ int UtcDaliTextFieldDefaultFontStylePropertyCoverage(void) END_TEST; } + +int UtcDaliTextFieldSettingPlaceholder(void) +{ + ToolkitTestApplication application; + tet_infoline("UtcDaliTextFieldSettingPlaceholder"); + + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + Stage::GetCurrent().Add( field ); + + // Check the placeholder property with pixel size + Property::Map placeholderPixelSizeMapSet; + Property::Map placeholderPixelSizeMapGet; + Property::Map placeholderFontstyleMap; + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::TEXT ] = "Setting Placeholder Text"; + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = "Setting Placeholder Text Focused"; + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::COLOR ] = Color::BLUE; + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::FONT_FAMILY ] = "Arial"; + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::PIXEL_SIZE ] = 15.0f; + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::ELLIPSIS ] = true; + + placeholderFontstyleMap.Insert( "weight", "bold" ); + placeholderPixelSizeMapSet[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderFontstyleMap; + field.SetProperty( TextField::Property::PLACEHOLDER, placeholderPixelSizeMapSet ); + + placeholderPixelSizeMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderPixelSizeMapGet.Count(), placeholderPixelSizeMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderPixelSizeMapGet, placeholderPixelSizeMapSet ), true, TEST_LOCATION ); + + // Check the placeholder property with point size + Property::Map placeholderMapSet; + Property::Map placeholderMapGet; + placeholderMapSet[ Text::PlaceHolder::Property::TEXT ] = "Setting Placeholder Text"; + placeholderMapSet[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = "Setting Placeholder Text Focused"; + placeholderMapSet[ Text::PlaceHolder::Property::COLOR ] = Color::RED; + placeholderMapSet[ Text::PlaceHolder::Property::FONT_FAMILY ] = "Arial"; + placeholderMapSet[ Text::PlaceHolder::Property::POINT_SIZE ] = 12.0f; + placeholderMapSet[ Text::PlaceHolder::Property::ELLIPSIS ] = false; + + // Check the placeholder font style property + placeholderFontstyleMap.Clear(); + + placeholderFontstyleMap.Insert( "weight", "bold" ); + placeholderFontstyleMap.Insert( "width", "condensed" ); + placeholderFontstyleMap.Insert( "slant", "italic" ); + placeholderMapSet[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderFontstyleMap; + field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); + + placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + // Reset font style. + placeholderFontstyleMap.Clear(); + placeholderFontstyleMap.Insert( "weight", "normal" ); + placeholderFontstyleMap.Insert( "slant", "oblique" ); + placeholderMapSet[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderFontstyleMap; + field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); + + placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + placeholderFontstyleMap.Clear(); + placeholderFontstyleMap.Insert( "slant", "roman" ); + placeholderMapSet[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderFontstyleMap; + field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); + + placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); + + placeholderFontstyleMap.Clear(); + placeholderMapSet[ Text::PlaceHolder::Property::FONT_STYLE ] = placeholderFontstyleMap; + + field.SetProperty( TextField::Property::PLACEHOLDER, placeholderMapSet ); + placeholderMapGet = field.GetProperty( TextField::Property::PLACEHOLDER ); + DALI_TEST_EQUALS( placeholderMapGet.Count(), placeholderMapSet.Count(), TEST_LOCATION ); + DALI_TEST_EQUALS( DaliTestCheckMaps( placeholderMapGet, placeholderMapSet ), true, TEST_LOCATION ); + + END_TEST; +} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp index 884efc4..30a7e8c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp @@ -405,3 +405,38 @@ int UtcDaliVideoViewMethodsForCoverage2(void) END_TEST; } + +int UtcDaliVideoViewPropertyUnderlay(void) +{ + ToolkitTestApplication application; + ToolkitApplication::DECODED_IMAGES_SUPPORTED = true; + + VideoView view = VideoView::New(); + DALI_TEST_CHECK( view ); + + Stage::GetCurrent().Add( view ); + + application.SendNotification(); + application.Render(); + + bool isUnderlay = view.GetProperty( Toolkit::VideoView::Property::UNDERLAY ).Get< bool >(); + DALI_TEST_CHECK( isUnderlay ); + + view.SetProperty( Toolkit::VideoView::Property::UNDERLAY, false ); + isUnderlay = view.GetProperty( Toolkit::VideoView::Property::UNDERLAY ).Get< bool >(); + DALI_TEST_CHECK( !isUnderlay ); + + view.SetProperty( Toolkit::VideoView::Property::UNDERLAY, true ); + isUnderlay = view.GetProperty( Toolkit::VideoView::Property::UNDERLAY ).Get< bool >(); + DALI_TEST_CHECK( isUnderlay ); + + // If platform api doesn't provide any API or feature for decoded images of video, + // UNDERLAY should be true + ToolkitApplication::DECODED_IMAGES_SUPPORTED = false; + + view.SetProperty( Toolkit::VideoView::Property::UNDERLAY, false ); + isUnderlay = view.GetProperty( Toolkit::VideoView::Property::UNDERLAY ).Get< bool >(); + DALI_TEST_CHECK( isUnderlay ); + + END_TEST; +} diff --git a/dali-toolkit/dali-toolkit.h b/dali-toolkit/dali-toolkit.h index 6e8cc5e..c6fafad 100644 --- a/dali-toolkit/dali-toolkit.h +++ b/dali-toolkit/dali-toolkit.h @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/dali-toolkit/internal/controls/video-view/video-view-impl.cpp b/dali-toolkit/internal/controls/video-view/video-view-impl.cpp index 2fdb70b..5834950 100644 --- a/dali-toolkit/internal/controls/video-view/video-view-impl.cpp +++ b/dali-toolkit/internal/controls/video-view/video-view-impl.cpp @@ -62,6 +62,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "video", MAP, VIDEO ) DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "looping", BOOLEAN, LOOPING ) DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "muted", BOOLEAN, MUTED ) DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "volume", MAP, VOLUME ) +DALI_PROPERTY_REGISTRATION( Toolkit, VideoView, "underlay", BOOLEAN, UNDERLAY ) DALI_SIGNAL_REGISTRATION( Toolkit, VideoView, "finished", FINISHED_SIGNAL ) @@ -75,6 +76,8 @@ DALI_TYPE_REGISTRATION_END() const char* const VOLUME_LEFT( "volumeLeft" ); const char* const VOLUME_RIGHT( "volumeRight" ); + +// 3.0 TC uses RENDERING_TARGET. It should be removed in next release const char* const RENDERING_TARGET( "renderingTarget" ); const char* const WINDOW_SURFACE_TARGET( "windowSurfaceTarget" ); const char* const NATIVE_IMAGE_TARGET( "nativeImageTarget" ); @@ -128,9 +131,9 @@ VideoView::VideoView() mUpdateTriggerPropertyIndex( Property::INVALID_INDEX), mNotification( NULL ), mCurrentVideoPlayPosition( 0 ), - mIsNativeImageTarget( true ), mIsPlay( false ), - mIsPause( false ) + mIsPause( false ), + mIsUnderlay( true ) { mVideoPlayer = Dali::VideoPlayer::New(); @@ -159,14 +162,9 @@ Toolkit::VideoView VideoView::New() void VideoView::OnInitialize() { - Any source; - Dali::NativeImageSourcePtr nativeImageSourcePtr = Dali::NativeImageSource::New( source ); - mNativeImage = Dali::NativeImage::New( *nativeImageSourcePtr ); - - mVideoPlayer.SetRenderingTarget( nativeImageSourcePtr ); - mVideoPlayer.FinishedSignal().Connect( this, &VideoView::EmitSignalFinish ); - mUpdateTriggerPropertyIndex = Self().RegisterProperty( "updateTrigger", true ); + mVideoPlayer.FinishedSignal().Connect( this, &VideoView::EmitSignalFinish ); + SetWindowSurfaceTarget(); } void VideoView::SetUrl( const std::string& url ) @@ -177,7 +175,7 @@ void VideoView::SetUrl( const std::string& url ) mPropertyMap.Clear(); } - if( mIsNativeImageTarget ) + if( !mIsUnderlay ) { Actor self( Self() ); Internal::InitializeVisual( self, mVisual, mNativeImage ); @@ -218,11 +216,13 @@ void VideoView::SetPropertyMap( Property::Map map ) if( target && target->Get( targetType ) && targetType == WINDOW_SURFACE_TARGET ) { - this->SetWindowSurfaceTarget(); + mIsUnderlay = true; + SetWindowSurfaceTarget(); } else if( target && target->Get( targetType ) && targetType == NATIVE_IMAGE_TARGET ) { - this->SetNativeImageTarget(); + mIsUnderlay = false; + SetNativeImageTarget(); } RelayoutRequest(); @@ -465,6 +465,15 @@ void VideoView::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::VideoView::Property::UNDERLAY: + { + bool underlay; + if( value.Get( underlay ) ) + { + impl.SetUnderlay( underlay ); + } + break; + } } } } @@ -513,6 +522,11 @@ Property::Value VideoView::GetProperty( BaseObject* object, Property::Index prop value = map; break; } + case Toolkit::VideoView::Property::UNDERLAY: + { + value = impl.IsUnderlay(); + break; + } } } @@ -609,7 +623,22 @@ void VideoView::SetWindowSurfaceTarget() mVideoPlayer.SetRenderingTarget( Dali::Adaptor::Get().GetNativeWindowHandle() ); mVideoPlayer.SetUrl( mUrl ); - mIsNativeImageTarget = false; + if( !mRenderer ) + { + // For underlay rendering mode, video display area have to be transparent. + Geometry geometry = VisualFactoryCache::CreateQuadGeometry(); + Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); + mRenderer = Renderer::New( geometry, shader ); + + mRenderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); + mRenderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE ); + mRenderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ZERO ); + mRenderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE ); + mRenderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ZERO ); + } + self.AddRenderer( mRenderer ); + + UpdateDisplayArea(); if( mIsPlay ) { @@ -625,22 +654,17 @@ void VideoView::SetWindowSurfaceTarget() { mVideoPlayer.SetPlayPosition( curPos ); } - - // For underlay rendering mode, video display area have to be transparent. - Geometry geometry = VisualFactoryCache::CreateQuadGeometry(); - Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); - Renderer renderer = Renderer::New( geometry, shader ); - - renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ZERO ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE ); - renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ZERO ); - self.AddRenderer( renderer ); } void VideoView::SetNativeImageTarget() { + if( mVideoPlayer.IsVideoTextureSupported() == false ) + { + DALI_LOG_ERROR( "Platform doesn't support decoded video frame images\n" ); + mIsUnderlay = true; + return; + } + Actor self( Self() ); int curPos = mVideoPlayer.GetPlayPosition(); @@ -652,7 +676,7 @@ void VideoView::SetNativeImageTarget() mVideoPlayer.SetUrl( mUrl ); Internal::InitializeVisual( self, mVisual, mNativeImage ); - mIsNativeImageTarget = true; + Self().RemoveRenderer( mRenderer ); if( mIsPlay ) { @@ -672,6 +696,11 @@ void VideoView::SetNativeImageTarget() void VideoView::UpdateDisplayArea() { + if( !mIsUnderlay ) + { + return; + } + Actor self( Self() ); bool positionUsesAnchorPoint = self.GetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >(); @@ -688,6 +717,28 @@ void VideoView::UpdateDisplayArea() mVideoPlayer.SetDisplayArea( mDisplayArea ); } +void VideoView::SetUnderlay( bool set ) +{ + if( set != mIsUnderlay ) + { + mIsUnderlay = set; + + if( mIsUnderlay ) + { + SetWindowSurfaceTarget(); + } + else + { + SetNativeImageTarget(); + } + } +} + +bool VideoView::IsUnderlay() +{ + return mIsUnderlay; +} + } // namespace Internal } // namespace toolkit diff --git a/dali-toolkit/internal/controls/video-view/video-view-impl.h b/dali-toolkit/internal/controls/video-view/video-view-impl.h index 130d2c2..d5a498a 100644 --- a/dali-toolkit/internal/controls/video-view/video-view-impl.h +++ b/dali-toolkit/internal/controls/video-view/video-view-impl.h @@ -207,11 +207,21 @@ public: */ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); - /* + /** * @brief Updates video display area for window rendering target */ void UpdateDisplayArea(); + /** + * @brief Sets underlay flag and initializes new rendering target by flag. + */ + void SetUnderlay( bool set ); + + /** + * @brief Checks underlay flag. + */ + bool IsUnderlay(); + private: // From Control /** @@ -265,14 +275,15 @@ private: Dali::Toolkit::VideoView::VideoViewSignalType mFinishedSignal; std::string mUrl; Dali::DisplayArea mDisplayArea; + Dali::Renderer mRenderer; Property::Index mUpdateTriggerPropertyIndex; TriggerEventInterface* mNotification; int mCurrentVideoPlayPosition; - bool mIsNativeImageTarget; bool mIsPlay; bool mIsPause; + bool mIsUnderlay; }; } // namespace Internal diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index d859b42..c1eb0e4 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -73,7 +73,7 @@ EventData::EventData( DecoratorPtr decorator ) mPlaceholderFont( NULL ), mPlaceholderTextActive(), mPlaceholderTextInactive(), - mPlaceholderTextColor( 0.8f, 0.8f, 0.8f, 0.8f ), + mPlaceholderTextColor( 0.8f, 0.8f, 0.8f, 0.8f ), // This color has been published in the Public API (placeholder-properties.h). mEventQueue(), mInputStyleChangedQueue(), mPreviousState( INACTIVE ), diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 99e031a..ae749e6 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -27,6 +27,7 @@ #include // INTERNAL INCLUDES +#include #include #include #include @@ -47,14 +48,14 @@ const float MAX_FLOAT = std::numeric_limits::max(); const std::string EMPTY_STRING(""); -const char * const PLACEHOLDER_TEXT = "placeholderText"; -const char * const PLACEHOLDER_TEXT_FOCUSED = "placeholderTextFocused"; -const char * const PLACEHOLDER_COLOR = "placeholderColor"; -const char * const PLACEHOLDER_FONT_FAMILY = "placeholderFontFamily"; -const char * const PLACEHOLDER_FONT_STYLE = "placeholderFontStyle"; -const char * const PLACEHOLDER_POINT_SIZE = "placeholderPointSize"; -const char * const PLACEHOLDER_PIXEL_SIZE = "placeholderPixelSize"; -const char * const PLACEHOLDER_ELLIPSIS = "placeholderEllipsis"; +const char * const PLACEHOLDER_TEXT = "text"; +const char * const PLACEHOLDER_TEXT_FOCUSED = "textFocused"; +const char * const PLACEHOLDER_COLOR = "color"; +const char * const PLACEHOLDER_FONT_FAMILY = "fontFamily"; +const char * const PLACEHOLDER_FONT_STYLE = "fontStyle"; +const char * const PLACEHOLDER_POINT_SIZE = "pointSize"; +const char * const PLACEHOLDER_PIXEL_SIZE = "pixelSize"; +const char * const PLACEHOLDER_ELLIPSIS = "ellipsis"; float ConvertToEven( float value ) { @@ -1986,19 +1987,19 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) Property::Key& key = keyValue.first; Property::Value& value = keyValue.second; - if( key == PLACEHOLDER_TEXT ) + if( key == Toolkit::Text::PlaceHolder::Property::TEXT || key == PLACEHOLDER_TEXT ) { std::string text = ""; value.Get( text ); SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text ); } - else if( key == PLACEHOLDER_TEXT_FOCUSED ) + else if( key == Toolkit::Text::PlaceHolder::Property::TEXT_FOCUSED || key == PLACEHOLDER_TEXT_FOCUSED ) { std::string text = ""; value.Get( text ); SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text ); } - else if( key == PLACEHOLDER_COLOR ) + else if( key == Toolkit::Text::PlaceHolder::Property::COLOR || key == PLACEHOLDER_COLOR ) { Vector4 textColor; value.Get( textColor ); @@ -2007,17 +2008,17 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) SetPlaceholderTextColor( textColor ); } } - else if( key == PLACEHOLDER_FONT_FAMILY ) + else if( key == Toolkit::Text::PlaceHolder::Property::FONT_FAMILY || key == PLACEHOLDER_FONT_FAMILY ) { std::string fontFamily = ""; value.Get( fontFamily ); SetPlaceholderFontFamily( fontFamily ); } - else if( key == PLACEHOLDER_FONT_STYLE ) + else if( key == Toolkit::Text::PlaceHolder::Property::FONT_STYLE || key == PLACEHOLDER_FONT_STYLE ) { SetFontStyleProperty( this, value, Text::FontStyle::PLACEHOLDER ); } - else if( key == PLACEHOLDER_POINT_SIZE ) + else if( key == Toolkit::Text::PlaceHolder::Property::POINT_SIZE || key == PLACEHOLDER_POINT_SIZE ) { float pointSize; value.Get( pointSize ); @@ -2026,7 +2027,7 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) SetPlaceholderTextFontSize( pointSize, Text::Controller::POINT_SIZE ); } } - else if( key == PLACEHOLDER_PIXEL_SIZE ) + else if( key == Toolkit::Text::PlaceHolder::Property::PIXEL_SIZE || key == PLACEHOLDER_PIXEL_SIZE ) { float pixelSize; value.Get( pixelSize ); @@ -2035,7 +2036,7 @@ void Controller::SetPlaceholderProperty( const Property::Map& map ) SetPlaceholderTextFontSize( pixelSize, Text::Controller::PIXEL_SIZE ); } } - else if( key == PLACEHOLDER_ELLIPSIS ) + else if( key == Toolkit::Text::PlaceHolder::Property::ELLIPSIS || key == PLACEHOLDER_ELLIPSIS ) { bool ellipsis; value.Get( ellipsis ); @@ -2050,33 +2051,33 @@ void Controller::GetPlaceholderProperty( Property::Map& map ) { if( !mImpl->mEventData->mPlaceholderTextActive.empty() ) { - map[ PLACEHOLDER_TEXT_FOCUSED ] = mImpl->mEventData->mPlaceholderTextActive; + map[ Text::PlaceHolder::Property::TEXT_FOCUSED ] = mImpl->mEventData->mPlaceholderTextActive; } if( !mImpl->mEventData->mPlaceholderTextInactive.empty() ) { - map[ PLACEHOLDER_TEXT ] = mImpl->mEventData->mPlaceholderTextInactive; + map[ Text::PlaceHolder::Property::TEXT ] = mImpl->mEventData->mPlaceholderTextInactive; } - map[ PLACEHOLDER_COLOR ] = mImpl->mEventData->mPlaceholderTextColor; - map[ PLACEHOLDER_FONT_FAMILY ] = GetPlaceholderFontFamily(); + map[ Text::PlaceHolder::Property::COLOR ] = mImpl->mEventData->mPlaceholderTextColor; + map[ Text::PlaceHolder::Property::FONT_FAMILY ] = GetPlaceholderFontFamily(); Property::Value fontStyleMapGet; GetFontStyleProperty( this, fontStyleMapGet, Text::FontStyle::PLACEHOLDER ); - map[ PLACEHOLDER_FONT_STYLE ] = fontStyleMapGet; + map[ Text::PlaceHolder::Property::FONT_STYLE ] = fontStyleMapGet; // Choose font size : POINT_SIZE or PIXEL_SIZE if( !mImpl->mEventData->mIsPlaceholderPixelSize ) { - map[ PLACEHOLDER_POINT_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::POINT_SIZE ); + map[ Text::PlaceHolder::Property::POINT_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::POINT_SIZE ); } else { - map[ PLACEHOLDER_PIXEL_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::PIXEL_SIZE ); + map[ Text::PlaceHolder::Property::PIXEL_SIZE ] = GetPlaceholderTextFontSize( Text::Controller::PIXEL_SIZE ); } if( mImpl->mEventData->mPlaceholderEllipsisFlag ) { - map[ PLACEHOLDER_ELLIPSIS ] = IsPlaceholderTextElideEnabled(); + map[ Text::PlaceHolder::Property::ELLIPSIS ] = IsPlaceholderTextElideEnabled(); } } } diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index e85a2fd..dbc16eb 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -84,6 +84,8 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( \n void main()\n {\n + if ( vTexCoord.y > 1.0 )\n + discard;\n gl_FragColor = texture2D( sTexture, vTexCoord );\n }\n ); diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index 6c35875..e979607 100755 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -194,12 +194,11 @@ const char* FRAGMENT_SHADER_SINGLE_COLOR_TEXT_WITH_EMOJI = DALI_COMPOSE_SHADER( // Set the color of non-transparent pixel in text to what it is animated to. // Markup text with multiple text colors are not animated (but can be supported later on if required). // Emoji color are not animated. - mediump vec4 textColor = textTexture * textTexture.a;\n - mediump float vstep = step( 0.0001, textColor.a );\n - textColor.rgb = mix( textColor.rgb, uTextColorAnimatable.rgb, vstep * maskTexture );\n + mediump float vstep = step( 0.0001, textTexture.a );\n + textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture );\n // Draw the text as overlay above the style - gl_FragColor = textColor * uColor * vec4( mixColor, opacity );\n + gl_FragColor = textTexture * uColor * vec4( mixColor, opacity );\n }\n ); @@ -225,12 +224,11 @@ const char* FRAGMENT_SHADER_SINGLE_COLOR_TEXT_WITH_STYLE_AND_EMOJI = DALI_COMPOS // Set the color of non-transparent pixel in text to what it is animated to. // Markup text with multiple text colors are not animated (but can be supported later on if required). // Emoji color are not animated. - mediump vec4 textColor = textTexture * textTexture.a;\n - mediump float vstep = step( 0.0001, textColor.a );\n - textColor.rgb = mix( textColor.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );\n + mediump float vstep = step( 0.0001, textTexture.a );\n + textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );\n // Draw the text as overlay above the style - gl_FragColor = ( textColor + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, opacity );\n + gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, opacity );\n }\n ); diff --git a/dali-toolkit/public-api/controls/text-controls/placeholder-properties.h b/dali-toolkit/public-api/controls/text-controls/placeholder-properties.h new file mode 100644 index 0000000..d102d4f --- /dev/null +++ b/dali-toolkit/public-api/controls/text-controls/placeholder-properties.h @@ -0,0 +1,149 @@ +#ifndef DALI_TOOLKIT_PLACEHOLDER_PROPERTIES_H +#define DALI_TOOLKIT_PLACEHOLDER_PROPERTIES_H + +/* + * Copyright (c) 2017 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. + * + */ + +namespace Dali +{ + +namespace Toolkit +{ + +/** + * @addtogroup dali_toolkit_controls + * @{ + */ + +namespace Text +{ + +/** + * @brief Placeholder text used by Text controls to show text before any text inputed. + * @SINCE_1_2.62 + * + */ +namespace PlaceHolder +{ + +/** + * @brief Placeholder text Propeties used by Text controls to show placeholder + * @SINCE_1_2.62 + * + */ +namespace Property +{ + +/** + * @brief The configurable settings for the Placeholder text. + * @SINCE_1_2.62 + * + */ +enum Setting +{ + /** + * @brief The text to display as a placeholder. + * @details Name "text", type Property::STRING. + * @note Optional. If not provided then no placeholder text will be shown whilst control not focused. + * @SINCE_1_2.62 + */ + TEXT, + + /** + * @brief The text to display as placeholder when focused. + * @details Name "textFocused", type Property::STRING. + * @note Optional. If not provided then no placeholder text will be shown when focused. + * @SINCE_1_2.62 + */ + TEXT_FOCUSED, + + /** + * @brief The colour of the placeholder text. + * @details Name "color", type Property::VECTOR4. + * @note If color not provided then 80% white will be used. + * @SINCE_1_2.62 + */ + COLOR, + + /** + * @brief The font family to be used for placeholder text. + * @details Name "fontFamily", type Property::STRING. + * @note Optional. Default font family used if not provided. + * @SINCE_1_2.62 + */ + FONT_FAMILY, + + /** + * @brief The font style to be used for placeholder text. + * @details Name "fontStyle", type Property::MAP. + * + * Example usage: + * @code + * Property::Map fontStylePropertyMap; + * fontStylePropertyMap.Insert( "weight", "bold" ); + * fontStylePropertyMap.Insert( "width", "condensed" ); + * fontStylePropertyMap.Insert( "slant", "italic" ); + * ... + * placeholderPropertyMap[ Text::PlaceHolder::Property::FONT_STYLE] = fontStylePropertyMap; + * @endcode + * + * @note Optional. Default font style used if not provided. + * @SINCE_1_2.62 + */ + FONT_STYLE, + + /** + * @brief The font point size to be used. + * @details Name "pointSize", type Property::FLOAT. + * @note Optional. Not required if PIXEL_SIZE provided. If neither provided then the text control point size is used. + * @SINCE_1_2.62 + */ + POINT_SIZE, + + /** + * @brief The font size in pixels to be used + * @details Name "pixelSize", type Property::FLOAT. + * @note Optional. Not required if POINT_SIZE provided. If neither provided then the text control point size is used. + * @SINCE_1_2.62 + */ + PIXEL_SIZE, + + /** + * @brief If ellipsis should be used when placeholder is too long. + * @details Name "ellipsis", type Property::BOOLEAN + * @note Optional. Default is false. + * @SINCE_1_2.62 + */ + ELLIPSIS +}; + +} // namespace Property + +} // namespace PlaceHolder + + +} // namespace Text + +/** + * @} + */ + +} // namespace Toolkit + +} // namespace Dali + +#endif //DALI_TOOLKIT_PLACEHOLDER_PROPERTIES_H diff --git a/dali-toolkit/public-api/controls/text-controls/text-field.h b/dali-toolkit/public-api/controls/text-controls/text-field.h index 1fb34e0..0875753 100644 --- a/dali-toolkit/public-api/controls/text-controls/text-field.h +++ b/dali-toolkit/public-api/controls/text-controls/text-field.h @@ -439,18 +439,18 @@ public: * Example Usage: * @code * Property::Map propertyMap; - * propertyMap["placeholderText"] = "Setting Placeholder Text"; - * propertyMap["placeholderTextFocused"] = "Setting Placeholder Text Focused"; - * propertyMap["placeholderColor"] = Color::RED; - * propertyMap["placeholderFontFamily"] = "Arial"; - * propertyMap["placeholderPointSize"] = 12.0f; - * propertyMap["placeholderEllipsis"] = true; + * propertyMap[ Text::PlaceHolder::Property::TEXT ] = "Setting Placeholder Text"; + * propertyMap[ Text::PlaceHolder::Property::TEXT_FOCUSED] = "Setting Placeholder Text Focused"; + * propertyMap[ Text::PlaceHolder::Property::COLOR] = Color::RED; + * propertyMap[ Text::PlaceHolder::Property::FONT_FAMILY ] = "Arial"; + * propertyMap[ Text::PlaceHolder::Property::POINT_SIZE ] = 12.0f; + * propertyMap[ Text::PlaceHolder::Property::ELLIPSIS ] = true; * * Property::Map fontStyleMap; * fontStyleMap.Insert( "weight", "bold" ); * fontStyleMap.Insert( "width", "condensed" ); * fontStyleMap.Insert( "slant", "italic" ); - * propertyMap["placeholderFontStyle"] = fontStyleMap; + * propertyMap[ Text::PlaceHolder::Property::FONT_STYLE] = fontStyleMap; * * field.SetProperty( TextField::Property::PLACEHOLDER, propertyMap ); * @endcode diff --git a/dali-toolkit/public-api/controls/video-view/video-view.h b/dali-toolkit/public-api/controls/video-view/video-view.h index d6a9bdf..154d93e 100644 --- a/dali-toolkit/public-api/controls/video-view/video-view.h +++ b/dali-toolkit/public-api/controls/video-view/video-view.h @@ -66,6 +66,8 @@ public: // Signal typedef Signal< void (VideoView&) > VideoViewSignalType; ///< Video playback finished signal type @ SINCE_1_1.38 +public: + /** * @brief Enumeration for the start and end property ranges for this control. * @SINCE_1_0.0 @@ -101,7 +103,16 @@ public: * @brief name "volume", left and right volume scalar as float type, Property::Map with two values ( "left" and "right" ). * @SINCE_1_1.38 */ - VOLUME + VOLUME, + + /** + * @brief name "underlay", Video rendering by underlay, true or false + * This shows video composited underneath the window by the system. This means it may ignore rotation of the video-view + * If false, video-view shows decoded frame images sequentially. + * If Platform or video plugin doesn't support decoded frame images, this should always be true. + * @SINCE_1_2.62 + */ + UNDERLAY }; }; diff --git a/dali-toolkit/public-api/file.list b/dali-toolkit/public-api/file.list index f29325b..e490f79 100755 --- a/dali-toolkit/public-api/file.list +++ b/dali-toolkit/public-api/file.list @@ -104,6 +104,7 @@ public_api_table_view_header_files = \ public_api_text_controls_header_files = \ $(public_api_src_dir)/controls/text-controls/hidden-input-properties.h \ + $(public_api_src_dir)/controls/text-controls/placeholder-properties.h \ $(public_api_src_dir)/controls/text-controls/text-editor.h \ $(public_api_src_dir)/controls/text-controls/text-label.h \ $(public_api_src_dir)/controls/text-controls/text-field.h