X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-GridLayout.cpp;h=224c6f4a53b7f1f81b99bd59f8e99093c9f6dfd3;hb=f66c8a201b4ca45d2b65229bdae411b6e18633fa;hp=7e9d341f598951cffd4e6248ed3bcd3fa1684543;hpb=998d982768c7f211d948cfd7921ec27ff739ce49;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp index 7e9d341..224c6f4 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-GridLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * 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. @@ -17,532 +17,614 @@ #include #include -#include // for FLT_MAX - -// Need to override adaptor classes for toolkit test harness, so include -// test harness headers before dali headers. #include +#include -#include #include +#include +#include +#include +#include +#include + +#include <../custom-layout.h> + +#include using namespace Dali; using namespace Toolkit; -void utc_dali_toolkit_grid_layout_startup(void) +void utc_dali_toolkit_grid_layouting_startup(void) { test_return_value = TET_UNDEF; } -void utc_dali_toolkit_grid_layout_cleanup(void) +void utc_dali_toolkit_grid_layouting_cleanup(void) { test_return_value = TET_PASS; } - -namespace +int UtcDaliLayouting_GridLayout01(void) { + ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_GridLayout01 2 Column, 4 Items"); -const unsigned int TOTAL_ITEM_NUMBER = 200; + const auto NUMBER_OF_COLUMNS = 2; + const auto NUMBER_OF_ITEMS = 4; -Vector3 GridLayoutItemSizeFunction(unsigned int numberOfColumns, float layoutWidth, float sideMargin, float columnSpacing) -{ - float width = (layoutWidth - sideMargin * 2.0f - columnSpacing * static_cast(numberOfColumns - 1)) / static_cast(numberOfColumns); + tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS ); - return Vector3(width, width, width); -} + Stage stage = Stage::GetCurrent(); + auto rootControl = Control::New(); + auto absoluteLayout = AbsoluteLayout::New(); + DevelControl::SetLayout( rootControl, absoluteLayout ); + rootControl.SetName( "AbsoluteLayout" ); + stage.Add( rootControl ); -// Implementation of ItemFactory for providing actors to ItemView -class TestItemFactory : public ItemFactory -{ -public: + 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 ); - /** - * Constructor - * @param application class, stored as reference - */ - TestItemFactory() + std::vector< Control > controls; + for( auto i=0; i < NUMBER_OF_ITEMS; i++ ) { + controls.push_back( CreateLeafControl( 100, 100 ) ); } -public: // From ItemFactory - - /** - * Query the number of items available from the factory. - * The maximum available item has an ID of GetNumberOfItems() - 1. - */ - virtual unsigned int GetNumberOfItems() + for( auto&& iter : controls ) { - return TOTAL_ITEM_NUMBER; + gridContainer.Add( iter ); } - /** - * Create an Actor to represent a visible item. - * @param itemId - * @return the created actor. - */ - virtual Actor NewItem(unsigned int itemId) - { - // Create an test actor for this item - ImageActor actor = CreateSolidColorActor(Color::RED); - actor.SetSize(64.0f, 64.0f); - return actor; - } -}; - -} // namespace + 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( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); -int UtcDaliGridLayoutNew(void) -{ - ToolkitTestApplication application; + // Item sizes will not be changed + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + tet_printf( "Confirm number of columns is as set\n"); + DALI_TEST_EQUALS( gridLayout.GetNumberOfColumns(), NUMBER_OF_COLUMNS, TEST_LOCATION ); - DALI_TEST_CHECK(gridLayout); END_TEST; } -int UtcDaliGridLayoutSetAndGetNumberOfColumns(void) +int UtcDaliLayouting_GridLayout02(void) { ToolkitTestApplication application; + tet_infoline("UtcDaliLayouting_GridLayout02"); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + const auto NUMBER_OF_COLUMNS = 3; + const auto NUMBER_OF_ITEMS = 7; - // Set the number of columns - gridLayout->SetNumberOfColumns(6); + tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS ); - // Check whether we get the correct number of columns - DALI_TEST_CHECK(gridLayout->GetNumberOfColumns() == 6); - END_TEST; -} + Stage stage = Stage::GetCurrent(); -int UtcDaliGridLayoutSetAndGetRowSpacing(void) -{ - ToolkitTestApplication application; + auto rootControl = Control::New(); + auto absoluteLayout = AbsoluteLayout::New(); + DevelControl::SetLayout( rootControl, absoluteLayout ); + rootControl.SetName( "AbsoluteLayout" ); + stage.Add( rootControl ); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + 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 ); - // Set the row spacing - gridLayout->SetRowSpacing(10.0f); + std::vector< Control > controls; + for( auto i=0; i < NUMBER_OF_ITEMS; i++ ) + { + controls.push_back( CreateLeafControl( 100, 100 ) ); + } - // Check whether we get the correct row spacing - DALI_TEST_EQUALS(gridLayout->GetRowSpacing(), 10.0f, TEST_LOCATION ); - END_TEST; -} + for( auto&& iter : controls ) + { + gridContainer.Add( iter ); + } -int UtcDaliGridLayoutSetAndGetColumnSpacing(void) -{ - ToolkitTestApplication application; + rootControl.Add( gridContainer ); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + // Ensure layouting happens + application.SendNotification(); + application.Render(); - // Set the column spacing - gridLayout->SetColumnSpacing(10.0f); + // grid layouts out 3 items per row, which is 480x800. + // Row 1 + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + // Row 2 + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[4].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[5].GetProperty( Actor::Property::POSITION ), Vector3( 200.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + // Row 3 + DALI_TEST_EQUALS( controls[6].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 200.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[4].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[5].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[6].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - // Check whether we get the correct column spacing - DALI_TEST_EQUALS(gridLayout->GetColumnSpacing(), 10.0f, TEST_LOCATION ); END_TEST; } -int UtcDaliGridLayoutSetAndGetTopMargin(void) +int UtcDaliLayouting_GridLayout03(void) { ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_GridLayout03 Grid Padding"); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + const auto NUMBER_OF_COLUMNS = 2; + const auto NUMBER_OF_ITEMS = 4; - // Set the top margin - gridLayout->SetTopMargin(30.0f); + tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS ); - // Check whether we get the correct top margin - DALI_TEST_EQUALS(gridLayout->GetTopMargin(), 30.0f, TEST_LOCATION ); - END_TEST; -} + Extents GRID_PADDING( Extents( 10, 10, 20, 20 ) ); // start,end,top,bottom -int UtcDaliGridLayoutSetAndGetBottomMargin(void) -{ - ToolkitTestApplication application; + tet_printf( "Testing with Padding 10,10,20,20\n"); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + Stage stage = Stage::GetCurrent(); - // Set the bottom margin - gridLayout->SetBottomMargin(30.0f); + auto rootControl = Control::New(); + auto absoluteLayout = AbsoluteLayout::New(); + DevelControl::SetLayout( rootControl, absoluteLayout ); + rootControl.SetName( "AbsoluteLayout" ); + stage.Add( rootControl ); - // Check whether we get the correct bottom margin - DALI_TEST_EQUALS(gridLayout->GetBottomMargin(), 30.0f, TEST_LOCATION ); - END_TEST; -} + 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 ); -int UtcDaliGridLayoutSetAndGetSideMargin(void) -{ - ToolkitTestApplication application; + std::vector< Control > controls; + for( auto i=0; i < NUMBER_OF_ITEMS; i++ ) + { + controls.push_back( CreateLeafControl( 100, 100 ) ); + } - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + for( auto&& iter : controls ) + { + gridContainer.Add( iter ); + } - // Set the side margin - gridLayout->SetSideMargin(10.0f); + rootControl.Add( gridContainer ); - // Check whether we get the correct side margin - DALI_TEST_EQUALS(gridLayout->GetSideMargin(), 10.0f, TEST_LOCATION ); - END_TEST; -} + // Ensure layouting happens + application.SendNotification(); + application.Render(); -int UtcDaliGridLayoutSetAndGetZGap(void) -{ - ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_GridLayout03 Grid Padding 2 Column, 4 Items"); + DALI_TEST_EQUALS( controls[0].GetProperty( 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( 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( 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( Actor::Property::POSITION ), Vector3( 100.0f + GRID_PADDING.start, 100.0f + GRID_PADDING.top, 0.0f ), 0.0001f, TEST_LOCATION ); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + tet_infoline(" UtcDaliLayouting_GridLayout03 Size of Grid should include padding"); + DALI_TEST_EQUALS( gridContainer.GetProperty( 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 ); - // Set the gap of items in the Z axis in different columns - gridLayout->SetZGap(5.0f); + tet_infoline(" UtcDaliLayouting_GridLayout03 Item sizes unchanged"); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - // Check whether we get the correct Z gap - DALI_TEST_EQUALS(gridLayout->GetZGap(), 5.0f, TEST_LOCATION ); END_TEST; } -int UtcDaliGridLayoutSetAndGetItemSizeFunction(void) +int UtcDaliLayouting_GridLayout04(void) { ToolkitTestApplication application; + tet_infoline(" UtcDaliLayouting_GridLayout04 Child Margin"); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); - - // Set the item size function - gridLayout->SetItemSizeFunction(GridLayoutItemSizeFunction); + const auto NUMBER_OF_COLUMNS = 2; + const auto NUMBER_OF_ITEMS = 4; - // Check whether we get the correct item size function - DALI_TEST_CHECK(gridLayout->GetItemSizeFunction() == GridLayoutItemSizeFunction); - END_TEST; -} - -int UtcDaliGridLayoutSetAndGetScrollSpeedFactor(void) -{ - ToolkitTestApplication application; - - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + tet_printf( "Testing %d columns with %d items\n", NUMBER_OF_COLUMNS, NUMBER_OF_ITEMS ); - // Set the scroll speed factor - gridLayout->SetScrollSpeedFactor(0.05f); + Extents GRID_PADDING( Extents( 10, 10, 20, 20 ) ); // start,end,top,bottom + Extents ITEM_MARGIN( Extents( 10, 10, 5, 5 ) ); // start,end,top,bottom - // Check whether we get the correct scroll speed factor - DALI_TEST_EQUALS(gridLayout->GetScrollSpeedFactor(), 0.05f, TEST_LOCATION ); - END_TEST; -} + tet_printf( "Testing with Margin 10,10,5,5\n"); -int UtcDaliGridLayoutSetAndGetMaximumSwipeSpeed(void) -{ - ToolkitTestApplication application; + Stage stage = Stage::GetCurrent(); - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + auto rootControl = Control::New(); + auto absoluteLayout = AbsoluteLayout::New(); + DevelControl::SetLayout( rootControl, absoluteLayout ); + rootControl.SetName( "AbsoluteLayout" ); + stage.Add( rootControl ); - // Set the maximum swipe speed - gridLayout->SetMaximumSwipeSpeed(50.0f); + 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 ); - // Check whether we get the correct maximum swipe speed - DALI_TEST_EQUALS(gridLayout->GetMaximumSwipeSpeed(), 50.0f, TEST_LOCATION ); - END_TEST; -} + 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 ); + } -int UtcDaliGridLayoutSetAndGetItemFlickAnimationDuration(void) -{ - ToolkitTestApplication application; + for( auto&& iter : controls ) + { + gridContainer.Add( iter ); + } - // Create a grid layout - GridLayoutPtr gridLayout = GridLayout::New(); + rootControl.Add( gridContainer ); - // Set the flick animaiton duration - gridLayout->SetItemFlickAnimationDuration(0.35f); + // Ensure layouting happens + application.SendNotification(); + application.Render(); - // Check whether we get the correct flick animaiton duration - DALI_TEST_EQUALS( gridLayout->GetItemFlickAnimationDuration(), 0.35f, TEST_LOCATION ); - END_TEST; -} + DALI_TEST_EQUALS( controls[0].GetProperty( 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 ); -int UtcDaliGridLayoutConstraintLeft(void) -{ - ToolkitTestApplication application; + DALI_TEST_EQUALS( controls[1].GetProperty( 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 ); - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - GridLayoutPtr gridLayout = GridLayout::New(); - gridLayout->SetNumberOfColumns(6); + DALI_TEST_EQUALS( controls[2].GetProperty( 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 ); - view.SetName("view actor"); - view.AddLayout(*gridLayout); - view.SetSize(vec); + DALI_TEST_EQUALS( controls[3].GetProperty( 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 ); - Stage::GetCurrent().Add(view); - gridLayout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); + tet_infoline(" UtcDaliLayouting_GridLayout03 Size of Grid should include padding and margins"); - application.SendNotification(); - application.Render(0); + const auto NUMBER_OF_ROWS = ( NUMBER_OF_ITEMS / NUMBER_OF_COLUMNS ); - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } + DALI_TEST_EQUALS( gridContainer.GetProperty( 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 ); - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } - } + tet_infoline(" UtcDaliLayouting_GridLayout03 Item sizes unchanged"); + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); END_TEST; } -int UtcDaliGridLayoutConstraintRight(void) +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 ) ); + } - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - GridLayoutPtr gridLayout = GridLayout::New(); - gridLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*gridLayout); - view.SetSize(vec); + for( auto&& iter : controls ) + { + gridContainer.Add( iter ); + } - Stage::GetCurrent().Add(view); - gridLayout->SetOrientation(ControlOrientation::Right); - view.ActivateLayout(0, vec, 0.0f); + customHBox.Add( gridContainer ); + // Ensure layouting happens application.SendNotification(); - application.Render(0); + application.Render(); - // render 10 frames - for(int i = 0; i < 10; ++i) - { - application.Render(16); // 60hz frames - } + // Grid will layout first 2 items on first row then last 2 on second row. + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) - { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } - } + // Item sizes will not be changed + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); END_TEST; } -int UtcDaliGridLayoutConstraintUp(void) +int UtcDaliLayouting_GridLayout06(void) { ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - GridLayoutPtr gridLayout = GridLayout::New(); - gridLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*gridLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - gridLayout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) + 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++ ) { - application.Render(16); // 60hz frames + controls.push_back( CreateLeafControl( 100, 100 ) ); } - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) + for( auto&& iter : controls ) { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } + gridContainer.Add( iter ); } - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); + 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( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::POSITION ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - ItemLayoutPtr layout = gridLayout; - layout->GetClosestOnScreenLayoutPosition(0, 0.0f, vec); - int nextItem = layout->GetNextFocusItemID(0, 10, Dali::Toolkit::Control::Right, false); - DALI_TEST_CHECK(nextItem == 1); + // Item sizes will not be changed + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 100.0f, 75.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - Stage::GetCurrent().Remove(view); END_TEST; } -int UtcDaliGridLayoutConstraintDown(void) + +int UtcDaliLayouting_GridLayout07(void) { ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - GridLayoutPtr gridLayout = GridLayout::New(); - gridLayout->SetNumberOfColumns(6); - - view.SetName("view actor"); - view.AddLayout(*gridLayout); - view.SetSize(vec); - - Stage::GetCurrent().Add(view); - gridLayout->SetOrientation(ControlOrientation::Down); - view.ActivateLayout(0, vec, 0.0f); - - application.SendNotification(); - application.Render(0); - - // render 10 frames - for(int i = 0; i < 10; ++i) + 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++ ) { - application.Render(16); // 60hz frames + controls.push_back( CreateLeafControl( 100, 100 ) ); } - // Confirm: we have actors in the view and they are positioned some distance from the origin. - int nonZeroCount = 0; - int elementsFound = 0; - for(unsigned int i = 0; i < 10; i++) + for( auto&& iter : controls ) { - Actor testActor = view.GetItem(i); - if (testActor) - { - elementsFound++; - Vector3 pos = testActor.GetCurrentPosition(); - - if (pos.LengthSquared() > 0.0f) - { - nonZeroCount++; - } - } + gridContainer.Add( iter ); } - DALI_TEST_CHECK((elementsFound > 0) && (nonZeroCount == elementsFound)); - Stage::GetCurrent().Remove(view); - END_TEST; -} + customHBox.Add( gridContainer ); -int UtcDaliGridLayoutScrollDirection(void) -{ - ToolkitTestApplication application; + // Ensure layouting happens + application.SendNotification(); + application.Render(); - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - Vector3 vec(480.0f, 800.0f, 0.0f); - GridLayoutPtr gridLayout = GridLayout::New(); - gridLayout->SetNumberOfColumns(6); + // Grid will layout first 2 items on first row then last 2 on second row. + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 75.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::POSITION ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - view.SetName("view actor"); - view.AddLayout(*gridLayout); - view.SetSize(vec); + // Item sizes will not be changed + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - Stage::GetCurrent().Add(view); - gridLayout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); + END_TEST; +} - application.SendNotification(); - application.Render(0); - ItemLayoutPtr layout = gridLayout; +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 ) ); + } - // render 10 frames - for(int i = 0; i < 10; ++i) + for( auto&& iter : controls ) { - application.Render(16); // 60hz frames + gridContainer.Add( iter ); } - gridLayout->SetOrientation(ControlOrientation::Up); - view.ActivateLayout(0, vec, 0.0f); + customHBox.Add( gridContainer ); + + // Ensure layouting happens application.SendNotification(); application.Render(); - Degree deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 0.0f); + 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( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::POSITION ), Vector3( 75.0f, 0.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::POSITION ), Vector3( 0.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::POSITION ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); - gridLayout->SetOrientation(ControlOrientation::Down); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); + // Item sizes will be changed + DALI_TEST_EQUALS( controls[0].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[1].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[2].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + DALI_TEST_EQUALS( controls[3].GetProperty( Actor::Property::SIZE ), Vector3( 75.0f, 100.0f, 0.0f ), 0.0001f, TEST_LOCATION ); + + END_TEST; +} - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK((deg == 180.0f)); - layout->SetOrientation(ControlOrientation::Left); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); +int UtcDaliLayouting_GridLayoutDownCast(void) +{ + TestApplication application; + tet_infoline(" UtcDaliLayouting_GridLayoutDownCast - Testing Downcast"); - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 90.f); + Grid gridLayout = Grid::New(); - gridLayout->SetOrientation(ControlOrientation::Right); - view.ActivateLayout(0, vec, 0.0f); - application.SendNotification(); - application.Render(); + LayoutGroup layoutGroup( gridLayout ); - deg = layout->GetScrollDirection(); - DALI_TEST_CHECK(deg == 270.0f); + Grid gridLayoutCandidate = Grid::DownCast( layoutGroup ); + DALI_TEST_CHECK( gridLayoutCandidate ); - Stage::GetCurrent().Remove(view); END_TEST; -} +} \ No newline at end of file