2 * Copyright (c) 2020 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>
21 #if defined(ELDBUS_ENABLED)
22 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
26 using namespace Dali::Toolkit;
28 void dali_color_conversion_startup(void)
30 test_return_value = TET_UNDEF;
31 #if defined(ELDBUS_ENABLED)
32 DBusWrapper::Install(std::unique_ptr<DBusWrapper>(new TestDBusWrapper));
36 void dali_color_conversion_cleanup(void)
38 test_return_value = TET_PASS;
41 int UtcDaliPropertyHelperConvertHtmlStringToColor(void)
43 tet_infoline( "Test to check whether An HTML style hex string can be converted" );
45 const std::string stringColor( "#FF0000" );
48 DALI_TEST_CHECK( Toolkit::Internal::ConvertStringToColor( stringColor, result ) );
50 DALI_TEST_EQUALS( result, Color::RED, TEST_LOCATION );
55 int UtcDaliPropertyHelperConvertStringPropertyToColor(void)
57 tet_infoline( "Test to check whether A Property value containing a string can be converted" );
59 const std::string stringColor( "#00FF00" );
60 Property::Value colorProperty( stringColor );
63 DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
65 DALI_TEST_EQUALS( result, Color::GREEN, TEST_LOCATION );
70 int UtcDaliPropertyHelperConvertVector4PropertyToColor(void)
72 tet_infoline( "Test to check whether A Property value containing a string can be converted" );
74 const Vector4 color( 0.0, 0.0, 1.0, 1.0 );
75 Property::Value colorProperty( color );
78 DALI_TEST_CHECK( Toolkit::Internal::ConvertPropertyToColor( colorProperty, result ) );
80 DALI_TEST_EQUALS( result, Color::BLUE, TEST_LOCATION );