From 373b3ff175c506e632735cc9f89196e0d030cb37 Mon Sep 17 00:00:00 2001 From: Nick Holland Date: Wed, 20 Jan 2016 10:56:39 +0000 Subject: [PATCH] Simplify javascript layer behavior enum STRING 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 | 5 ++++- dali/internal/event/actors/layer-impl.cpp | 8 +++++--- dali/internal/event/common/property-helper.h | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Layer.cpp b/automated-tests/src/dali/utc-Dali-Layer.cpp index 97f58a1..255caa0 100644 --- a/automated-tests/src/dali/utc-Dali-Layer.cpp +++ b/automated-tests/src/dali/utc-Dali-Layer.cpp @@ -477,7 +477,7 @@ int UtcDaliLayerDefaultProperties(void) Property::Value behavior = actor.GetProperty(Layer::Property::BEHAVIOR); - DALI_TEST_CHECK( std::strcmp( behavior.Get().c_str(), "LAYER_2D") ); + DALI_TEST_EQUALS(behavior.Get().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().c_str(), "LAYER_3D", TEST_LOCATION ); DALI_TEST_CHECK( !actor.IsDepthTestDisabled() ); actor.SetDepthTestDisabled( true ); diff --git a/dali/internal/event/actors/layer-impl.cpp b/dali/internal/event/actors/layer-impl.cpp index ff26d1e..078d16a 100644 --- a/dali/internal/event/actors/layer-impl.cpp +++ b/dali/internal/event/actors/layer-impl.cpp @@ -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 diff --git a/dali/internal/event/common/property-helper.h b/dali/internal/event/common/property-helper.h index 65de3c8..6f9e793 100644 --- a/dali/internal/event/common/property-helper.h +++ b/dali/internal/event/common/property-helper.h @@ -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 -- 2.7.4