UTC coverage for MathUtils,Matrix,Uint16Pair,PropertyTypes 39/39939/2
authorLee Morgan <Lee.morgan@partner.samsung.com>
Tue, 26 May 2015 13:59:24 +0000 (14:59 +0100)
committerLee Morgan <Lee.morgan@partner.samsung.com>
Tue, 26 May 2015 16:36:47 +0000 (17:36 +0100)
Change-Id: I58973609f12f288f97f26f1ca65abae5234f43e6

automated-tests/src/dali/CMakeLists.txt
automated-tests/src/dali/utc-Dali-MathUtils.cpp
automated-tests/src/dali/utc-Dali-Matrix.cpp
automated-tests/src/dali/utc-Dali-PropertyNotification.cpp
automated-tests/src/dali/utc-Dali-PropertyTypes.cpp [new file with mode: 0644]
automated-tests/src/dali/utc-Dali-TypeRegistry.cpp
automated-tests/src/dali/utc-Dali-Uint16Pair.cpp [new file with mode: 0644]
automated-tests/src/dali/utc-Dali-Vector2.cpp
dali/public-api/math/math-utils.h

index 41aadab4617cfc0378b2b2d0e072f07a567e8caf..a726b6d9c926c216d1d4635a61dcb4150ac39079 100644 (file)
@@ -66,6 +66,7 @@ SET(TC_SOURCES
         utc-Dali-PropertyMap.cpp
         utc-Dali-PropertyArray.cpp
         utc-Dali-PropertyNotification.cpp
+        utc-Dali-PropertyTypes.cpp
         utc-Dali-PropertyValue.cpp
         utc-Dali-Quaternion.cpp
         utc-Dali-Radian.cpp
@@ -85,6 +86,7 @@ SET(TC_SOURCES
         utc-Dali-TouchEventCombiner.cpp
         utc-Dali-TouchProcessing.cpp
         utc-Dali-TypeRegistry.cpp
+        utc-Dali-Uint16Pair.cpp
         utc-Dali-Vector.cpp
         utc-Dali-Vector2.cpp
         utc-Dali-Vector3.cpp
index 84b992f348bd5b364edba3d1d5b69d867bc61692..1bed5efb9084ebaab71b593cfdaa1d23c14f92b7 100644 (file)
@@ -34,8 +34,7 @@ void utc_dali_math_utils_cleanup(void)
 }
 
 
-// Positive test case for a method
-int UtcDaliMathUtilsNextPowerOfTwo(void)
+int UtcDaliMathUtilsNextPowerOfTwoP(void)
 {
   Dali::TestApplication testApp;
 
@@ -61,39 +60,91 @@ int UtcDaliMathUtilsNextPowerOfTwo(void)
   END_TEST;
 }
 
+int UtcDaliMathUtilsNextPowerOfTwoN(void)
+{
+  Dali::TestApplication testApp;
+
+  try
+  {
+    NextPowerOfTwo( (1u << (sizeof(unsigned) * 8 - 1)) + 1);
+    tet_result(TET_FAIL);
+  }
+  catch( Dali::DaliException& e )
+  {
+    DALI_TEST_PRINT_ASSERT( e );
+    DALI_TEST_ASSERT( e, "Return type cannot represent the next power of two greater than the argument.", TEST_LOCATION );
+  }
+  catch( ... )
+  {
+    tet_printf("Assertion test failed - wrong Exception\n" );
+    tet_result(TET_FAIL);
+  }
+
+  END_TEST;
+}
+
+int UtcDaliMathUtilsClampP(void)
+{
+  Dali::TestApplication testApp;
+
+  //floats
+  DALI_TEST_EQUALS(Clamp(-1.0f, 0.0f, 1.0f), 0.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(Clamp(0.0f, -1.0f, 1.0f), 0.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(Clamp(1.0f, 0.0f, 1.0f), 1.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(Clamp(2.0f, 0.0f, 1.0f), 1.0f, TEST_LOCATION);
+
+  // integers
+  DALI_TEST_EQUALS(Clamp(-10, 0, 10), 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(Clamp(0, -10, 10), 0, TEST_LOCATION);
+  DALI_TEST_EQUALS(Clamp(20, 0, 10), 10, TEST_LOCATION);
+
+  float value=-10.0f, min=-2.0f, max=4.0f;
+  ClampInPlace(value, min, max);
+  DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION);
+
+  value = 10.0f;
+  ClampInPlace(value, min, max);
+  DALI_TEST_EQUALS(value, max, 0.001, TEST_LOCATION);
+
+  value = 3.0f;
+  ClampInPlace(value, min, max);
+  DALI_TEST_EQUALS(value, 3.0f, 0.001, TEST_LOCATION);
+  END_TEST;
+}
 
-// Positive test case for a method
-int UtcDaliMathUtilsIsPowerOfTwo(void)
+int UtcDaliMathUtilsClampInPlaceP(void)
 {
   Dali::TestApplication testApp;
 
-  DALI_TEST_EQUALS(IsPowerOfTwo(0), false, TEST_LOCATION);
-
-  DALI_TEST_EQUALS(IsPowerOfTwo(1), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(2), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(3), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(4), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(5), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(6), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(7), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(8), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(255), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(256), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(257), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(511), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(512), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(513), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(768), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(1023), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(1024), true, TEST_LOCATION);
-  DALI_TEST_EQUALS(IsPowerOfTwo(1025), false, TEST_LOCATION);
+  float value=-10.0f, min=-2.0f, max=4.0f;
+  ClampInPlace(value, min, max);
+  DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION);
+
+  value = 10.0f;
+  ClampInPlace(value, min, max);
+  DALI_TEST_EQUALS(value, max, 0.001, TEST_LOCATION);
+
+  value = 3.0f;
+  ClampInPlace(value, min, max);
+  DALI_TEST_EQUALS(value, 3.0f, 0.001, TEST_LOCATION);
   END_TEST;
 }
 
+int UtcDaliMathUtilsLerpP(void)
+{
+  Dali::TestApplication testApp;
 
+  float offset=0.0f, low=-2.0f, high=4.0f;
+  DALI_TEST_EQUALS(Lerp(offset, low, high), low, 0.001, TEST_LOCATION);
+  offset = 1.0f;
+  DALI_TEST_EQUALS(Lerp(offset, low, high), high, 0.001, TEST_LOCATION);
+  offset = 0.5f;
+  DALI_TEST_EQUALS(Lerp(offset, low, high), 1.0f, 0.001, TEST_LOCATION);
 
-// Positive test case for a method
-int UtcDaliMathUtilsGetRangedEpsilon(void)
+  END_TEST;
+}
+
+int UtcDaliMathUtilsGetRangedEpsilonP(void)
 {
   Dali::TestApplication testApp;
 
@@ -168,50 +219,7 @@ int UtcDaliMathUtilsGetRangedEpsilon(void)
   END_TEST;
 }
 
-// Positive test case for a method
-int UtcDaliMathUtilsRound(void)
-{
-  Dali::TestApplication testApp;
-
-  DALI_TEST_EQUALS(Round(1.00001, 4), 1.0f, TEST_LOCATION);
-  DALI_TEST_EQUALS(Round(0.99999f, 4), 1.0f, TEST_LOCATION);
-  DALI_TEST_EQUALS(Round(-1.00001, 4), -1.0f, TEST_LOCATION);
-  DALI_TEST_EQUALS(Round(-0.99999f, 4), -1.0f, TEST_LOCATION);
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliMathUtilsClamp(void)
-{
-  Dali::TestApplication testApp;
-
-  //floats
-  DALI_TEST_EQUALS(Clamp(-1.0f, 0.0f, 1.0f), 0.0f, TEST_LOCATION);
-  DALI_TEST_EQUALS(Clamp(0.0f, -1.0f, 1.0f), 0.0f, TEST_LOCATION);
-  DALI_TEST_EQUALS(Clamp(1.0f, 0.0f, 1.0f), 1.0f, TEST_LOCATION);
-  DALI_TEST_EQUALS(Clamp(2.0f, 0.0f, 1.0f), 1.0f, TEST_LOCATION);
-
-  // integers
-  DALI_TEST_EQUALS(Clamp(-10, 0, 10), 0, TEST_LOCATION);
-  DALI_TEST_EQUALS(Clamp(0, -10, 10), 0, TEST_LOCATION);
-  DALI_TEST_EQUALS(Clamp(20, 0, 10), 10, TEST_LOCATION);
-
-  float value=-10.0f, min=-2.0f, max=4.0f;
-  ClampInPlace(value, min, max);
-  DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION);
-
-  value = 10.0f;
-  ClampInPlace(value, min, max);
-  DALI_TEST_EQUALS(value, max, 0.001, TEST_LOCATION);
-
-  value = 3.0f;
-  ClampInPlace(value, min, max);
-  DALI_TEST_EQUALS(value, 3.0f, 0.001, TEST_LOCATION);
-  END_TEST;
-}
-
-// Positive test case for a method
-int UtcDaliMathUtilsWrapInDomain(void)
+int UtcDaliMathUtilsWrapInDomainP(void)
 {
   Dali::TestApplication testApp;
 
@@ -230,8 +238,7 @@ int UtcDaliMathUtilsWrapInDomain(void)
   END_TEST;
 }
 
-// Positive test case for a method
-int UtcDaliMathUtilsShortestDistanceInDomain(void)
+int UtcDaliMathUtilsShortestDistanceInDomainP(void)
 {
   Dali::TestApplication testApp;
 
@@ -245,7 +252,7 @@ int UtcDaliMathUtilsShortestDistanceInDomain(void)
   END_TEST;
 }
 
-int UtcDaliMathUtilsEquals(void)
+int UtcDaliMathUtilsEqualsZeroP(void)
 {
   float v=0.0f;
 
@@ -255,8 +262,32 @@ int UtcDaliMathUtilsEquals(void)
   v -= (Math::PI_2 * 2.0f);
   DALI_TEST_CHECK(EqualsZero(v));
 
+  END_TEST;
+}
+
+int UtcDaliMathUtilsEquals01P(void)
+{
   float w=100.0f;
   float x=w+1e-8f;
   DALI_TEST_CHECK( Equals(w, x, GetRangedEpsilon( w, x )) );
   END_TEST;
 }
+
+int UtcDaliMathUtilsEquals02P(void)
+{
+  float w=100.0f;
+  float x=w+1e-8f;
+  DALI_TEST_CHECK( Equals(w, x) );
+  END_TEST;
+}
+
+int UtcDaliMathUtilsRoundP(void)
+{
+  Dali::TestApplication testApp;
+
+  DALI_TEST_EQUALS(Round(1.00001, 4), 1.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(Round(0.99999f, 4), 1.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(Round(-1.00001, 4), -1.0f, TEST_LOCATION);
+  DALI_TEST_EQUALS(Round(-0.99999f, 4), -1.0f, TEST_LOCATION);
+  END_TEST;
+}
index 17649ed43a7d778837bdaec29cd8ff34f67863da..cd2525f5b0bf5d04677e0a7884490f9527341f8a 100644 (file)
@@ -109,6 +109,14 @@ int UtcDaliMatrixAssignP(void)
   END_TEST;
 }
 
+int UtcDaliMatrixAssign02P(void)
+{
+  Matrix a(Matrix::IDENTITY);
+  a = a; // self assign does the do nothing branch
+  DALI_TEST_EQUALS(Matrix(Matrix::IDENTITY), a, 0.001, TEST_LOCATION);
+  END_TEST;
+}
+
 int UtcDaliMatrixSetIdentityP(void)
 {
   float els[] = { 0.0f,  1.0f,  2.0f,  3.0f,
@@ -141,7 +149,7 @@ int UtcDaliMatrixSetIdentityAndScaleP(void)
   END_TEST;
 }
 
-int UtcDaliMatrixInvertTransform01P(void)
+int UtcDaliMatrixInvertTransformP(void)
 {
   for (int i=0;i<1000;++i)
   {
@@ -165,7 +173,7 @@ int UtcDaliMatrixInvertTransform01P(void)
   END_TEST;
 }
 
-int UtcDaliMatrixInvertTransform02P(void)
+int UtcDaliMatrixInvertTransformN(void)
 {
   std::string exceptionString( "EqualsZero( mMatrix[3] ) && EqualsZero( mMatrix[7] ) && EqualsZero( mMatrix[11] ) && Equals( mMatrix[15], 1.0f" );
   try
@@ -188,7 +196,7 @@ int UtcDaliMatrixInvertTransform02P(void)
 
   try
   {
-    float els[] = { 0.0f,  1.0f,  2.0f,  3.0f,
+    float els[] = { 0.0f,  1.0f,  2.0f,  0.0f,
                     4.0f,  5.0f,  6.0f,  7.0f,
                     8.0f,  9.0f, 10.0f, 11.0f,
                     12.0f, 13.0f, 14.0f, 15.0f };
@@ -206,8 +214,8 @@ int UtcDaliMatrixInvertTransform02P(void)
 
   try
   {
-    float els[] = { 0.0f,  1.0f,  2.0f,  3.0f,
-                    4.0f,  5.0f,  6.0f,  7.0f,
+    float els[] = { 0.0f,  1.0f,  2.0f,  0.0f,
+                    4.0f,  5.0f,  6.0f,  0.0f,
                     8.0f,  9.0f, 10.0f, 11.0f,
                     12.0f, 13.0f, 14.0f, 15.0f };
     Matrix m(els);
@@ -224,9 +232,9 @@ int UtcDaliMatrixInvertTransform02P(void)
 
   try
   {
-    float els[] = { 0.0f,  1.0f,  2.0f,  3.0f,
-                    4.0f,  5.0f,  6.0f,  7.0f,
-                    8.0f,  9.0f, 10.0f, 11.0f,
+    float els[] = { 0.0f,  1.0f,  2.0f,  0.0f,
+                    4.0f,  5.0f,  6.0f,  0.0f,
+                    8.0f,  9.0f, 10.0f,  0.0f,
                     12.0f, 13.0f, 14.0f, 15.0f };
     Matrix m(els);
 
@@ -642,7 +650,6 @@ int UtcDaliMatrixSetTransformComponents01P(void)
   END_TEST;
 }
 
-
 int UtcDaliMatrixSetInverseTransformComponent01P(void)
 {
   // Create an arbitrary vector
@@ -655,9 +662,8 @@ int UtcDaliMatrixSetInverseTransformComponent01P(void)
         Vector3 vForward(x, y, z);
         vForward.Normalize();
 
-        for( float angle = 5.0f; angle <= 360.0f; angle += 15.0f)
         {
-          Quaternion rotation1(Radian(Degree(angle)), vForward);
+          Quaternion rotation1(Quaternion::IDENTITY); // test no rotation branch
           Vector3 scale1(2.0f, 3.0f, 4.0f);
           Vector3 position1(1.0f, 2.0f, 3.0f);
 
@@ -767,6 +773,18 @@ int UtcDaliMatrixGetTransformComponents02P(void)
   END_TEST;
 }
 
+int UtcDaliMatrixGetTransformComponents03P(void)
+{
+  Matrix m2; // zero branch
+  Vector3 pos2;
+  Vector3 scale2;
+  Quaternion q2;
+  m2.GetTransformComponents(pos2, q2, scale2);
+  DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), pos2, 0.001, TEST_LOCATION);
+  DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), scale2, 0.001, TEST_LOCATION);
+  // DALI_TEST_EQUALS(Quaternion(), q2, 0.001, TEST_LOCATION);
+  END_TEST;
+}
 
 int UtcDaliMatrixOStreamOperator(void)
 {
index 7e5e45059b1f455402c77ecb82d69c122ecd4ddb..690e6c47e5cd398e0fb63088206dcad2978ff111 100644 (file)
@@ -364,6 +364,33 @@ int UtcDaliPropertyNotificationGetNotifyMode(void)
   END_TEST;
 }
 
+int UtcDaliPropertyNotificationGetNotifyResultP(void)
+{
+  TestApplication application;
+  tet_infoline(" UtcDaliPropertyNotificationGetNotifyMode");
+
+  Actor actor = Actor::New();
+
+  PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
+                                                                    GreaterThanCondition(100.0f));
+  notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+  gCallBackCalled = false;
+  notification.NotifySignal().Connect( &TestCallback );
+
+  actor.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
+
+  application.Render(RENDER_FRAME_INTERVAL);
+  application.SendNotification();
+  application.Render(RENDER_FRAME_INTERVAL);
+  application.SendNotification();
+
+  bool notifyResult = notification.GetNotifyResult();
+
+  DALI_TEST_EQUALS( notifyResult, false, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliPropertyNotificationGreaterThan(void)
 {
   TestApplication application;
diff --git a/automated-tests/src/dali/utc-Dali-PropertyTypes.cpp b/automated-tests/src/dali/utc-Dali-PropertyTypes.cpp
new file mode 100644 (file)
index 0000000..2064909
--- /dev/null
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+#include <iomanip>
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+
+using namespace Dali;
+
+DALI_IMPORT_API const char* const GetName(Property::Type type);
+
+int UtcDaliPropertyTypesGetNameP(void)
+{
+  DALI_TEST_EQUALS( "NONE",               Dali::PropertyTypes::GetName(Property::NONE               ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "BOOLEAN",            Dali::PropertyTypes::GetName(Property::BOOLEAN            ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "FLOAT",              Dali::PropertyTypes::GetName(Property::FLOAT              ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "INTEGER",            Dali::PropertyTypes::GetName(Property::INTEGER            ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "UNSIGNED_INTEGER",   Dali::PropertyTypes::GetName(Property::UNSIGNED_INTEGER   ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "VECTOR2",            Dali::PropertyTypes::GetName(Property::VECTOR2            ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "VECTOR3",            Dali::PropertyTypes::GetName(Property::VECTOR3            ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "VECTOR4",            Dali::PropertyTypes::GetName(Property::VECTOR4            ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "MATRIX3",            Dali::PropertyTypes::GetName(Property::MATRIX3            ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "MATRIX",             Dali::PropertyTypes::GetName(Property::MATRIX             ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "RECTANGLE",          Dali::PropertyTypes::GetName(Property::RECTANGLE          ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "ROTATION",           Dali::PropertyTypes::GetName(Property::ROTATION           ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "STRING",             Dali::PropertyTypes::GetName(Property::STRING             ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "ARRAY",              Dali::PropertyTypes::GetName(Property::ARRAY              ), TEST_LOCATION );
+  DALI_TEST_EQUALS( "MAP",                Dali::PropertyTypes::GetName(Property::MAP                ), TEST_LOCATION );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet02P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<bool>() == Property::BOOLEAN );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet03P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<float>() == Property::FLOAT );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet04P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<int>() == Property::INTEGER );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet05P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<unsigned int>() == Property::UNSIGNED_INTEGER );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet06P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Vector2>() == Property::VECTOR2 );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet07P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Vector3>() == Property::VECTOR3 );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet08P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Vector4>() == Property::VECTOR4 );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet09P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Matrix3>() == Property::MATRIX3 );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet10(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Matrix>() == Property::MATRIX );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet11P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::AngleAxis>() == Property::ROTATION );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet12P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Quaternion>() == Property::ROTATION );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet13P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<std::string>() == Property::STRING );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet14P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Rect<int> >() == Property::RECTANGLE );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet15P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Property::Map>() == Property::MAP );
+  END_TEST;
+}
+
+int UtcDaliPropertyTypesGet16P(void)
+{
+  DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Property::Array>() == Property::ARRAY );
+  END_TEST;
+}
index 6fa224f20b062db5971a4becaccb433f3ca45c62..b9657e1d3b08925905d67e480dc3b5d1b77bf5e0 100644 (file)
@@ -1006,6 +1006,11 @@ int UtcDaliTypeRegistryPropertyRegistrationP(void)
   typeInfo.GetPropertyIndices( indices );
   DALI_TEST_EQUALS( indices.size(), 1u, TEST_LOCATION );
 
+  // check property name count
+  TypeInfo::NameContainer names;
+  typeInfo.GetProperties(names);
+  DALI_TEST_CHECK( 1 == names.size() );
+
   // Ensure indices returned from actor and customActor differ by two
   Actor actor = Actor::New();
   actor.GetPropertyIndices( indices );
diff --git a/automated-tests/src/dali/utc-Dali-Uint16Pair.cpp b/automated-tests/src/dali/utc-Dali-Uint16Pair.cpp
new file mode 100644 (file)
index 0000000..d372a2b
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+
+using namespace Dali;
+
+
+int UtcDaliUint16PairConstructor01P(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v;
+
+  DALI_TEST_EQUALS(v.GetX(), 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(v.GetY(), 0u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairConstructor02P(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(10,10);
+
+  DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION);
+  DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairCopyConstructor01P(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair u(5,5);
+  Uint16Pair v(u);
+  DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+  DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairGetWidthP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(5,5);
+  DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairGetHeightP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(5,5);
+  DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairGetXP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(5,5);
+  DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairGetYP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(5,5);
+  DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairEqualsP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(5,5);
+  Uint16Pair u(5,5);
+  DALI_TEST_EQUALS(v == u, true, TEST_LOCATION);
+
+  v = Uint16Pair(5,4);
+  u = Uint16Pair(5,5);
+  DALI_TEST_EQUALS(v == u, false, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairNotEqualsP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair v(5,5);
+  Uint16Pair u(5,5);
+  DALI_TEST_EQUALS(v != u, false, TEST_LOCATION);
+
+  v = Uint16Pair(5,4);
+  u = Uint16Pair(5,5);
+  DALI_TEST_EQUALS(v != u, true, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairLessThanP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair u(5,5);
+  Uint16Pair v(6,6);
+  DALI_TEST_EQUALS(u < v, true, TEST_LOCATION);
+
+  u = Uint16Pair(0,1);
+  v = Uint16Pair(1,0);
+  DALI_TEST_EQUALS(v < u, true, TEST_LOCATION);
+
+  u = Uint16Pair(1,0);
+  v = Uint16Pair(0,1);
+  DALI_TEST_EQUALS(v < u, false, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairGreaterThanP(void)
+{
+  Dali::TestApplication testApp;
+
+  Uint16Pair u;
+  Uint16Pair v;
+
+  u = Uint16Pair(0,1);
+  v = Uint16Pair(1,0);
+  DALI_TEST_EQUALS(u > v, true, TEST_LOCATION);
+
+  u = Uint16Pair(1,0);
+  v = Uint16Pair(0,1);
+  DALI_TEST_EQUALS(v > u, true, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairFromFloatVecP(void)
+{
+  Dali::TestApplication testApp;
+
+  Dali::Vector2 v2(5.f, 5.f);
+
+  Uint16Pair u = Uint16Pair::FromFloatVec2(v2);
+  DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
+  DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
+
+  Dali::Vector3 v3(5.f, 5.f, 5.f);
+
+  u = Uint16Pair::FromFloatVec2(v3);
+  DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
+  DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliUint16PairFromFloatArrayP(void)
+{
+  Dali::TestApplication testApp;
+
+  float array[] = {5.f, 5.f};
+
+  Uint16Pair u = Uint16Pair::FromFloatArray(array);
+  DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
+  DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
+
+  END_TEST;
+}
index f9c12ec2dfcdf018561e4377a53b58ea1a70684a..761e76262b77c2111ed6cf4e50770bafbd34596e 100644 (file)
@@ -363,7 +363,7 @@ int UtcDaliVector2OperatorSubscriptN(void)
   catch (Dali::DaliException& e)
   {
     DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_ASSERT( e, "index < 2", TEST_LOCATION);
+    DALI_TEST_ASSERT( e, "Vector element index out of bounds", TEST_LOCATION);
   }
 
   END_TEST;
@@ -394,7 +394,7 @@ int UtcDaliVector2OperatorConstSubscriptN(void)
   catch (Dali::DaliException& e)
   {
     DALI_TEST_PRINT_ASSERT( e );
-    DALI_TEST_ASSERT( e, "index < 2" , TEST_LOCATION);
+    DALI_TEST_ASSERT( e, "Vector element index out of bounds" , TEST_LOCATION);
   }
 
 
index 0dd50566711b843fdf7a86c7f750491b0b758099..9c6db4acf680b8655b5d009c06ca2c7e6cef1f75 100644 (file)
@@ -35,7 +35,7 @@ namespace Dali
  */
 inline unsigned int NextPowerOfTwo( unsigned int i )
 {
-  DALI_ASSERT_DEBUG(i <= 1u << (sizeof(unsigned) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
+  DALI_ASSERT_ALWAYS(i <= 1u << (sizeof(unsigned) * 8 - 1) && "Return type cannot represent the next power of two greater than the argument.");
   if(i==0u)
   {
     return 1u;