X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-TableView.cpp;h=30f0cda82ee9965de2d258bc652178905de43130;hp=0e998192af6ca62d7ad1535a32e2bf091343b000;hb=acf6adf93f736fcfc7a5f33b2a9dfab87d53106e;hpb=3826dbe84a1b03ec20e4ceba0e8132533e4cac33 diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp index 0e99819..30f0cda 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp @@ -41,6 +41,7 @@ const char* const PROPERTY_NAME_COLUMNS = "columns"; const char* const PROPERTY_NAME_CELL_PADDING = "cell-padding"; const char* const PROPERTY_NAME_LAYOUT_ROWS = "layout-rows"; const char* const PROPERTY_NAME_LAYOUT_COLUMNS = "layout-columns"; +const Vector2 CELL_SIZE( 10, 10 ); static bool gObjectCreatedCallBackCalled; @@ -58,9 +59,9 @@ struct Constraint100 /** * function operator to apply the parent size */ - Dali::Vector3 operator()(const Dali::Vector3& current) + void operator()( Dali::Vector3& current, const PropertyInputContainer& /* inputs */ ) { - return Dali::Vector3( 100.0f, 100.0f, 100.0f ); + current.x = current.y = current.z = 100.0f; } }; @@ -70,8 +71,6 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& tableView = TableView::New( 10, 10 ); // 10 by 10 grid. DALI_TEST_CHECK( tableView ); - tableView.SetRelayoutEnabled( true ); - Stage::GetCurrent().Add( tableView ); tableView.SetSize( Dali::Vector2( 100.0f, 100.0f ) ); @@ -79,12 +78,9 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& actor2 = Actor::New(); actor3 = Actor::New(); - actor1.SetRelayoutEnabled( true ); - actor1.SetSize( Dali::Vector2( 10, 10 ) ); - actor2.SetRelayoutEnabled( true ); - actor2.SetSize( Dali::Vector2( 10, 10 ) ); - actor3.SetRelayoutEnabled( true ); - actor3.SetSize( Dali::Vector2( 10, 10 ) ); + actor1.SetSize( CELL_SIZE ); + actor2.SetSize( CELL_SIZE ); + actor3.SetSize( CELL_SIZE ); tableView.AddChild( actor1, TableView::CellPosition( 0, 0 ) ); tableView.AddChild( actor2, TableView::CellPosition( 0, 1 ) ); @@ -93,6 +89,17 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& } // namespace +int UtcDaliTableViewCtorCopyP(void) +{ + TestApplication application; + + TableView actor1 = TableView::New(10,10); + TableView actor2( actor1 ); + + DALI_TEST_EQUALS( actor1, actor2, TEST_LOCATION ); + END_TEST; +} + int UtcDaliTableViewNew(void) { ToolkitTestApplication application; @@ -148,6 +155,42 @@ int UtcDaliTableViewMetricsPadding(void) } // Test adjusting the metric values for the cell. +int UtcDaliTableViewMetricsFit(void) +{ + ToolkitTestApplication application; + + tet_infoline("UtcDaliTableViewMetricsFit"); + + TableView tableView; + Actor actor1; + Actor actor2; + Actor actor3; + + SetupTableViewAndActors(tableView, actor1, actor2, actor3); + application.SendNotification(); + application.Render(); + + // 1. check that with no fixed width/heights, actors are in default position. + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION ); + + // 2. check that with a fixed width & height, actors to the right and below are offsetted. + tableView.SetFitHeight(0); + tableView.SetFitWidth(0); + DALI_TEST_EQUALS( tableView.IsFitHeight(0), true, TEST_LOCATION ); + DALI_TEST_EQUALS( tableView.IsFitWidth(0), true, TEST_LOCATION ); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION ); + DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION ); + END_TEST; +} + +// Test adjusting the metric values for the cell. int UtcDaliTableViewMetricsFixed(void) { ToolkitTestApplication application; @@ -642,7 +685,8 @@ int UtcDaliTableViewCustomProperties(void) // Create a 10x10 table-view TableView tableView = TableView::New(10,10); - tableView.ApplyConstraint( Constraint::New( Actor::Property::SIZE, Constraint100() ) ); + Constraint constraint = Constraint::New( tableView, Actor::Property::SIZE, Constraint100() ); + constraint.Apply(); DALI_TEST_CHECK( tableView ); // Create a child actor with the custom properties