From: Seoyeon Kim Date: Mon, 22 Mar 2021 00:54:03 +0000 (+0000) Subject: Merge "Make AccessibilityManager::SetCurrentFocusActor more usable" into devel/master X-Git-Tag: dali_2.0.19~10 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=fa290a9257bce2f6be5fc14b32ab2e5bca18da09;hp=fe08faff0b7bbe1f6573b42aa17201c513b793a6 Merge "Make AccessibilityManager::SetCurrentFocusActor more usable" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp index 863a3b0..01b5ae5 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-web-engine.cpp @@ -221,6 +221,18 @@ public: MockWebEngineSettings() : mockDefaultFontSize( 16 ), mockJavaScriptEnabled( true ), + mockAutoFittingEnabled ( true ), + mockPluginsEnabled ( true ), + mockPrivateBrowsingEnabled( true ), + mockLinkMagnifierEnabled( true ), + mockKeypadWithoutUserActionUsed( true ), + mockAutofillPasswordFormEnabled( true ), + mockFormCandidateDataEnabled( true ), + mockTextSelectionEnabled( true ), + mockTextAutosizingEnable( true ), + mockArrowScrollEnable( true ), + mockClipboardEnabled( true ), + mockImePanelEnabled( true ), mockImageLoadedAutomatically( true ), mockDefaultTextEncodingName() { @@ -246,6 +258,126 @@ public: mockJavaScriptEnabled = enabled; } + bool IsAutoFittingEnabled() const override + { + return mockAutoFittingEnabled; + } + + void EnableAutoFitting( bool enabled ) override + { + mockAutoFittingEnabled = enabled; + } + + bool ArePluginsEnabled() const override + { + return mockPluginsEnabled; + } + + void EnablePlugins( bool enabled ) override + { + mockPluginsEnabled = enabled; + } + + bool IsPrivateBrowsingEnabled() const override + { + return mockPrivateBrowsingEnabled; + } + + void EnablePrivateBrowsing( bool enabled ) override + { + mockPrivateBrowsingEnabled = enabled; + } + + bool IsLinkMagnifierEnabled() const override + { + return mockLinkMagnifierEnabled; + } + + void EnableLinkMagnifier( bool enabled ) override + { + mockLinkMagnifierEnabled = enabled; + } + + bool IsKeypadWithoutUserActionUsed() const override + { + return mockKeypadWithoutUserActionUsed; + } + + void UseKeypadWithoutUserAction( bool used ) override + { + mockKeypadWithoutUserActionUsed = used; + } + + bool IsAutofillPasswordFormEnabled() const override + { + return mockAutofillPasswordFormEnabled; + } + + void EnableAutofillPasswordForm( bool enabled ) override + { + mockAutofillPasswordFormEnabled = enabled; + } + + bool IsFormCandidateDataEnabled() const override + { + return mockFormCandidateDataEnabled; + } + + void EnableFormCandidateData( bool enabled ) override + { + mockFormCandidateDataEnabled = enabled; + } + + bool IsTextSelectionEnabled() const override + { + return mockTextSelectionEnabled; + } + + void EnableTextSelection( bool enabled ) override + { + mockTextSelectionEnabled = enabled; + } + + bool IsTextAutosizingEnabled() const override + { + return mockTextAutosizingEnable; + } + + void EnableTextAutosizing( bool enabled ) override + { + mockTextAutosizingEnable = enabled; + } + + bool IsArrowScrollEnabled() const override + { + return mockArrowScrollEnable; + } + + void EnableArrowScroll( bool enabled ) override + { + mockArrowScrollEnable = enabled; + } + + bool IsClipboardEnabled() const override + { + return mockClipboardEnabled; + } + + void EnableClipboard( bool enabled ) override + { + mockClipboardEnabled = enabled; + } + + bool IsImePanelEnabled() const override + { + return mockImePanelEnabled; + } + + void EnableImePanel( bool enabled ) override + { + mockImePanelEnabled = enabled; + } + bool AreImagesLoadedAutomatically() const override { return mockImageLoadedAutomatically; @@ -278,6 +410,18 @@ public: { } + void EnableCacheBuilder( bool enabled ) override + { + } + + void UseScrollbarThumbFocusNotifications( bool used ) override + { + } + + void EnableDoNotTrack( bool enabled ) override + { + } + void AllowFileAccessFromExternalUrl( bool allowed ) override { } @@ -289,6 +433,18 @@ public: private: int mockDefaultFontSize; bool mockJavaScriptEnabled; + bool mockAutoFittingEnabled; + bool mockPluginsEnabled; + bool mockPrivateBrowsingEnabled; + bool mockLinkMagnifierEnabled; + bool mockKeypadWithoutUserActionUsed; + bool mockAutofillPasswordFormEnabled; + bool mockFormCandidateDataEnabled; + bool mockTextSelectionEnabled; + bool mockTextAutosizingEnable; + bool mockArrowScrollEnable; + bool mockClipboardEnabled; + bool mockImePanelEnabled; bool mockImageLoadedAutomatically; std::string mockDefaultTextEncodingName; }; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp index 243a73b..c77b4ac 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-AnimatedImageVisual.cpp @@ -1,6 +1,6 @@ /* - * 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. @@ -293,6 +293,52 @@ int UtcDaliAnimatedImageVisualGetPropertyMap04(void) END_TEST; } +int UtcDaliAnimatedImageVisualImageLoadingFail01(void) +{ + ToolkitTestApplication application; + TestGlAbstraction& gl = application.GetGlAbstraction(); + + { + Property::Map propertyMap; + propertyMap.Insert( Visual::Property::TYPE, Visual::ANIMATED_IMAGE ); + propertyMap.Insert( ImageVisual::Property::URL, "dummy.gif" ); + propertyMap.Insert( ImageVisual::Property::BATCH_SIZE, 2 ); + propertyMap.Insert( ImageVisual::Property::CACHE_SIZE, 2 ); + propertyMap.Insert( ImageVisual::Property::FRAME_DELAY, 20 ); + propertyMap.Insert( ImageVisual::Property::SYNCHRONOUS_LOADING, true ); + propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS, 0.23f ); + propertyMap.Insert( DevelVisual::Property::CORNER_RADIUS_POLICY, Visual::Transform::Policy::ABSOLUTE ); + + VisualFactory factory = VisualFactory::Get(); + Visual::Base visual = factory.CreateVisual( propertyMap ); + + DummyControl dummyControl = DummyControl::New(true); + Impl::DummyControl& dummyImpl = static_cast(dummyControl.GetImplementation()); + dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual ); + + dummyControl.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); + application.GetScene().Add( dummyControl ); + + TraceCallStack& textureTrace = gl.GetTextureTrace(); + textureTrace.Enable(true); + + application.SendNotification(); + application.Render(20); + + DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 1, TEST_LOCATION ); + + DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedImageVisual::Action::JUMP_TO, 6 ); + + application.SendNotification(); + application.Render(20); + + DALI_TEST_EQUALS( gl.GetNumGeneratedTextures(), 1, TEST_LOCATION ); + + dummyControl.Unparent(); + } + + END_TEST; +} int UtcDaliAnimatedImageVisualSynchronousLoading(void) { diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index d5a243c..06d3307 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -964,33 +964,113 @@ int utcDaliTextEditorTextChangedP(void) gTextChangedCallBackCalled = false; editor.SetProperty( TextEditor::Property::TEXT, "ABC" ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( gTextChangedCallBackCalled ); DALI_TEST_CHECK( textChangedSignal ); - application.SendNotification(); - editor.SetKeyInputFocus(); gTextChangedCallBackCalled = false; application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( gTextChangedCallBackCalled ); // Remove all text editor.SetProperty( TextField::Property::TEXT, "" ); + application.SendNotification(); + application.Render(); // Pressing backspace key: TextChangedCallback should not be called when there is no text in texteditor. gTextChangedCallBackCalled = false; application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( !gTextChangedCallBackCalled ); // Pressing delete key: TextChangedCallback should not be called when there is no text in texteditor. gTextChangedCallBackCalled = false; application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( !gTextChangedCallBackCalled ); END_TEST; } +int utcDaliTextEditorTextChangedWithInputMethodContext(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextEditorTextChangedWithInputMethodContext"); + TextEditor editor = TextEditor::New(); + DALI_TEST_CHECK( editor ); + + + application.GetScene().Add( editor ); + + // connect to the text changed signal. + ConnectionTracker* testTracker = new ConnectionTracker(); + editor.TextChangedSignal().Connect(&TestTextChangedCallback); + bool textChangedSignal = false; + editor.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) ); + + + // get InputMethodContext + std::string text; + InputMethodContext::EventData imfEvent; + InputMethodContext inputMethodContext = DevelTextEditor::GetInputMethodContext( editor ); + + editor.SetKeyInputFocus(); + editor.SetProperty( DevelTextEditor::Property::ENABLE_EDITING, true ); + + // input text + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "ㅎ", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( editor.GetProperty( TextEditor::Property::TEXT ), std::string("ㅎ"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "호", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( editor.GetProperty( TextEditor::Property::TEXT ), std::string("호"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "혿", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( editor.GetProperty( TextEditor::Property::TEXT ), std::string("혿"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "호", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "두", 1, 2 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( editor.GetProperty( TextEditor::Property::TEXT ), std::string("호두"), TEST_LOCATION ); + + END_TEST; +} + + int utcDaliTextEditorInputStyleChanged01(void) { // The text-editor emits signals when the input style changes. These changes of style are diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index b535059..0795816 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -1034,33 +1034,113 @@ int utcDaliTextFieldTextChangedP(void) gTextChangedCallBackCalled = false; field.SetProperty( TextField::Property::TEXT, "ABC" ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( gTextChangedCallBackCalled ); DALI_TEST_CHECK( textChangedSignal ); - application.SendNotification(); - field.SetKeyInputFocus(); gTextChangedCallBackCalled = false; application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( gTextChangedCallBackCalled ); // Remove all text field.SetProperty( TextField::Property::TEXT, "" ); + application.SendNotification(); + application.Render(); // Pressing backspace key: TextChangedCallback should not be called when there is no text in textfield. gTextChangedCallBackCalled = false; application.ProcessEvent( GenerateKey( "", "", "", DALI_KEY_BACKSPACE, 0, 0, Integration::KeyEvent::DOWN, "", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( !gTextChangedCallBackCalled ); // Pressing delete key: TextChangedCallback should not be called when there is no text in textfield. gTextChangedCallBackCalled = false; application.ProcessEvent( GenerateKey( "", "", "", Dali::DevelKey::DALI_KEY_DELETE, 0, 0, Integration::KeyEvent::DOWN, "Delete", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + END_TEST; +} + +int utcDaliTextFieldTextChangedWithInputMethodContext(void) +{ + ToolkitTestApplication application; + tet_infoline(" utcDaliTextFieldTextChangedWithInputMethodContext"); + TextField field = TextField::New(); + DALI_TEST_CHECK( field ); + + + application.GetScene().Add( field ); + + // connect to the text changed signal. + ConnectionTracker* testTracker = new ConnectionTracker(); + field.TextChangedSignal().Connect(&TestTextChangedCallback); + bool textChangedSignal = false; + field.ConnectSignal( testTracker, "textChanged", CallbackFunctor(&textChangedSignal) ); + + + // get InputMethodContext + std::string text; + InputMethodContext::EventData imfEvent; + InputMethodContext inputMethodContext = DevelTextField::GetInputMethodContext( field ); + + field.SetKeyInputFocus(); + field.SetProperty( DevelTextField::Property::ENABLE_EDITING, true ); + + // input text + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "ㅎ", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("ㅎ"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "호", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("호"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "혿", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("혿"), TEST_LOCATION ); + + gTextChangedCallBackCalled = false; + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "호", 0, 1 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); + DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + + imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "두", 1, 2 ); + inputMethodContext.EventReceivedSignal().Emit(inputMethodContext, imfEvent); DALI_TEST_CHECK( !gTextChangedCallBackCalled ); + application.SendNotification(); + application.Render(); + DALI_TEST_CHECK( gTextChangedCallBackCalled ); + DALI_TEST_EQUALS( field.GetProperty( TextField::Property::TEXT ), std::string("호두"), TEST_LOCATION ); + END_TEST; } + // Negative test for the textChanged signal. int utcDaliTextFieldTextChangedN(void) { @@ -1079,6 +1159,8 @@ int utcDaliTextFieldTextChangedN(void) gTextChangedCallBackCalled = false; field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "ABC" ); // Setting placeholder, not TEXT + application.SendNotification(); + application.Render(); DALI_TEST_CHECK( !gTextChangedCallBackCalled ); DALI_TEST_CHECK( !textChangedSignal ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp old mode 100644 new mode 100755 index b92cea6..7b7e397 --- a/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-WebView.cpp @@ -750,6 +750,9 @@ int UtcDaliWebSettingsGetSetDefaultFontSize(void) settings->AllowMixedContents( false ); settings->EnableSpatialNavigation( false ); settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); settings->AllowFileAccessFromExternalUrl( false ); settings->AllowScriptsOpenWindows( false ); @@ -779,6 +782,9 @@ int UtcDaliWebSettingsCheckEnableJavaScript(void) settings->AllowMixedContents( false ); settings->EnableSpatialNavigation( false ); settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); settings->AllowFileAccessFromExternalUrl( false ); settings->AllowScriptsOpenWindows( false ); @@ -794,6 +800,384 @@ int UtcDaliWebSettingsCheckEnableJavaScript(void) END_TEST; } +int UtcDaliWebSettingsCheckEnableAutoFitting(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ) + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsAutoFittingEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnableAutoFitting( false ); + value = settings->IsAutoFittingEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnablePlugins(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ) + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->ArePluginsEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnablePlugins( false ); + value = settings->ArePluginsEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnablePrivateBrowsing(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ) + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsPrivateBrowsingEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnablePrivateBrowsing( false ); + value = settings->IsPrivateBrowsingEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableLinkMagnifier(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ) + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsLinkMagnifierEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnableLinkMagnifier( false ); + value = settings->IsLinkMagnifierEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckUseKeypadWithoutUserAction(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ) + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsKeypadWithoutUserActionUsed(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->UseKeypadWithoutUserAction( false ); + value = settings->IsKeypadWithoutUserActionUsed(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableAutofillPasswordForm(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ) + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsAutofillPasswordFormEnabled(); + DALI_TEST_CHECK( value ); + settings->EnableAutofillPasswordForm( false ); + value = settings->IsAutofillPasswordFormEnabled(); + DALI_TEST_CHECK( !value ); + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableFormCandidateData(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ); + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsFormCandidateDataEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnableFormCandidateData( false ); + value = settings->IsFormCandidateDataEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableTextSelection(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ); + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsTextSelectionEnabled(); + DALI_TEST_CHECK( value ); + + //Check Set/GetProperty + settings->EnableTextSelection(false); + value = settings->IsTextSelectionEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableTextAutosizing(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ); + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsTextAutosizingEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnableTextAutosizing(false); + value = settings->IsTextAutosizingEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableArrowScroll(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ); + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsArrowScrollEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnableArrowScroll(false); + value = settings->IsArrowScrollEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableClipboard(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ); + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsClipboardEnabled(); + DALI_TEST_CHECK( value ); + settings->EnableClipboard(false); + value = settings->IsClipboardEnabled(); + DALI_TEST_CHECK( !value ); + END_TEST; +} + +int UtcDaliWebSettingsCheckEnableImePanel(void) +{ + ToolkitTestApplication application; + + WebView view = WebView::New(); + DALI_TEST_CHECK( view ); + + Dali::Toolkit::WebSettings* settings = view.GetSettings(); + DALI_TEST_CHECK( settings != 0 ); + + // Reset something + settings->AllowMixedContents( false ); + settings->EnableSpatialNavigation( false ); + settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); + settings->AllowFileAccessFromExternalUrl( false ); + settings->AllowScriptsOpenWindows( false ); + + // Check default value is true or not + bool value = settings->IsImePanelEnabled(); + DALI_TEST_CHECK( value ); + + // Check Set/GetProperty + settings->EnableImePanel(false); + value = settings->IsImePanelEnabled(); + DALI_TEST_CHECK( !value ); + + END_TEST; +} + int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void) { ToolkitTestApplication application; @@ -808,6 +1192,9 @@ int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void) settings->AllowMixedContents( false ); settings->EnableSpatialNavigation( false ); settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); settings->AllowFileAccessFromExternalUrl( false ); settings->AllowScriptsOpenWindows( false ); @@ -840,6 +1227,9 @@ int UtcDaliWebSettingsGetSetDefaultTextEncodingName(void) settings->AllowMixedContents( false ); settings->EnableSpatialNavigation( false ); settings->EnableWebSecurity( false ); + settings->EnableCacheBuilder( false ); + settings->EnableDoNotTrack( false ); + settings->UseScrollbarThumbFocusNotifications( false ); settings->AllowFileAccessFromExternalUrl( false ); settings->AllowScriptsOpenWindows( false ); diff --git a/dali-toolkit/devel-api/controls/web-view/web-settings.cpp b/dali-toolkit/devel-api/controls/web-view/web-settings.cpp old mode 100644 new mode 100755 index bdd191a..d39a93e --- a/dali-toolkit/devel-api/controls/web-view/web-settings.cpp +++ b/dali-toolkit/devel-api/controls/web-view/web-settings.cpp @@ -59,6 +59,21 @@ void WebSettings::EnableWebSecurity(bool enabled) mWebEngineSettings.EnableWebSecurity(enabled); } +void WebSettings::EnableCacheBuilder(bool enabled) +{ + mWebEngineSettings.EnableCacheBuilder(enabled); +} + +void WebSettings::UseScrollbarThumbFocusNotifications(bool used) +{ + mWebEngineSettings.UseScrollbarThumbFocusNotifications(used); +} + +void WebSettings::EnableDoNotTrack( bool enabled ) +{ + mWebEngineSettings.EnableDoNotTrack(enabled); +} + void WebSettings::AllowFileAccessFromExternalUrl(bool allowed) { mWebEngineSettings.AllowFileAccessFromExternalUrl(allowed); @@ -74,6 +89,126 @@ void WebSettings::EnableJavaScript(bool enabled) mWebEngineSettings.EnableJavaScript(enabled); } +bool WebSettings::IsAutoFittingEnabled() const +{ + return mWebEngineSettings.IsAutoFittingEnabled(); +} + +void WebSettings::EnableAutoFitting(bool enabled) +{ + mWebEngineSettings.EnableAutoFitting(enabled); +} + +bool WebSettings::ArePluginsEnabled() const +{ + return mWebEngineSettings.ArePluginsEnabled(); +} + +void WebSettings::EnablePlugins(bool enabled) +{ + mWebEngineSettings.EnablePlugins(enabled); +} + +bool WebSettings::IsPrivateBrowsingEnabled() const +{ + return mWebEngineSettings.IsPrivateBrowsingEnabled(); +} + +void WebSettings::EnablePrivateBrowsing(bool enabled) +{ + mWebEngineSettings.EnablePrivateBrowsing(enabled); +} + +bool WebSettings::IsLinkMagnifierEnabled() const +{ + return mWebEngineSettings.IsLinkMagnifierEnabled(); +} + +void WebSettings::EnableLinkMagnifier(bool enabled) +{ + mWebEngineSettings.EnableLinkMagnifier(enabled); +} + +bool WebSettings::IsKeypadWithoutUserActionUsed() const +{ + return mWebEngineSettings.IsKeypadWithoutUserActionUsed(); +} + +void WebSettings::UseKeypadWithoutUserAction(bool used) +{ + mWebEngineSettings.UseKeypadWithoutUserAction(used); +} + +bool WebSettings::IsAutofillPasswordFormEnabled() const +{ + return mWebEngineSettings.IsAutofillPasswordFormEnabled(); +} + +void WebSettings::EnableAutofillPasswordForm(bool enabled) +{ + mWebEngineSettings.EnableAutofillPasswordForm(enabled); +} + +bool WebSettings::IsFormCandidateDataEnabled() const +{ + return mWebEngineSettings.IsFormCandidateDataEnabled(); +} + +void WebSettings::EnableFormCandidateData( bool enabled ) +{ + mWebEngineSettings.EnableFormCandidateData(enabled); +} + +bool WebSettings::IsTextSelectionEnabled() const +{ + return mWebEngineSettings.IsTextSelectionEnabled(); +} + +void WebSettings::EnableTextSelection( bool enabled ) +{ + return mWebEngineSettings.EnableTextSelection(enabled); +} + +bool WebSettings::IsTextAutosizingEnabled() const +{ + return mWebEngineSettings.IsTextAutosizingEnabled(); +} + +void WebSettings::EnableTextAutosizing( bool enabled ) +{ + return mWebEngineSettings.EnableTextAutosizing(enabled); +} + +bool WebSettings::IsArrowScrollEnabled() const +{ + return mWebEngineSettings.IsArrowScrollEnabled(); +} + +void WebSettings::EnableArrowScroll( bool enabled ) +{ + return mWebEngineSettings.EnableArrowScroll(enabled); +} + +bool WebSettings::IsClipboardEnabled() const +{ + return mWebEngineSettings.IsClipboardEnabled(); +} + +void WebSettings::EnableClipboard( bool enabled ) +{ + return mWebEngineSettings.EnableClipboard(enabled); +} + +bool WebSettings::IsImePanelEnabled() const +{ + return mWebEngineSettings.IsImePanelEnabled(); +} + +void WebSettings::EnableImePanel( bool enabled ) +{ + return mWebEngineSettings.EnableImePanel(enabled); +} + void WebSettings::AllowScriptsOpenWindows(bool allowed) { mWebEngineSettings.AllowScriptsOpenWindows(allowed); diff --git a/dali-toolkit/devel-api/controls/web-view/web-settings.h b/dali-toolkit/devel-api/controls/web-view/web-settings.h old mode 100644 new mode 100755 index 4d24b58..ba8b1fa --- a/dali-toolkit/devel-api/controls/web-view/web-settings.h +++ b/dali-toolkit/devel-api/controls/web-view/web-settings.h @@ -96,6 +96,29 @@ public: void EnableWebSecurity(bool enabled); /** + * @brief Enables/disables cache builder. + * + * @param[in] enabled if true, to enable the cache builder + * otherwise to disable + */ + void EnableCacheBuilder( bool enabled ); + + /** + * @brief Used/Unused uses scrollbar thumb focus notifications. The default is used. + * + * @param[in] used True if uses scrollbar thumb focus notifications, false otherwise + */ + void UseScrollbarThumbFocusNotifications ( bool used ); + + /** + * @brief Enable/disables do not track executing. + * + * @param[in] enabled if true, to enable do not track + * otherwise to disable + */ + void EnableDoNotTrack( bool enabled ); + + /** * @brief Allow/Disallow file access from external url * * @param[in] allowed if true, to allow file access from external url @@ -118,6 +141,174 @@ public: void EnableJavaScript(bool enabled); /** + * @brief Returns whether auto fitting can be executable. The default is true. + * + * @return true if auto fitting executing is enabled, false otherwise + */ + bool IsAutoFittingEnabled() const; + + /** + * @brief Enables/disables auto fitting executing. The default is enabled. + * + * @param[in] enabled True if auto fitting executing is enabled, false otherwise + */ + void EnableAutoFitting( bool enabled ); + + /** + * @brief Returns whether plugins can be executable. The default is true. + * + * @return true if plugins executing is enabled, false otherwise + */ + bool ArePluginsEnabled() const; + + /** + * @brief Enables/disables Plugins executing. The default is enabled. + * + * @param[in] enabled True if Plugins executing is enabled, false otherwise + */ + void EnablePlugins( bool enabled ); + + /** + * @brief Returns whether private browsing can be executable. The default is true. + * + * @return true if private browsing executing is enabled, false otherwise + */ + bool IsPrivateBrowsingEnabled() const; + + /** + * @brief Enables/disables private browsing executing. The default is enabled. + * + * @param[in] enabled True if private browsing executing is enabled, false otherwise + */ + void EnablePrivateBrowsing( bool enabled ); + + /** + * @brief Returns whether link magnifier can be executable. The default is true. + * + * @return true if link magnifier executing is enabled, false otherwise + */ + bool IsLinkMagnifierEnabled() const; + + /** + * @brief Enables/disables link magnifier executing. The default is enabled. + * + * @param[in] enabled True if link magnifier executing is enabled, false otherwise + */ + void EnableLinkMagnifier( bool enabled ); + + /** + * @brief Returns whether uses keypad without user action can be executable. The default is true. + * + * @return true if keypad without user action executing is used, false otherwise + */ + bool IsKeypadWithoutUserActionUsed() const; + + /** + * @brief Uses/Unused keypad without user action executing. The default is used. + * + * @param[in] used True if keypad without user action executing is used, false otherwise + */ + void UseKeypadWithoutUserAction( bool used ); + + /** + * @brief Returns whether autofill password form can be executable. The default is true. + * + * @return true if autofill password form executing is enabled, false otherwise + */ + bool IsAutofillPasswordFormEnabled() const; + + /** + * @brief Enables/disables autofill password form executing. The default is enabled. + * + * @param[in] enabled True if autofill password form executing is enabled, false otherwise + */ + void EnableAutofillPasswordForm( bool enabled ); + + /** + * @brief Returns whether form candidate data can be executable. The default is true. + * + * @return true if form candidate data executing is enabled, false otherwise + */ + bool IsFormCandidateDataEnabled() const; + + /** + * @brief Enables/disables form candidate data executing. The default is enabled. + * + * @param[in] enabled True if form candidate data executing is enabled, false otherwise + */ + void EnableFormCandidateData( bool enabled ); + + /** + * @brief Returns whether text selection can be executable. The default is true. + * + * @return true if text selection executing is enabled, false otherwise + */ + bool IsTextSelectionEnabled() const; + + /** + * brief Enables/disables text selection executing. The default is enabled. + * + * @param[in] enabled True if text selection executing is enabled, false otherwise + */ + void EnableTextSelection( bool enabled ); + + /** + * @brief Returns whether text autosizing can be executable. The default is true. + * + * @return true if text autosizing executing is enabled, false otherwise + */ + bool IsTextAutosizingEnabled() const; + + /** + * @brief Enables/disables text autosizing executing. The default is enabled. + * + * @param[in] enabled True if text autosizing executing is enabled, false otherwise + */ + void EnableTextAutosizing( bool enabled ); + + /** + * @brief Returns whether arrow scroll can be executable. The default is true. + * + * @return true if arrow scroll executing is enabled, false otherwise + */ + bool IsArrowScrollEnabled() const; + + /** + * @brief Enables/disables arrow scroll executing. The default is enabled. + * + * @param[in] enabled True if arrow scroll executing is enabled, false otherwise + */ + void EnableArrowScroll( bool enabled ); + + /** + * @brief Returns whether clipboard can be executable. The default is true. + * + * @return true if clipboard executing is enabled, false otherwise + */ + bool IsClipboardEnabled() const; + + /** + * @brief Enables/disables clipboard executing. The default is enabled. + * + * @param[in] enabled True if clipboard is enabled, false otherwise + */ + void EnableClipboard( bool enabled ); + + /** + * @brief Returns whether ime panel can be executable. The default is true. + * + * @return true if ime panel executing is enabled, false otherwise + */ + bool IsImePanelEnabled() const; + + /** + * @brief Enables/disables ime panel executing. The default is enabled. + * + * @param[in] enabled True if ime panel executing is enabled, false otherwise + */ + void EnableImePanel( bool enabled ); + + /** * @brief Allow if the scripts can open new windows. * * @param[in] allowed if true, the scripts can open new windows, diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 4e7d3f0..3d48333 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1384,7 +1384,7 @@ float TextEditor::GetHeightForWidth(float width) void TextEditor::ResizeActor(Actor& actor, const Vector2& size) { - if (actor.GetProperty(Dali::Actor::Property::SIZE).GetVectorXY() != size) + if(actor.GetProperty(Dali::Actor::Property::SIZE).GetVectorXY() != size) { actor.SetProperty(Actor::Property::SIZE, size); } @@ -1446,6 +1446,14 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container) } RenderText(updateTextType); + + // If there is text changed, callback is called. + if(mTextChanged) + { + Dali::Toolkit::TextEditor handle(GetOwner()); + mTextChangedSignal.Emit(handle); + mTextChanged = false; + } } // The text-editor emits signals when the input style changes. These changes of style are @@ -1661,8 +1669,7 @@ void TextEditor::CaretMoved(unsigned int position) void TextEditor::TextChanged() { - Dali::Toolkit::TextEditor handle(GetOwner()); - mTextChangedSignal.Emit(handle); + mTextChanged = true; } void TextEditor::MaxLengthReached() @@ -1984,7 +1991,8 @@ TextEditor::TextEditor() mHasBeenStaged(false), mScrollAnimationEnabled(false), mScrollBarEnabled(false), - mScrollStarted(false) + mScrollStarted(false), + mTextChanged(false) { } diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h index 866c444..4c408ca 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h @@ -362,7 +362,7 @@ private: // Implementation * @param[in] actor The actor to be resized. * @param[in] size Size to change. */ - void ResizeActor( Actor& actor, const Vector2& size ); + void ResizeActor(Actor& actor, const Vector2& size); /** * @brief Render view, create and attach actor(s) to this text editor. @@ -402,6 +402,7 @@ private: // Data bool mScrollAnimationEnabled : 1; bool mScrollBarEnabled : 1; bool mScrollStarted : 1; + bool mTextChanged : 1; struct AccessibleImpl : public DevelControl::AccessibleImpl, public virtual Dali::Accessibility::Text, diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 8b60fbe..47b32e9 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1335,7 +1335,7 @@ float TextField::GetHeightForWidth(float width) void TextField::ResizeActor(Actor& actor, const Vector2& size) { - if (actor.GetProperty(Dali::Actor::Property::SIZE).GetVectorXY() != size) + if(actor.GetProperty(Dali::Actor::Property::SIZE).GetVectorXY() != size) { actor.SetProperty(Actor::Property::SIZE, size); } @@ -1397,6 +1397,14 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) } RenderText(updateTextType); + + // If there is text changed, callback is called. + if(mTextChanged) + { + Dali::Toolkit::TextField handle(GetOwner()); + mTextChangedSignal.Emit(handle); + mTextChanged = false; + } } // The text-field emits signals when the input style changes. These changes of style are @@ -1689,8 +1697,7 @@ void TextField::CaretMoved(unsigned int position) void TextField::TextChanged() { - Dali::Toolkit::TextField handle(GetOwner()); - mTextChangedSignal.Emit(handle); + mTextChanged = true; } void TextField::MaxLengthReached() @@ -1867,7 +1874,8 @@ TextField::TextField() mAlignmentOffset(0.f), mRenderingBackend(DEFAULT_RENDERING_BACKEND), mExceedPolicy(Dali::Toolkit::TextField::EXCEED_POLICY_CLIP), - mHasBeenStaged(false) + mHasBeenStaged(false), + mTextChanged(false) { } diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.h b/dali-toolkit/internal/controls/text-controls/text-field-impl.h index 2fae0bb..07a7a37 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.h @@ -318,7 +318,7 @@ private: // Implementation * @param[in] actor The actor to be resized. * @param[in] size Size to change. */ - void ResizeActor( Actor& actor, const Vector2& size ); + void ResizeActor(Actor& actor, const Vector2& size); /** * @brief Render view, create and attach actor(s) to this Text Field. @@ -357,6 +357,7 @@ private: // Data int mRenderingBackend; int mExceedPolicy; bool mHasBeenStaged : 1; + bool mTextChanged : 1; protected: struct AccessibleImpl : public DevelControl::AccessibleImpl, diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp index 9952c55..c9623a6 100644 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.cpp @@ -265,8 +265,13 @@ void AnimatedImageVisual::DoCreateInstancePropertyMap(Property::Map& map) const void AnimatedImageVisual::OnDoAction(const Dali::Property::Index actionId, const Dali::Property::Value& attributes) { - // Check if action is valid for this visual type and perform action if possible + // Make not set any action when the resource status is already failed. + if(mImpl->mResourceStatus == Toolkit::Visual::ResourceStatus::FAILED) + { + return; + } + // Check if action is valid for this visual type and perform action if possible switch(actionId) { case DevelAnimatedImageVisual::Action::PAUSE: @@ -322,7 +327,6 @@ void AnimatedImageVisual::OnDoAction(const Dali::Property::Index actionId, const void AnimatedImageVisual::DoSetProperties(const Property::Map& propertyMap) { // url[s] already passed in from constructor - for(Property::Map::SizeType iter = 0; iter < propertyMap.Count(); ++iter) { KeyValuePair keyValue = propertyMap.GetKeyValue(iter); @@ -491,6 +495,13 @@ void AnimatedImageVisual::DoSetOnScene(Actor& actor) mPlacementActor = actor; TextureSet textureSet = PrepareTextureSet(); + // Loading animated image file is failed. + if(!mImageCache || + (mAnimatedImageLoading && !mAnimatedImageLoading.HasLoadingSucceeded())) + { + textureSet = SetLoadingFailed(); + } + if(textureSet) // if the image loading is successful { StartFirstFrame(textureSet); @@ -632,8 +643,12 @@ void AnimatedImageVisual::StartFirstFrame(TextureSet& textureSet) mFrameDelayTimer.TickSignal().Connect(this, &AnimatedImageVisual::DisplayNextFrame); mFrameDelayTimer.Start(); } - DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "ResourceReady(ResourceStatus::READY)\n"); - ResourceReady(Toolkit::Visual::ResourceStatus::READY); + + if(mImpl->mResourceStatus != Toolkit::Visual::ResourceStatus::FAILED) + { + DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "ResourceReady(ResourceStatus::READY)\n"); + ResourceReady(Toolkit::Visual::ResourceStatus::READY); + } } TextureSet AnimatedImageVisual::PrepareTextureSet() @@ -667,32 +682,31 @@ void AnimatedImageVisual::SetImageSize(TextureSet& textureSet) void AnimatedImageVisual::FrameReady(TextureSet textureSet) { - if(textureSet) + // When image visual requested to load new frame to mImageCache and it is failed. + if(!textureSet) { - SetImageSize(textureSet); + textureSet = SetLoadingFailed(); + } - if(mStartFirstFrame) - { - StartFirstFrame(textureSet); - } - else - { - if(mImpl->mRenderer) - { - mImpl->mRenderer.SetTextures(textureSet); - } - } + SetImageSize(textureSet); + + if(mStartFirstFrame) + { + StartFirstFrame(textureSet); } else { - DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "ResourceReady(ResourceStatus::FAILED)\n"); - ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); + if(mImpl->mRenderer) + { + mImpl->mRenderer.SetTextures(textureSet); + } } } bool AnimatedImageVisual::DisplayNextFrame() { - bool continueTimer = false; + TextureSet textureSet; + bool continueTimer = false; if(mImageCache) { @@ -756,7 +770,6 @@ bool AnimatedImageVisual::DisplayNextFrame() DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::DisplayNextFrame(this:%p) CurrentFrameIndex:%d\n", this, frameIndex); - TextureSet textureSet; if(nextFrame) { textureSet = mImageCache->NextFrame(); @@ -766,21 +779,41 @@ bool AnimatedImageVisual::DisplayNextFrame() textureSet = mImageCache->Frame(frameIndex); } - if(textureSet) + continueTimer = (mActionStatus == DevelAnimatedImageVisual::Action::PLAY) ? true : false; + } + + if(textureSet) + { + SetImageSize(textureSet); + if(mImpl->mRenderer) { - SetImageSize(textureSet); - if(mImpl->mRenderer) - { - mImpl->mRenderer.SetTextures(textureSet); - } + mImpl->mRenderer.SetTextures(textureSet); } - - continueTimer = (mActionStatus == DevelAnimatedImageVisual::Action::PLAY) ? true : false; } return continueTimer; } +TextureSet AnimatedImageVisual::SetLoadingFailed() +{ + DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "ResourceReady(ResourceStatus::FAILED)\n"); + ResourceReady(Toolkit::Visual::ResourceStatus::FAILED); + + TextureSet textureSet = TextureSet::New(); + Texture brokenImage = mFactoryCache.GetBrokenVisualImage(); + textureSet.SetTexture(0u, brokenImage); + + if(mFrameDelayTimer) + { + mFrameDelayTimer.Stop(); + mFrameDelayTimer.Reset(); + } + + SetImageSize(textureSet); + + return textureSet; +} + } // namespace Internal } // namespace Toolkit diff --git a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h index 6ccdcbb..608b43f 100644 --- a/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h +++ b/dali-toolkit/internal/visuals/animated-image/animated-image-visual.h @@ -228,6 +228,12 @@ private: */ void InitializeAnimatedImage(const VisualUrl& imageUrl); + /** + * Set the state of loading fail of an image or a frame. + * Returns TextureSet of broken image. + */ + TextureSet SetLoadingFailed(); + // Undefined AnimatedImageVisual(const AnimatedImageVisual& animatedImageVisual); diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index e15896b..5a75711 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -29,7 +29,7 @@ namespace Toolkit { const unsigned int TOOLKIT_MAJOR_VERSION = 2; const unsigned int TOOLKIT_MINOR_VERSION = 0; -const unsigned int TOOLKIT_MICRO_VERSION = 16; +const unsigned int TOOLKIT_MICRO_VERSION = 18; const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index bae4c89..12787c2 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali2-toolkit Summary: Dali 3D engine Toolkit -Version: 2.0.16 +Version: 2.0.18 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT @@ -87,8 +87,7 @@ Application development package for Dali 3D engine toolkit - headers and package Summary: DLI scene loading library Group: System/Libraries License: Apache-2.0 - -BuildRequires: pkgconfig(dali2-toolkit) +Requires: dali2-toolkit %description -n %{dali2_scene_loader} Provides functionality for loading and displaying DLI format scenes. See README.md for more details.