)\r
\r
#head file path\r
-INCLUDE_DIRECTORIES( \r
+INCLUDE_DIRECTORIES(\r
./\r
../dali-core\r
../dali-adaptor\r
${devel_api_src_dir}/image-loader/atlas-upload-observer.cpp\r
${devel_api_src_dir}/image-loader/image-atlas.cpp\r
${devel_api_src_dir}/image-loader/texture-manager.cpp\r
- ${devel_api_src_dir}/layouting/absolute-layout.cpp\r
- ${devel_api_src_dir}/layouting/grid.cpp\r
- ${devel_api_src_dir}/layouting/linear-layout.cpp\r
- ${devel_api_src_dir}/layouting/layout-item-impl.cpp\r
- ${devel_api_src_dir}/layouting/layout-item.cpp\r
- ${devel_api_src_dir}/layouting/layout-group-impl.cpp\r
- ${devel_api_src_dir}/layouting/layout-group.cpp\r
- ${devel_api_src_dir}/layouting/layout-controller.cpp\r
${devel_api_src_dir}/scripting/script.cpp\r
${devel_api_src_dir}/styling/style-manager-devel.cpp\r
${devel_api_src_dir}/transition-effects/cube-transition-cross-effect.cpp\r
${internal_src_dir}/builder/style.cpp\r
${internal_src_dir}/builder/tree-node-manipulator.cpp\r
${internal_src_dir}/builder/replacement.cpp\r
- ${internal_src_dir}/layouting/absolute-layout-impl.cpp\r
- ${internal_src_dir}/layouting/grid-impl.cpp\r
- ${internal_src_dir}/layouting/grid-locations.cpp\r
- ${internal_src_dir}/layouting/linear-layout-impl.cpp\r
- ${internal_src_dir}/layouting/layout-item-data-impl.cpp\r
- ${internal_src_dir}/layouting/layout-group-data-impl.cpp\r
- ${internal_src_dir}/layouting/layout-controller-impl.cpp\r
- ${internal_src_dir}/layouting/layout-controller-debug.cpp\r
- ${internal_src_dir}/layouting/layout-transition-data-impl.cpp\r
${internal_src_dir}/visuals/animated-image/animated-image-visual.cpp\r
${internal_src_dir}/visuals/animated-image/image-cache.cpp\r
${internal_src_dir}/visuals/animated-image/fixed-image-cache.cpp\r
add_dependencies(dali-toolkit dali-core)\r
add_dependencies(dali-toolkit dali-adaptor)\r
\r
-#add link library \r
+#add link library\r
#TARGET_LINK_LIBRARIES(${FS_BUILD_BINARY_PREFIX}sqrt ${LIBRARIES})\r
utc-Dali-ItemView-internal.cpp
utc-Dali-LogicalModel.cpp
utc-Dali-PropertyHelper.cpp
- utc-Dali-SizeNegotiationMapper.cpp
utc-Dali-Text-CharacterSetConversion.cpp
utc-Dali-Text-Circular.cpp
utc-Dali-Text-Controller.cpp
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-
-#include <stdlib.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/internal/layouting/size-negotiation-mapper.h>
-#include <dali-toolkit/internal/controls/control/control-data-impl.h>
-#include <dali-toolkit/devel-api/layouting/linear-layout.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-int UtcDaliLayoutingSizeNegotiationMapper_01(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingSizeNegotiationMapper_01 - Test mapping Dimension::ALL_DIMENSIONS");
-
- auto control = Control::New();
- control.SetName( "fitToChildrenControl" );
- DevelControl::SetLayoutingRequired( control, true );
- control.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
-
- Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
- Toolkit::Internal::Control::Impl& controlDataImpl = Toolkit::Internal::Control::Impl::Get( controlImpl );
- Toolkit::Internal::LayoutItemPtr layout = controlDataImpl.GetLayout();
- // Set defaults which should be overriden by mapper
- control.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Set ALL_DIMENSIONS specifications using mapper
- Toolkit::Internal::SizeNegotiationMapper::SetLayoutParametersUsingResizePolicy( control, layout, Dimension::ALL_DIMENSIONS );
-
- // Test WIDTH and HEIGHT updated
- DALI_TEST_EQUALS( control.GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::WRAP_CONTENT ), TEST_LOCATION );
- DALI_TEST_EQUALS( control.GetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION ), Property::Value( ChildLayoutData::WRAP_CONTENT ), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayoutingSizeNegotiationMapper_02(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingSizeNegotiationMapper_02 - Test mapping for Dimension::WIDTH only");
-
- auto control = Control::New();
- control.SetName( "fitToChildrenControl" );
- DevelControl::SetLayoutingRequired( control, true );
- control.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
-
- Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
- Toolkit::Internal::Control::Impl& controlDataImpl = Toolkit::Internal::Control::Impl::Get( controlImpl );
- Toolkit::Internal::LayoutItemPtr layout = controlDataImpl.GetLayout();
-
- // Set defaults which should be overriden by mapper
- control.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Set WIDTH specifications using mapper
- Toolkit::Internal::SizeNegotiationMapper::SetLayoutParametersUsingResizePolicy( control, layout, Dimension::WIDTH );
-
- // Test WIDTH only updated.
- DALI_TEST_EQUALS( control.GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::WRAP_CONTENT ), TEST_LOCATION );
- DALI_TEST_EQUALS( control.GetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayoutingSizeNegotiationMapper_03(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingSizeNegotiationMapper_03 - Test mapping for Dimension::HEIGHT only");
-
- auto control = Control::New();
- control.SetName( "fitToChildrenControl" );
- DevelControl::SetLayoutingRequired( control, true );
- control.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
-
- Toolkit::Internal::Control& controlImpl = Toolkit::Internal::GetImplementation( control );
- Toolkit::Internal::Control::Impl& controlDataImpl = Toolkit::Internal::Control::Impl::Get( controlImpl );
- Toolkit::Internal::LayoutItemPtr layout = controlDataImpl.GetLayout();
-
- // Set defaults which should be overriden by mapper
- control.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Set HEIGHT specifications using mapper
- Toolkit::Internal::SizeNegotiationMapper::SetLayoutParametersUsingResizePolicy( control, layout, Dimension::HEIGHT );
-
- // Test HEIGHT only updated.
- DALI_TEST_EQUALS( control.GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
- DALI_TEST_EQUALS( control.GetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION ), Property::Value( ChildLayoutData::WRAP_CONTENT), TEST_LOCATION );
-
- END_TEST;
-}
\ No newline at end of file
# List of test case sources (Only these get parsed for test cases)
SET(TC_SOURCES
- utc-Dali-AbsoluteLayout.cpp
utc-Dali-Alignment.cpp
utc-Dali-AnimatedImageVisual.cpp
utc-Dali-AnimatedVectorImageVisual.cpp
- utc-Dali-BinLayout.cpp
utc-Dali-BloomView.cpp
utc-Dali-BubbleEmitter.cpp
utc-Dali-Builder.cpp
utc-Dali-CubeTransitionEffect.cpp
utc-Dali-EffectsView.cpp
utc-Dali-FlexContainer.cpp
- utc-Dali-FlexLayout.cpp
utc-Dali-GaussianBlurView.cpp
- utc-Dali-GridLayout.cpp
utc-Dali-ImageView.cpp
utc-Dali-ImageVisual.cpp
utc-Dali-JsonParser.cpp
utc-Dali-KeyInputFocusManager.cpp
- utc-Dali-Layouting.cpp
- utc-Dali-LayoutingAnimation.cpp
- utc-Dali-LayoutingNesting.cpp
- utc-Dali-LayoutingResizePolicy.cpp
- utc-Dali-LayoutingSettingAndRemoval.cpp
utc-Dali-PageTurnView.cpp
utc-Dali-Scene3dView.cpp
utc-Dali-Script.cpp
# Append list of test harness files (Won't get parsed for test cases)
LIST(APPEND TC_SOURCES
- custom-layout.cpp
- custom-layout-impl.cpp
dali-toolkit-test-utils/toolkit-adaptor.cpp
dali-toolkit-test-utils/toolkit-accessibility-adaptor.cpp
dali-toolkit-test-utils/toolkit-application.cpp
dali-toolkit-test-utils/dali-test-suite-utils.cpp
dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
dali-toolkit-test-utils/dummy-control.cpp
- dali-toolkit-test-utils/layout-utils.cpp
dali-toolkit-test-utils/mesh-builder.cpp
dali-toolkit-test-utils/test-actor-utils.cpp
dali-toolkit-test-utils/test-animation-data.cpp
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// CLASS HEADER
-#include "custom-layout-impl.h"
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/actors/actor.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-
-namespace Test
-{
-
-namespace Internal
-{
-
-using Dali::Actor;
-using Dali::Toolkit::MeasuredSize;
-
-CustomLayout::CustomLayout()
-: mBehaviourFlags( 0 )
-{
-}
-
-CustomLayoutPtr CustomLayout::New()
-{
- CustomLayoutPtr layout( new CustomLayout() );
- return layout;
-}
-
-void CustomLayout::MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight )
-{
- // Initially use the measure spec of the child's parent
- auto childWidthMeasureSpec = widthMeasureSpec;
- auto childHeightMeasureSpec = heightMeasureSpec;
-
- if ( true == GetCustomBehaviourFlags( Test::CustomLayout::BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH ) )
- {
- // Use unspecified width measure spec, child can be any width it desires
- childWidthMeasureSpec = MeasureSpec( widthMeasureSpec.GetSize(), MeasureSpec::Mode::UNSPECIFIED );
- }
-
- if ( true == GetCustomBehaviourFlags( Test::CustomLayout::BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT) )
- {
- // Use unspecified height measure spec, child can be any height it desires
- childHeightMeasureSpec = MeasureSpec( heightMeasureSpec.GetSize(), MeasureSpec::Mode::UNSPECIFIED );
- }
-
- MeasureChild( childLayout, childWidthMeasureSpec, childHeightMeasureSpec );
- resultingWidth += childLayout->GetMeasuredWidth();
- resultingHeight = std::max( childLayout->GetMeasuredHeight(), resultingHeight );
-}
-
-void CustomLayout::OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec )
-{
- auto accumulatedWidth = 0;
- auto maxHeight = 0;
-
- // In this layout we will:
- // Measuring the layout with the children in a horizontal configuration, one after another
- // Set the required width to be the accumulated width of our children
- // Set the required height to be the maximum height of any of our children
-
- for( unsigned int i=0; i<GetChildCount(); ++i )
- {
- auto childLayout = GetChildAt( i );
- if( childLayout )
- {
- MeasureChildren( childLayout, widthMeasureSpec, heightMeasureSpec, accumulatedWidth, maxHeight );
- }
- }
-
- // Finally, call this method to set the dimensions we would like
- SetMeasuredDimensions( MeasuredSize( accumulatedWidth ), MeasuredSize( maxHeight ) );
-}
-
-void CustomLayout::OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom )
-{
- LayoutLength childTop( 0 );
- LayoutLength childLeft( 0 );
-
- // We want to vertically align the children to the middle
- LayoutLength height = bottom - top;
- LayoutLength middle = height / 2;
-
- auto owner = GetOwner();
- auto actor = Actor::DownCast(owner);
-
- // Horizontally align the children to the left
- int count = actor.GetChildCount();
- LayoutLength currentLeft = 0;
-
- for( int i = 0; i < count; i++)
- {
- Dali::Toolkit::Control child = Dali::Toolkit::Control::DownCast( actor.GetChildAt( i ) );
- if( !child )
- {
- continue;
- }
-
- Dali::Toolkit::LayoutItem childLayout = Dali::Toolkit::DevelControl::GetLayout( child );
- if( childLayout )
- {
- Dali::Toolkit::Internal::LayoutItem& childLayoutImpl = GetImplementation( childLayout );
-
- LayoutLength childWidth = childLayoutImpl.GetMeasuredWidth();
- LayoutLength childHeight = childLayoutImpl.GetMeasuredHeight();
-
- childTop = middle - childHeight / 2;
- childLayoutImpl.Layout( currentLeft, childTop, currentLeft + childWidth, childTop + childHeight );
- currentLeft += childWidth;
- }
- }
-}
-
-void CustomLayout::SetCustomBehaviourFlag( int flag )
-{
- mBehaviourFlags |= flag;
- RequestLayout();
-}
-
-bool CustomLayout::GetCustomBehaviourFlags( int flagToCheck )
-{
- return ( mBehaviourFlags & flagToCheck ) != 0;
-}
-
-void CustomLayout::ClearPrivateFlag( int flag )
-{
- mBehaviourFlags &= ~flag;
- RequestLayout();
-}
-
-} // namespace Internal
-
-} // namespace Test
+++ /dev/null
-#ifndef TEST_INTERNAL_CUSTOM_LAYOUT_H
-#define TEST_INTERNAL_CUSTOM_LAYOUT_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.
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/common/intrusive-ptr.h>
-#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
-#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
-
-// INTERNAL INCLUDES
-#include "custom-layout.h"
-
-namespace Test
-{
-
-namespace Internal
-{
-
-using Dali::Toolkit::MeasureSpec;
-using Dali::Toolkit::LayoutLength;
-
-class CustomLayout;
-using CustomLayoutPtr = Dali::IntrusivePtr< CustomLayout >;
-
-/**
- * @brief The implementation of our custom layout.
- *
- * Here we will override the methods that we require to mimic a very simple horizontal layout.
- */
-class CustomLayout final : public Dali::Toolkit::Internal::LayoutGroup
-{
-public:
-
- /**
- * @brief Create a new CustomLayout object.
- * @return An intrusive pointer to the created CustomLayout object
- */
- static CustomLayoutPtr New();
-
- // Movable but not copyable
- CustomLayout( const CustomLayout& other ) = delete;
- CustomLayout& operator=( const CustomLayout& ) = delete;
- CustomLayout( CustomLayout&& other ) = default;
- CustomLayout& operator=( CustomLayout&& other ) = default;
-
- /**
- * @copydoc CustomLayout::SetCustomBehaviourFlag
- */
- void SetCustomBehaviourFlag( int flag );
-
- /**
- * @copydoc CustomLayout::GetCustomBehaviourFlags
- */
- bool GetCustomBehaviourFlags( int flagToCheck );
-
- /**
- * @copydoc CustomLayout::ClearPrivateFlag
- */
- void ClearPrivateFlag( int flag );
-
-private:
-
- /**
- * @brief Default Constructor
- */
- CustomLayout();
-
- /**
- * Virtual Destructor
- */
- virtual ~CustomLayout() = default;
-
- /**
- * @copydoc LayoutItem::OnMeasure
- *
- * Overriding this method so that we can calculate the size we require using our children's sizes
- */
- virtual void OnMeasure( MeasureSpec widthMeasureSpec, Dali::Toolkit::MeasureSpec heightMeasureSpec ) override;
-
- /**
- * @copydoc LayoutItem::OnLayout
- *
- * Overriding this method so that we can layout our children as required.
- */
- virtual void OnLayout( bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom ) override;
-
- /**
- * Measure children with parent's measure spec unless BehaviourFlag set to use an unconstrained width or height.
- * @param[in] childLayout child to measure
- * @param[in] widthMeasureSpec default layout width measure spec
- * @param[in] heightMeasureSpec default layout height measure spec
- * @param[out] resultingWidth resulting width of layout after children are measured
- * @param[out] resultingHeight resulting height of layout after children are measured
- */
- void MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight );
-
- using Dali::Toolkit::Internal::LayoutGroup::MeasureChildren; ///< To tell the compiler that we really do want to overload MeasureChildren in this class & were not trying to override it
-
- private:
-
- int mBehaviourFlags; // flags to alter behaviour of this custom layout
-
-};
-
-} // namespace Internal
-
-inline Internal::CustomLayout& GetImplementation( Test::CustomLayout& handle )
-{
- DALI_ASSERT_ALWAYS( handle && "CustomLayout handle is empty" );
- Dali::BaseObject& object = handle.GetBaseObject();
- return static_cast<Internal::CustomLayout&>( object );
-}
-
-inline const Internal::CustomLayout& GetImplementation( const Test::CustomLayout& handle )
-{
- DALI_ASSERT_ALWAYS( handle && "CustomLayout handle is empty" );
- const Dali::BaseObject& object = handle.GetBaseObject();
- return static_cast<const Internal::CustomLayout&>( object );
-}
-
-} // namespace Test
-
-#endif // TEST_INTERNAL_CUSTOM_LAYOUT_H
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// CLASS HEADER
-#include "custom-layout.h"
-
-// INTERNAL HEADERS
-#include "custom-layout-impl.h"
-
-namespace Test
-{
-
-CustomLayout CustomLayout::New()
-{
- Internal::CustomLayoutPtr internal = Internal::CustomLayout::New();
- return CustomLayout( internal.Get() );
-}
-
-CustomLayout CustomLayout::DownCast( BaseHandle handle )
-{
- return CustomLayout( dynamic_cast< Test::Internal::CustomLayout* >( handle.GetObjectPtr() ) );
-}
-
-CustomLayout::CustomLayout( Internal::CustomLayout* object )
-: Dali::Toolkit::LayoutGroup( object )
-{
-}
-
-void CustomLayout::RequestLayout()
-{
- GetImplementation( *this ).RequestLayout();
-}
-
-void CustomLayout::SetCustomBehaviourFlag( int flag )
-{
- GetImplementation(*this).SetCustomBehaviourFlag( flag );
-}
-
-bool CustomLayout::GetCustomBehaviourFlags( int flagToCheck )
-{
- return GetImplementation(*this).GetCustomBehaviourFlags( flagToCheck );
-}
-
-void CustomLayout::ClearPrivateFlag( int flag )
-{
- return GetImplementation(*this).ClearPrivateFlag( flag );
-}
-
-} // namespace Test
+++ /dev/null
-#ifndef TEST_CUSTOM_LAYOUT_H
-#define TEST_CUSTOM_LAYOUT_H
-
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
-#include <dali-toolkit/devel-api/layouting/layout-group.h>
-
-namespace Test
-{
-
-namespace Internal
-{
-class CustomLayout;
-}
-
-/**
- * @brief This is the handle class to a very simple Custom Layout.
- *
- * This class lays out its children horizontally in a very simple manner.
- */
-class CustomLayout : public Dali::Toolkit::LayoutGroup
-{
-public:
-
- // Behaviour flags
- static const int BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH = 0x00000001; // Child width measured without constraint
- static const int BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT = 0x00000002; // Child height measured without constraint
-
- /**
- * @brief Creates an uninitialized CustomLayout handle.
- *
- * Initialize it using CustomLayout::New().
- * Calling member functions with an uninitialized handle is not allowed.
- */
- CustomLayout() = default;
-
- /**
- * @brief Creates a CustomLayout object.
- */
- static CustomLayout New();
-
-
- /**
- * @brief Default destructor.
- *
- * This is non-virtual, since derived Handle types must not contain data or virtual methods
- */
- ~CustomLayout() = default;
-
- /**
- * @brief Copy constructor
- */
- CustomLayout( const CustomLayout& ) = default;
-
- /**
- * @brief Assigment operator
- */
- CustomLayout& operator=( const CustomLayout& ) = default;
-
- /**
- * @brief Move constructor
- */
- CustomLayout( CustomLayout&& ) = default;
-
- /**
- * @brief Movable assignment operator
- */
- CustomLayout& operator=( CustomLayout&& ) = default;
-
- /**
- * @brief Downcasts a handle to a CustomLayout handle.
- *
- * If handle points to a CustomLayout, the downcast produces a valid handle.
- * If not, the returned handle is left uninitialized.
-
- * @param[in] handle to an object
- * @return Handle to a CustomLayout or an uninitialized handle
- */
- static CustomLayout DownCast( BaseHandle handle );
-
- /**
- * Request for a relayout of this layout
- */
- void RequestLayout();
-
- /**
- * Enables setting of flags corresponding to particular behaviour of this layout
- * @param[in] flag the flag to set
- */
- void SetCustomBehaviourFlag( int flag );
-
- /**
- * Returns true or false depending on whether flag is set
- * @return bool returns true if flag set
- */
- bool GetCustomBehaviourFlags( int flagToCheck );
-
- /**
- * Clears the flag if already set.
- * @param[in] flag the flag to clear
- */
- void ClearPrivateFlag( int flag );
-
-public: // Not intended for application developers
-
- /// @cond internal
- /**
- * @brief This constructor is used by CustomLayout::New() methods.
- *
- * @param[in] actor A pointer to a newly allocated Dali resource
- */
- explicit CustomLayout( Internal::CustomLayout* body );
- /// @endcond
-};
-
-} // namespace Test
-
-#endif // TEST_CUSTOM_LAYOUT_H
+++ /dev/null
-/*
- * Copyright (c) 2018 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.
- *
- */
-
-// FILE HEADER
-#include "layout-utils.h"
-
-// EXTERNAL INCLUDES
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
-#include <dali-toolkit/devel-api/image-loader/texture-manager.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/flex-layout.h>
-
-// INTERNAL INCLUDES
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-std::string CreateImageURL( Vector4 color, ImageDimensions size )
-{
- auto pixelBuffer = Devel::PixelBuffer::New( size.GetWidth(), size.GetHeight(), Pixel::RGB888 );
- unsigned char* pixels = pixelBuffer.GetBuffer();
- pixels[0] = static_cast<unsigned char>( color.r );
- pixels[1] = static_cast<unsigned char>( color.g );
- pixels[2] = static_cast<unsigned char>( color.b );
- auto texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGB888, size.GetWidth(), size.GetHeight() );
- auto pixelData = Devel::PixelBuffer::Convert( pixelBuffer );
- texture.Upload( pixelData );
- return TextureManager::AddTexture( texture );
-}
-
-Control CreateLeafControl( int width, int height )
-{
- auto control = Control::New();
- control.SetName( "Leaf" );
- std::string url = CreateImageURL( Vector4( 255, 0, 0, 255 ), ImageDimensions( 1, 1 ) );
-
- Property::Map map;
- map[ Visual::Property::TYPE ] = Visual::IMAGE;
- map[ ImageVisual::Property::URL ] = url;
- map[ ImageVisual::Property::DESIRED_WIDTH ] = (float) width;
- map[ ImageVisual::Property::DESIRED_HEIGHT ] = (float) height;
- control.SetProperty( Control::Property::BACKGROUND, map );
- return control;
-}
-
-TextLabel CreateTextLabel( const char* text )
-{
- TextLabel textLabel = TextLabel::New(text);
- textLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
- textLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
- textLabel.SetName( "TextLabel" );
- textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- return textLabel;
-}
-
-ImageView CreateImageView( std::string& url, ImageDimensions size )
-{
- ImageView imageView = ImageView::New( url, size );
- imageView.SetName( "ImageView" );
- imageView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- return imageView;
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_LAYOUT_UTILS_H__
-#define __DALI_TOOLKIT_LAYOUT_UTILS_H__
-
-/*
- * Copyright (c) 2018 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 <dali-toolkit/dali-toolkit.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-/**
- * @brief Creates an empty image buffer filled with the color for layout tests
- *
- * @param[in] color The color of the image buffer.
- * @param[in] size The size of the image buffer.
- * @param[out] string The url.
- */
-std::string CreateImageURL( Vector4 color, ImageDimensions size );
-
-/**
- * @brief Creates an empty leaf control filled with red color for layout tests
- *
- * @param[in] width The width of the control.
- * @param[in] height The height of the control.
- * @param[out] Control The control.
- */
-Control CreateLeafControl( int width, int height );
-
-/**
- * @brief Creates a text label for layout tests
- *
- * @param[in] text The text of the label.
- * @param[out] TextLabel The text label.
- */
-TextLabel CreateTextLabel( const char* text );
-
-/**
- * @brief Creates an image view for layout tests
- *
- * @param[in] url The image url.
- * @param[in] size The size of the image view.
- * @param[out] ImageView The image view.
- */
-ImageView CreateImageView( std::string& url, ImageDimensions size );
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_LAYOUT_UTILS_H__
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-void utc_dali_toolkit_absolute_layout_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_absolute_layoutg_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-int UtcDaliLayouting_AbsoluteLayoutDownCast(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliLayouting_AbsoluteLayoutDownCast - Testing Downcast");
-
- AbsoluteLayout absoluteLayout = AbsoluteLayout::New();
-
- LayoutGroup layoutGroup( absoluteLayout );
-
- AbsoluteLayout absoluteLayoutCandidate = AbsoluteLayout::DownCast( layoutGroup );
- DALI_TEST_CHECK( absoluteLayoutCandidate );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AbsoluteLayoutAssignment(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliLayouting_AbsoluteLayoutAssignment - Testing operator=");
-
- AbsoluteLayout absoluteLayout = AbsoluteLayout::New();
- AbsoluteLayout absoluteLayout2;
-
- absoluteLayout2 = absoluteLayout;
-
- DALI_TEST_CHECK( absoluteLayout2 == absoluteLayout );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AbsoluteLayout01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AbsoluteLayout01 - Position an item with Actor::Property::POSITION");
-
- Stage stage = Stage::GetCurrent();
- auto absoluteLayout = Control::New();
- auto layout = AbsoluteLayout::New();
- layout.SetAnimateLayout( true );
- DevelControl::SetLayout( absoluteLayout, layout );
- absoluteLayout.SetName( "AsoluteLayout");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- // Position one of the controls using the actor property.
- controls[1].SetProperty(Actor::Property::POSITION, Vector3( 100.0f, 0.0f, 0.0f) );
-
- for( auto&& iter : controls )
- {
- absoluteLayout.Add( iter );
- }
- absoluteLayout.SetParentOrigin( ParentOrigin::CENTER );
- absoluteLayout.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( absoluteLayout );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // AbsoluteLayout renders items at the positions given by their Actor::Property::POSITION relative to the top left of the container.
- // Items can overlap or spill out of their parent container.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // The controls[1] was the only control to have a defiend position
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Items size should not change regardless of parent's size.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AbsoluteLayout_SetPosition(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AbsoluteLayout_GetWorldPosition - Testing WorldPosition");
-
- Stage stage = Stage::GetCurrent();
-
- Dali::Toolkit::Control layoutControl = Dali::Toolkit::Control::New();
- layoutControl.SetName("AsoluteLayout");
- layoutControl.SetAnchorPoint( Dali::AnchorPoint::CENTER );
- layoutControl.SetParentOrigin( Dali::ParentOrigin::CENTER );
-
- Dali::Toolkit::AbsoluteLayout absoluteLayout = Dali::Toolkit::AbsoluteLayout::New();
- Dali::Toolkit::DevelControl::SetLayout( layoutControl, absoluteLayout );
-
- stage.GetRootLayer().Add( layoutControl );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render(0);
-
- Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
- control.SetSize( 100.0f, 100.0f );
- control.SetParentOrigin( ParentOrigin::CENTER );
- control.SetAnchorPoint( AnchorPoint::CENTER );
- Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
- control.SetPosition( parentPosition );
-
- layoutControl.Add( control );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render(0);
-
- // The value of z should not be zero
- DALI_TEST_EQUALS( control.GetCurrentPosition(), parentPosition, TEST_LOCATION );
-
- END_TEST;
-}
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <toolkit-event-thread-callback.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
-#include <dali-toolkit/devel-api/layouting/bin-layout.h>
-#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
-#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
-#include <dali-toolkit/devel-api/layouting/linear-layout.h>
-
-#include <../custom-layout.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-namespace
-{
-// Turns the given control into a Root layout control and adds it to the stage.
-void SetupRootLayoutControl( Control& rootControl )
-{
- rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "RootAbsoluteLayout" );
- Stage stage = Stage::GetCurrent();
- stage.Add( rootControl );
-}
-
-void CreateDefaultBinContainer( Control& binContainer )
-{
- binContainer = Control::New();
- binContainer.SetName( "binContainer" );
- DevelControl::SetLayout( binContainer, BinLayout::New() );
- binContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- binContainer.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-}
-
-} // namespace
-
-void utc_dali_toolkit_bin_layouting_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_bin_layouting_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliLayouting_BinLayoutDownCast(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliLayouting_BinLayoutDownCast - Testing Downcast");
-
- BinLayout binLayout = BinLayout::New();
-
- LayoutGroup layoutGroup( binLayout );
-
- BinLayout binLayoutCandidate = BinLayout::DownCast( layoutGroup );
- DALI_TEST_CHECK( binLayoutCandidate );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_BinLayoutAssignment(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliLayouting_BinLayoutAssignment - Testing operator=");
-
- BinLayout binLayout = BinLayout::New();
- BinLayout binLayout2;
-
- binLayout2 = binLayout;
-
- DALI_TEST_EQUALS( binLayout2, binLayout, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_BinLayoutCopyConstructor(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliLayouting_BinLayoutCopyConstructor - Testing copy constructor");
-
- BinLayout binLayout1 = BinLayout::New();
- BinLayout binLayout2( binLayout1 );
-
- DALI_TEST_EQUALS( binLayout1, binLayout2, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliLayouting_BinLayout01(void)
-{
- const auto NUMBER_OF_ITEMS = 4;
-
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_BinLayout01 BinLayout WRAP_CONTENT");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto binContainer = Control::New();
- auto binLayout = BinLayout::New();
- binContainer.SetName( "BinLayout");
- DevelControl::SetLayout( binContainer, binLayout );
- binContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- binContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- binContainer.Add( iter );
- }
-
- rootControl.Add( binContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Items will be laid out at the same position
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // BinLayout size to be that of greatest child dimensions
- DALI_TEST_EQUALS( binContainer.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_BinLayout02(void)
-{
- const auto NUMBER_OF_ITEMS = 4;
-
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_BinLayout02 BinLayout MATCH_PARENT");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto binContainer = Control::New();
- auto binLayout = BinLayout::New();
- binContainer.SetName( "BinLayout");
- DevelControl::SetLayout( binContainer, binLayout );
- binContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- binContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- binContainer.Add( iter );
- }
-
- rootControl.Add( binContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Items will be laid out at the same position
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // BinLayout size to be that of greatest child dimensions
- DALI_TEST_EQUALS( binContainer.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_BinLayout03(void)
-{
- const auto NUMBER_OF_ITEMS = 4;
-
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_BinLayout03 Explicit child Positioning when Bin layout MATCH_PARENT");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto binContainer = Control::New();
- auto binLayout = BinLayout::New();
- binContainer.SetName( "BinLayout");
- DevelControl::SetLayout( binContainer, binLayout );
- binContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- binContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- binContainer.Add( iter );
- }
-
- tet_infoline("Position child explicitly from top left");
- controls[0].SetProperty(Actor::Property::POSITION_X, 50.0f );
-
- tet_infoline("Position child explicitly from top left");
- controls[2].SetProperty(Actor::Property::POSITION_Y, 50.0f );
-
- rootControl.Add( binContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Items will be laid out at the same position
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // BinLayout size to be that of parent
- DALI_TEST_EQUALS( binContainer.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayoutingBinLayoutResizePolicy_01(void)
-{
- /*
- Root
- |
- Control (LinearLayout Horizontal)
- |
- Control (BinLayout)
- |
- Control (ResizePolicy::FILL_TO_PARENT)
- |
- LeafControl
- */
-
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingBinLayoutResizePolicy_01 - Test ResizePolicy mapping with FILL_TO_PARENT on BinLayout child");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- SetupRootLayoutControl( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "hBox" );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- auto binContainer = Control::New();
- CreateDefaultBinContainer( binContainer );
- hbox.Add( binContainer );
-
- auto control = Control::New();
- control.SetName( "fillToParentControl" );
- DevelControl::SetLayoutingRequired( control, true );
- control.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- binContainer.Add( control );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
-
- for( auto&& iter : controls )
- {
- control.Add( iter );
- }
-
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Testing child of BinLayout is size of parent");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Testing BinLayout's child control has not altered it's children's sizes ");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Testing BinLayout is size of parent");
- DALI_TEST_EQUALS( binContainer.GetProperty<Vector3>( Actor::Property::SIZE ), hbox.GetProperty<Vector3>( Actor::Property::SIZE ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayoutingBinLayoutResizePolicy_02(void)
-{
- /*
- Root
- |
- Control (LinearLayout Horizontal)
- |
- Control (BinLayout)
- |
- Control (ResizePolicy::SIZE_RELATIVE_TO_PARENT)
- |
- LeafControl
- */
-
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingBinLayoutResizePolicy_02 - Set ResizePolicy SIZE_RELATIVE_TO_PARENT on BinLayout child");
-
- const auto NUMBER_OF_ITEMS = 4;
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- SetupRootLayoutControl( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "hBox" );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- auto binContainer = Control::New();
- CreateDefaultBinContainer( binContainer );
- hbox.Add( binContainer );
-
- auto control = Control::New();
- control.SetName( "fitToChildrenControl" );
- DevelControl::SetLayoutingRequired( control, true );
- control.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
- control.SetSizeModeFactor( Vector3( 0.50f, 1.0f, 1.0f ) );
- binContainer.Add( control );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 40, 40 ) );
- }
-
- for( auto&& iter : controls )
- {
- control.Add( iter );
- }
-
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Testing child of BinLayout is the defined relative size of parent");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 240.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Testing BinLayout's child control has not altered it's children's sizes ");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Testing BinLayout is size of parent");
- DALI_TEST_EQUALS( binContainer.GetProperty<Vector3>( Actor::Property::SIZE ), hbox.GetProperty<Vector3>( Actor::Property::SIZE ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliBinLayoutResizePolicy_03(void)
-{
- /*
- Root
- |
- Control (LinearLayout Horizontal)
- |
- Control (LayoutingRequired)
- |
- Control (ResizePolicy::SIZE_RELATIVE_TO_PARENT)
- |
- LeafControl
- */
-
- ToolkitTestApplication application;
- tet_infoline("UtcDaliBinLayoutResizePolicy_03 - Set ResizePolicy SIZE_FIXED_OFFSET_FROM_PARENT on BinLayout child");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- SetupRootLayoutControl( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "hBox" );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- auto binContainer = Control::New();
- CreateDefaultBinContainer( binContainer );
- hbox.Add( binContainer );
-
- hbox.Add( binContainer );
-
- auto control = Control::New();
- control.SetName( "fitToChildrenControl" );
- DevelControl::SetLayoutingRequired( control, true );
- control.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
- control.SetSizeModeFactor( Vector3( -100.0f, 10.0f, 0.0f ) );
- binContainer.Add( control );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
-
- for( auto&& iter : controls )
- {
- control.Add( iter );
- }
-
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( DevelControl::IsLayoutingRequired( control ), true , 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 380.0f, 810.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/flex-layout.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-void utc_dali_toolkit_flexlayout_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_flexlayout_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliLayouting_FlexLayout01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout01");
-
- Stage stage = Stage::GetCurrent();
- auto flexBox = Control::New();
- auto flexLayout = FlexLayout::New();
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::CENTER );
- DevelControl::SetLayout( flexBox, flexLayout );
- flexBox.SetName( "Flexbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- const Extents CONTROL_MARGIN = Extents( 0, 10, 0, 0 );
- for( auto&& iter : controls )
- {
- iter.SetProperty(Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
- flexBox.Add( iter );
- }
- flexBox.SetParentOrigin( ParentOrigin::CENTER );
- flexBox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( flexBox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see goto https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsInBhZGRpbmciOnsidG9wIjoiIiwicmlnaHQiOiIiLCJib3R0b20iOiIiLCJsZWZ0IjoiIn0sIm1hcmdpbiI6eyJyaWdodCI6IjEwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI2MCIsImhlaWdodCI6IjYwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwYWRkaW5nIjp7InRvcCI6IiIsInJpZ2h0IjoiIiwiYm90dG9tIjoiIiwibGVmdCI6IiJ9LCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fSx7IndpZHRoIjoiODAiLCJoZWlnaHQiOiI4MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwicGFkZGluZyI6eyJ0b3AiOiIiLCJyaWdodCI6IiIsImJvdHRvbSI6IiIsImxlZnQiOiIifSwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6MTAwLCJoZWlnaHQiOjEwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwYWRkaW5nIjp7InRvcCI6IiIsInJpZ2h0IjoiIiwiYm90dG9tIjoiIiwibGVmdCI6IiJ9LCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3( 0, 0, 0 ),TEST_LOCATION);
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3( 480, 800, 0 ),TEST_LOCATION);
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- const Extents CONTROL_PADDING = Extents( 5, 10, 15, 15 );
- for( auto&& iter : controls )
- {
- iter.SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
- flexBox.Add( iter );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsInBhZGRpbmciOnsidG9wIjoiMTUiLCJyaWdodCI6IjEwIiwiYm90dG9tIjoiMTUiLCJsZWZ0IjoiNSJ9LCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fSx7IndpZHRoIjoiNjAiLCJoZWlnaHQiOiI2MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwicGFkZGluZyI6eyJ0b3AiOiIxNSIsInJpZ2h0IjoiMTAiLCJib3R0b20iOiIxNSIsImxlZnQiOiI1In0sIm1hcmdpbiI6eyJyaWdodCI6IjEwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI4MCIsImhlaWdodCI6IjgwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwYWRkaW5nIjp7InRvcCI6IjE1IiwicmlnaHQiOiIxMCIsImJvdHRvbSI6IjE1IiwibGVmdCI6IjUifSwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6MTAwLCJoZWlnaHQiOjEwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwYWRkaW5nIjp7InRvcCI6IjE1IiwicmlnaHQiOiIxMCIsImJvdHRvbSI6IjE1IiwibGVmdCI6IjUifSwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 65.0f, 355.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 150.0f, 345.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 255.0f, 335.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 90.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 95.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 115.0f, 130.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- const Extents FLEXBOX_PADDING = Extents( 25, 25, 25, 25 );
- flexBox.SetProperty(Toolkit::Control::Property::PADDING, FLEXBOX_PADDING );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicGFkZGluZyI6eyJ0b3AiOiIyNSIsInJpZ2h0IjoiMjUiLCJib3R0b20iOiIyNSIsImxlZnQiOiIyNSJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9LCJmbGV4V3JhcCI6MSwiY2hpbGRyZW4iOlt7IndpZHRoIjoiNDAiLCJoZWlnaHQiOiI0MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwicGFkZGluZyI6eyJ0b3AiOiIxNSIsInJpZ2h0IjoiMTAiLCJib3R0b20iOiIxNSIsImxlZnQiOiI1In0sIm1hcmdpbiI6eyJyaWdodCI6IjEwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI2MCIsImhlaWdodCI6IjYwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwYWRkaW5nIjp7InRvcCI6IjE1IiwicmlnaHQiOiIxMCIsImJvdHRvbSI6IjE1IiwibGVmdCI6IjUifSwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjgwIiwiaGVpZ2h0IjoiODAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsInBhZGRpbmciOnsidG9wIjoiMTUiLCJyaWdodCI6IjEwIiwiYm90dG9tIjoiMTUiLCJsZWZ0IjoiNSJ9LCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fSx7IndpZHRoIjoxMDAsImhlaWdodCI6MTAwLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsInBhZGRpbmciOnsidG9wIjoiMTUiLCJyaWdodCI6IjEwIiwiYm90dG9tIjoiMTUiLCJsZWZ0IjoiNSJ9LCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f, 355.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 175.0f, 345.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 280.0f, 335.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 90.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 95.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 115.0f, 130.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout02(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout02");
-
- Stage stage = Stage::GetCurrent();
- auto flexBox = Control::New();
- auto flexLayout = FlexLayout::New();
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::CENTER );
-
- DevelControl::SetLayout( flexBox, flexLayout );
- flexBox.SetName( "Flexbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- const Extents CONTROL_MARGIN = Extents( 0, 10, 0, 0 );
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
- flexBox.Add( iter );
- }
-
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- flexBox.SetParentOrigin( ParentOrigin::CENTER );
- flexBox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( flexBox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // flexbox centers elements vertically, it fills test harness stage, which is 480x800.
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3( 0, 0, 0 ),TEST_LOCATION);
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3( 480, 800, 0 ),TEST_LOCATION);
-
- DALI_TEST_EQUALS( controls[1].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::WRAP_CONTENT ), TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
-
- // left aligned elements with right margin 10
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout03(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout03 Test nested flex boxes");
-
- Stage stage = Stage::GetCurrent();
-
- auto flexbox1 = Control::New();
- auto flexLayout1 = FlexLayout::New();
- DevelControl::SetLayout( flexbox1, flexLayout1 );
- flexbox1.SetName( "Flexbox1");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 20, 20 ) );
- controls.push_back( CreateLeafControl( 30, 30 ) );
- flexbox1.Add( controls[0] );
- flexbox1.Add( controls[1] );
- flexbox1.SetParentOrigin( ParentOrigin::CENTER );
- flexbox1.SetAnchorPoint( AnchorPoint::CENTER );
-
- flexLayout1.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- flexLayout1.SetFlexWrap(Dali::Toolkit::FlexLayout::WrapType::NO_WRAP);
- flexLayout1.SetFlexAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout1.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout1.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::FLEX_START );
-
- auto flexbox2 = Control::New();
- auto flexLayout2 = FlexLayout::New();
- DevelControl::SetLayout( flexbox2, flexLayout2 );
- flexbox2.SetName( "Flexbox2");
-
- controls.push_back( CreateLeafControl( 25, 25 ) );
- controls.push_back( CreateLeafControl( 35, 35 ) );
- flexbox2.Add( controls[2] );
- flexbox2.Add( controls[3] );
- flexbox2.SetParentOrigin( ParentOrigin::CENTER );
- flexbox2.SetAnchorPoint( AnchorPoint::CENTER );
-
- flexLayout2.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::COLUMN );
- flexLayout2.SetFlexWrap(Dali::Toolkit::FlexLayout::WrapType::NO_WRAP);
- flexLayout2.SetFlexAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout2.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout2.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::FLEX_START );
-
- auto flexbox3 = Control::New();
- auto flexLayout3 = FlexLayout::New();
- DevelControl::SetLayout( flexbox3, flexLayout3 );
- flexbox3.SetParentOrigin( ParentOrigin::CENTER );
- flexbox3.SetName( "Flexbox3");
- flexbox3.Add( flexbox1 );
- flexbox3.Add( flexbox2 );
- stage.Add( flexbox3 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 30.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 55.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 20.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 30.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 25.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 35.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox1,2 are sized to wrap their content
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 30.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 30.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox3 matches parent (root layer)
- DALI_TEST_EQUALS( flexbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout04(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout04");
-
- Stage stage = Stage::GetCurrent();
- auto flexBox = Control::New();
- auto flexLayout = FlexLayout::New();
- flexLayout.SetFlexAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout.SetFlexWrap(Dali::Toolkit::FlexLayout::WrapType::NO_WRAP);
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::FLEX_START );
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::COLUMN );
- DevelControl::SetLayout( flexBox, flexLayout );
- flexBox.SetName( "Flexbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- for( auto&& iter : controls )
- {
- flexBox.Add( iter );
- }
- flexBox.SetParentOrigin( ParentOrigin::CENTER );
- flexBox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( flexBox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwiZmxleERpcmVjdGlvbiI6MCwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI2MCIsImhlaWdodCI6IjYwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Ensure layouting happens
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::COLUMN_REVERSE );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwiZmxleERpcmVjdGlvbiI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI2MCIsImhlaWdodCI6IjYwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Ensure layouting happens
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI2MCIsImhlaWdodCI6IjYwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Ensure layouting happens
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW_REVERSE );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwiZmxleERpcmVjdGlvbiI6MywicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOiI2MCIsImhlaWdodCI6IjYwIiwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwibWFyZ2luIjp7InJpZ2h0IjoiMTAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Ensure layouting happens
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::CENTER );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiY2hpbGRyZW4iOlt7IndpZHRoIjoiNDAiLCJoZWlnaHQiOiI0MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Ensure layouting happens
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_END );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjMsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiY2hpbGRyZW4iOlt7IndpZHRoIjoiNDAiLCJoZWlnaHQiOiI0MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJtYXJnaW4iOnsicmlnaHQiOiIxMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Ensure layouting happens
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::STRETCH );
- controls[0].SetProperty( Actor::Property::MAXIMUM_SIZE, Vector2(40.f, 40.f) );
- controls[1].SetProperty( Actor::Property::MAXIMUM_SIZE, Vector2(60.f, 60.f) );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiY2hpbGRyZW4iOlt7IndpZHRoIjoiNDAiLCJoZWlnaHQiOiI0MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwibWFyZ2luIjp7InJpZ2h0IjoiMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fSx7IndpZHRoIjoiNjAiLCJoZWlnaHQiOiI2MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwibWFyZ2luIjp7InJpZ2h0IjoiMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::FLEX_START );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiY2hpbGRyZW4iOlt7IndpZHRoIjoiNDAiLCJoZWlnaHQiOiI0MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwibWFyZ2luIjp7InJpZ2h0IjoiMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fSx7IndpZHRoIjoiNjAiLCJoZWlnaHQiOiI2MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduQ29udGVudCI6MCwibWFyZ2luIjp7InJpZ2h0IjoiMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::CENTER );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImp1c3RpZnlDb250ZW50IjoxLCJhbGlnbkl0ZW1zIjoxLCJhbGlnbkNvbnRlbnQiOjEsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH0sImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::FLEX_END );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImp1c3RpZnlDb250ZW50IjoyLCJhbGlnbkl0ZW1zIjoxLCJhbGlnbkNvbnRlbnQiOjEsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH0sImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::SPACE_BETWEEN );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImp1c3RpZnlDb250ZW50IjozLCJhbGlnbkl0ZW1zIjoxLCJhbGlnbkNvbnRlbnQiOjEsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH0sImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::SPACE_AROUND );
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImp1c3RpZnlDb250ZW50Ijo0LCJhbGlnbkl0ZW1zIjoxLCJhbGlnbkNvbnRlbnQiOjEsInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH0sImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 95.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 325.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout05(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout05");
-
- Stage stage = Stage::GetCurrent();
- auto flexBox = Control::New();
- auto flexLayout = FlexLayout::New();
- flexLayout.SetFlexAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- flexLayout.SetFlexWrap(Dali::Toolkit::FlexLayout::WrapType::NO_WRAP);
- flexLayout.SetFlexJustification( Dali::Toolkit::FlexLayout::Justification::FLEX_START );
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- DevelControl::SetLayout( flexBox, flexLayout );
- flexBox.SetName( "Flexbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 200, 200 ) );
- controls.push_back( CreateLeafControl( 400, 400 ) );
- for( auto&& iter : controls )
- {
- flexBox.Add( iter );
- }
- flexBox.SetParentOrigin( ParentOrigin::CENTER );
- flexBox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( flexBox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Shrink is off
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 400.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexWrap(Dali::Toolkit::FlexLayout::WrapType::WRAP);
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjIwMCIsImhlaWdodCI6IjIwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjQwMCIsImhlaWdodCI6IjQwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 400.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexAlignment(Dali::Toolkit::FlexLayout::Alignment::CENTER);
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MiwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjIwMCIsImhlaWdodCI6IjIwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjQwMCIsImhlaWdodCI6IjQwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 400.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexAlignment(Dali::Toolkit::FlexLayout::Alignment::FLEX_END);
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MiwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjIwMCIsImhlaWdodCI6IjIwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjQwMCIsImhlaWdodCI6IjQwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 400.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexLayout.SetFlexAlignment(Dali::Toolkit::FlexLayout::Alignment::STRETCH);
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see the test go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MiwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjIwMCIsImhlaWdodCI6IjIwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjQwMCIsImhlaWdodCI6IjQwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX1dfQ==
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 400.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout06(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout06");
-
- Stage stage = Stage::GetCurrent();
- auto flexBox = Control::New();
- auto flexLayout = FlexLayout::New();
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::COLUMN );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::FLEX_START );
- DevelControl::SetLayout( flexBox, flexLayout );
- flexBox.SetName( "Flexbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
- for( auto&& iter : controls )
- {
- flexBox.Add( iter );
- }
- flexBox.SetParentOrigin( ParentOrigin::CENTER );
- flexBox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( flexBox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // flexbox centers elements vertically, it fills test harness stage, which is 480x800.
- // left aligned elements with right margin 10
- // To see goto https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwiZmxleERpcmVjdGlvbiI6MCwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjgwIiwiaGVpZ2h0IjoiODAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6MTAwLCJoZWlnaHQiOjEwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0, 0, 0),TEST_LOCATION);
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480, 800, 0),TEST_LOCATION);
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexBox.Remove( controls[1] );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see goto https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjEsImFsaWduQ29udGVudCI6MSwiZmxleERpcmVjdGlvbiI6MCwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjgwIiwiaGVpZ2h0IjoiODAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6MTAwLCJoZWlnaHQiOjEwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fV19
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout07(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout07");
-
- Stage stage = Stage::GetCurrent();
- auto flexBox = Control::New();
- auto flexLayout = FlexLayout::New();
- flexLayout.SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection::ROW );
- flexLayout.SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::CENTER );
- DevelControl::SetLayout( flexBox, flexLayout );
- flexBox.SetName( "Flexbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::FlexLayout::ChildProperty::FLEX, 0.f );
- iter.SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Dali::Toolkit::FlexLayout::Alignment::AUTO );
- flexBox.Add( iter );
- }
- flexBox.SetParentOrigin( ParentOrigin::CENTER );
- flexBox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( flexBox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see goto https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjgwIiwiaGVpZ2h0IjoiODAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6MTAwLCJoZWlnaHQiOjEwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19XX0=
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3( 0, 0, 0 ),TEST_LOCATION);
- DALI_TEST_EQUALS( flexBox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3( 480, 800, 0 ),TEST_LOCATION);
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 180.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::FlexLayout::ChildProperty::FLEX, 0.25f );
- iter.SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Toolkit::FlexLayout::Alignment::AUTO );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleEdyb3ciOiIwLjI1In0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleEdyb3ciOiIwLjI1In0seyJ3aWR0aCI6IjgwIiwiaGVpZ2h0IjoiODAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleEdyb3ciOiIwLjI1In0seyJ3aWR0aCI6MTAwLCJoZWlnaHQiOjEwMCwibWluV2lkdGgiOm51bGwsIm1pbkhlaWdodCI6bnVsbCwibWF4V2lkdGgiOm51bGwsIm1heEhlaWdodCI6bnVsbCwiYWxpZ25JdGVtcyI6MCwiYWxpZ25Db250ZW50IjowLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH0sImZsZXhHcm93IjoiMC4yNSJ9XX0=
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 360.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::FlexLayout::ChildProperty::FLEX, 0.f );
- }
- controls[0].SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Toolkit::FlexLayout::Alignment::CENTER );
- controls[1].SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Toolkit::FlexLayout::Alignment::FLEX_START );
- controls[2].SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Toolkit::FlexLayout::Alignment::FLEX_END );
- controls[3].SetProperty( Toolkit::FlexLayout::ChildProperty::ALIGN_SELF, Toolkit::FlexLayout::Alignment::STRETCH );
- controls[3].SetProperty( Actor::Property::MAXIMUM_SIZE, Vector2(100.f, 100.f) );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // To see go to https://yogalayout.com/playground/#eyJ3aWR0aCI6IjQ4MCIsImhlaWdodCI6IjgwMCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjIsImFsaWduQ29udGVudCI6MSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfSwiZmxleFdyYXAiOjEsImNoaWxkcmVuIjpbeyJ3aWR0aCI6IjQwIiwiaGVpZ2h0IjoiNDAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnbkNvbnRlbnQiOjAsIm1hcmdpbiI6eyJyaWdodCI6IjAifSwicG9zaXRpb24iOnsidG9wIjpudWxsLCJyaWdodCI6bnVsbCwiYm90dG9tIjpudWxsLCJsZWZ0IjpudWxsfX0seyJ3aWR0aCI6IjYwIiwiaGVpZ2h0IjoiNjAiLCJtaW5XaWR0aCI6bnVsbCwibWluSGVpZ2h0IjpudWxsLCJtYXhXaWR0aCI6bnVsbCwibWF4SGVpZ2h0IjpudWxsLCJhbGlnbkl0ZW1zIjowLCJhbGlnblNlbGYiOjEsImFsaWduQ29udGVudCI6MCwibWFyZ2luIjp7InJpZ2h0IjoiMCJ9LCJwb3NpdGlvbiI6eyJ0b3AiOm51bGwsInJpZ2h0IjpudWxsLCJib3R0b20iOm51bGwsImxlZnQiOm51bGx9fSx7IndpZHRoIjoiODAiLCJoZWlnaHQiOiI4MCIsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduU2VsZiI6MywiYWxpZ25Db250ZW50IjowLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19LHsid2lkdGgiOjEwMCwiaGVpZ2h0IjoxMDAsIm1pbldpZHRoIjpudWxsLCJtaW5IZWlnaHQiOm51bGwsIm1heFdpZHRoIjpudWxsLCJtYXhIZWlnaHQiOm51bGwsImFsaWduSXRlbXMiOjAsImFsaWduU2VsZiI6NCwiYWxpZ25Db250ZW50IjowLCJtYXJnaW4iOnsicmlnaHQiOiIwIn0sInBvc2l0aW9uIjp7InRvcCI6bnVsbCwicmlnaHQiOm51bGwsImJvdHRvbSI6bnVsbCwibGVmdCI6bnVsbH19XX0=
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 720.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 180.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout08(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout08");
-
- Stage stage = Stage::GetCurrent();
-
- auto flexbox1 = Control::New();
- auto flexLayout1 = FlexLayout::New();
- DevelControl::SetLayout( flexbox1, flexLayout1 );
- flexbox1.SetName( "Flexbox1");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 20, 20 ) );
- flexbox1.Add( controls[0] );
- flexbox1.SetParentOrigin( ParentOrigin::CENTER );
- flexbox1.SetAnchorPoint( AnchorPoint::CENTER );
- const Extents CONTROL_MARGIN = Extents( 10, 10, 10, 10 );
- const Extents CONTROL_PADDING = Extents( 5, 5, 5, 5 );
- flexbox1.SetProperty( Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
- flexbox1.SetProperty( Toolkit::Control::Property::PADDING, CONTROL_PADDING );
- flexbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- flexbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- auto flexbox2 = Control::New();
- auto flexLayout2 = FlexLayout::New();
- DevelControl::SetLayout( flexbox2, flexLayout2 );
- flexbox2.SetParentOrigin( ParentOrigin::CENTER );
- flexbox2.SetName( "Flexbox2");
- flexbox2.Add( flexbox1 );
- stage.Add( flexbox2 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 15.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 20.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 30.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 10.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout_NestedFlexboxWithSpec(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout_NestedFlexboxWithSpec Test nested flex box with wrap content/match parent");
-
- Stage stage = Stage::GetCurrent();
-
- auto flexbox1 = Control::New();
- auto flexLayout1 = FlexLayout::New();
- DevelControl::SetLayout( flexbox1, flexLayout1 );
- flexbox1.SetName( "Flexbox1");
- flexbox1.SetParentOrigin( ParentOrigin::CENTER );
- flexbox1.SetAnchorPoint( AnchorPoint::CENTER );
-
- auto flexbox2 = Control::New();
- auto flexLayout2 = FlexLayout::New();
- DevelControl::SetLayout( flexbox2, flexLayout2 );
- flexbox2.SetParentOrigin( ParentOrigin::CENTER );
- flexbox2.SetAnchorPoint( AnchorPoint::CENTER );
- flexbox2.SetName( "Flexbox2");
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- flexbox2.Add( controls[0] );
- flexbox1.Add( flexbox2 );
- stage.Add( flexbox1 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox2 is sized to wrap its content
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox2 width is sized to match parent
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox2 height is sized to match parent
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- flexbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox2 is sized to match its parent
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FlexLayout_WithTextLabel(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FlexLayout_WithTextLabel ");
-
- Stage stage = Stage::GetCurrent();
-
- auto flexbox1 = Control::New();
- auto flexLayout1 = FlexLayout::New();
- DevelControl::SetLayout( flexbox1, flexLayout1 );
- flexbox1.SetName( "Flexbox1");
- flexbox1.SetParentOrigin( ParentOrigin::CENTER );
- flexbox1.SetAnchorPoint( AnchorPoint::CENTER );
-
- std::vector< Control > controls;
- controls.push_back( CreateTextLabel( "W" ) );
- flexbox1.Add( controls[0] );
- stage.Add( flexbox1 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 52.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test flexbox2 is sized to wrap its content
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- TextLabel::DownCast( controls[0] ).SetProperty( TextLabel::Property::TEXT, "WWWW" );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 214.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( flexbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <toolkit-event-thread-callback.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
-#include <dali-toolkit/devel-api/layouting/grid.h>
-#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
-#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
-
-#include <../custom-layout.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-void utc_dali_toolkit_grid_layouting_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_grid_layouting_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliLayouting_GridLayout00(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout00 1 Column, 0 Items");
-
- const auto NUMBER_OF_COLUMNS = 1;
- const auto NUMBER_OF_ITEMS = 0;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- rootControl.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_printf( "Confirm number of columns is as set\n");
- DALI_TEST_EQUALS( gridLayout.GetNumberOfColumns(), NUMBER_OF_COLUMNS, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_GridLayout01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout01 2 Column, 4 Items");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- rootControl.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Grid will layout first 2 items on first row then last 2 on second row.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_printf( "Confirm number of columns is as set\n");
- DALI_TEST_EQUALS( gridLayout.GetNumberOfColumns(), NUMBER_OF_COLUMNS, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_GridLayout02(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_GridLayout02");
-
- const auto NUMBER_OF_COLUMNS = 3;
- const auto NUMBER_OF_ITEMS = 7;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- rootControl.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // grid layouts out 3 items per row, which is 480x800.
- // Row 1
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- // Row 2
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 200.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- // Row 3
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_GridLayout03(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout03 Grid Padding");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Extents GRID_PADDING( Extents( 10, 10, 20, 20 ) ); // start,end,top,bottom
-
- tet_printf( "Testing with Padding 10,10,20,20\n");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( Control::Property::PADDING, GRID_PADDING );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- rootControl.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline(" UtcDaliLayouting_GridLayout03 Grid Padding 2 Column, 4 Items");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f + GRID_PADDING.start , 0.0f + GRID_PADDING.top, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f + GRID_PADDING.start, 0.0f + GRID_PADDING.top, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f + GRID_PADDING.start, 100.0f + GRID_PADDING.top , 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f + GRID_PADDING.start, 100.0f + GRID_PADDING.top, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline(" UtcDaliLayouting_GridLayout03 Size of Grid should include padding");
- DALI_TEST_EQUALS( gridContainer.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f * NUMBER_OF_COLUMNS + GRID_PADDING.start + + GRID_PADDING.end,
- 100.0f * ( NUMBER_OF_ITEMS / NUMBER_OF_COLUMNS ) +
- GRID_PADDING.top + GRID_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline(" UtcDaliLayouting_GridLayout03 Item sizes unchanged");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_GridLayout04(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout04 Child Margin");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Extents GRID_PADDING( Extents( 10, 10, 20, 20 ) ); // start,end,top,bottom
- Extents ITEM_MARGIN( Extents( 10, 10, 5, 5 ) ); // start,end,top,bottom
-
- tet_printf( "Testing with Margin 10,10,5,5\n");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- gridContainer.SetProperty( Control::Property::PADDING, GRID_PADDING );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- auto control = CreateLeafControl( 100, 100 );
- control.SetProperty(Toolkit::Control::Property::MARGIN, ITEM_MARGIN );
- controls.push_back( control );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- rootControl.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ),
- Vector3( 0.0f + GRID_PADDING.start + ITEM_MARGIN.start,
- 0.0f + GRID_PADDING.top + ITEM_MARGIN.top,
- 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ),
- Vector3( 100.0f + GRID_PADDING.start + ITEM_MARGIN.start *2 + ITEM_MARGIN.end,
- 0.0f + GRID_PADDING.top + ITEM_MARGIN.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ),
- Vector3( 0.0f + GRID_PADDING.start + ITEM_MARGIN.start,
- 100.0f + GRID_PADDING.top + ITEM_MARGIN.top*2 + ITEM_MARGIN.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ),
- Vector3( 100.0f + GRID_PADDING.start + ITEM_MARGIN.start*2 + ITEM_MARGIN.end,
- 100.0f + GRID_PADDING.top + ITEM_MARGIN.top*2 + ITEM_MARGIN.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline(" UtcDaliLayouting_GridLayout03 Size of Grid should include padding and margins");
-
- const auto NUMBER_OF_ROWS = ( NUMBER_OF_ITEMS / NUMBER_OF_COLUMNS );
-
- DALI_TEST_EQUALS( gridContainer.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f * NUMBER_OF_COLUMNS + GRID_PADDING.start + GRID_PADDING.end +
- ITEM_MARGIN.start *NUMBER_OF_COLUMNS + ITEM_MARGIN.end *NUMBER_OF_COLUMNS,
- 100.0f * NUMBER_OF_ROWS +
- GRID_PADDING.top + GRID_PADDING.bottom +
- ITEM_MARGIN.bottom *NUMBER_OF_ROWS + ITEM_MARGIN.bottom *NUMBER_OF_ROWS,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline(" UtcDaliLayouting_GridLayout03 Item sizes unchanged");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_GridLayout05(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout05 2 Column, 4 Items UNSPECIFIED width and height SPECIFICATIONS");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto customLayout = Test::CustomLayout::New();
- tet_printf( "Set Flag so child is measured with an unconstrained measure spec\n");
- customLayout.SetCustomBehaviourFlag( Test::CustomLayout::BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH );
- customLayout.SetCustomBehaviourFlag( Test::CustomLayout::BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT );
- auto customHBox = Control::New();
- customHBox.SetName("CustomHBox");
- DevelControl::SetLayout( customHBox, customLayout );
- tet_printf( "Set width of custom layout to be smaller than child Grid wants to be\n");
- customHBox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 150 );
- customHBox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 150 );
- rootControl.Add( customHBox );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- tet_printf( "Grid SPEC set to MATCH_PARENT, this will be ignored if BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH or BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT flags are set\n");
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- customHBox.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Grid will layout first 2 items on first row then last 2 on second row.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_GridLayout06(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout06 2 Column, 4 Items UNSPECIFIED width SPECIFICATION");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto customLayout = Test::CustomLayout::New();
- tet_printf( "Set Flag so child is measured with an unconstrained measure spec\n");
- customLayout.SetCustomBehaviourFlag( Test::CustomLayout::BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH );
- auto customHBox = Control::New();
- customHBox.SetName("CustomHBox");
- DevelControl::SetLayout( customHBox, customLayout );
- tet_printf( "Set width of custom layout to be smaller than child Grid wants to be\n");
- customHBox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 150 );
- customHBox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 150 );
- rootControl.Add( customHBox );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- tet_printf( "Grid SPEC set to MATCH_PARENT, this will be ignored if BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH or BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT flags are set\n");
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- customHBox.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Grid will layout first 2 items on first row then last 2 on second row.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_GridLayout07(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout07 2 Column, 4 Items UNSPECIFIED height SPECIFICATION");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto customLayout = Test::CustomLayout::New();
- tet_printf( "Set Flag so child is measured with an unconstrained measure spec\n");
- customLayout.SetCustomBehaviourFlag( Test::CustomLayout::BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT );
- auto customHBox = Control::New();
- customHBox.SetName("CustomHBox");
- DevelControl::SetLayout( customHBox, customLayout );
- tet_printf( "Set width of custom layout to be smaller than child Grid wants to be\n");
- customHBox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 150 );
- customHBox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 150 );
- rootControl.Add( customHBox );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- tet_printf( "Grid SPEC set to MATCH_PARENT, this will be ignored if BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_WIDTH or BEHAVIOUR_FLAG_UNCONSTRAINED_CHILD_HEIGHT flags are set\n");
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- customHBox.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Grid will layout first 2 items on first row then last 2 on second row.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 75.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will not be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_GridLayout08(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayout08 2 Column, 4 Items Grid with children too wide for parent spec");
-
- const auto NUMBER_OF_COLUMNS = 2;
- const auto NUMBER_OF_ITEMS = 4;
-
- tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto customLayout = Test::CustomLayout::New();
- auto customHBox = Control::New();
- customHBox.SetName("CustomHBox");
- DevelControl::SetLayout( customHBox, customLayout );
- tet_printf( "Set width of custom layout to be smaller than child Grid wants to be\n");
- customHBox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 150 );
- customHBox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 200 );
- rootControl.Add( customHBox );
-
- auto gridContainer = Control::New();
- auto gridLayout = Grid::New();
- gridLayout.SetNumberOfColumns( NUMBER_OF_COLUMNS );
- gridContainer.SetName( "GridLayout");
- DevelControl::SetLayout( gridContainer, gridLayout );
- gridContainer.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- gridContainer.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- for( auto i=0; i < NUMBER_OF_ITEMS; i++ )
- {
- controls.push_back( CreateLeafControl( 100, 100 ) );
- }
-
- for( auto&& iter : controls )
- {
- gridContainer.Add( iter );
- }
-
- customHBox.Add( gridContainer );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_printf( "Children width reduced from 100 to 75\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS );
- // Grid will layout first 2 items on first row then last 2 on second row.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 75.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Item sizes will be changed
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_GridLayoutDownCast(void)
-{
- TestApplication application;
- tet_infoline(" UtcDaliLayouting_GridLayoutDownCast - Testing Downcast");
-
- Grid gridLayout = Grid::New();
-
- LayoutGroup layoutGroup( gridLayout );
-
- Grid gridLayoutCandidate = Grid::DownCast( layoutGroup );
- DALI_TEST_CHECK( gridLayoutCandidate );
-
- END_TEST;
-}
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <toolkit-event-thread-callback.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
-#include <dali-toolkit/devel-api/layouting/linear-layout.h>
-#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
-#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
-#include <dali/devel-api/actors/actor-devel.h>
-
-#include <../custom-layout.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-namespace
-{
-
-// Turns the given control into a Root layout control and adds it to the stage.
-void SetupRootLayoutControl( Control& rootControl )
-{
- rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "RootAbsoluteLayout" );
- Stage stage = Stage::GetCurrent();
- stage.Add( rootControl );
-}
-
-} // unnamed namespace
-
-void utc_dali_toolkit_layouting_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_layouting_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliLayouting_LayoutLength_Types(void)
-{
- tet_infoline("UtcDaliLayouting_LayoutLength Types");
-
- // testing that operators return correct type
- // operator+
- {
- auto value = LayoutLength( 10 ) + LayoutLength();
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = LayoutLength( 10 ) + 20;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 22 + LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = LayoutLength( 10 ) + 2.1f;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 2.2f + LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- // operator-
- {
- auto value = LayoutLength() - LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = LayoutLength( 10 ) - 99;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 20 - LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = LayoutLength( 10 ) - 9.9f;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 2.0f - LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
-
- // operator*
- {
- auto value = LayoutLength() * LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = LayoutLength( 10 ) * 2;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 10 * LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = LayoutLength( 10 ) * 2.1f;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 1.0f * LayoutLength( 10 );
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- // operator/
- {
- auto value = LayoutLength( 10 ) / 2.0f;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
-
- // combinations
- {
- auto value = ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
- {
- auto value = 20 + ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
- DALI_TEST_EQUALS( typeid(value).name(), typeid(LayoutLength).name(), TEST_LOCATION );
- }
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutLength_Values(void)
-{
- tet_infoline("UtcDaliLayouting_LayoutLength Values");
-
- // operator+
- {
- LayoutLength value = LayoutLength( 10 ) + LayoutLength();
- DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = LayoutLength( 10 ) + 20;
- DALI_TEST_EQUALS( value.AsInteger(), 30.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = 22 - LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsInteger(), 12.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = LayoutLength( 10 ) + 2.1f;
- DALI_TEST_EQUALS( value.AsDecimal(), 12.1f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), 12.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = 2.3f - LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsDecimal(), -7.7f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsInteger(), -8.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), -7.0f, 0.0001f, TEST_LOCATION );
- }
- // operator-
- {
- LayoutLength value = LayoutLength() - LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsInteger(), -10.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = LayoutLength( 10 ) - 99;
- DALI_TEST_EQUALS( value.AsInteger(), -89.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = 20 - LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), 10.f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = LayoutLength( 10 ) - 9.9f;
- DALI_TEST_EQUALS( value.AsInteger(), 0.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsDecimal(), 0.1f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), 0.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = 10.9f - LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsInteger(), 1.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsDecimal(), 0.9f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), 0.0f, 0.0001f, TEST_LOCATION );
- }
- // operator*
- {
- LayoutLength value = LayoutLength() * LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsInteger(), 0.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = LayoutLength(1) * 10;
- DALI_TEST_EQUALS( value.AsInteger(), 10.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = 11 * LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsInteger(), 110.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = LayoutLength( 10 ) * 2.12f;
- DALI_TEST_EQUALS( value.AsDecimal(), 21.2f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsInteger(), 21.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), 21.0f, 0.0001f, TEST_LOCATION );
- }
- {
- LayoutLength value = 2.189f * LayoutLength( 10 );
- DALI_TEST_EQUALS( value.AsDecimal(), 21.89f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsInteger(), 22.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsTruncated(), 21.0f, 0.0001f, TEST_LOCATION );
- }
- // operator/
- {
- LayoutLength value = LayoutLength( 11 ) / 2.0f;
- DALI_TEST_EQUALS( value.AsDecimal(), 5.5f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsInteger(), 6.0f, 0.0001f, TEST_LOCATION );
- }
-
- // combinations
- {
- LayoutLength value;
- value = 20 + ( LayoutLength( 10 ) * 2.0f ) / 1.5f;
- DALI_TEST_EQUALS( value.AsInteger(), 33.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsDecimal(), 33.3333f, 0.0001f, TEST_LOCATION );
- }
- {
- uint16_t padding( 1 );
- LayoutLength right(35), left(10), mTotalLength(2);
- LayoutLength value;
- value = padding + ( right - left - mTotalLength ) / 2.0f;
- // = 1 + ( 35 - 10 - 2 ) / 2
- DALI_TEST_EQUALS( value.AsInteger(), 13.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsDecimal(), 12.5f, 0.0001f, TEST_LOCATION );
- }
- {
- uint16_t padding = 1, top = 2, bottom = 3;
- LayoutLength childSpace( 44 ), childHeight( 23 );
- LayoutLength value;
- value = padding + ( ( childSpace - childHeight ) / 2.0f ) + top - bottom;
- // = 1 + ( ( 44 - 23 ) / 2 ) + 2 - 3
- DALI_TEST_EQUALS( value.AsInteger(), 11.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( value.AsDecimal(), 10.5f, 0.0001f, TEST_LOCATION );
- }
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutLength_Operators(void)
-{
- tet_infoline("UtcDaliLayouting_LayoutLength operators");
-
- {
- LayoutLength value = 10;
- DALI_TEST_EQUALS( (int)value.AsInteger(), 10, TEST_LOCATION );
- value += 1;
- DALI_TEST_EQUALS( (int)value.AsInteger(), 11, TEST_LOCATION );
- value -= 12;
- DALI_TEST_EQUALS( (int)value.AsInteger(), -1, TEST_LOCATION );
- LayoutLength value2 = value;
- DALI_TEST_EQUALS( value == value2, true, TEST_LOCATION );
- value2 = 123;
- DALI_TEST_EQUALS( value != value2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( value < value2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( value <= value2, true, TEST_LOCATION );
- value = 456;
- DALI_TEST_EQUALS( value > value2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( value >= value2, true, TEST_LOCATION );
- }
-
- {
- LayoutLength value( 123 );
- std::stringstream ss;
- ss << value;
- DALI_TEST_EQUALS( ss.str(), "123", TEST_LOCATION );
- }
- {
- LayoutLength value( 0.123f );
- std::stringstream ss;
- ss << value;
- DALI_TEST_EQUALS( ss.str(), "0.123", TEST_LOCATION );
- }
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout01");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Change a layout
- auto newHBoxLayout = LinearLayout::New();
- newHBoxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
- DevelControl::SetLayout( hbox, newHBoxLayout );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout02(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout02 Test nested hboxes with default spec of WRAP_CONTENT");
-
- Stage stage = Stage::GetCurrent();
-
- auto hbox1 = Control::New();
- auto hboxLayout1 = LinearLayout::New();
- DevelControl::SetLayout( hbox1, hboxLayout1 );
-
- auto hbox2 = Control::New();
- auto hboxLayout2 = LinearLayout::New();
- DevelControl::SetLayout( hbox2, hboxLayout2 );
-
- hbox1.SetName( "HBox1");
- hbox2.SetName( "HBox2");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 20, 40 ) );
- controls.push_back( CreateLeafControl( 30, 50 ) );
- controls.push_back( CreateLeafControl( 40, 60 ) );
- controls.push_back( CreateLeafControl( 50, 70 ) );
-
- controls.push_back( CreateLeafControl( 25, 40 ) );
- controls.push_back( CreateLeafControl( 35, 50 ) );
- controls.push_back( CreateLeafControl( 45, 60 ) );
- controls.push_back( CreateLeafControl( 55, 70 ) );
-
- int counter=0;
- for( auto&& iter : controls )
- {
- if( counter < 4 )
- {
- hbox1.Add( iter );
- }
- else
- {
- hbox2.Add( iter );
- }
- ++counter;
- }
- hbox1.SetParentOrigin( ParentOrigin::CENTER );
- hbox1.SetAnchorPoint( AnchorPoint::CENTER );
- hbox2.SetParentOrigin( ParentOrigin::CENTER );
- hbox2.SetAnchorPoint( AnchorPoint::CENTER );
-
- auto hbox3 = Control::New();
- auto hboxLayout3 = LinearLayout::New();
- DevelControl::SetLayout( hbox3, hboxLayout3 );
-
- hbox3.SetParentOrigin( ParentOrigin::CENTER );
- hbox3.SetName( "HBox3");
- hbox3.Add( hbox1 );
- hbox3.Add( hbox2 );
-
- stage.Add( hbox3 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
-
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 60.0f, 5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 105.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 45.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test hbox1 and 2 are sized to wrap their content
- DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 140.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 160.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 140.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test hbox3 matches parent (root layer)
- DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_HboxLayout03(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout03 Test nested hboxes with MATCH_PARENT");
-
- Stage stage = Stage::GetCurrent();
-
- auto hbox1 = Control::New();
- auto hboxLayout1 = LinearLayout::New();
- DevelControl::SetLayout( hbox1, hboxLayout1 );
-
- auto hbox2 = Control::New();
- auto hboxLayout2 = LinearLayout::New();
- DevelControl::SetLayout( hbox2, hboxLayout2 );
-
- hbox1.SetName( "HBox1");
- hbox2.SetName( "HBox2");
- hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 20, 40 ) );
- controls.push_back( CreateLeafControl( 30, 50 ) );
- controls.push_back( CreateLeafControl( 40, 60 ) );
- controls.push_back( CreateLeafControl( 50, 70 ) );
-
- controls.push_back( CreateLeafControl( 25, 40 ) );
- controls.push_back( CreateLeafControl( 35, 50 ) );
- controls.push_back( CreateLeafControl( 45, 60 ) );
- controls.push_back( CreateLeafControl( 55, 70 ) );
-
- int counter=0;
- for( auto&& iter : controls )
- {
- if( counter < 4 )
- {
- hbox1.Add( iter );
- }
- else
- {
- hbox2.Add( iter );
- }
- ++counter;
- }
- hbox1.SetParentOrigin( ParentOrigin::CENTER );
- hbox1.SetAnchorPoint( AnchorPoint::CENTER );
- hbox2.SetParentOrigin( ParentOrigin::CENTER );
- hbox2.SetAnchorPoint( AnchorPoint::CENTER );
-
- auto hbox3 = Control::New();
- auto hboxLayout3 = LinearLayout::New();
- DevelControl::SetLayout( hbox3, hboxLayout3);
-
- hbox3.SetParentOrigin( ParentOrigin::CENTER );
- hbox3.SetName( "HBox3");
- hbox3.Add( hbox1 );
- hbox3.Add( hbox2 );
-
- stage.Add( hbox3 );
-
- //std::ostringstream oss;
- //DumpControlHierarchy( oss, Stage::GetCurrent().GetRootLayer() );
- //printf("Control hierarchy: \n%s\n", oss.str().c_str() );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f,375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f,370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f,365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 30.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 25.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 60.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 105.0f,365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 25.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 35.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 45.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 55.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 480.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Test hbox3 matches parent (root layer)
- DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout04(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout04 Test nested hboxes with explicit WRAP_CONTENT");
-
- Stage stage = Stage::GetCurrent();
-
- auto hbox1 = Control::New();
- auto hboxLayout1 = LinearLayout::New();
- DevelControl::SetLayout( hbox1, hboxLayout1 );
-
- auto hbox2 = Control::New();
- auto hboxLayout2 = LinearLayout::New();
- DevelControl::SetLayout( hbox2, hboxLayout2 );
-
- hbox1.SetName( "HBox1"); // Default spec is to wrap content
- hbox2.SetName( "HBox2");
- hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox1.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox2.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 80, 50 ) );
- controls.push_back( CreateLeafControl( 80, 60 ) );
- controls.push_back( CreateLeafControl( 80, 70 ) );
-
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 80, 50 ) );
- controls.push_back( CreateLeafControl( 80, 60 ) );
- controls.push_back( CreateLeafControl( 80, 70 ) );
-
- int counter=0;
- for( auto&& iter : controls )
- {
- if( counter < 4 )
- {
- hbox1.Add( iter );
- }
- else
- {
- hbox2.Add( iter );
- }
- ++counter;
- }
-
- controls[6].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- auto hbox3 = Control::New();
- auto hboxLayout3 = LinearLayout::New();
- DevelControl::SetLayout( hbox3, hboxLayout3 );
-
- hbox3.SetParentOrigin( ParentOrigin::CENTER );
- hbox3.SetName( "HBox3");
- hbox3.Add( hbox1 );
- hbox3.Add( hbox2 );
- stage.Add( hbox3 );
-
- //std::ostringstream oss;
- //DumpControlHierarchy( oss, Stage::GetCurrent().GetRootLayer() );
- //printf("Control hierarchy: \n%s\n", oss.str().c_str() );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f,10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 160.0f, 5.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 15.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 160.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[4].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[5].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[6].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[7].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 320.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 320.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox1.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox2.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 320.0f, 365.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
-
- // Test hbox3 matches parent (root layer)
- DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox3.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout05(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout05 - Set children size explicitly via width & height specification");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 100 );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 50 );
- }
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 110.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout06(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout06 - Test nested layouts");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox" );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Change a layout
- auto newHBoxLayout = LinearLayout::New();
- newHBoxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, newHBoxLayout );
-
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Change size specification
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Use WRAP_CONTENT again
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout07(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set LTR/RTL direction");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetCellPadding( LayoutSize( 10, 0 ) );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- hbox.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800 from left to right.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hbox.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 470.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 400.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 310.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 200.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout08(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout08 - Test layout animation");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- absoluteLayout.SetAnimateLayout( true );
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- Control control1 = CreateLeafControl( 40, 40 );
- rootControl.Add( control1 );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox" );
-
- Control control2 = CreateLeafControl( 40, 40 );
- hbox.Add( control2 );
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- rootControl.Add( hbox );
-
- DALI_TEST_EQUALS( absoluteLayout.IsLayoutAnimated(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelControl::GetLayout( control1 ).IsLayoutAnimated(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( hboxLayout.IsLayoutAnimated(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelControl::GetLayout( control2 ).IsLayoutAnimated(), false, TEST_LOCATION );
-
- tet_infoline(" Set hBoxLayout to animate");
- hboxLayout.SetAnimateLayout( true );
- tet_infoline(" Set absoluteLayout not to animate");
- absoluteLayout.SetAnimateLayout( false );
-
- DALI_TEST_EQUALS( absoluteLayout.IsLayoutAnimated(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelControl::GetLayout( control1 ).IsLayoutAnimated(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( hboxLayout.IsLayoutAnimated(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelControl::GetLayout( control2 ).IsLayoutAnimated(), true, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout09(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set alignment");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Check default orientation
- DALI_TEST_EQUALS( static_cast<unsigned int>( hboxLayout.GetOrientation() ), static_cast<unsigned int>( LinearLayout::Orientation::HORIZONTAL ), TEST_LOCATION );
- // Check default alignment
- DALI_TEST_EQUALS( hboxLayout.GetAlignment(), ( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL ), TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::TOP );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::TOP );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::TOP );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 380.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 760.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 230.0f, 370.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::TOP );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::TOP );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::TOP );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::BEGIN | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::END | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 420.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::BOTTOM );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 740.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL | Dali::Toolkit::LinearLayout::Alignment::CENTER_VERTICAL );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 390.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout_Weight(void)
-{
- ToolkitTestApplication application;
- tet_infoline( " UtcDaliLayouting_HboxLayout_Weight - Test LinearLayout weight horizontally" );
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox" );
-
- std::vector<Control> controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- // Set weight for each leaf to use quarter of available space
- // 480 * 0.25, 480 * 0.25, 480 * 0.25, 480 * 0.25,
- // width spec has to be set to 0 so not to consume any extra space.
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.Add( iter );
- }
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 360.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Set weight for 3, 4 leafs to use all remaining available space after 1, 2 content sized leafs.
- // 40, 60, (480 - 40 - 60) * 0.5, (480 - 40 - 60) * 0.5
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 290.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 190.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 190.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Add intrinsic width for 3rd leaf so now we should get
- // 40, 60, (480 - 40 - 60 - 80) * 0.5 + 80, (480 - 40 - 60 - 80) * 0.5
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 80 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 230.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 150.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 40 );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 110.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 330.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 440.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 110.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 220.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 110.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // WRAP_CONTENT doesn't affect weight
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 180.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 300.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // MATCH_PARENT doesn't affect weight
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 120.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 240.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 360.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- const Extents CONTROL_MARGIN = Extents( 10, 10, 0, 0 );
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- iter.SetProperty( Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
- }
-
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 10.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 70.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 150.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 250.0f, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 220.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_VboxLayout_Weight(void)
-{
- ToolkitTestApplication application;
- tet_infoline( " UtcDaliLayouting_VboxLayout_Weight - Test LinearLayout weight vertically" );
-
- Stage stage = Stage::GetCurrent();
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetOrientation( Dali::Toolkit::LinearLayout::Orientation::VERTICAL );
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "VBox" );
-
- std::vector<Control> controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- // Set weight for each leaf to use quarter of available space
- // 800 * 0.25, 800 * 0.25, 800 * 0.25, 800 * 0.25,
- // width spec has to be set to 0 so not to consume any extra space.
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
- vbox.Add( iter );
- }
-
- vbox.SetParentOrigin( ParentOrigin::CENTER );
- vbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( vbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 600.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Set weight for 3, 4 leafs to use all remaining available space after 1, 2 content sized leafs.
- // 40, 60, (800 - 40 - 60) * 0.5, (800 - 40 - 60) * 0.5
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 450.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Add intrinsic width for 3rd leaf so now we should get
- // 40, 60, (800 - 40 - 60 - 100) * 0.5 + 100, (800 - 40 - 60 - 100) * 0.5
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 500.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 175.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 525.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 700.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 175.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 175.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // WRAP_CONTENT doesn't affect weight
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[1].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[3].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 620.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // MATCH_PARENT doesn't affect weight
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.25f );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 600.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- const Extents CONTROL_MARGIN = Extents( 0, 0, 10, 10 );
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- iter.SetProperty( Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
- }
-
- controls[0].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[1].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[2].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0 );
- controls[3].SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 1 );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 70.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 150.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 250.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 540.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_NestedLinearLayout_Weight(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_NestedLinearLayout_Weight - test weighted children with wrapped parent");
-
- Stage stage = Stage::GetCurrent();
- auto rootControl = Control::New();
- rootControl.SetName( "AbsoluteLayout");
- auto rootLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, rootLayout );
- rootControl.SetAnchorPoint( AnchorPoint::CENTER );
- rootControl.SetParentOrigin( ParentOrigin::CENTER );
- stage.Add( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
-
- // set equal share of wrapped content width (40 + 60 = 100) for both children 100 * 0.5, 100 * 0.5
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 0 );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.Add( iter );
- }
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 50.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hboxLayout.SetOrientation(Dali::Toolkit::LinearLayout::Orientation::VERTICAL);
-
- // set equal share of wrapped content height (40 + 60 = 100) for both children 100 * 0.5, 100 * 0.5
- for( auto&& iter : controls )
- {
- iter.SetProperty( Toolkit::LinearLayout::ChildProperty::WEIGHT, 0.5f );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- iter.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 0 );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-namespace
-{
-const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/broken.png";
-}
-
-int UtcDaliLayouting_HboxLayout_ImageView(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout - Use image view for leaf");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox" );
-
- std::string url = CreateImageURL( Vector4( 0, 255, 0, 255), ImageDimensions( 100, 100 ) );
- ImageView imageView = CreateImageView( url, ImageDimensions() );
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- hbox.Add( imageView );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("UtcDaliLayouting_HboxLayout - Change image (new size)");
- url = CreateImageURL( Vector4( 0, 255, 0, 255), ImageDimensions( 200, 200 ) );
- imageView.SetImage( url );
-
- // Ensure layouting happenss
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Ensure layouting happenss
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 200.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- // Ensure layouting happenss
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- imageView.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- Image image = FrameBufferImage::New( 50, 50, Pixel::RGBA8888 );
- imageView.SetImage( image );
-
- // Ensure layouting happenss
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 375.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 50.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- Property::Map imagePropertyMap;
- imagePropertyMap[ Toolkit::Visual::Property::TYPE ] = Toolkit::Visual::IMAGE;
- imagePropertyMap[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME;
- imagePropertyMap[ ImageVisual::Property::DESIRED_WIDTH ] = 150;
- imagePropertyMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 150;
- imageView.SetProperty( Toolkit::ImageView::Property::IMAGE, imagePropertyMap );
-
- DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
- // Ensure layouting happenss
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 325.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( imageView.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 150.0f, 150.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout_TextLabel(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout - Use text label for leaf");
-
- Stage stage = Stage::GetCurrent();
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox" );
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
-
- std::vector< Control > controls;
- TextLabel textLabel = CreateTextLabel( "W" );
- controls.push_back( textLabel );
- hbox.Add( textLabel );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 368.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 52.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- textLabel.SetProperty( TextLabel::Property::TEXT, "WWWW" );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 368.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 214.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10.0f );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 382.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 36.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- controls[0].SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 382.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 36.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-// Padding tests
-
-int UtcDaliLayouting_HboxLayout_Padding01(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_HboxLayout_Padding01 - Adding Padding to a single child");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
- tet_printf( "\nAdding Padding to control at index %u \n", 1 );
- controls[1].SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- tet_infoline("Test Child Actor Position");
- float xPositionOfControlBeingTested = 0.0f;
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f,
- 0.0f ), 0.0001f, TEST_LOCATION );
- xPositionOfControlBeingTested += 40.0f;
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f - ( ( CONTROL_PADDING.top + CONTROL_PADDING.bottom) * 0.5f ), 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 80.0f;
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Test Child Actor Size");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
- 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom , 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout_Padding02(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_HboxLayout_Padding02 - Adding Padding to a all children");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
-
- for( auto&& iter : controls )
- {
- iter.SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- tet_infoline("Test Child Actor Position");
- float xPositionOfControlBeingTested = 0.0f;
- float yPositionOfControlBeingTested = ( 800.0f * 0.5) - ( 0.5 * ( 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom ) );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- yPositionOfControlBeingTested,
- 0.0f ), 0.0001f, TEST_LOCATION );
- xPositionOfControlBeingTested += 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- yPositionOfControlBeingTested,
- 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- yPositionOfControlBeingTested,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 80.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- yPositionOfControlBeingTested,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Test Child Actor Size");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
- 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
- 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f + CONTROL_PADDING.start + CONTROL_PADDING.end ,
- 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f + CONTROL_PADDING.start + CONTROL_PADDING.end,
- 40.0f + CONTROL_PADDING.top + CONTROL_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_HboxLayout_Padding03(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_HboxLayout_Padding03 - Changing padding on a single child");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 40, 40 ) );
-
- const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
- tet_printf( "\nAdding Padding to control at index 1 \n" );
- controls[1].SetProperty(Toolkit::Control::Property::PADDING, CONTROL_PADDING );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- tet_infoline("Test Child Actor Position");
- float xPositionOfControlBeingTested = 0.0f;
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f,
- 0.0f ), 0.0001f, TEST_LOCATION );
- xPositionOfControlBeingTested += 40.0f;
-
- DALI_TEST_EQUALS( controls[ 1 ].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f - ( ( CONTROL_PADDING.top + CONTROL_PADDING.bottom) * 0.5f ), 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 40.0f + CONTROL_PADDING.start + CONTROL_PADDING.end;
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- const Extents NEW_CONTROL_PADDING = Extents(10, 10, 20, 2 );
- tet_printf( "\nChanging Padding to control at index 1 \n" );
- controls[1].SetProperty(Toolkit::Control::Property::PADDING, NEW_CONTROL_PADDING );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- xPositionOfControlBeingTested = 0.0f; // reset
-
- tet_infoline("Test Child Actor Position");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f,
- 0.0f ), 0.0001f, TEST_LOCATION );
- xPositionOfControlBeingTested += 40.0f;
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f - ( ( NEW_CONTROL_PADDING.top + NEW_CONTROL_PADDING.bottom) * 0.5f ), 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 40.0f + NEW_CONTROL_PADDING.start + NEW_CONTROL_PADDING.end;
- tet_printf( "\nIf x position %u then change has not been processed \n", 40 + 40 + CONTROL_PADDING.start + CONTROL_PADDING.end );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Test Child Actor Size");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f + NEW_CONTROL_PADDING.start + NEW_CONTROL_PADDING.end,
- 40.0f + NEW_CONTROL_PADDING.top + NEW_CONTROL_PADDING.bottom , 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ) , Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout_Padding04(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_HboxLayout_Padding04 - Adding Padding to the hbox");
-
- // Adding padding to the layout should offset the positioning of the children.
-
- const Extents LAYOUT_PADDING = Extents(5, 10, 20, 2 );
- const Size CONTROL_SIZE = Size( 40, 40 );
-
- Stage stage = Stage::GetCurrent();
- // Create a root layout, ideally Dali would have a default layout in the root layer.
- // Without this root layer the LinearLayout (or any other layout) will not
- // honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings.
- // It uses the default stage size and ideally should have a layout added to it.
- auto rootLayoutControl = Control::New();
- rootLayoutControl.SetName( "AbsoluteLayout");
- auto rootLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootLayoutControl, rootLayout );
- rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER );
- rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER );
- stage.Add( rootLayoutControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
- hbox.SetProperty(Toolkit::Control::Property::PADDING, LAYOUT_PADDING );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- rootLayoutControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
- application.SendNotification();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- tet_infoline("Test Child Actor Position");
-
- auto controlXPosition=0.0f;
-
- controlXPosition = LAYOUT_PADDING.start; // First child positioned at offset defined by the padding
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Second child positioned is the position of the first child + the first child's width.
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- LAYOUT_PADDING.top,
- 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Third child positioned adjacent to second
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Forth passed adjacent to the third
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- auto totalControlsWidth = CONTROL_SIZE.width * controls.size();
- auto totalControlsHeight = CONTROL_SIZE.height;
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + LAYOUT_PADDING.start + LAYOUT_PADDING.end,
- totalControlsHeight + LAYOUT_PADDING.top + LAYOUT_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
-
- END_TEST;
-}
-
-int UtcDaliLayouting_HboxLayout_Padding05(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_HboxLayout_Padding05 - Changing the hbox Padding");
-
- // Adding padding to the layout should offset the positioning of the children.
-
- const Extents LAYOUT_PADDING = Extents(5, 10, 20, 2 );
- const Size CONTROL_SIZE = Size( 40, 40 );
-
- Stage stage = Stage::GetCurrent();
- // Create a root layout, ideally Dali would have a default layout in the root layer.
- // Without this root layer the LinearLayout (or any other layout) will not
- // honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings.
- // It uses the default stage size and ideally should have a layout added to it.
- auto rootLayoutControl = Control::New();
- rootLayoutControl.SetName( "AbsoluteLayout");
- auto rootLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootLayoutControl, rootLayout );
- rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER );
- rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER );
- stage.Add( rootLayoutControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
- hbox.SetProperty(Toolkit::Control::Property::PADDING, LAYOUT_PADDING );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
-
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- rootLayoutControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
- application.SendNotification();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- tet_infoline("Test Child Actor Position");
-
- auto controlXPosition=0.0f;
-
- controlXPosition = LAYOUT_PADDING.start; // First child positioned at offset defined by the padding
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Second child positioned is the position of the first child + the first child's width.
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- LAYOUT_PADDING.top,
- 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Third child positioned adjacent to second
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Forth passed adjacent to the third
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- auto totalControlsWidth = CONTROL_SIZE.width * controls.size();
- auto totalControlsHeight = CONTROL_SIZE.height;
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + LAYOUT_PADDING.start + LAYOUT_PADDING.end,
- totalControlsHeight + LAYOUT_PADDING.top + LAYOUT_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Change layout padding
- const Extents NEW_LAYOUT_PADDING = Extents(5, 20, 10, 2 );
- tet_printf( "\nChanging Padding to control at index 1 \n" );
- hbox.SetProperty(Toolkit::Control::Property::PADDING, NEW_LAYOUT_PADDING );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
- application.SendNotification();
-
- controlXPosition = NEW_LAYOUT_PADDING.start; // First child positioned at offset defined by the padding
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( NEW_LAYOUT_PADDING.start,
- NEW_LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Second child positioned is the position of the first child + the first child's width.
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- NEW_LAYOUT_PADDING.top,
- 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Third child positioned adjacent to second
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- NEW_LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlXPosition+=CONTROL_SIZE.width; // Forth passed adjacent to the third
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( controlXPosition,
- NEW_LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
- totalControlsWidth = CONTROL_SIZE.width * controls.size();
- totalControlsHeight = CONTROL_SIZE.height;
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + NEW_LAYOUT_PADDING.start + NEW_LAYOUT_PADDING.end,
- totalControlsHeight + NEW_LAYOUT_PADDING.top + NEW_LAYOUT_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
- END_TEST;
-}
-
-// Margin Tests
-
-int UtcDaliLayouting_HboxLayout_Margin01(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_HboxLayout_Margin01 - Adding a margin to a single child");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 40 ) );
- controls.push_back( CreateLeafControl( 80, 40 ) );
- controls.push_back( CreateLeafControl( 100, 40 ) );
-
- const Extents CONTROL_MARGIN = Extents(5, 10, 20, 0 );
- tet_printf( "\nAdding Margin to control at index 1 \n" );
- controls[1].SetProperty(Toolkit::Control::Property::MARGIN, CONTROL_MARGIN );
-
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800.
- // hbox left justifies elements
- tet_infoline("Test Child Actor Position");
- auto xPositionOfControlBeingTested = 0.0f;
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f,
- 0.0f ), 0.0001f, TEST_LOCATION );
- xPositionOfControlBeingTested += 40.0f + CONTROL_MARGIN.start;
-
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,
- 380.0f + CONTROL_MARGIN.top, 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 60.0f + CONTROL_MARGIN.end;
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested, 380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- xPositionOfControlBeingTested += 80.0f;
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( xPositionOfControlBeingTested,380.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Test Child Actor Size is the same after Margin added");
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 40.0f , 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_VboxLayout01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_VboxLayout01");
-
- Stage stage = Stage::GetCurrent();
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- vboxLayout.SetAlignment( LinearLayout::Alignment::TOP | LinearLayout::Alignment::CENTER_HORIZONTAL );
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "Vbox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- for( auto&& iter : controls )
- {
- vbox.Add( iter );
- }
- vbox.SetParentOrigin( ParentOrigin::CENTER );
- vbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( vbox );
-
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Check it.
- DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // vbox centers elements horizontally, it fills test harness stage, which is 480x800.
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 220.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 210.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 190.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_VboxLayout02(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_VboxLayout01");
-
- Stage stage = Stage::GetCurrent();
-
- // @todo Can't set specification properties on root control. Really need to make LayoutController a root
- // LayoutGroup for this to happen automatically.
- //
- // For this test, add an hbox instead
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout");
- stage.Add( rootControl );
-
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- vboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::TOP | Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "Vbox");
- rootControl.Add( vbox );
-
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- for( auto&& iter : controls )
- {
- vbox.Add( iter );
- }
- vbox.SetParentOrigin( ParentOrigin::CENTER );
- vbox.SetAnchorPoint( AnchorPoint::CENTER );
-
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Check it.
- DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( rootControl.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0,0,0),TEST_LOCATION);
- DALI_TEST_EQUALS( rootControl.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480,800,0),TEST_LOCATION);
-
- // vbox centers elements horizontally, it should wrap it's content horizontally, i.e. it should take the width of the largest element (100)
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // 3rd control is set to match parent - this should also be 100 wide
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 30.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_VboxLayout03(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_VboxLayout03 test with cell padding set");
-
- Stage stage = Stage::GetCurrent();
-
- // @todo Can't set specification properties on root control. Really need to make LayoutController a root
- // LayoutGroup for this to happen automatically.
- //
- // For this test, add an hbox instead
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "Hbox");
- stage.Add( hbox );
-
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetCellPadding( LayoutSize( 0, 10 ) );
- vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- vboxLayout.SetAlignment( Dali::Toolkit::LinearLayout::Alignment::TOP | Dali::Toolkit::LinearLayout::Alignment::CENTER_HORIZONTAL );
-
- DALI_TEST_EQUALS( vboxLayout.GetCellPadding(), LayoutSize( 0, 10 ), TEST_LOCATION );
-
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "Vbox");
- hbox.Add( vbox );
-
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
- controls.push_back( CreateLeafControl( 80, 80 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- for( auto&& iter : controls )
- {
- vbox.Add( iter );
- }
- vbox.SetParentOrigin( ParentOrigin::CENTER );
- vbox.SetAnchorPoint( AnchorPoint::CENTER );
-
- controls[2].SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
-
- // Check it.
- DALI_TEST_EQUALS( controls[2].GetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION ), Property::Value( ChildLayoutData::MATCH_PARENT ), TEST_LOCATION );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0,0,0),TEST_LOCATION);
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(480,800,0),TEST_LOCATION);
-
- // vbox centers elements horizontally, it should wrap it's content horizontally, i.e. it should take the width of the largest element (100)
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // 3rd control is set to match parent - this should also be 100 wide
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 30.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 20.0f, 50.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 210.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_VboxLayout_Padding(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_VboxLayout_Padding - Adding Padding to the vbox");
-
- // Adding padding to the layout should offset the positioning of the children.
-
- const Extents LAYOUT_PADDING = Extents(5, 10, 20, 2 );
- const Size CONTROL_SIZE = Size( 40, 40 );
-
- Stage stage = Stage::GetCurrent();
- // Create a root layout, ideally Dali would have a default layout in the root layer.
- // Without this root layer the LinearLayout (or any other layout) will not
- // honour WIDTH_SPECIFICATION or HEIGHT_SPECIFICATION settings.
- // It uses the default stage size and ideally should have a layout added to it.
- auto rootLayoutControl = Control::New();
- rootLayoutControl.SetName( "AbsoluteLayout");
- auto rootLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootLayoutControl, rootLayout );
- rootLayoutControl.SetAnchorPoint( AnchorPoint::CENTER );
- rootLayoutControl.SetParentOrigin( ParentOrigin::CENTER );
- stage.Add( rootLayoutControl );
-
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "VBox");
- vbox.SetProperty( Toolkit::Control::Property::PADDING, LAYOUT_PADDING );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
- controls.push_back( CreateLeafControl( CONTROL_SIZE.width, CONTROL_SIZE.height ) );
-
- for( auto&& iter : controls )
- {
- vbox.Add( iter );
- }
-
- vbox.SetParentOrigin( ParentOrigin::CENTER );
- vbox.SetAnchorPoint( AnchorPoint::CENTER );
- rootLayoutControl.Add( vbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // Extra update needed to Relayout one more time. Catches any position updates, false positive without this seen.
- application.SendNotification();
-
- // vbox centers elements horizontally, it fills test harness stage, which is 480x800.
- tet_infoline("Test Child Actor Position");
-
- auto controlYPosition = 0.0f;
-
- controlYPosition = LAYOUT_PADDING.top; // First child positioned at offset defined by the padding
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
- LAYOUT_PADDING.top,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlYPosition += CONTROL_SIZE.height; // Second child positioned is the position of the first child + the first child's height.
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
- controlYPosition,
- 0.0f ),
- 0.0001f, TEST_LOCATION );
-
- controlYPosition += CONTROL_SIZE.height; // Third child positioned adjacent to second
- DALI_TEST_EQUALS( controls[2].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
- controlYPosition,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- controlYPosition += CONTROL_SIZE.height; // Forth passed adjacent to the third
- DALI_TEST_EQUALS( controls[3].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( LAYOUT_PADDING.start,
- controlYPosition,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- auto totalControlsWidth = CONTROL_SIZE.width;
- auto totalControlsHeight = CONTROL_SIZE.height * controls.size();
-
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( totalControlsWidth + LAYOUT_PADDING.start + LAYOUT_PADDING.end,
- totalControlsHeight + LAYOUT_PADDING.top + LAYOUT_PADDING.bottom,
- 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_HboxLayout_TargetSize(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_HboxLayout07 - Set target size on leaf");
-
- Stage stage = Stage::GetCurrent();
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- for( auto&& iter : controls )
- {
- iter.SetSize( 100, 100 );
- hbox.Add( iter );
- }
- hbox.SetParentOrigin( ParentOrigin::CENTER );
- hbox.SetAnchorPoint( AnchorPoint::CENTER );
- stage.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // hbox centers elements vertically, it fills test harness stage, which is 480x800 from left to right.
- // hbox left justifies elements
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutChildren01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_LayoutChildren01");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- stage.Add( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- rootControl.Add( hbox );
-
- DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
-
- tet_infoline("Test removal by removing child actor from parent container" );
- hbox.Unparent();
-
- DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 0, TEST_LOCATION );
-
- auto& hboxImpl = GetImplementation( hboxLayout );
- tet_infoline("Test child actor still has hbox layout " );
- DALI_TEST_EQUALS( (bool)hboxLayout.GetOwner(), true, TEST_LOCATION );
-
- tet_infoline("Test hbox layout has no parent " );
- DALI_TEST_EQUALS( (void*)hboxImpl.GetParent(), (void*)nullptr, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutChildren02(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_LayoutChildren02");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- stage.Add( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- rootControl.Add( hbox );
-
- DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
-
- tet_infoline("Test removal by removing child layout from parent layout" );
- absoluteLayout.Remove( hboxLayout );
-
- DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 0, TEST_LOCATION );
-
- auto& hboxImpl = GetImplementation( hboxLayout );
-
- tet_infoline("Check child actor has orphaned layout (Moving child keeps old layout)");
- DALI_TEST_EQUALS( hboxLayout.GetOwner(), hbox, TEST_LOCATION );
- DALI_TEST_EQUALS( DevelControl::GetLayout(hbox), hboxLayout, TEST_LOCATION );
-
- tet_infoline("Check orphaned layout has no parent");
- DALI_TEST_EQUALS( (void*)hboxImpl.GetParent(), (void*)nullptr, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_LayoutChildren03(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_LayoutChildren03");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- stage.Add( rootControl );
-
- auto hbox = Control::New();
- tet_infoline("Test unparenting by adding child with no layout to parent (should auto-generate LayoutItem) ");
- auto hboxLayout = LinearLayout::New();
- rootControl.Add( hbox );
-
- DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
-
- tet_infoline("Then setting a layout on the child container");
- DevelControl::SetLayout( hbox, hboxLayout );
-
- DALI_TEST_EQUALS( absoluteLayout.GetChildCount(), 1, TEST_LOCATION );
-
- auto& hboxImpl = GetImplementation( hboxLayout );
- auto& absImpl = GetImplementation( absoluteLayout );
- DALI_TEST_EQUALS( hboxLayout.GetOwner(), Handle(hbox), TEST_LOCATION );
- DALI_TEST_EQUALS( hboxImpl.GetParent(), (Dali::Toolkit::Internal::LayoutParent*)&absImpl, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_SetLayoutOrder(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_SetLayoutOrder01 - Call SetLayout after adding the control to the root layout");
-
- Stage stage = Stage::GetCurrent();
-
- auto rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "AbsoluteLayout" );
- stage.Add( rootControl );
-
- tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Creating control");
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hbox.SetName( "HBox");
-
- tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Add control to root layout");
- rootControl.Add( hbox );
-
- tet_infoline(" UtcDaliLayouting_SetLayoutOrder - Set layout to control AFTER control added to root");
- DevelControl::SetLayout( hbox, hboxLayout );
-
- // Add a Child control
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) ); // Single control
- for( auto&& iter : controls )
- {
- hbox.Add( iter );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_LayoutGroup01(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_LayoutGroup01 - Test adding a control to a layout then adding a TextLabel to that control");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- DevelControl::SetLayoutingRequired( hbox, true );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called but with layout required set true");
-
- auto control = Control::New();
- control.SetName("Control1");
- DevelControl::SetLayoutingRequired( control, true );
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- tet_infoline("Add a Textlabel to the control");
- auto textLabel = TextLabel::New("Test text");
- textLabel.SetName("TextLabel");
-
- control.Add( textLabel );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test text is it's natural size");
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 228.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- tet_infoline("Test control is width of it's parent and height of it's child");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 600.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutGroup02(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_LayoutGroup02 - Test control is the size of it's largest child");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called but with layout required set true");
-
- auto control = Control::New();
- control.SetName("Control1");
- DevelControl::SetLayoutingRequired( control, true );
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- tet_infoline("Add a Textlabel to the control");
- auto textLabel = TextLabel::New("Test text");
- textLabel.SetName("TextLabel");
- control.Add( textLabel );
-
- tet_infoline("Add another Textlabel to the control");
- auto largeTextLabel = TextLabel::New("Test large text");
- largeTextLabel.SetName("TextLabel-Large");
- control.Add( largeTextLabel );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test text is it's natural size");
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 228.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- tet_infoline("Test text is centered in the control, the control is the size of the largest child");
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Test large text is it's natural size");
- DALI_TEST_EQUALS( largeTextLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 382.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- tet_infoline("Test text is aligned to start as is the size of the control");
- DALI_TEST_EQUALS( largeTextLabel.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- tet_infoline("Test control is width of it's parent and height of it's largest child");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 382.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutGroup03(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_LayoutGroup03 - Test control with a LayoutGroup as a leaf");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called");
-
- auto control = Control::New();
- control.SetName("Control1");
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test control is width of it's parent and exact given height");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 600.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-
-int UtcDaliLayouting_LayoutGroup04(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_LayoutGroup04 - Test control with a LayoutGroup as a leaf and with SetLayotRequired = true");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called");
-
- auto control = Control::New();
- control.SetName("Control1");
- DevelControl::SetLayoutingRequired( control, true );
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test control is width of it's parent and exact given height");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 600.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_IsLayoutingRequired(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_IsLayoutingRequired - Test setting the SetLayoutRequired and then check if flag was set");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called");
-
- auto control = Control::New();
- control.SetName("Control1");
- DALI_TEST_EQUALS( DevelControl::IsLayoutingRequired( control ), false, TEST_LOCATION );
- DevelControl::SetLayoutingRequired( control, true );
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 100 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test control is width of it's parent and exact given height");
- DALI_TEST_EQUALS( DevelControl::IsLayoutingRequired( control ), true, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutGroupWithPadding01(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_LayoutGroupWithPadding01 - Test adding a control to a layout that has padding");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called");
-
- auto control = Control::New();
- control.SetName("Control1");
- DevelControl::SetLayoutingRequired( control, true );
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
- tet_printf( "Adding Padding to control");
- control.SetProperty( Toolkit::Control::Property::PADDING, CONTROL_PADDING );
-
- tet_infoline("Add a Textlabel to the control");
- auto textLabel = TextLabel::New("Test text");
- textLabel.SetName("TextLabel");
- control.Add( textLabel );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test text is it's natural size");
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 228.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- tet_infoline("Test control is size of it's child and control it's own padding");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 243.0f, 86.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutGroupWithChildMargin01(void)
-{
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayouting_LayoutGroupWithChildMargin01 - Test adding a control with padding to a layout that has padding");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- // Create a parent layout
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hbox.SetName( "HBox");
- rootControl.Add( hbox );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 600 );
- hbox.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- hbox.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // LinearLayout will eventually do this internally.
-
- tet_infoline("Add a control without SetLayout being called");
-
- auto control = Control::New();
- control.SetName("Control1");
- DevelControl::SetLayoutingRequired( control, true );
- hbox.Add( control );
- control.SetProperty( LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
- control.SetProperty( LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::WRAP_CONTENT );
-
- const Extents CONTROL_PADDING = Extents(5, 10, 20, 2 );
- tet_printf( "Adding Padding to control");
- control.SetProperty( Toolkit::Control::Property::PADDING, CONTROL_PADDING );
-
- tet_infoline("Add a Textlabel to the control");
- auto textLabel = TextLabel::New("Test text");
- const Extents CHILD_MARGIN = Extents( 10, 0, 5, 0 );
- textLabel.SetProperty( Toolkit::Control::Property::MARGIN, CHILD_MARGIN );
- textLabel.SetName("TextLabel");
- control.Add( textLabel );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- tet_infoline("Test text is it's natural size");
- DALI_TEST_EQUALS( textLabel.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 228.0f, 64.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- tet_infoline("Test control is width of it's parent and height of it's child");
- DALI_TEST_EQUALS( control.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 253.0f, 91.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_SetLayout(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_SetLayout - Test reusing layouts");
-
- Control rootControl;
- SetupRootLayoutControl( rootControl );
-
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container" );
- rootControl.Add( container );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
- controls.push_back( CreateLeafControl( 60, 60 ) );
-
- for( auto&& iter : controls )
- {
- container.Add( iter );
- }
-
- container.SetParentOrigin( ParentOrigin::CENTER );
- container.SetAnchorPoint( AnchorPoint::CENTER );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Change a layout
- auto verticalLayout = LinearLayout::New();
- verticalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- DevelControl::SetLayout( container, verticalLayout );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Second round
- DevelControl::SetLayout( container, horizontalLayout );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 10.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 40.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Change a layout
- DevelControl::SetLayout( container, verticalLayout );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 60.0f, 60.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_StageAdd(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_StageAdd");
-
- Stage stage = Stage::GetCurrent();
-
- AbsoluteLayout absoluteLayout = AbsoluteLayout::New();
- Control container = Control::New();
- container.SetName( "Container" );
- DevelControl::SetLayout( container, absoluteLayout );
- container.SetAnchorPoint( Dali::AnchorPoint::CENTER );
- container.SetParentOrigin( Dali::ParentOrigin::CENTER );
-
- Control child = Control::New();
- child.SetAnchorPoint( Dali::AnchorPoint::TOP_LEFT );
- child.SetPosition( 0.0f, 0.0f );
- child.SetSize( 480.0f, 180.0f );
- child.SetName( "Child Control" );
- container.Add( child );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); // Not re-laid out
- DALI_TEST_EQUALS( child.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render();
-
- // Add container to stage here
- // Should call RequestLayout() to measure and layout
- stage.Add( container );
-
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION ); // Stage Size
- DALI_TEST_EQUALS( child.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 180.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <toolkit-event-thread-callback.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
-#include <dali-toolkit/devel-api/layouting/grid.h>
-#include <dali-toolkit/devel-api/layouting/linear-layout.h>
-#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
-#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
-
-#include <../custom-layout.h>
-#include <dummy-control.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-void utc_dali_toolkit_layouting_animation_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_layouting_animation_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-
-// Functor to test whether a Finish signal is emitted
-struct LayoutTransitionFinishCheck
-{
- LayoutTransitionFinishCheck( bool& signalReceived )
- : mSignalReceived( signalReceived )
- {
- }
-
- void operator()( LayoutTransitionData::Type type, LayoutTransitionData& layoutTransitionData )
- {
- mSignalReceived = true;
- }
-
- void Reset()
- {
- mSignalReceived = false;
- }
-
- void CheckSignalReceived()
- {
- if (!mSignalReceived)
- {
- tet_printf("Expected Finish signal was not received\n");
- tet_result(TET_FAIL);
- }
- else
- {
- tet_result(TET_PASS);
- }
- }
-
- void CheckSignalNotReceived()
- {
- if (mSignalReceived)
- {
- tet_printf("Unexpected Finish signal was received\n");
- tet_result(TET_FAIL);
- }
- else
- {
- tet_result(TET_PASS);
- }
- }
-
- bool& mSignalReceived; // owned by individual tests
-};
-
-} // anon namespace
-
-int UtcDaliLayouting_LayoutTransitionDataConstructorP(void)
-{
- TestApplication application;
-
- LayoutTransitionData layoutTransitionData;
-
- DALI_TEST_CHECK( !layoutTransitionData );
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutTransitionDataNewP(void)
-{
- TestApplication application;
-
- LayoutTransitionData layoutTransitionData = LayoutTransitionData::New();
-
- DALI_TEST_CHECK(layoutTransitionData);
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutTransitionDataDownCastP(void)
-{
- TestApplication application;
-
- LayoutTransitionData layoutTransitionData = LayoutTransitionData::New();
- BaseHandle object(layoutTransitionData);
-
- LayoutTransitionData layoutTransitionData2 = LayoutTransitionData::DownCast(object);
- DALI_TEST_CHECK(layoutTransitionData2);
-
- LayoutTransitionData layoutTransitionData3 = DownCast< LayoutTransitionData >(object);
- DALI_TEST_CHECK(layoutTransitionData2);
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutTransitionDataDownCastN(void)
-{
- TestApplication application;
-
- BaseHandle unInitializedObject;
-
- LayoutTransitionData layoutTransitionData1 = LayoutTransitionData::DownCast( unInitializedObject );
- DALI_TEST_CHECK( !layoutTransitionData1 );
-
- LayoutTransitionData layoutTransitionData2 = DownCast< LayoutTransitionData >( unInitializedObject );
- DALI_TEST_CHECK( !layoutTransitionData2 );
- END_TEST;
-}
-
-int UtcDaliLayouting_LayoutTransitionDataSetGetTransition(void)
-{
- TestApplication application;
-
- auto layout = LinearLayout::New();
- auto layoutTransitionData = LayoutTransitionData::New();
-
- layout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
-
- layout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, LayoutTransitionData() );
- layout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
-
- layout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, LayoutTransitionData() );
- layout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
-
- layout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, LayoutTransitionData() );
- layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == LayoutTransitionData() );
-
- layout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, LayoutTransitionData() );
- layout.SetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE, layoutTransitionData );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_ADD ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_OWNER_SET ) == LayoutTransitionData() );
- DALI_TEST_CHECK( layout.GetTransitionData( LayoutTransitionData::ON_LAYOUT_CHANGE ) == layoutTransitionData );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_SetLayoutTransition01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_SetLayoutTransition01" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( false );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- auto verticalLayout = LinearLayout::New();
- verticalLayout.SetAnimateLayout( false );
- verticalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
- for( auto&& iter : controls )
- {
- container.Add( iter );
- }
- stage.Add( container );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map["property"] = "size";
- map["targetValue"] = Property::Value(); // capture from layout update
- map["animator"] = Property::Map()
- .Add("alphaFunction", "LINEAR")
- .Add("timePeriod", Property::Map()
- .Add("delay", 0.0f)
- .Add("duration", 0.0f));
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- Property::Map map;
- map["property"] = "opacity";
- map["initialValue"] = 0.0f;
- map["targetValue"] = 1.0f;
- map["animator"] = Property::Map()
- .Add("alphaFunction", "LINEAR")
- .Add("timePeriod", Property::Map()
- .Add("delay", 0.0f)
- .Add("duration", 0.5f));
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for children
- Property::Map map;
- map["property"] = "position";
- map["animator"] = Property::Map()
- .Add("alphaFunction", "LINEAR")
- .Add("timePeriod", Property::Map()
- .Add("delay", 0.0f)
- .Add("duration", 0.0f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- // Grow children from (0,0) size to full size (captured)
- Property::Map map;
- map["property"] = "size";
- map["initialValue"] = Vector3( 0.0f, 0.0f, 0 );
- map["animator"] = Property::Map()
- .Add("alphaFunction", "LINEAR")
- .Add("timePeriod", Property::Map()
- .Add("delay", 0.0f)
- .Add("duration", 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map );
- }
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- // First round, no animation
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- horizontalLayout.SetAnimateLayout( true );
- verticalLayout.SetAnimateLayout( true );
-
- // Change a layout, start transition
- verticalLayout.SetTransitionData( LayoutTransitionData::ON_OWNER_SET, layoutTransitionData );
- DevelControl::SetLayout( container, verticalLayout );
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // Second round, animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( container.GetCurrentOpacity(), 0.0f, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // Third round, animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( container.GetCurrentOpacity(), 1.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- finishCheck.CheckSignalReceived();
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- // Transition back now with default transition
- DevelControl::SetLayout( container, horizontalLayout );
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( container.GetCurrentOpacity(), 1.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( container.GetCurrentOpacity(), 1.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for complete default animation */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AddChildLayoutTransition01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition01" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( true );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- stage.Add( container );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size";
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for a child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::NONE;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "position";
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- // Grow a child from (0,0) size to full size (captured)
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_ADD;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size";
- map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to an added child
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
- container.Add( controls[0] );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // The animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // The animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_RemoveChildLayoutTransition01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_RemoveChildLayoutTransition01" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( false );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container" );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- stage.Add( container );
- container.Add( controls[0] );
- container.Add( controls[1] );
-
- // Initial rendering done
- application.SendNotification();
- application.Render();
-
- horizontalLayout.SetAnimateLayout( true );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent width
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant resize for parent height
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for parent X position
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_X;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for parent Y position
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_Y;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Shrink the children
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.0f;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map );
- }
- {
- // Shrink the children
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.0f;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map );
- }
- {
- // Shrink the removed child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_REMOVE;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Size( 0.0f, 0.0f );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map );
- }
- {
- // Instant position for children
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_X;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- // Instant position for children
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION_Y;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_TO" )
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_REMOVE, layoutTransitionData );
- container.Remove( controls[1] );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // Animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
- // this control is already removed from the tree.
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // Animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- // this control is already removed from the tree.
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
- // this control is already removed from the tree.
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- // this control is already removed from the tree.
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- // this control is already removed from the tree.
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FocusChildLayoutTransition01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition01" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( false );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container" );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- stage.Add( container );
- container.Add( controls[0] );
- container.Add( controls[1] );
-
- KeyInputFocusManager manager = KeyInputFocusManager::Get();
- manager.SetFocus( controls[0] );
-
- // Initial rendering done
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- horizontalLayout.SetAnimateLayout( true );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for parent
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- // Shrink the lost focus child
- Property::Map map;
- map[ "affectsSiblings" ] = false;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 80.0f, 80.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
- }
- {
- // Grow the gained focus child
- Property::Map map;
- map[ "affectsSiblings" ] = false;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
- manager.SetFocus( controls[1] );
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // Animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // Animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 80.0f, 80.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 120.0f, 120.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FocusChildLayoutTransition02(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition02" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( false );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container" );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- stage.Add( container );
- container.Add( controls[0] );
- container.Add( controls[1] );
-
- KeyInputFocusManager manager = KeyInputFocusManager::Get();
- manager.SetFocus( controls[0] );
-
- // Initial rendering done
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- horizontalLayout.SetAnimateLayout( true );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Shrink the lost focus child width
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = false;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // move all children
- }
- {
- // Shrink the lost focus child width
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_WIDTH;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 80.0f;
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
- }
- {
- // Shrink the lost focus child height
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE_HEIGHT;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 80.0f;
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
- }
- {
- // Grow the gained focus child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 120.0f, 120.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
- manager.SetFocus( controls[1] );
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // Animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // Animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 80.0f, 340.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 80.0f, 80.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 120.0f, 120.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 360.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 80.0f, 340.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_FocusChildLayoutTransition03(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_FocusChildLayoutTransition03" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( false );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container" );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- stage.Add( container );
- container.Add( controls[0] );
- container.Add( controls[1] );
-
- KeyInputFocusManager manager = KeyInputFocusManager::Get();
- manager.SetFocus( controls[0] );
-
- // Initial rendering done
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- horizontalLayout.SetAnimateLayout( true );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Shrink the lost focus child width
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = false;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // move all children
- }
- {
- // Shrink the lost focus child width
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE_X;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.8f;
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
- }
- {
- // Shrink the lost focus child height
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE_Y;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_LOST;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = 0.8f;
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus lost child
- }
- {
- // Grow the gained focus child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::AFFECTS_SIBLINGS ] = true;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SCALE;
- map[ LayoutTransitionData::AnimatorKey::CONDITION ] = LayoutTransitionData::Condition::ON_FOCUS_GAINED;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 1.2f, 1.2f, 1.0f );
- map[ LayoutTransitionData::AnimatorKey::TYPE ] = LayoutTransitionData::Animator::ANIMATE_TO;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to on focus gained child
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_FOCUS, layoutTransitionData );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
- manager.SetFocus( controls[1] );
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // Animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 100.0f, 350.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // Animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( -10.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 90.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize() * controls[0].GetCurrentScale(), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize() * controls[1].GetCurrentScale(), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( -10.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 90.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ) * controls[0].GetProperty<Vector3>( Actor::Property::SCALE ), Vector3( 80.0f, 80.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ) * controls[1].GetProperty<Vector3>( Actor::Property::SCALE ), Vector3( 120.0f, 120.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition02_KeyFrames" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( true );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- stage.Add( container );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for a child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- // Grow a child from (0,0) size to full size with key frames
- KeyFrames keyFrames = KeyFrames::New();
- keyFrames.Add( 0.0f, Vector3( 0.0f, 0.0f, 0 ) );
- keyFrames.Add( 0.5f, Vector3( 100.0f, 100.0f, 0 ) );
-
- Property::Map map;
- map[ "property" ] = Actor::Property::SIZE;
- map[ "condition" ] = LayoutTransitionData::Condition::ON_ADD;
- map[ "animator" ] = Property::Map()
- .Add( "type", "ANIMATE_BETWEEN")
- .Add( "alphaFunction", "LINEAR")
- .Add( "timePeriod", Property::Map()
- .Add( "delay", 0.0f)
- .Add( "duration", 0.5f));
- layoutTransitionData.AddPropertyAnimator( Actor(), map, keyFrames, Animation::Interpolation::Linear );
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
- container.Add( controls[0] );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // The animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // The animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AddChildLayoutTransition03_Path(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition03_Path" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( true );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- stage.Add( container );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
-
- Dali::Path path = Dali::Path::New();
- {
- // Curve position for a child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_PATH")
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f ) );
-
- // Build the path
- Vector3 position0( 30.0, 80.0, 0.0 );
- Vector3 position1( 70.0, 120.0, 0.0 );
- Vector3 position2( 0.0, 350.0, 0.0 );
-
- //Dali::Path path = Dali::Path::New();
- path.AddPoint( position0 );
- path.AddPoint( position1 );
- path.AddPoint( position2 );
-
- // Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0 ) );
- path.AddControlPoint( Vector3( 56.0, 119.0, 0.0 ) );
-
- // Control points for second segment
- path.AddControlPoint( Vector3( 78.0, 120.0, 0.0 ) );
- path.AddControlPoint( Vector3( 93.0, 104.0, 0.0 ) );
-
- layoutTransitionData.AddPropertyAnimator( controls[0], map, path, Vector3::XAXIS );
- }
- {
- // Grow a child from (0,0) size to full size (captured)
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = "size";
- map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( controls[0], map );
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
- container.Add( controls[0] );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render( 0 );
-
- finishCheck.CheckSignalNotReceived();
- // The animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- Vector3 position, tangent;
- Quaternion rotation;
- path.Sample( 0.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), position, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentOrientation(), rotation, 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- path.Sample( 1.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), position, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentOrientation(), rotation, 0.0001f, TEST_LOCATION );
-
- // The animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition04_AnimateBy" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( true );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- stage.Add( container );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for a child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Vector3( 10.0f, 10.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::TYPE, "ANIMATE_BY")
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR")
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f)
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.5f));
- layoutTransitionData.AddPropertyAnimator( controls[0], map );
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
- container.Add( controls[0] );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // The animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // The animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 110.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 110.0f, 110.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_AddChildLayoutTransition05(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_AddChildLayoutTransition05" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( true );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container");
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- stage.Add( container );
-
- auto layoutTransitionData = LayoutTransitionData::New();
- {
- // Instant resize for parent
- Property::Map map;
- map[ "property" ] = Actor::Property::SIZE;
- map[ "targetValue" ] = Property::Value(); // capture from layout update
- map[ "animator" ] = Property::Map()
- .Add( "name", "InstantAnimator" )
- .Add( "type", "ANIMATE_TO")
- .Add( "alphaFunction", "LINEAR" )
- .Add( "timePeriod", Property::Map()
- .Add( "delay", 0.0f )
- .Add( "duration", 0.0f ) );
- layoutTransitionData.AddPropertyAnimator( container, map );
- }
- {
- // Instant position for a child
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::COLOR_ALPHA;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = "InstantAnimator";
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- {
- // Grow a child from (0,0) size to full size (captured)
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::INITIAL_VALUE ] = Vector3( 0.0f, 0.0f, 0 );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = std::string();
- layoutTransitionData.AddPropertyAnimator( controls[0], map );
- }
- {
- // Instant opacity for a child, for testing
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = "InstantAnimator";
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
-
- // Just throw all other alpha functions in
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "WRONG" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "LINEAR" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "REVERSE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_SQUARE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT_SQUARE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_OUT" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_OUT_SINE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_IN_SINE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT_SINE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "BOUNCE" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "SIN" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, "EASE_OUT_BACK" );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, Vector4( 0.0f, 1.0f, 2.0f, 3.0f ) );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- // valid
- Property::Array array;
- array.Reserve( 4 );
- array.PushBack( 0.0f );
- array.PushBack( 1.0f );
- array.PushBack( 2.0f );
- array.PushBack( 3.0f );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, array );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- // invalid
- Property::Array array;
- array.Reserve( 3 );
- array.PushBack( 0.0f );
- array.PushBack( 1.0f );
- array.PushBack( 2.0f );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, array );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- // invalid
- Property::Array array;
- array.Reserve( 4 );
- array.PushBack( 0.0f );
- array.PushBack( 10 );
- array.PushBack( 2.0f );
- array.PushBack( 3.0f );
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, array );
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
- { // no property, not going to be used, but going to be parsed
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = 0; // invalid
- layoutTransitionData.AddPropertyAnimator( Actor(), map ); // apply to all children except parent
- }
-
- horizontalLayout.SetTransitionData( LayoutTransitionData::ON_CHILD_ADD, layoutTransitionData );
- container.Add( controls[0] );
-
- bool signalReceived(false);
- LayoutTransitionFinishCheck finishCheck(signalReceived);
- layoutTransitionData.FinishedSignal().Connect(&application, finishCheck);
-
- application.SendNotification();
- application.Render( 1u /*just very beginning of the animation*/ );
-
- finishCheck.CheckSignalNotReceived();
- // The animation just started
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 0.0f, 0.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- // The animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- application.SendNotification();
- application.Render( 10u /* wait a bit more for a signal */ );
-
- // Now sizes and positions are finally set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- finishCheck.CheckSignalReceived();
-
- END_TEST;
-}
-
-int UtcDaliLayouting_DefaultTransition01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_DefaultTransition01" );
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto horizontalLayout = LinearLayout::New();
- horizontalLayout.SetAnimateLayout( false );
- horizontalLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
-
- DevelControl::SetLayout( container, horizontalLayout );
- container.SetName( "Container" );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 100, 100 ) );
- controls.push_back( CreateLeafControl( 100, 100 ) );
-
- stage.Add( container );
- container.Add( controls[0] );
- container.Add( controls[1] );
-
- // Initial rendering done
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 100.0f, 350.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- horizontalLayout.SetAnimateLayout( true );
-
- auto layoutTransitionData0 = LayoutTransitionData::New();
- {
- // Default instant resize
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData0.AddPropertyAnimator( controls[0], map );
- }
- {
- // Instant instant position
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData0.AddPropertyAnimator( controls[0], map );
- }
- DevelControl::GetLayout( controls[0] ).SetTransitionData( LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData0 );
-
- auto layoutTransitionData1 = LayoutTransitionData::New();
- {
- // Default instant resize
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::SIZE;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData1.AddPropertyAnimator( controls[1], map );
- }
- {
- // Instant instant position
- Property::Map map;
- map[ LayoutTransitionData::AnimatorKey::PROPERTY ] = Actor::Property::POSITION;
- map[ LayoutTransitionData::AnimatorKey::TARGET_VALUE ] = Property::Value(); // capture from layout update
- map[ LayoutTransitionData::AnimatorKey::ANIMATOR ] = Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::ALPHA_FUNCTION, AlphaFunction::LINEAR )
- .Add( LayoutTransitionData::AnimatorKey::TIME_PERIOD, Property::Map()
- .Add( LayoutTransitionData::AnimatorKey::DELAY, 0.0f )
- .Add( LayoutTransitionData::AnimatorKey::DURATION, 0.0f ) );
- layoutTransitionData1.AddPropertyAnimator( controls[1], map );
- }
- DevelControl::GetLayout( controls[1] ).SetTransitionData( LayoutTransitionData::Type::ON_LAYOUT_CHANGE, layoutTransitionData1 );
-
- horizontalLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
-
- application.SendNotification();
- application.Render( 10u /*just very beginning of the animation*/ );
-
- // Animation just finished
- DALI_TEST_EQUALS( container.GetCurrentPosition(), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentPosition(), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentPosition(), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetCurrentSize(), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetCurrentSize(), Vector3( 100.0f, 100.0f, 0.0f ), 1.0f, TEST_LOCATION );
-
- // Now sizes and positions are set
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 300.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::POSITION ), Vector3( 0.0f, 400.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( container.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[1].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayouting_CheckResourceLeak01(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliLayouting_CheckResourceLeak01 - Remove animating layout and add child to stage" );
-
- Dali::Toolkit::Impl::DummyControl::constructorCount = 0;
- Dali::Toolkit::Impl::DummyControl::destructorCount = 0;
-
- Stage stage = Stage::GetCurrent();
- auto container = Control::New();
- auto linearLayout = LinearLayout::New();
- linearLayout.SetAnimateLayout( true );
-
- DevelControl::SetLayout( container, linearLayout );
- container.SetName( "Container" );
-
- stage.Add( container );
-
- DummyControl control = DummyControl::New( true );
- control.SetName( "DummyControl01" );
- control.SetSize( 100, 100 );
- container.Add( control );
-
- control = DummyControl::New( true );
- control.SetName( "DummyControl02" );
- control.SetSize( 100, 100 );
- container.Add( control );
-
- linearLayout.SetAnimateLayout( true );
-
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 0, TEST_LOCATION );
-
- // Initial rendering done
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 0, TEST_LOCATION );
-
- stage.Remove( container );
- container.Reset();
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 1, TEST_LOCATION );
-
- Stage::GetCurrent().Add( control );
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 1, TEST_LOCATION );
-
- stage.Remove( control );
- control.Reset();
-
- application.SendNotification();
- application.Render(static_cast<unsigned int>( 0.5f * 1000.0f ) + 1u /*just after the end of the animation*/ );
-
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::constructorCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Toolkit::Impl::DummyControl::destructorCount, 2, TEST_LOCATION );
-
- END_TEST;
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <stdlib.h>
-#include <dali-toolkit-test-suite-utils.h>
-#include <toolkit-event-thread-callback.h>
-
-#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
-#include <dali-toolkit/devel-api/layouting/absolute-layout.h>
-#include <dali-toolkit/devel-api/layouting/linear-layout.h>
-#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
-#include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
-#include <dali/devel-api/actors/actor-devel.h>
-
-#include <../custom-layout.h>
-
-#include <layout-utils.h>
-
-using namespace Dali;
-using namespace Toolkit;
-
-namespace
-{
-
-// Turns the given control into a Root layout control and adds it to the stage.
-void SetupRootLayoutControl( Control& rootControl )
-{
- rootControl = Control::New();
- auto absoluteLayout = AbsoluteLayout::New();
- DevelControl::SetLayout( rootControl, absoluteLayout );
- rootControl.SetName( "RootAbsoluteLayout" );
- Stage stage = Stage::GetCurrent();
- stage.Add( rootControl );
-}
-
-} // unnamed namespace
-
-void utc_dali_toolkit_layouting_nesting_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_toolkit_layouting_nesting_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-// Test nesting of Layouts and Controls
-
-int UtcDaliLayoutingNesting_01(void)
-{
- /*
-
- Root
- |
- Control (LinearLayout Horizontal)
- |
- Control (LinearLayout Vertical)
- |
- LeafControl
-
- */
-
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingNesting_01 - Nesting a LinearLayout (MATCH_PARENT) containing a leaf control within a LinearLayout");
-
- auto rootControl = Control::New();
- SetupRootLayoutControl( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "hBox" );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 480 );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 800 );
-
-
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "vBox" );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox.Add( vbox );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
-
- for( auto&& iter : controls )
- {
- vbox.Add( iter );
- }
-
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliLayoutingNesting_02(void)
-{
- /*
-
- Root
- |
- Control (LinearLayout Horizontal)
- | |
- Control (LinearLayout Vertical)
- | |
- LeafControl
-
- */
-
- ToolkitTestApplication application;
- tet_infoline("UtcDaliLayoutingNesting_02 - Nesting a LinearLayout (MATCH_PARENT) containing a leaf control within a LinearLayout");
- tet_infoline("Then change the parent's size and test child responded correctly");
-
- auto rootControl = Control::New();
- SetupRootLayoutControl( rootControl );
-
- auto hbox = Control::New();
- auto hboxLayout = LinearLayout::New();
- hboxLayout.SetOrientation( LinearLayout::Orientation::HORIZONTAL );
- DevelControl::SetLayout( hbox, hboxLayout );
- hbox.SetName( "hBox" );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 480 );
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, 800 );
-
-
- auto vbox = Control::New();
- auto vboxLayout = LinearLayout::New();
- vboxLayout.SetOrientation( LinearLayout::Orientation::VERTICAL );
- DevelControl::SetLayout( vbox, vboxLayout );
- vbox.SetName( "vBox" );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- vbox.SetProperty( Toolkit::LayoutItem::ChildProperty::HEIGHT_SPECIFICATION, ChildLayoutData::MATCH_PARENT );
- hbox.Add( vbox );
-
- std::vector< Control > controls;
- controls.push_back( CreateLeafControl( 40, 40 ) );
-
- for( auto&& iter : controls )
- {
- vbox.Add( iter );
- }
-
- rootControl.Add( hbox );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( vbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 480.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( controls[0].GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 40.0f, 40.0f, 0.0f ), 0.0001f, TEST_LOCATION );
-
- hbox.SetProperty( Toolkit::LayoutItem::ChildProperty::WIDTH_SPECIFICATION, 400 );
-
- // Ensure layouting happens
- application.SendNotification();
- application.Render();
-
-
- DALI_TEST_EQUALS( hbox.GetProperty<Vector3>( Actor::Property::SIZE ), Vector3( 400.0f, 800.0f, 0.0f ), 0.0001f, TEST_LOCATION );