-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.8.2)
PROJECT(tct_coreapi_utc)
+SET(CMAKE_CXX_STANDARD 17)
INCLUDE(FindPkgConfig)
SET(BIN_DIR "/opt/usr/bin")
dali2-core
)
+ADD_COMPILE_OPTIONS( -rdynamic )
ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror )
ADD_COMPILE_OPTIONS( ${${CAPI_LIB}_CFLAGS_OTHER} )
ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.cpp ${TC_SOURCES})
TARGET_LINK_LIBRARIES(${EXEC_NAME}
${${CAPI_LIB}_LIBRARIES}
- -lpthread -ldl --coverage
+ -lpthread -ldl --coverage -rdynamic
)
# Path to installed precompiled addons
#define END_TEST \
return ((test_return_value>0)?1:0)
+extern "C"
+{
void tet_infoline(const char* str)
{
vfprintf(stderr, format, arg);
va_end(arg);
}
+}
+
bool operator==(TimePeriod a, TimePeriod b)
{
#include <dali/public-api/dali-core.h>
#include <test-compare-types.h>
+extern "C"
+{
void tet_infoline(const char*str);
void tet_printf(const char *format, ...);
+}
#include "test-application.h"
#include "test-actor-utils.h"
LAST_ACTOR_FLAG ///< Special marker for last actor flag @SINCE_1_0.0
};
- static const int32_t ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1; ///< Value for deriving classes to continue on the flag enum
+ static constexpr int32_t ACTOR_FLAG_COUNT = Log< LAST_ACTOR_FLAG - 1 >::value + 1; ///< Value for deriving classes to continue on the flag enum
/**
* @brief Creates a CustomActorImpl.
+++ /dev/null
-/*
- * 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.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/common/constants.h>
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/math/compile-time-math.h>
-#include <dali/public-api/math/degree.h>
-
-namespace Dali
-{
-
-const Vector3 ParentOrigin::TOP_LEFT (0.0f, 0.0f, 0.5f);
-const Vector3 ParentOrigin::TOP_CENTER (0.5f, 0.0f, 0.5f);
-const Vector3 ParentOrigin::TOP_RIGHT (1.0f, 0.0f, 0.5f);
-const Vector3 ParentOrigin::CENTER_LEFT (0.0f, 0.5f, 0.5f);
-const Vector3 ParentOrigin::CENTER (0.5f, 0.5f, 0.5f);
-const Vector3 ParentOrigin::CENTER_RIGHT (1.0f, 0.5f, 0.5f);
-const Vector3 ParentOrigin::BOTTOM_LEFT (0.0f, 1.0f, 0.5f);
-const Vector3 ParentOrigin::BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
-const Vector3 ParentOrigin::BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
-
-const Vector3 ParentOrigin::DEFAULT( ParentOrigin::TOP_LEFT );
-
-const Vector3 AnchorPoint::TOP_LEFT (0.0f, 0.0f, 0.5f);
-const Vector3 AnchorPoint::TOP_CENTER (0.5f, 0.0f, 0.5f);
-const Vector3 AnchorPoint::TOP_RIGHT (1.0f, 0.0f, 0.5f);
-const Vector3 AnchorPoint::CENTER_LEFT (0.0f, 0.5f, 0.5f);
-const Vector3 AnchorPoint::CENTER (0.5f, 0.5f, 0.5f);
-const Vector3 AnchorPoint::CENTER_RIGHT (1.0f, 0.5f, 0.5f);
-const Vector3 AnchorPoint::BOTTOM_LEFT (0.0f, 1.0f, 0.5f);
-const Vector3 AnchorPoint::BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
-const Vector3 AnchorPoint::BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
-
-const Vector3 AnchorPoint::DEFAULT( AnchorPoint::CENTER );
-
-const Vector4 Color::BLACK( 0.0f, 0.0f, 0.0f, 1.0f );
-const Vector4 Color::WHITE( 1.0f, 1.0f, 1.0f, 1.0f );
-
-const Vector4 Color::RED( 1.0f, 0.0f, 0.0f, 1.0f );
-const Vector4 Color::GREEN( 0.0f, 1.0f, 0.0f, 1.0f );
-const Vector4 Color::BLUE( 0.0f, 0.0f, 1.0f, 1.0f );
-
-const Vector4 Color::YELLOW( 1.0f, 1.0f, 0.0f, 1.0f );
-const Vector4 Color::MAGENTA( 1.0f, 0.0f, 1.0f, 1.0f );
-const Vector4 Color::CYAN( 0.0f, 1.0f, 1.0f, 1.0f );
-
-const Vector4 Color::TRANSPARENT( 0.0f, 0.0f, 0.0f, 0.0f );
-
-// epsilon constants
-const float Math::MACHINE_EPSILON_0 = Epsilon<0>::value;
-const float Math::MACHINE_EPSILON_1 = Epsilon<1>::value;
-const float Math::MACHINE_EPSILON_10 = Epsilon<10>::value;
-const float Math::MACHINE_EPSILON_100 = Epsilon<100>::value;
-const float Math::MACHINE_EPSILON_1000 = Epsilon<1000>::value;
-const float Math::MACHINE_EPSILON_10000 = Epsilon<10000>::value;
-
-} // namespace Dali
#define DALI_CONSTANTS_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <math.h> // M_PI
// INTERNAL INCLUDES
+#include <dali/public-api/math/compile-time-math.h>
#include <dali/public-api/math/vector3.h>
#include <dali/public-api/math/vector4.h>
*/
namespace ParentOrigin
{
-extern const Vector3 DEFAULT; ///< TOP_LEFT
-static const float TOP = 0.0f;
-static const float BOTTOM = 1.0f;
-static const float LEFT = 0.0f;
-static const float RIGHT = 1.0f;
-static const float MIDDLE = 0.5f;
-
-DALI_CORE_API extern const Vector3 TOP_LEFT; ///< 0.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_CENTER; ///< 0.5f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_RIGHT; ///< 1.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_LEFT; ///< 0.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER; ///< 0.5f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_RIGHT; ///< 1.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_LEFT; ///< 0.0f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_CENTER; ///< 0.5f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_RIGHT; ///< 1.0f, 1.0f, 0.5f
-
+static constexpr float TOP = 0.0f;
+static constexpr float BOTTOM = 1.0f;
+static constexpr float LEFT = 0.0f;
+static constexpr float RIGHT = 1.0f;
+static constexpr float MIDDLE = 0.5f;
+static constexpr Vector3 TOP_LEFT (0.0f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_CENTER (0.5f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_RIGHT (1.0f, 0.0f, 0.5f);
+static constexpr Vector3 CENTER_LEFT (0.0f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER (0.5f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER_RIGHT (1.0f, 0.5f, 0.5f);
+static constexpr Vector3 BOTTOM_LEFT (0.0f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
+static constexpr Vector3 DEFAULT( TOP_LEFT );
}
/**
*/
namespace AnchorPoint
{
-static const float TOP = 0.0f;
-static const float BOTTOM = 1.0f;
-static const float LEFT = 0.0f;
-static const float RIGHT = 1.0f;
-static const float MIDDLE = 0.5f;
-
-extern const Vector3 DEFAULT; ///< CENTER
-DALI_CORE_API extern const Vector3 TOP_LEFT; ///< 0.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_CENTER; ///< 0.5f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 TOP_RIGHT; ///< 1.0f, 0.0f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_LEFT; ///< 0.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER; ///< 0.5f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 CENTER_RIGHT; ///< 1.0f, 0.5f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_LEFT; ///< 0.0f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_CENTER; ///< 0.5f, 1.0f, 0.5f
-DALI_CORE_API extern const Vector3 BOTTOM_RIGHT; ///< 1.0f, 1.0f, 0.5f
-
+static constexpr float TOP = 0.0f;
+static constexpr float BOTTOM = 1.0f;
+static constexpr float LEFT = 0.0f;
+static constexpr float RIGHT = 1.0f;
+static constexpr float MIDDLE = 0.5f;
+static constexpr Vector3 TOP_LEFT (0.0f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_CENTER (0.5f, 0.0f, 0.5f);
+static constexpr Vector3 TOP_RIGHT (1.0f, 0.0f, 0.5f);
+static constexpr Vector3 CENTER_LEFT (0.0f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER (0.5f, 0.5f, 0.5f);
+static constexpr Vector3 CENTER_RIGHT (1.0f, 0.5f, 0.5f);
+static constexpr Vector3 BOTTOM_LEFT (0.0f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_CENTER(0.5f, 1.0f, 0.5f);
+static constexpr Vector3 BOTTOM_RIGHT (1.0f, 1.0f, 0.5f);
+static constexpr Vector3 DEFAULT( CENTER );
}
*/
namespace Color
{
-DALI_CORE_API extern const Vector4 BLACK; ///< Pure black (0.0f, 0.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 WHITE; ///< Pure white (1.0f, 1.0f, 1.0f, 1.0f);
-
-DALI_CORE_API extern const Vector4 RED; ///< Pure red (1.0f, 0.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 GREEN; ///< Pure green (0.0f, 1.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 BLUE; ///< Pure blue (0.0f, 0.0f, 1.0f, 1.0f);
-
-DALI_CORE_API extern const Vector4 YELLOW; ///< Pure yellow (1.0f, 1.0f, 0.0f, 1.0f);
-DALI_CORE_API extern const Vector4 MAGENTA; ///< Pure magenta (1.0f, 0.0f, 1.0f, 1.0f);
-DALI_CORE_API extern const Vector4 CYAN; ///< Pure cyan (0.0f, 1.0f, 1.0f, 1.0f);
-
-DALI_CORE_API extern const Vector4 TRANSPARENT; ///< Black transparent (0.0f, 0.0f, 0.0f, 0.0f);
+static constexpr Vector4 BLACK( 0.0f, 0.0f, 0.0f, 1.0f );
+static constexpr Vector4 WHITE( 1.0f, 1.0f, 1.0f, 1.0f );
+static constexpr Vector4 RED( 1.0f, 0.0f, 0.0f, 1.0f );
+static constexpr Vector4 GREEN( 0.0f, 1.0f, 0.0f, 1.0f );
+static constexpr Vector4 BLUE( 0.0f, 0.0f, 1.0f, 1.0f );
+static constexpr Vector4 YELLOW( 1.0f, 1.0f, 0.0f, 1.0f );
+static constexpr Vector4 MAGENTA( 1.0f, 0.0f, 1.0f, 1.0f );
+static constexpr Vector4 CYAN( 0.0f, 1.0f, 1.0f, 1.0f );
+static constexpr Vector4 TRANSPARENT( 0.0f, 0.0f, 0.0f, 0.0f );
} // namespace Color
*/
namespace Math
{
-DALI_CORE_API extern const float MACHINE_EPSILON_0; ///< Epsilon for values near zero
-DALI_CORE_API extern const float MACHINE_EPSILON_1; ///< Epsilon for values near 1
-DALI_CORE_API extern const float MACHINE_EPSILON_10; ///< Epsilon for values near 10
-DALI_CORE_API extern const float MACHINE_EPSILON_100; ///< Epsilon for values near 100
-DALI_CORE_API extern const float MACHINE_EPSILON_1000; ///< Epsilon for values near 1000
-DALI_CORE_API extern const float MACHINE_EPSILON_10000; ///< Epsilon for values near 10000
+static constexpr float MACHINE_EPSILON_0 = Epsilon<0>::value;
+static constexpr float MACHINE_EPSILON_1 = Epsilon<1>::value;
+static constexpr float MACHINE_EPSILON_10 = Epsilon<10>::value;
+static constexpr float MACHINE_EPSILON_100 = Epsilon<100>::value;
+static constexpr float MACHINE_EPSILON_1000 = Epsilon<1000>::value;
+static constexpr float MACHINE_EPSILON_10000 = Epsilon<10000>::value;
// float is preferred to double for performance on ARM targets
-static const float PI = static_cast<float>(M_PI); ///< Constant representing PI
-static const float PI_2 = static_cast<float>(M_PI_2); ///< Constant representing PI/2
-static const float PI_4 = static_cast<float>(M_PI_4); ///< Constant representing PI/4
-static const float PI_OVER_180 = Dali::Math::PI/180.0f; ///< Constant used to convert degree to radian
-static const float ONE80_OVER_PI = 180.0f/Dali::Math::PI; ///< Constant used to convert radian to degree
+static constexpr float PI = static_cast<float>(M_PI); ///< Pi
+static constexpr float PI_2 = static_cast<float>(M_PI_2); ///< Pi/2
+static constexpr float PI_4 = static_cast<float>(M_PI_4); ///< Pi/4
+static constexpr float PI_OVER_180 = Dali::Math::PI/180.0f; ///< Constant used to convert degree to radian
+static constexpr float ONE80_OVER_PI = 180.0f/Dali::Math::PI; ///< Constant used to convert radian to degree
} // namespace Math
${public_api_src_dir}/animation/linear-constrainer.cpp
${public_api_src_dir}/animation/path.cpp
${public_api_src_dir}/animation/time-period.cpp
- ${public_api_src_dir}/common/constants.cpp
${public_api_src_dir}/common/dali-common.cpp
${public_api_src_dir}/common/dali-vector.cpp
${public_api_src_dir}/common/extents.cpp
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
{
}
-const Radian ANGLE_360 = Radian( Math::PI * 2.f ); ///< 360 degree turn in radians
-const Radian ANGLE_315 = Radian( Math::PI * 1.75f ); ///< 315 degree turn in radians
-const Radian ANGLE_270 = Radian( Math::PI * 1.5f ); ///< 270 degree turn in radians
-const Radian ANGLE_225 = Radian( Math::PI * 1.25f ); ///< 225 degree turn in radians
-const Radian ANGLE_180 = Radian( Math::PI ); ///< 180 degree turn in radians
-const Radian ANGLE_135 = Radian( Math::PI * 0.75f ); ///< 135 degree turn in radians
-const Radian ANGLE_120 = Radian( Math::PI * 2.f/3.f ); ///< 120 degree turn in radians
-const Radian ANGLE_90 = Radian( Math::PI_2 ); ///< 90 degree turn in radians
-const Radian ANGLE_60 = Radian( Math::PI / 3.f ); ///< 60 degree turn in radians
-const Radian ANGLE_45 = Radian( Math::PI_4 ); ///< 45 degree turn in radians
-const Radian ANGLE_30 = Radian( Math::PI / 6.f ); ///< 30 degree turn in radians
-const Radian ANGLE_0 = Radian( 0.0f ); ///< 0 degree turn in radians
-
} // namespace Dali
* @SINCE_1_0.0
* @param[in] value The initial value in degrees
*/
- explicit Degree( float value )
+ explicit constexpr Degree( float value )
: degree( value )
{ }
// compiler generated destructor, copy constructor and assignment operators are ok as this class is POD
-// useful constant angles
-DALI_CORE_API extern const Radian ANGLE_360; ///< 360 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_315; ///< 315 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_270; ///< 270 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_225; ///< 225 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_180; ///< 180 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_135; ///< 135 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_120; ///< 120 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_90; ///< 90 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_60; ///< 60 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_45; ///< 45 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_30; ///< 30 degree turn in radians
-DALI_CORE_API extern const Radian ANGLE_0; ///< 0 degree turn in radians
/**
* @brief Compares equality between two degrees.
* @SINCE_1_0.0
* @param[in] value The initial value in radians
*/
- explicit Radian( float value )
+ explicit constexpr Radian( float value )
: radian( value )
{ }
return Radian( Clamp<float>( angle.radian, min, max ) );
}
+// useful constant angles
+inline constexpr Radian ANGLE_360( Math::PI * 2.f );
+inline constexpr Radian ANGLE_315( Math::PI * 1.75f );
+inline constexpr Radian ANGLE_270( Math::PI * 1.5f );
+inline constexpr Radian ANGLE_225( Math::PI * 1.25f );
+inline constexpr Radian ANGLE_180( Math::PI );
+inline constexpr Radian ANGLE_135( Math::PI * 0.75f );
+inline constexpr Radian ANGLE_120( Math::PI * 2.f/3.f );
+inline constexpr Radian ANGLE_90 ( Math::PI_2 );
+inline constexpr Radian ANGLE_60 ( Math::PI / 3.f );
+inline constexpr Radian ANGLE_45 ( Math::PI_4 );
+inline constexpr Radian ANGLE_30 ( Math::PI / 6.f );
+inline constexpr Radian ANGLE_0 ( 0.0f );
+
/**
* @}
*/
* @param[in] x x or width component
* @param[in] y y or height component
*/
- explicit Vector2(float x, float y)
+ explicit constexpr Vector2(float x, float y)
: x(x), y(y)
{
}
* @param[in] y (or height) component
* @param[in] z (or depth) component
*/
- explicit Vector3(float x, float y, float z)
+ explicit constexpr Vector3(float x, float y, float z)
: x(x),
y(y),
z(z)
* @param[in] z z (or b/p) component
* @param[in] w w (or a/q) component
*/
- explicit Vector4(float x, float y, float z, float w)
+ explicit constexpr Vector4(float x, float y, float z, float w)
: x(x),
y(y),
z(z),
namespace Dali
{
-const int32_t Property::INVALID_INDEX = -1;
-const int32_t Property::INVALID_KEY = -1;
-const int32_t Property::INVALID_COMPONENT_INDEX = -1;
-
Property::Property(Handle& obj, Property::Index propIndex)
: object(obj),
propertyIndex(propIndex),
#define DALI_PROPERTY_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
typedef int32_t Index;
- static const int32_t INVALID_INDEX; ///< -1 is not a valid property index
- static const int32_t INVALID_KEY; ///< -1 is not a valid property key
- static const int32_t INVALID_COMPONENT_INDEX; ///< -1 is not a valid property index
+ static constexpr int32_t INVALID_INDEX{-1}; ///< -1 is not a valid property index
+ static constexpr int32_t INVALID_KEY{-1}; ///< -1 is not a valid property key
+ static constexpr int32_t INVALID_COMPONENT_INDEX{-1}; ///< -1 is not a valid property index
typedef Dali::Vector< Index > IndexContainer; ///< A vector of property indices @SINCE_1_0.0