From 9baeba7b9511e893ff68285903ff7e813adcab65 Mon Sep 17 00:00:00 2001 From: Yoonsang Lee Date: Mon, 25 May 2015 16:48:41 +0900 Subject: [PATCH] Update TableView utc - Add UtcDaliTableViewCtorCopyP - Add UtcDaliTableViewMetricsFit Change-Id: I334db04227c4a028bb7328fc94f91f563fb74cb0 --- .../src/dali-toolkit/utc-Dali-TableView.cpp | 54 ++++++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp index 45dd92c..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; @@ -77,9 +78,9 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor& actor2 = Actor::New(); actor3 = Actor::New(); - actor1.SetSize( Dali::Vector2( 10, 10 ) ); - actor2.SetSize( Dali::Vector2( 10, 10 ) ); - 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 ) ); @@ -88,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; @@ -143,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; -- 2.7.4