Saving a bit of memory by using pretty function instead of full file name
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit-unmanaged / utc-Dali-TableView.cpp
index a50ffc9..7fe943a 100644 (file)
@@ -432,10 +432,10 @@ int UtcDaliTableViewChildAssert(void)
     // should assert
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e )
+  catch( Dali::DaliExceptione )
   {
-    tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "child", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "child", TEST_LOCATION);
   }
   END_TEST;
 }
@@ -457,10 +457,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("1. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "rowIndex < mFixedHeights.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "rowIndex < mFixedHeights.size()", TEST_LOCATION);
   }
 
   try
@@ -469,10 +469,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("2. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "rowIndex < mFixedHeights.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "rowIndex < mFixedHeights.size()", TEST_LOCATION);
   }
 
   try
@@ -481,10 +481,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("3. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "columnIndex < mFixedWidths.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "columnIndex < mFixedWidths.size()", TEST_LOCATION);
   }
 
   try
@@ -493,10 +493,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("4. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "columnIndex < mFixedWidths.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "columnIndex < mFixedWidths.size()", TEST_LOCATION);
   }
 
   // relatives...
@@ -507,10 +507,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("5. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION);
   }
 
   try
@@ -519,10 +519,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("6. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "rowIndex < mRelativeHeights.size()", TEST_LOCATION);
   }
 
   try
@@ -531,10 +531,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("7. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION);
   }
 
   try
@@ -543,10 +543,10 @@ int UtcDaliTableViewMetricsAssert(void)
 
     tet_result(TET_FAIL);
   }
-  catch( Dali::DaliException &e)
+  catch( Dali::DaliException& e )
   {
-    tet_printf("8. Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
-    DALI_TEST_EQUALS(e.mCondition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION);
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_EQUALS(e.condition, "columnIndex < mRelativeWidths.size()", TEST_LOCATION);
   }
   END_TEST;
 }
@@ -595,12 +595,12 @@ int UtcDaliTableViewSetGetProperty(void)
 
   //{ "policy": "fixed", "value": 30.0 },
   Property::Map item1;
-  item1.push_back( Property::StringValuePair( "policy", "fixed" ) );
-  item1.push_back( Property::StringValuePair( "value", 30.f) );
+  item1[ "policy" ] = "fixed";
+  item1[ "value" ] = 30.f;
   //{ "policy": "relative", "value": 0.2 },
   Property::Map item2;
-  item2.push_back( Property::StringValuePair( "policy", "relative" ) );
-  item2.push_back( Property::StringValuePair( "value", 0.2f ) );
+  item2[ "policy" ] = "relative";
+  item2[ "value" ] = 0.2f;
 
   // Test "layout-rows" property
   DALI_TEST_CHECK( tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_ROWS) == TableView::PROPERTY_LAYOUT_ROWS );
@@ -613,20 +613,20 @@ int UtcDaliTableViewSetGetProperty(void)
    *   }
    */
   Property::Map layoutRows;
-  layoutRows.push_back( Property::StringValuePair("1", item1) );
-  layoutRows.push_back( Property::StringValuePair("3", item2) );
+  layoutRows[ "1" ] = item1;
+  layoutRows[ "3" ] = item2;
   tableView.SetProperty( TableView::PROPERTY_LAYOUT_ROWS, layoutRows );
 
   DALI_TEST_EQUALS( tableView.GetFixedHeight( 1u ), 30.f, TEST_LOCATION );
   DALI_TEST_EQUALS( tableView.GetRelativeHeight( 3u ), 0.2f, TEST_LOCATION );
 
   Property::Map layoutRowsGet = tableView.GetProperty(TableView::PROPERTY_LAYOUT_ROWS).Get<Property::Map>();
