../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
dali-toolkit-test-utils/toolkit-text-utils.cpp
float positions01[] = { 0.f, 8.f, 16.f, 26.f, 33.f, 41.f, 45.f, 54.f, 64.0f };
Size textSize02( 80.f, 100.f );
- float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 9.0f };
+ float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 23.0f };
Size textSize03( 80.f, 100.f );
- float positions03[] = { 78.f, 73.f, 70.f, 65.f, 57.f, 55.f, 51.f, 50.f, 45.f, 35.f, 32.f, 24.f, 7.f };
+ float positions03[] = { 78.f, 73.f, 70.f, 65.f, 57.f, 55.f, 51.f, 50.f, 45.f, 35.f, 32.f, 24.f, 21.f };
Size textSize04( 80.f, 10.f );
float positions04[] = { 2.f };
../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
)
../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
)
dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
dali-toolkit-test-utils/test-platform-abstraction.cpp
dali-toolkit-test-utils/test-render-controller.cpp
+ dali-toolkit-test-utils/test-render-surface.cpp
dali-toolkit-test-utils/test-trace-call-stack.cpp
dali-toolkit-test-utils/test-native-image.cpp
)
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
Integration::StencilBufferAvailable::TRUE );
mCore->ContextCreated();
- mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
- mCore->SetDpi( mDpi.x, mDpi.y );
Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage);
Dali::Integration::Log::InstallLogFunction(logFunction);
Dali::Integration::Trace::LogContext( true, "Test" );
+ mRenderSurface = new TestRenderSurface( Dali::PositionSize( 0, 0, mSurfaceWidth, mSurfaceHeight ) );
+ mScene = Dali::Integration::Scene::New( Vector2( static_cast<float>( mSurfaceWidth ), static_cast<float>( mSurfaceHeight ) ) );
+ mScene.SetSurface( *mRenderSurface );
+
+ mScene.SetDpi( Vector2( static_cast<float>( mDpi.x ), static_cast<float>( mDpi.y ) ) );
+
+ mCore->SurfaceResized( mRenderSurface );
+
mCore->SceneCreated();
+ mCore->Initialize();
}
TestApplication::~TestApplication()
{
Dali::Integration::Log::UninstallLogFunction();
+ delete mRenderSurface;
delete mCore;
}
mCore->ProcessEvents();
}
-void TestApplication::SetSurfaceWidth( uint32_t width, uint32_t height )
-{
- mSurfaceWidth = width;
- mSurfaceHeight = height;
-
- mCore->SurfaceResized( mSurfaceWidth, mSurfaceHeight );
-}
-
-void TestApplication::SetTopMargin( uint32_t margin )
-{
- mCore->SetTopMargin( margin );
-}
-
void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* location )
{
if( GetUpdateStatus() == 0 &&
#define __DALI_TEST_APPLICATION_H__
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "test-gl-sync-abstraction.h"
#include "test-gl-abstraction.h"
#include "test-render-controller.h"
+#include "test-render-surface.h"
#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/resource-policies.h>
#include <dali/integration-api/trace.h>
+#include <dali/integration-api/scene.h>
namespace Dali
{
TestGestureManager& GetGestureManager();
void ProcessEvent(const Integration::Event& event);
void SendNotification();
- void SetSurfaceWidth( uint32_t width, unsigned height );
- void SetTopMargin( uint32_t margin );
bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
uint32_t GetUpdateStatus();
bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
mLoggingEnabled = enabled;
}
+ Integration::Scene GetScene() const
+ {
+ return mScene;
+ }
+
private:
void DoUpdate( uint32_t intervalMilliseconds, const char* location=NULL );
TestGlAbstraction mGlAbstraction;
TestGlSyncAbstraction mGlSyncAbstraction;
TestGestureManager mGestureManager;
+ TestRenderSurface* mRenderSurface;
Integration::UpdateStatus mStatus;
Integration::RenderStatus mRenderStatus;
Integration::Core* mCore;
+ Dali::Integration::Scene mScene;
uint32_t mSurfaceWidth;
uint32_t mSurfaceHeight;
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "test-render-surface.h"
+
+namespace Dali
+{
+
+TestRenderSurface::TestRenderSurface( Dali::PositionSize positionSize )
+: mPositionSize( positionSize ),
+ mBackgroundColor()
+{
+}
+
+TestRenderSurface::~TestRenderSurface()
+{
+}
+
+Dali::PositionSize TestRenderSurface::GetPositionSize() const
+{
+ return mPositionSize;
+};
+
+void TestRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
+{
+ dpiHorizontal = dpiVertical = 96;
+};
+
+void TestRenderSurface::InitializeGraphics()
+{
+}
+
+void TestRenderSurface::CreateSurface()
+{
+}
+
+void TestRenderSurface::DestroySurface()
+{
+}
+
+bool TestRenderSurface::ReplaceGraphicsSurface()
+{
+ return false;
+}
+
+void TestRenderSurface::MoveResize( Dali::PositionSize positionSize )
+{
+ mPositionSize = positionSize;
+}
+
+void TestRenderSurface::StartRender()
+{
+}
+
+bool TestRenderSurface::PreRender( bool resizingSurface )
+{
+ return true;
+}
+
+void TestRenderSurface::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface )
+{
+}
+
+void TestRenderSurface::StopRender()
+{
+}
+
+void TestRenderSurface::ReleaseLock()
+{
+}
+
+Dali::Integration::RenderSurface::Type TestRenderSurface::GetSurfaceType()
+{
+ return WINDOW_RENDER_SURFACE;
+}
+
+void TestRenderSurface::MakeContextCurrent()
+{
+}
+
+Integration::DepthBufferAvailable TestRenderSurface::GetDepthBufferRequired()
+{
+ return Integration::DepthBufferAvailable::TRUE;
+}
+
+Integration::StencilBufferAvailable TestRenderSurface::GetStencilBufferRequired()
+{
+ return Integration::StencilBufferAvailable::TRUE;
+}
+
+void TestRenderSurface::SetBackgroundColor( Vector4 color )
+{
+ mBackgroundColor = color;
+}
+
+Vector4 TestRenderSurface::GetBackgroundColor()
+{
+ return mBackgroundColor;
+}
+
+} // Namespace dali
--- /dev/null
+#ifndef TEST_REENDER_SURFACE_H
+#define TEST_REENDER_SURFACE_H
+
+/*
+ * Copyright (c) 2019 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/integration-api/render-surface.h>
+
+namespace Dali
+{
+
+/**
+ * Concrete implementation of the RenderSurface class.
+ */
+class DALI_CORE_API TestRenderSurface : public Dali::Integration::RenderSurface
+{
+public:
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::RenderSurface
+ */
+ TestRenderSurface( Dali::PositionSize positionSize );
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::~RenderSurface
+ */
+ virtual ~TestRenderSurface();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetPositionSize
+ */
+ virtual Dali::PositionSize GetPositionSize() const;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetDpi
+ */
+ virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical );
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::InitializeGraphics
+ */
+ virtual void InitializeGraphics();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::CreateSurface
+ */
+ virtual void CreateSurface();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::DestroySurface
+ */
+ virtual void DestroySurface();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::ReplaceGraphicsSurface
+ */
+ virtual bool ReplaceGraphicsSurface();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::MoveResize
+ */
+ virtual void MoveResize( Dali::PositionSize positionSize );
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::StartRender
+ */
+ virtual void StartRender();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::PreRender
+ */
+ virtual bool PreRender( bool resizingSurface );
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::PostRender
+ */
+ virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface );
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::StopRender
+ */
+ virtual void StopRender();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::ReleaseLock
+ */
+ virtual void ReleaseLock();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetSurfaceType
+ */
+ virtual Dali::Integration::RenderSurface::Type GetSurfaceType();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::MakeContextCurrent
+ */
+ virtual void MakeContextCurrent();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetDepthBufferRequired
+ */
+ virtual Integration::DepthBufferAvailable GetDepthBufferRequired();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetStencilBufferRequired
+ */
+ virtual Integration::StencilBufferAvailable GetStencilBufferRequired();
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::SetBackgroundColor
+ */
+ virtual void SetBackgroundColor( Vector4 color );
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetBackgroundColor
+ */
+ virtual Vector4 GetBackgroundColor();
+
+private:
+
+ /**
+ * @brief Undefined copy constructor. RenderSurface cannot be copied
+ */
+ TestRenderSurface( const TestRenderSurface& rhs );
+
+ /**
+ * @brief Undefined assignment operator. RenderSurface cannot be copied
+ */
+ TestRenderSurface& operator=( const TestRenderSurface& rhs );
+
+private:
+
+ Dali::PositionSize mPositionSize;
+ Vector4 mBackgroundColor; ///< The background color of the surface
+};
+
+} // Dali
+
+#endif
bool HandleActionReadFromTopEvent();
bool HandleActionReadFromNextEvent();
bool HandleActionZoomEvent();
- bool HandleActionReadIndicatorInformationEvent();
bool HandleActionReadPauseResumeEvent();
bool HandleActionStartStopEvent();
return false;
}
-bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
-{
- if( mActionHandler )
- {
- return mActionHandler->AccessibilityActionReadIndicatorInformation();
- }
- return false;
-}
-
bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
{
if( mActionHandler )
return Internal::Adaptor::GetImplementation(*this).HandleActionZoomEvent();
}
-bool AccessibilityAdaptor::HandleActionReadIndicatorInformationEvent()
-{
- return Internal::Adaptor::GetImplementation(*this).HandleActionReadIndicatorInformationEvent();
-}
-
bool AccessibilityAdaptor::HandleActionReadPauseResumeEvent()
{
return Internal::Adaptor::GetImplementation(*this).HandleActionReadPauseResumeEvent();
*
*/
-#include <dali/integration-api/adaptors/render-surface.h>
+#include <dali/integration-api/adaptors/render-surface-interface.h>
namespace Dali
{
} // namespace Integration
-class TestRenderSurface : public RenderSurface
-{
-public:
- virtual PositionSize GetPositionSize() const { PositionSize size; return size; }
-
- virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) { dpiHorizontal = dpiVertical = 96; }
-
- virtual void InitializeGraphics( Dali::Internal::Adaptor::GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection ) {};
-
- virtual void CreateSurface() {}
-
- virtual void DestroySurface() {}
-
- virtual bool ReplaceGraphicsSurface() { return false; }
-
- virtual void MoveResize( Dali::PositionSize positionSize ) {}
-
- virtual void SetViewMode( ViewMode viewMode ) {}
-
- virtual void StartRender() {}
-
- virtual bool PreRender( bool resizingSurface ) { return false; }
-
- virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) {}
-
- virtual void StopRender() {}
-
- virtual void ReleaseLock() {}
-
- virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
-
- virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::WINDOW_RENDER_SURFACE; }
-};
-
namespace Internal
{
namespace Adaptor
~Adaptor();
public:
- static Dali::RenderSurface& GetSurface();
+ static Dali::RenderSurfaceInterface& GetSurface();
static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
static bool mAvailable;
static Vector<CallbackBase*> mCallbacks;
#include <toolkit-adaptor-impl.h>
#include <dali/integration-api/debug.h>
#include <test-application.h>
+#include <test-render-surface.h>
namespace Dali
{
return *adaptor;
}
-Dali::RenderSurface& Adaptor::GetSurface()
+Dali::RenderSurfaceInterface& Adaptor::GetSurface()
{
- Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface;
+ Dali::RenderSurfaceInterface* renderSurface = reinterpret_cast <Dali::RenderSurfaceInterface*>( new Dali::TestRenderSurface( Dali::PositionSize( 0, 0, 480, 800 ) ) );
return *renderSurface;
}
return Internal::Adaptor::Adaptor::Get();
}
-Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface )
+Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurfaceInterface& surface )
{
return Internal::Adaptor::Adaptor::Get();
}
-Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration )
+Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurfaceInterface& surface, Configuration::ContextLoss configuration )
{
return Internal::Adaptor::Adaptor::Get();
}
}
}
-void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface )
+void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& surface )
{
}
return Internal::Adaptor::Adaptor::AdaptorSignal();
}
-RenderSurface& Adaptor::GetSurface()
+Dali::RenderSurfaceInterface& Adaptor::GetSurface()
{
return Internal::Adaptor::Adaptor::GetSurface();
}
END_TEST;
}
-int UtcDaliAccessibilityManagerActionReadIndicatorInformationSignalP(void)
-{
- ToolkitTestApplication application;
- tet_infoline( " UtcDaliAccessibilityManagerActionReadIndicatorInformationSignalP" );
-
- AccessibilityManagerSignalHandler callback;
-
- Dali::AccessibilityAdaptor accAdaptor = Dali::AccessibilityAdaptor::Get();
- Test::AccessibilityAdaptor::SetEnabled( accAdaptor, true );
- accAdaptor.HandleActionEnableEvent();
-
- AccessibilityManager manager = AccessibilityManager::Get();
- DALI_TEST_CHECK( manager );
-
- manager.ActionReadIndicatorInformationSignal().Connect( &callback, &AccessibilityManagerSignalHandler::Callback );
-
- Dali::AccessibilityAdaptor accessibilityAdaptor = Dali::AccessibilityAdaptor::Get();
- accessibilityAdaptor.HandleActionReadIndicatorInformationEvent();
-
- DALI_TEST_EQUALS( callback.GetCalls(), 1u, TEST_LOCATION );
-
- END_TEST;
-}
-
int UtcDaliAccessibilityManagerActionReadIndicatorInformationSignalN(void)
{
ToolkitTestApplication application;
namespace
{
bool gOnRelayout = false;
+
+static bool gKeyInputFocusCallBackCalled;
+
+static void TestKeyInputFocusCallback( Control control )
+{
+ tet_infoline(" TestKeyInputFocusCallback");
+
+ gKeyInputFocusCallBackCalled = true;
+}
} // namespace
///////////////////////////////////////////////////////////////////////////////////////////////////
END_TEST;
}
+
+int UtcDaliControlWrapperEmitKeyFocusSignal(void)
+{
+ ToolkitTestApplication application;
+
+ Impl::TestCustomControl* controlWrapperImpl = new ::Impl::TestCustomControl( Toolkit::Internal::ControlWrapper::CONTROL_BEHAVIOUR_DEFAULT );
+ ControlWrapper controlWrapper = ControlWrapper::New( customControlTypeName, *controlWrapperImpl );
+
+ gKeyInputFocusCallBackCalled = false;
+ controlWrapper.KeyInputFocusGainedSignal().Connect(&TestKeyInputFocusCallback);
+
+ application.SendNotification();
+ application.Render();
+
+ controlWrapperImpl->EmitKeyInputFocusSignal( true );
+
+ DALI_TEST_CHECK( gKeyInputFocusCallBackCalled );
+
+ END_TEST;
+}
\ No newline at end of file
#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-actions-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <test-native-image.h>
Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
bool enable;
DALI_TEST_CHECK( value.Get( enable ) );
- DALI_TEST_CHECK( !enable );
+ DALI_TEST_CHECK( enable );
// pre-multiplied alpha blending
imageView.SetProperty( Toolkit::ImageView::Property::PRE_MULTIPLIED_ALPHA, true );
END_TEST;
}
+int UtcDaliImageViewPreMultipliedAlphaPng(void)
+{
+ ToolkitTestApplication application;
+
+ // Set up trace debug
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable( true );
+
+ Property::Map imageMap;
+ imageMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+ imageMap[ ImageVisual::Property::RELEASE_POLICY] = ImageVisual::ReleasePolicy::NEVER; // To keep the texture cache
+
+ ImageView imageView1 = ImageView::New();
+ imageView1.SetProperty( ImageView::Property::IMAGE, imageMap );
+
+ Stage::GetCurrent().Add( imageView1 );
+
+ Property::Value value = imageView1.GetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA );
+ bool enable;
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( enable ); // Default value is true
+
+ // loading started, this waits for the loader thread for max 30 seconds
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ value = imageView1.GetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( enable ); // Keep true
+
+ // conventional alpha blending
+ Renderer renderer1 = imageView1.GetRendererAt( 0 );
+ value = renderer1.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( enable );
+
+ int srcFactorRgb = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+ int destFactorRgb = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+ int srcFactorAlpha = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+ int destFactorAlpha = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ DALI_TEST_CHECK( srcFactorRgb == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION ); // A new texture should be generated.
+ textureTrace.Reset();
+
+ // Disable pre-multiplied alpha blending
+ imageView1.SetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA, false );
+
+ // Reload the image
+ Property::Map attributes;
+ DevelControl::DoAction( imageView1, ImageView::Property::IMAGE, DevelImageVisual::Action::RELOAD, attributes );
+
+ // loading started, this waits for the loader thread for max 30 seconds
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ value = imageView1.GetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( !enable );
+
+ // conventional alpha blending
+ value = renderer1.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( !enable );
+
+ srcFactorRgb = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+ destFactorRgb = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+ srcFactorAlpha = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+ destFactorAlpha = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION ); // A new texture should be generated.
+ textureTrace.Reset();
+
+ // Make a new ImageView using the same image
+ ImageView imageView2 = ImageView::New();
+ imageView2.SetProperty( ImageView::Property::IMAGE, imageMap );
+
+ Stage::GetCurrent().Add( imageView2 );
+
+ application.SendNotification();
+ application.Render();
+
+ Renderer renderer2 = imageView2.GetRendererAt( 0 );
+ value = renderer2.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( enable );
+
+ srcFactorRgb = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+ destFactorRgb = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+ srcFactorAlpha = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+ destFactorAlpha = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ DALI_TEST_CHECK( srcFactorRgb == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION ); // The cached texture should be used.
+
+ END_TEST;
+}
+
+int UtcDaliImageViewPreMultipliedAlphaJpg(void)
+{
+ ToolkitTestApplication application;
+
+ // Set up trace debug
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable( true );
+
+ Property::Map imageMap;
+ imageMap[ ImageVisual::Property::URL ] = gImage_600_RGB;
+ imageMap[ ImageVisual::Property::RELEASE_POLICY] = ImageVisual::ReleasePolicy::NEVER; // To keep the texture cache
+
+ ImageView imageView1 = ImageView::New();
+ imageView1.SetProperty( ImageView::Property::IMAGE, imageMap );
+
+ Stage::GetCurrent().Add( imageView1 );
+
+ Property::Value value = imageView1.GetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA );
+ bool enable;
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( enable ); // Default value is true
+
+ // loading started, this waits for the loader thread for max 30 seconds
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ value = imageView1.GetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( !enable ); // Should be false after loading
+
+ // conventional alpha blending
+ Renderer renderer1 = imageView1.GetRendererAt( 0 );
+ value = renderer1.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( !enable );
+
+ int srcFactorRgb = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+ int destFactorRgb = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+ int srcFactorAlpha = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+ int destFactorAlpha = renderer1.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION ); // A new texture should be generated.
+ textureTrace.Reset();
+
+ ImageView imageView2 = ImageView::New();
+ imageView2.SetProperty( ImageView::Property::IMAGE, imageMap );
+
+ // Disable pre-multiplied alpha blending
+ imageView2.SetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA, false );
+
+ Stage::GetCurrent().Add( imageView2 );
+
+ application.SendNotification();
+ application.Render();
+
+ value = imageView2.GetProperty( ImageView::Property::PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( !enable );
+
+ // conventional alpha blending
+ Renderer renderer2 = imageView2.GetRendererAt( 0 );
+ value = renderer2.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
+ DALI_TEST_CHECK( value.Get( enable ) );
+ DALI_TEST_CHECK( !enable );
+
+ srcFactorRgb = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
+ destFactorRgb = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
+ srcFactorAlpha = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
+ destFactorAlpha = renderer2.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ DALI_TEST_CHECK( srcFactorRgb == BlendFactor::SRC_ALPHA );
+ DALI_TEST_CHECK( destFactorRgb == BlendFactor::ONE_MINUS_SRC_ALPHA );
+ DALI_TEST_CHECK( srcFactorAlpha == BlendFactor::ONE );
+ DALI_TEST_CHECK( destFactorAlpha == BlendFactor::ONE_MINUS_SRC_ALPHA );
+
+ DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), false, TEST_LOCATION ); // The cached texture should be used.
+
+ END_TEST;
+}
+
int UtcDaliImageViewPixelArea(void)
{
// Test pixel area property
int UtcDaliScrollViewPagePathEffectSetup(void)
{
+ ToolkitTestApplication application;
tet_infoline(" UtcDaliScrollViewPagePathEffectSetup");
ScrollViewPagePathEffect effect;
VisualFactory factory = VisualFactory::Get();
- // image visual, test default value ( false )
+ // image visual, test default value ( true )
{
Visual::Base imageVisual = factory.CreateVisual(
Property::Map()
// test values
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<bool>(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<bool>(), true, TEST_LOCATION );
}
// image visual, override premultiplied
Property::Map()
.Add( Toolkit::Visual::Property::TYPE, Visual::IMAGE )
.Add( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME )
- .Add( Visual::Property::PREMULTIPLIED_ALPHA, true ) );
+ .Add( Visual::Property::PREMULTIPLIED_ALPHA, false ) );
Dali::Property::Map visualMap;
imageVisual.CreatePropertyMap( visualMap );
// test values
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<bool>(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS( value->Get<bool>(), false, TEST_LOCATION);
}
// svg visual ( premultiplied alpha by default is true )
return DevelCustomActor::GetTypeInfo(Self());
}
+void ControlWrapper::EmitKeyInputFocusSignal( bool focusGained )
+{
+ Control::EmitKeyInputFocusSignal( focusGained );
+}
+
} // namespace Internal
} // namespace Toolkit
return ret;
}
-bool AccessibilityManager::AccessibilityActionReadIndicatorInformation()
-{
- Dali::Toolkit::AccessibilityManager handle( this );
- if( !mActionReadIndicatorInformationSignal.Empty() )
- {
- mActionReadIndicatorInformationSignal.Emit( handle );
- }
-
- // TODO: Read the information in the indicator
-
- return mIsAccessibilityTtsEnabled;
-}
-
bool AccessibilityManager::AccessibilityActionReadPauseResume()
{
Dali::Toolkit::AccessibilityManager handle( this );
virtual bool AccessibilityActionZoom();
/**
- * Perform the accessibility action to read the information in the indicator (by two fingers triple tap).
- * @return whether the accessibility action is performed or not.
- */
- virtual bool AccessibilityActionReadIndicatorInformation();
-
- /**
* Perform the accessibility action to pause/resume the current read out (by two fingers single tap).
* @return whether the accessibility action is performed or not.
*/
it != endIt;
++it )
{
- delete (*it).familyName;
+ delete[] (*it).familyName;
}
fontDescriptionRuns.Clear();
glyphInfo = ellipsisGlyph;
// Change the 'x' and 'y' position of the ellipsis glyph.
-
- if( position.x > firstPenX )
- {
- position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
- }
-
position.x += ellipsisGlyph.xBearing;
position.y = penY - ellipsisGlyph.yBearing;
mLoading( false ),
mOrientationCorrection( true )
{
+ EnablePreMultipliedAlpha( mFactoryCache.GetPreMultiplyOnLoad() );
}
ImageVisual::ImageVisual( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const Image& image )
mLoading( false ),
mOrientationCorrection( true )
{
+ EnablePreMultipliedAlpha( mFactoryCache.GetPreMultiplyOnLoad() );
}
ImageVisual::~ImageVisual()
atlasUploadObserver = this;
}
- auto preMultiplyOnLoad = mFactoryCache.GetPreMultiplyOnLoad() && !mImpl->mCustomShader
+ auto preMultiplyOnLoad = IsPreMultipliedAlphaEnabled() && !mImpl->mCustomShader
? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
: TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
{
if( NPatchLoader::UNINITIALIZED_ID == mId && mImageUrl.IsLocalResource() )
{
- bool preMultiplyOnLoad = mFactoryCache.GetPreMultiplyOnLoad() && !mImpl->mCustomShader ? true : false;
+ bool preMultiplyOnLoad = IsPreMultipliedAlphaEnabled() && !mImpl->mCustomShader ? true : false;
mId = mLoader.Load( mImageUrl.GetUrl(), mBorder, preMultiplyOnLoad );
mBorder(),
mAuxiliaryImageAlpha( 0.0f )
{
+ EnablePreMultipliedAlpha( mFactoryCache.GetPreMultiplyOnLoad() );
}
NPatchVisual::~NPatchVisual()
{
// First check if the requested Texture is cached.
const TextureHash textureHash = GenerateHash( url.GetUrl(), desiredSize, fittingMode, samplingMode, useAtlas,
- maskTextureId, preMultiplyOnLoad );
+ maskTextureId );
TextureManager::TextureId textureId = INVALID_TEXTURE_ID;
const FittingMode::Type fittingMode,
const Dali::SamplingMode::Type samplingMode,
const UseAtlas useAtlas,
- TextureId maskTextureId,
- TextureManager::MultiplyOnLoad preMultiplyOnLoad)
+ TextureId maskTextureId )
{
std::string hashTarget( url );
const size_t urlLength = hashTarget.length();
}
}
- auto premultipliedIndex = hashTarget.length();
- hashTarget.resize( premultipliedIndex + 1 );
- switch( preMultiplyOnLoad )
- {
- case TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD:
- {
- hashTarget[ premultipliedIndex ] = 't';
- break;
- }
- case TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY:
- {
- hashTarget[ premultipliedIndex ] = 'f';
- break;
- }
- }
-
return Dali::CalculateHash( hashTarget );
}
{
// We have a match, now we check all the original parameters in case of a hash collision.
TextureInfo& textureInfo( mTextureInfoContainer[i] );
- auto multiplyOnLoad = textureInfo.preMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD :
- TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
if( ( url == textureInfo.url.GetUrl() ) &&
( useAtlas == textureInfo.useAtlas ) &&
( maskTextureId == textureInfo.maskTextureId ) &&
( size == textureInfo.desiredSize ) &&
- ( preMultiplyOnLoad == multiplyOnLoad ) &&
( ( size.GetWidth() == 0 && size.GetHeight() == 0 ) ||
( fittingMode == textureInfo.fittingMode &&
samplingMode == textureInfo.samplingMode ) ) )
{
- // The found Texture is a match.
- cacheIndex = i;
- break;
+ // 1. If preMultiplyOnLoad is MULTIPLY_ON_LOAD, then textureInfo.preMultiplyOnLoad should be true. The premultiplication result can be different.
+ // 2. If preMultiplyOnLoad is LOAD_WITHOUT_MULTIPLY, then textureInfo.preMultiplied should be false.
+ if( ( preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD && textureInfo.preMultiplyOnLoad )
+ || ( preMultiplyOnLoad == TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY && !textureInfo.preMultiplied ) )
+ {
+ // The found Texture is a match.
+ cacheIndex = i;
+ break;
+ }
}
}
}
TextureHash GenerateHash( const std::string& url, const ImageDimensions size,
const FittingMode::Type fittingMode,
const Dali::SamplingMode::Type samplingMode, const UseAtlas useAtlas,
- TextureId maskTextureId,
- MultiplyOnLoad preMultiplyOnLoad);
+ TextureId maskTextureId );
+
/**
* @brief Looks up a cached texture by its hash.
* If found, the given parameters are used to check there is no hash-collision.
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
#include <dali/devel-api/adaptor-framework/singleton-service.h>
// INTERNAL INCLUDES
AccessibilityManager::AccessibilityActionSignalType& AccessibilityManager::ActionReadIndicatorInformationSignal()
{
+ DALI_LOG_WARNING_NOFN("DEPRECATION WARNING: ActionReadIndicatorInformationSignal is deprecated and will be removed from next release.\n" );
+
return GetImpl(*this).ActionReadIndicatorInformationSignal();
}
AccessibilityActionSignalType& ActionZoomSignal();
/**
+ * @DEPRECATED_1_4.9
* @brief This is emitted when accessibility action is received to read the information
* in the indicator (by two fingers triple tap).
*
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 8;
+const unsigned int TOOLKIT_MICRO_VERSION = 9;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.4.8
+Version: 1.4.9
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT