OnActivated() change for Accessibility and KeyboardFocus
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-Alignment.cpp
index 879dbb3..2d9d8cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 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.
@@ -63,12 +63,9 @@ int UtcDaliAlignmentConstructorNegative(void)
     alignment.SetPadding(padding);
     tet_result(TET_FAIL);
   }
-  catch (DaliException& exception)
+  catch (DaliException& e)
   {
-    if (exception.mCondition == "alignment")
-    {
-      tet_result(TET_PASS);
-    }
+    DALI_TEST_ASSERT(e, "alignment", TEST_LOCATION );
   }
   END_TEST;
 }
@@ -422,19 +419,10 @@ int UtcDaliAlignmentSetAlignmentTypeNegative(void)
   {
     Alignment alignment = Alignment::New();
     Alignment::Type type(Alignment::Type(Alignment::HorizontalLeft | Alignment::HorizontalCenter));
-
-    try
-    {
-      alignment.SetAlignmentType(type);
-      tet_result(TET_FAIL);
-    }
-    catch (DaliException& exception)
-    {
-      if (exception.mCondition == "!horizontalSet")
-      {
-        tet_result(TET_PASS);
-      }
-    }
+    alignment.SetAlignmentType(type);
+    // center will prevail in conflict
+    DALI_TEST_CHECK( Alignment::HorizontalCenter & alignment.GetAlignmentType() );
+    DALI_TEST_CHECK( !(Alignment::HorizontalLeft & alignment.GetAlignmentType()) );
   }
 
   // Setting HorizontalCenter, HorizontalRight
@@ -442,56 +430,30 @@ int UtcDaliAlignmentSetAlignmentTypeNegative(void)
     Alignment alignment = Alignment::New();
     Alignment::Type type(Alignment::Type(Alignment::HorizontalCenter | Alignment::HorizontalRight));
 
-    try
-    {
-      alignment.SetAlignmentType(type);
-      tet_result(TET_FAIL);
-    }
-    catch (DaliException& exception)
-    {
-      if (exception.mCondition == "!horizontalSet")
-      {
-        tet_result(TET_PASS);
-      }
-    }
+    alignment.SetAlignmentType(type);
+    // center will prevail in conflict
+    DALI_TEST_CHECK( Alignment::HorizontalCenter & alignment.GetAlignmentType() );
+    DALI_TEST_CHECK( !(Alignment::HorizontalRight & alignment.GetAlignmentType()) );
   }
 
   // Setting VerticalTop, VerticalCenter
   {
     Alignment alignment = Alignment::New();
     Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalCenter));
-
-    try
-    {
-      alignment.SetAlignmentType(type);
-      tet_result(TET_FAIL);
-    }
-    catch (DaliException& exception)
-    {
-      if (exception.mCondition == "!verticalSet")
-      {
-        tet_result(TET_PASS);
-      }
-    }
+    alignment.SetAlignmentType(type);
+    // center will prevail in conflict
+    DALI_TEST_CHECK( Alignment::VerticalCenter & alignment.GetAlignmentType() );
+    DALI_TEST_CHECK( !(Alignment::VerticalTop & alignment.GetAlignmentType()) );
   }
 
   // Setting VerticalCenter, VerticalBottom
   {
     Alignment alignment = Alignment::New();
     Alignment::Type type(Alignment::Type(Alignment::VerticalTop | Alignment::VerticalBottom));
-
-    try
-    {
-      alignment.SetAlignmentType(type);
-      tet_result(TET_FAIL);
-    }
-    catch (DaliException& exception)
-    {
-      if (exception.mCondition == "!veritcalSet")
-      {
-        tet_result(TET_PASS);
-      }
-    }
+    alignment.SetAlignmentType(type);
+    // top will prevail in conflict
+    DALI_TEST_CHECK( Alignment::VerticalTop & alignment.GetAlignmentType() );
+    DALI_TEST_CHECK( !(Alignment::VerticalBottom & alignment.GetAlignmentType()) );
   }
   END_TEST;
 }
@@ -874,12 +836,9 @@ int UtcDaliAlignmentSetPaddingNegative(void)
     alignment.SetPadding(padding);
     tet_result(TET_FAIL);
   }
-  catch (DaliException& exception)
+  catch (DaliException& e)
   {
-    if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
-    {
-      tet_result(TET_PASS);
-    }
+    DALI_TEST_ASSERT(e, "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )", TEST_LOCATION );
   }
 
   try
@@ -888,12 +847,9 @@ int UtcDaliAlignmentSetPaddingNegative(void)
     alignment.SetPadding(padding);
     tet_result(TET_FAIL);
   }
-  catch (DaliException& exception)
+  catch (DaliException& e)
   {
-    if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
-    {
-      tet_result(TET_PASS);
-    }
+    DALI_TEST_ASSERT(e, "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )", TEST_LOCATION );
   }
 
   try
@@ -902,12 +858,9 @@ int UtcDaliAlignmentSetPaddingNegative(void)
     alignment.SetPadding(padding);
     tet_result(TET_FAIL);
   }
-  catch (DaliException& exception)
+  catch (DaliException& e)
   {
-    if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
-    {
-      tet_result(TET_PASS);
-    }
+    DALI_TEST_ASSERT(e, "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )", TEST_LOCATION );
   }
 
   try
@@ -916,12 +869,9 @@ int UtcDaliAlignmentSetPaddingNegative(void)
     alignment.SetPadding(padding);
     tet_result(TET_FAIL);
   }
-  catch (DaliException& exception)
+  catch (DaliException& e)
   {
-    if (exception.mCondition == "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )")
-    {
-      tet_result(TET_PASS);
-    }
+    DALI_TEST_ASSERT(e, "( padding.left >= 0.f ) && ( padding.top >= 0.f ) && ( padding.right >= 0.f ) && ( padding.bottom >= 0.f )", TEST_LOCATION );
   }
   END_TEST;
 }
@@ -974,7 +924,7 @@ int UtcDaliAlignmentChildAddAndRemove(void)
   END_TEST;
 }
 
-int UtcDaliAlignmentOnSizeSet(void)
+int UtcDaliAlignmentSizeSetP(void)
 {
   ToolkitTestApplication application;
 
@@ -984,7 +934,7 @@ int UtcDaliAlignmentOnSizeSet(void)
   application.Render();
   application.SendNotification();
 
-  Vector3 size(100.0f, 200.0f, 0.0f);
+  Vector2 size( 100.0f, 200.0f );
   alignment.SetSize(size);
 
   application.Render();
@@ -992,7 +942,7 @@ int UtcDaliAlignmentOnSizeSet(void)
   application.Render();
   application.SendNotification();
 
-  DALI_TEST_EQUALS(size, alignment.GetImplementation().GetControlSize(), TEST_LOCATION);
+  DALI_TEST_EQUALS(size, alignment.GetTargetSize().GetVectorXY(), TEST_LOCATION);
 
   Stage::GetCurrent().Remove(alignment);
   END_TEST;
@@ -1060,7 +1010,7 @@ int UtcDaliAlignmentOnSizeAnimation(void)
   Stage::GetCurrent().Add(alignment);
 
   Animation animation = Animation::New(100.0f);
-  animation.Resize(alignment, Vector3(100.0f, 150.0f, 200.0f));
+  animation.AnimateTo( Property( alignment, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) );
   animation.Play();
 
   application.Render();