2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/internal/helpers/color-conversion.h>
22 using namespace Dali::Toolkit;
24 void dali_color_conversion_startup(void)
26 test_return_value = TET_UNDEF;
29 void dali_color_conversion_cleanup(void)
31 test_return_value = TET_PASS;
34 int UtcDaliPropertyHelperConvertHtmlStringToColor(void)
36 tet_infoline( "Test to check whether An HTML style hex string can be converted" );
38 const std::string stringColor( "#FF0000" );
41 DALI_TEST_CHECK( Toolkit::Internal::ConvertStringToColor( stringColor, result ) );
43 DALI_TEST_EQUALS( result, Color::RED, TEST_LOCATION );
48 int UtcDaliPropertyHelperConvertStringPropertyToColor(void)
50 tet_infoline( "Test to check whether A Property value containing a string can be converted" );
52 const std::string stringColor( "#00FF00" );
53 Property::Value colorProperty( stringColor );
56 DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
58 DALI_TEST_EQUALS( result, Color::GREEN, TEST_LOCATION );
63 int UtcDaliPropertyHelperConvertVector4PropertyToColor(void)
65 tet_infoline( "Test to check whether A Property value containing a string can be converted" );
67 const Vector4 color( 0.0, 0.0, 1.0, 1.0 );
68 Property::Value colorProperty( color );
71 DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
73 DALI_TEST_EQUALS( result, Color::BLUE, TEST_LOCATION );