Simplify javascript layer behavior enum STRING 33/55533/5
authorNick Holland <nick.holland@partner.samsung.com>
Wed, 20 Jan 2016 10:56:39 +0000 (10:56 +0000)
committerNick Holland <nick.holland@partner.samsung.com>
Wed, 20 Jan 2016 11:45:37 +0000 (11:45 +0000)
Fixed false utc Layer test case which would always pass.

This seems better in js code:

before: layer.behavior = "Dali::Layer::LAYER_3D";

after: layer.behavior = "LAYER_3D";

Change-Id: I84109f55d32f6cdb00f10f763439bc6420235678

automated-tests/src/dali/utc-Dali-Layer.cpp
dali/internal/event/actors/layer-impl.cpp
dali/internal/event/common/property-helper.h

index 97f58a1..255caa0 100644 (file)
@@ -477,7 +477,7 @@ int UtcDaliLayerDefaultProperties(void)
 
 
   Property::Value behavior = actor.GetProperty(Layer::Property::BEHAVIOR);
-  DALI_TEST_CHECK( std::strcmp( behavior.Get<std::string>().c_str(), "LAYER_2D") );
+  DALI_TEST_EQUALS(behavior.Get<std::string>().c_str(), "LAYER_2D", TEST_LOCATION );
 
   END_TEST;
 }
@@ -491,6 +491,9 @@ int UtcDaliLayerSetDepthTestDisabled(void)
   DALI_TEST_CHECK( actor.IsDepthTestDisabled() );
 
   actor.SetBehavior( Layer::LAYER_3D );
+
+  Property::Value behavior = actor.GetProperty(Layer::Property::BEHAVIOR);
+  DALI_TEST_EQUALS(behavior.Get<std::string>().c_str(), "LAYER_3D", TEST_LOCATION );
   DALI_TEST_CHECK( !actor.IsDepthTestDisabled() );
 
   actor.SetDepthTestDisabled( true );
index ff26d1e..078d16a 100644 (file)
@@ -35,12 +35,14 @@ namespace Dali
 
 namespace
 {
-typedef Dali::Layer::Behavior Behavior;
+
+typedef Layer::Behavior Behavior;
 
 DALI_ENUM_TO_STRING_TABLE_BEGIN( Behavior )
-DALI_ENUM_TO_STRING( Dali::Layer::LAYER_2D )
-DALI_ENUM_TO_STRING( Dali::Layer::LAYER_3D )
+DALI_ENUM_TO_STRING_INSIDE_CLASS( Layer, LAYER_2D )
+DALI_ENUM_TO_STRING_INSIDE_CLASS( Layer, LAYER_3D )
 DALI_ENUM_TO_STRING_TABLE_END( Behavior )
+
 } // namespace
 
 namespace Internal
index 65de3c8..6f9e793 100644 (file)
@@ -95,6 +95,12 @@ struct PropertyDetails
 #define DALI_ENUM_TO_STRING_TABLE_END( t )   }; const unsigned int t##TableCount = sizeof( t##Table ) / sizeof( t##Table[0] );
 #define DALI_ENUM_TO_STRING( s ) { #s, s },
 
+/**
+ * DALI_ENUM_TO_STRING_INSIDE_CLASS
+ * Example converts ( Layer, LAYER_2D) to ( "LAYER_2D", Layer::Layer2D)
+ */
+#define DALI_ENUM_TO_STRING_INSIDE_CLASS( className, enumName) { #enumName, className::enumName },
+
 
 } // namespace Internal