-  DALI_TEST_CHECK( layoutRowsGet[0].first.compare(layoutRows[0].first) == 0 );
-  DALI_TEST_CHECK( layoutRowsGet[0].second.GetValue( "policy" ).Get<std::string>().compare(layoutRows[0].second.GetValue( "policy" ).Get<std::string>()) == 0 );
-  DALI_TEST_EQUALS( layoutRowsGet[0].second.GetValue( "value" ).Get<float>(),layoutRows[0].second.GetValue( "value" ).Get<float>(), TEST_LOCATION );
-  DALI_TEST_CHECK( layoutRowsGet[1].first.compare(layoutRows[1].first) == 0 );
-  DALI_TEST_CHECK( layoutRowsGet[1].second.GetValue( "policy" ).Get<std::string>().compare(layoutRows[1].second.GetValue( "policy" ).Get<std::string>()) == 0 );
-  DALI_TEST_EQUALS( layoutRowsGet[1].second.GetValue( "value" ).Get<float>(),layoutRows[1].second.GetValue( "value" ).Get<float>(), TEST_LOCATION );
+  DALI_TEST_CHECK( layoutRowsGet.GetKey(0).compare(layoutRows.GetKey(0)) == 0 );
+  DALI_TEST_CHECK( layoutRowsGet.GetValue(0).GetValue( "policy" ).Get<std::string>().compare(layoutRows.GetValue(0).GetValue( "policy" ).Get<std::string>()) == 0 );
+  DALI_TEST_EQUALS( layoutRowsGet.GetValue(0).GetValue( "value" ).Get<float>(),layoutRows.GetValue(0).GetValue( "value" ).Get<float>(), TEST_LOCATION );
+  DALI_TEST_CHECK( layoutRowsGet.GetKey(1).compare(layoutRows.GetKey(1)) == 0 );
+  DALI_TEST_CHECK( layoutRowsGet.GetValue(1).GetValue( "policy" ).Get<std::string>().compare(layoutRows.GetValue(1).GetValue( "policy" ).Get<std::string>()) == 0 );
+  DALI_TEST_EQUALS( layoutRowsGet.GetValue(1).GetValue( "value" ).Get<float>(),layoutRows.GetValue(1).GetValue( "value" ).Get<float>(), TEST_LOCATION );
 
   // Test "layout-columns" property
   DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_LAYOUT_COLUMNS ) == TableView::PROPERTY_LAYOUT_COLUMNS );
@@ -639,20 +639,20 @@ int UtcDaliTableViewSetGetProperty(void)
    *   }
    */
   Property::Map layoutColumns;
-  layoutColumns.push_back( Property::StringValuePair("2", item2) );
-  layoutColumns.push_back( Property::StringValuePair("3", item1) );
+  layoutColumns[ "2" ] = item2;
+  layoutColumns[ "3" ] = item1;
   tableView.SetProperty( TableView::PROPERTY_LAYOUT_COLUMNS, layoutColumns );
 
   DALI_TEST_EQUALS( tableView.GetRelativeWidth( 2u ), 0.2f, TEST_LOCATION );
   DALI_TEST_EQUALS( tableView.GetFixedWidth( 3u ), 30.f, TEST_LOCATION );
 
   Property::Map layoutColumnsGet = tableView.GetProperty(TableView::PROPERTY_LAYOUT_COLUMNS).Get<Property::Map>();
-  DALI_TEST_CHECK( layoutColumnsGet[0].first.compare(layoutColumns[0].first) == 0 );
-  DALI_TEST_CHECK( layoutColumnsGet[0].second.GetValue( "policy" ).Get<std::string>().compare(layoutColumns[0].second.GetValue( "policy" ).Get<std::string>()) == 0 );
-  DALI_TEST_EQUALS( layoutColumnsGet[0].second.GetValue( "value" ).Get<float>(),layoutColumns[0].second.GetValue( "value" ).Get<float>(), TEST_LOCATION );
-  DALI_TEST_CHECK( layoutColumnsGet[1].first.compare(layoutColumns[1].first) == 0 );
-  DALI_TEST_CHECK( layoutColumnsGet[1].second.GetValue( "policy" ).Get<std::string>().compare(layoutColumns[1].second.GetValue( "policy" ).Get<std::string>()) == 0 );
-  DALI_TEST_EQUALS( layoutColumnsGet[1].second.GetValue( "value" ).Get<float>(),layoutColumns[1].second.GetValue( "value" ).Get<float>(), TEST_LOCATION );
+  DALI_TEST_CHECK( layoutColumnsGet.GetKey(0).compare(layoutColumns.GetKey(0)) == 0 );
+  DALI_TEST_CHECK( layoutColumnsGet.GetValue(0).GetValue( "policy" ).Get<std::string>().compare(layoutColumns.GetValue(0).GetValue( "policy" ).Get<std::string>()) == 0 );
+  DALI_TEST_EQUALS( layoutColumnsGet.GetValue(0).GetValue( "value" ).Get<float>(),layoutColumns.GetValue(0).GetValue( "value" ).Get<float>(), TEST_LOCATION );
+  DALI_TEST_CHECK( layoutColumnsGet.GetKey(1).compare(layoutColumns.GetKey(1)) == 0 );
+  DALI_TEST_CHECK( layoutColumnsGet.GetValue(1).GetValue( "policy" ).Get<std::string>().compare(layoutColumns.GetValue(1).GetValue( "policy" ).Get<std::string>()) == 0 );
+  DALI_TEST_EQUALS( layoutColumnsGet.GetValue(1).GetValue( "value" ).Get<float>(),layoutColumns.GetValue(1).GetValue( "value" ).Get<float>(), TEST_LOCATION );
 
   END_TEST;
 }